~ubuntu-branches/ubuntu/utopic/dune-grid/utopic-proposed

« back to all changes in this revision

Viewing changes to dune/grid/io/file/vtk/subsamplingvtkwriter.hh

  • Committer: Package Import Robot
  • Author(s): Ansgar Burchardt
  • Date: 2014-02-14 10:49:16 UTC
  • mfrom: (1.3.1) (5.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20140214104916-2clchnny3eu7ks4w
Tags: 2.3.0-2
Install /usr/share/dune-grid.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
 
// vi: set et ts=8 sw=2 sts=2:
 
1
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 
2
// vi: set et ts=4 sw=2 sts=2:
3
3
 
4
4
#ifndef DUNE_SUBSAMPLINGVTKWRITER_HH
5
5
#define DUNE_SUBSAMPLINGVTKWRITER_HH
6
6
 
7
7
#include <ostream>
8
8
 
 
9
#include <dune/common/indent.hh>
9
10
#include <dune/geometry/type.hh>
10
 
#include <dune/common/indent.hh>
11
 
#include <dune/grid/common/virtualrefinement.hh>
 
11
#include <dune/geometry/virtualrefinement.hh>
12
12
#include <dune/grid/io/file/vtk/vtkwriter.hh>
13
13
#include <dune/grid/io/file/vtk/vtuwriter.hh>
14
14
 
15
15
/** @file
16
16
    @author Jö Fahlke
17
17
    @brief Provides subsampled file i/o for the visualization toolkit
18
 
*/
 
18
 */
19
19
 
20
20
 
21
21
namespace Dune
22
22
{
23
 
  /** 
 
23
  /**
24
24
   * @brief Writer for the output of subsampled grid functions in the vtk format.
25
25
   * @ingroup VTK
26
26
   *
27
27
   * Writes arbitrary grid functions (living on cells or vertices of a grid)
28
 
   * to a file suitable for easy visualization with 
 
28
   * to a file suitable for easy visualization with
29
29
   * <a href="http://public.kitware.com/VTK/">The Visualization Toolkit
30
30
   * (VTK)</a>.  In contrast to the regular VTKWriter, this Writer allows
31
31
   * subsampling of the elements via VirtualRefinement.  The
32
32
   * SubSamplingVTKWriter always writes nonconforming data.
33
33
   */
34
34
  template< class GridView >
35
 
  class SubsamplingVTKWriter 
 
35
  class SubsamplingVTKWriter
36
36
    : public VTKWriter<GridView>
37
37
  {
38
38
    typedef VTKWriter<GridView> Base;
60
60
  public:
61
61
    /**
62
62
     * @brief Construct a SubsamplingVTKWriter working on a specific GridView.
63
 
     * 
 
63
     *
64
64
     * @param gridView         The gridView the grid functions live
65
65
     *                         on. (E. g. a LevelGridView.)
66
66
     * @param level_           The level for the subrefinement.
73
73
    explicit SubsamplingVTKWriter (const GridView &gridView,
74
74
                                   unsigned int level_, bool coerceToSimplex_ = false)
75
75
      : Base(gridView, VTK::nonconforming)
76
 
      , level(level_), coerceToSimplex(coerceToSimplex_)
 
76
        , level(level_), coerceToSimplex(coerceToSimplex_)
77
77
    { }
78
78
 
79
79
  private:
170
170
            buildRefinement<dim, ctype>(i->type(),
171
171
                                        subsampledGeometryType(i->type()));
172
172
          for(SubElementIterator sit = refinement.eBegin(level),
173
 
                send = refinement.eEnd(level);
 
173
              send = refinement.eEnd(level);
174
174
              sit != send; ++sit)
175
175
          {
176
176
            for (int j=0; j<(*it)->ncomps(); j++)
223
223
            buildRefinement<dim, ctype>(i->type(),
224
224
                                        subsampledGeometryType(i->type()));
225
225
          for(SubVertexIterator sit = refinement.vBegin(level),
226
 
                send = refinement.vEnd(level);
 
226
              send = refinement.vEnd(level);
227
227
              sit != send; ++sit)
228
228
          {
229
229
            for (int j=0; j<(*it)->ncomps(); j++)
253
253
          buildRefinement<dim, ctype>(i->type(),
254
254
                                      subsampledGeometryType(i->type()));
255
255
        for(SubVertexIterator sit = refinement.vBegin(level),
256
 
              send = refinement.vEnd(level);
 
256
            send = refinement.vEnd(level);
257
257
            sit != send; ++sit)
258
258
        {
259
259
          FieldVector<ctype, dimw> coords = i->geometry().global(sit.coords());
288
288
          Refinement &refinement =
289
289
            buildRefinement<dim, ctype>(i->type(), coercedToType);
290
290
          for(SubElementIterator sit = refinement.eBegin(level),
291
 
                send = refinement.eEnd(level);
 
291
              send = refinement.eEnd(level);
292
292
              sit != send; ++sit)
293
293
          {
294
294
            IndexVector indices = sit.vertexIndices();