Dune Core Modules (2.5.0)

volumeiterators.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4#ifndef DUNE_GRID_IO_FILE_VTK_VOLUMEITERATORS_HH
5#define DUNE_GRID_IO_FILE_VTK_VOLUMEITERATORS_HH
6
7#include <dune/grid/common/gridenums.hh>
8
9#include <dune/grid/io/file/vtk/corner.hh>
10#include <dune/grid/io/file/vtk/corneriterator.hh>
11#include <dune/grid/io/file/vtk/functionwriter.hh>
12#include <dune/grid/io/file/vtk/pointiterator.hh>
13
14namespace Dune {
17
18 namespace VTK {
19
20 template<typename GV>
21 class ConformingVolumeIteratorFactory {
22 const GV& gv;
23
24 typedef typename GV::IndexSet IndexSet;
25 const IndexSet& indexSet() const { return gv.indexSet(); }
26 friend class ConformingConnectivityWriter<
27 ConformingVolumeIteratorFactory<GV> >;
28
29 public:
30 static const unsigned dimCell = GV::dimension;
31
32 typedef typename GV::template Codim<0>::Entity Cell;
33 typedef typename GV::template Codim<0>::
34 template Partition<InteriorBorder_Partition>::Iterator CellIterator;
35
36 typedef VTK::Corner<Cell> Corner;
37 typedef VTK::CornerIterator<CellIterator> CornerIterator;
38
39 typedef VTK::Corner<Cell> Point;
40 typedef VTK::PointIterator<CellIterator,
41 typename GV::IndexSet> PointIterator;
42
43 typedef ConformingConnectivityWriter<ConformingVolumeIteratorFactory<GV>
44 > ConnectivityWriter;
45 typedef typename GV::CollectiveCommunication CollectiveCommunication;
46
47 explicit ConformingVolumeIteratorFactory(const GV& gv_)
48 : gv(gv_)
49 { }
50
51 CellIterator beginCells() const {
52 return gv.template begin<0, InteriorBorder_Partition>();
53 }
54 CellIterator endCells() const {
55 return gv.template end<0, InteriorBorder_Partition>();
56 }
57
58 CornerIterator beginCorners() const {
59 return CornerIterator(beginCells(), endCells());
60 }
61 CornerIterator endCorners() const {
62 return CornerIterator(endCells());
63 }
64
65 PointIterator beginPoints() const {
66 return PointIterator(beginCells(), endCells(), gv.indexSet());
67 }
68 PointIterator endPoints() const {
69 return PointIterator(endCells());
70 }
71
72 ConnectivityWriter makeConnectivity() const {
73 return ConnectivityWriter(*this);
74 }
75 const CollectiveCommunication& comm() const {
76 return gv.comm();
77 }
78 };
79
80 template<typename GV>
81 class NonConformingVolumeIteratorFactory {
82 const GV& gv;
83
84 public:
85 static const unsigned dimCell = GV::dimension;
86
87 typedef typename GV::template Codim<0>::Entity Cell;
88 typedef typename GV::template Codim<0>::
89 template Partition<InteriorBorder_Partition>::Iterator CellIterator;
90
91 typedef VTK::Corner<Cell> Corner;
92 typedef VTK::CornerIterator<CellIterator> CornerIterator;
93
94 typedef Corner Point;
95 typedef CornerIterator PointIterator;
96
97 typedef NonConformingConnectivityWriter<Cell> ConnectivityWriter;
98 typedef typename GV::CollectiveCommunication CollectiveCommunication;
99
100 explicit NonConformingVolumeIteratorFactory(const GV& gv_)
101 : gv(gv_)
102 { }
103
104 CellIterator beginCells() const {
105 return gv.template begin<0, InteriorBorder_Partition>();
106 }
107 CellIterator endCells() const {
108 return gv.template end<0, InteriorBorder_Partition>();
109 }
110
111 CornerIterator beginCorners() const {
112 return CornerIterator(beginCells(), endCells());
113 }
114 CornerIterator endCorners() const {
115 return CornerIterator(endCells());
116 }
117
118 PointIterator beginPoints() const { return beginCorners(); }
119 PointIterator endPoints() const { return endCorners(); }
120
121 ConnectivityWriter makeConnectivity() const {
122 return ConnectivityWriter();
123 }
124 const CollectiveCommunication& comm() const {
125 return gv.comm();
126 }
127 };
128
129 } // namespace VTK
130
132
133} // namespace Dune
134
135#endif // DUNE_GRID_IO_FILE_VTK_VOLUMEITERATORS_HH
Dune namespace.
Definition: alignment.hh:11
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)