3 #ifndef DUNE_ALU2DGRID_INCLUDE_HH
4 #define DUNE_ALU2DGRID_INCLUDE_HH
6 #define ALU2DGRID_COMPATIBILITY_LEVEL 2
8 #include <alugrid_2d.h>
14 #define COMPILE_ALU2DGRID_LIB 0
16 #if COMPILE_ALU2DGRID_LIB
17 #define COMPILE_ALU2DGRID_INLINE 0
19 #define COMPILE_ALU2DGRID_INLINE 1
22 #if COMPILE_ALU2DGRID_INLINE
23 #define alu2d_inline inline
30 #ifndef ALUGRID_VERTEX_PROJECTION
31 #include <alugrid_serial.h>
34 #define ALU2DSPACE ALU2DSPACENAME ::
36 #define ALU2DSPACENAME ALU2DGrid
37 #define ALU2DDIMWORLD(dimw,eltype) < dimw,(eltype == ALU2DSPACE triangle ? 3 : 4) >
42 #define ALU2DGRID_PARALLEL 0
44 #include <dune/common/parallel/collectivecommunication.hh>
46 #if ALU2DGRID_PARALLEL
48 #warning "Using ALU2dGrid in parallel"
70 template<
int dim,
int dimw, ALU2DSPACE ElementType eltype >
71 struct ALU2dImplInterface;
73 template<
int dimw, ALU2DSPACE ElementType eltype >
74 struct ALU2dImplInterface< 0, dimw, eltype >
79 template<
int dimw, ALU2DSPACE ElementType eltype >
80 struct ALU2dImplInterface< 1, dimw, eltype >
85 template<
int dimw, ALU2DSPACE ElementType eltype >
86 struct ALU2dImplInterface< 2, dimw, eltype >
96 template<
int dimw, ALU2DSPACE ElementType eltype >
102 typedef typename ALU2dImplInterface< 2-cdim, dimw, eltype >::Type
InterfaceType;
120 typedef std::vector< int > VectorType;
124 bool valid()
const {
return valid_; }
130 return marker_[codim-1][idx] == elementIndex;
133 template <
class Gr
idType>
134 void update (
const GridType & grid,
int level )
136 enum { dim = GridType::dimension };
137 static const int dimworld = GridType::dimensionworld;
138 static const ALU2DSPACE ElementType eltype = GridType::elementType;
141 typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
144 for(
int i=0; i<2; ++i)
146 int s = grid.hierSetSize(i+1);
147 if((
int) marker_[i].size() < s ) marker_[i].resize(s);
149 size_t markerSize = marker_[i].size();
151 for(
size_t k=0; k<markerSize; ++k) marker_[i][k] = -1;
154 IteratorType iter(grid.myGrid(), level);
156 for(iter->first(); !iter->done(); iter->next())
158 ElementType & elem = iter->getitem();
159 int elIdx = elem.getIndex();
162 #if ALU2DGRID_PARALLEL
163 if( ! grid.rankManager().isValid( elIdx ,
All_Partition ) )
continue;
165 for(
int i=0; i<elem.numvertices(); ++i)
167 enum { vxCodim = 1 };
168 int vxIdx = elem.getVertex(i)->getIndex();
169 if( marker_[vxCodim][vxIdx] < 0) marker_[vxCodim][vxIdx] = elIdx;
171 enum { edgeCodim = 0 };
172 int edgeIdx = elem.edge_idx(i);
173 if( marker_[edgeCodim][edgeIdx] < 0) marker_[edgeCodim][edgeIdx] = elIdx;
180 VectorType marker_[2];
187 typedef std::vector< int > VectorType;
191 bool valid()
const {
return valid_; }
200 assert( codim == 1 );
201 return marker_[idx] == elementIndex;
205 template <
class Gr
idType>
208 static const int dimworld = GridType::dimensionworld;
212 typedef ALU2DSPACE Listwalkptr< ElementType > IteratorType;
216 int s = grid.hierSetSize(1);
217 if((
int) marker_.size() < s ) marker_.resize(s);
219 size_t markerSize = marker_.size();
221 for(
size_t k=0; k<markerSize; ++k) marker_[k] = -1;
226 int s = grid.hierSetSize(2);
227 if((
int) vertexLevels_.size() < s ) vertexLevels_.resize(s);
230 size_t vxSize = vertexLevels_.size();
231 for(
size_t k=0; k<vxSize; ++k) vertexLevels_[k] = -1;
234 enum { dim = GridType::dimension };
235 IteratorType iter(grid.myGrid());
237 for(iter->first(); !iter->done(); iter->next())
239 ElementType & elem = iter->getitem();
240 int elIdx = elem.getIndex();
242 #if ALU2DGRID_PARALLEL
244 if( ! grid.rankManager().isValid( elIdx ,
All_Partition ) )
continue;
246 int level = elem.level();
248 for(
int i=0; i<elem.numvertices(); ++i)
250 int vxIdx = elem.getVertex(i)->getIndex();
253 if(level > vertexLevels_[vxIdx]) vertexLevels_[vxIdx] = level;
255 int edgeIdx = elem.edge_idx(i);
256 if( marker_[edgeIdx] < 0) marker_[edgeIdx] = elIdx;
266 assert( vxIdx >= 0 && vxIdx < (
int) vertexLevels_.size());
268 assert( vertexLevels_[vxIdx] >= 0 );
269 return vertexLevels_[vxIdx];
276 assert( vxIdx >= 0 && vxIdx < (
int) vertexLevels_.size());
277 return (vertexLevels_[vxIdx] >= 0);
282 VectorType vertexLevels_;
void invalidate()
Definition: alu2dinclude.hh:193
Definition: alu2dinclude.hh:100
Definition: alu2dinclude.hh:55
HmeshType::helement_t HElementType
Definition: alu2dinclude.hh:108
bool isValidVertex(const int vxIdx) const
return level of vertex
Definition: alu2dinclude.hh:273
void readObject(double)
Definition: alu2dinclude.hh:295
bool isOnElement(int elementIndex, int idx, int codim) const
Definition: alu2dinclude.hh:196
Definition: alu2dinclude.hh:118
bool isOnElement(int elementIndex, int idx, int codim) const
Definition: alu2dinclude.hh:128
#define ALU2DDIMWORLD(dimw, eltype)
Definition: alu2dinclude.hh:37
Definition: alu2dinclude.hh:55
ALU2DSPACE Hmesh ALU2DDIMWORLD(dimw, eltype) HmeshType
Definition: alu2dinclude.hh:105
void read(T &) const
Definition: alu2dinclude.hh:302
Definition: alu2dinclude.hh:185
void update(const GridType &grid)
Definition: alu2dinclude.hh:206
void writeObject(T &)
Definition: alu2dinclude.hh:297
Definition: alu2dinclude.hh:55
ALU2dGridLeafMarkerVector()
Definition: alu2dinclude.hh:189
all entities
Definition: gridenums.hh:139
Definition: alu2dinclude.hh:52
bool valid() const
Definition: alu2dinclude.hh:124
ALU2dImplInterface< 2-cdim, dimw, eltype >::Type InterfaceType
Definition: alu2dinclude.hh:102
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:84
void write(const T &)
Definition: alu2dinclude.hh:304
Definition: alu2dinclude.hh:97
void readObject(int)
Definition: alu2dinclude.hh:294
Definition: alu2dinclude.hh:291
void invalidate()
Definition: alu2dinclude.hh:126
#define ALU2DSPACE
Definition: alu2dinclude.hh:34
void update(const GridType &grid, int level)
Definition: alu2dinclude.hh:134
ElementType
Definition: alu2dinclude.hh:55
Definition: alu2dinclude.hh:288
double alu2d_ctype
Definition: alu2dinclude.hh:63
void readObject(T &)
Definition: alu2dinclude.hh:293
Include standard header files.
Definition: agrid.hh:59
void writeObject(int)
Definition: alu2dinclude.hh:298
ALU2dGridMarkerVector()
Definition: alu2dinclude.hh:122
ALBERTA EL Element
Definition: misc.hh:51
HmeshType::hbndel_t HBndElType
Definition: alu2dinclude.hh:109
int levelOfVertex(const int vxIdx) const
return level of vertex
Definition: alu2dinclude.hh:263
void writeObject(double)
Definition: alu2dinclude.hh:299
bool valid() const
Definition: alu2dinclude.hh:191