1 #ifndef DUNE_ALU3DGRID_ALUGRID_HH
2 #define DUNE_ALU3DGRID_ALUGRID_HH
24 template<
int dim,
int dimworld >
27 template<
int dim,
int dimworld >
30 static const char* ALUGridParallelSerial()
32 #if ALU3DGRID_PARALLEL
45 class ALUCubeGrid< 3, 3 >
48 typedef ALUCubeGrid< 3, 3 > This;
52 enum { dimworld = 3 };
54 typedef BaseType::MPICommunicatorType MPICommunicatorType;
58 typedef BaseType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
61 typedef BaseType :: DuneBoundaryProjectionVector DuneBoundaryProjectionVector;
73 ALUCubeGrid(
const std::string macroName,
74 const MPICommunicatorType mpiComm = BaseType::defaultCommunicator(),
75 const DuneBoundaryProjectionType* bndProject = 0,
76 const DuneBoundaryProjectionVector* bndVector= 0,
77 const bool verb =
true ) :
78 BaseType(macroName,mpiComm,bndProject, bndVector,
nonconforming )
80 const bool verbose = verb && this->comm().rank() == 0;
83 std::cout <<
"\nCreated " << ALUGridParallelSerial() <<
" ALUCubeGrid<"<<dim<<
","<<dimworld;
84 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
97 ALUCubeGrid(
const MPICommunicatorType mpiComm,
98 const DuneBoundaryProjectionType* bndProject ,
99 const DuneBoundaryProjectionVector* bndVector,
100 const std::string macroName,
101 const bool verb =
true ) :
104 const bool verbose = verb && this->comm().rank() == 0;
107 std::cout <<
"\nCreated " << ALUGridParallelSerial() <<
" ALUCubeGrid<"<<dim<<
","<<dimworld;
108 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
113 ALUCubeGrid(
const MPICommunicatorType mpiComm = BaseType::defaultCommunicator() ) :
114 BaseType(
"", mpiComm,
115 (const DuneBoundaryProjectionType *) 0,
116 (const DuneBoundaryProjectionVector* ) 0,
119 if(this->comm().rank() == 0)
121 std::cout <<
"\nCreated empty ALUCubeGrid<"<<dim<<
","<<dimworld <<
">. \n\n";
125 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
126 typedef BaseType::ctype ctype;
127 typedef BaseType::GridFamily GridFamily;
128 typedef GridFamily::Traits Traits;
129 typedef BaseType::LocalIdSetImp LocalIdSetImp;
130 typedef Traits :: GlobalIdSet GlobalIdSet;
131 typedef Traits :: LocalIdSet LocalIdSet;
132 typedef GridFamily :: LevelIndexSetImp LevelIndexSetImp;
133 typedef GridFamily :: LeafIndexSetImp LeafIndexSetImp;
134 typedef BaseType::LeafIteratorImp LeafIteratorImp;
135 typedef Traits::Codim<0>::LeafIterator LeafIteratorType;
136 typedef Traits::Codim<0>::LeafIterator LeafIterator;
139 typedef BaseType::HierarchicIteratorImp HierarchicIteratorImp;
140 typedef BaseType::ObjectStreamType ObjectStreamType;
142 template< PartitionIteratorType pitype >
151 typedef Partition< All_Partition > :: LevelGridView LevelGridView;
152 typedef Partition< All_Partition > :: LeafGridView LeafGridView;
154 template< PartitionIteratorType pitype >
155 typename Partition< pitype >::LevelGridView levelView (
int level )
const
157 typedef typename Partition< pitype >::LevelGridView LevelGridView;
158 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
159 return LevelGridView( LevelGridViewImp( *
this, level ) );
162 template< PartitionIteratorType pitype >
163 typename Partition< pitype >::LeafGridView leafView ()
const
165 typedef typename Partition< pitype >::LeafGridView LeafGridView;
166 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
167 return LeafGridView( LeafGridViewImp( *
this ) );
170 LevelGridView levelView (
int level )
const
172 typedef LevelGridView::GridViewImp LevelGridViewImp;
173 return LevelGridView( LevelGridViewImp( *
this, level ) );
176 LeafGridView leafView ()
const
178 typedef LeafGridView::GridViewImp LeafGridViewImp;
179 return LeafGridView( LeafGridViewImp( *
this ) );
183 friend class Conversion< ALUCubeGrid<dimension,dimensionworld> , HasObjectStream > ;
184 friend class Conversion< const ALUCubeGrid<dimension,dimensionworld> , HasObjectStream > ;
186 friend class Conversion< ALUCubeGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
187 friend class Conversion< const ALUCubeGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
189 template<
class >
friend class ALU3dGridFactory;
192 ALUCubeGrid(
const ALUCubeGrid & g ) ;
195 ALUCubeGrid<dim,dimworld>&
196 operator = (
const ALUCubeGrid& g);
207 class ALUSimplexGrid< 3, 3 >
210 typedef ALUSimplexGrid< 3, 3 > This;
214 enum { dimworld = 3 };
216 typedef BaseType::MPICommunicatorType MPICommunicatorType;
220 typedef BaseType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
223 typedef BaseType :: DuneBoundaryProjectionVector DuneBoundaryProjectionVector;
235 ALUSimplexGrid(
const std::string macroName,
236 const MPICommunicatorType mpiComm = BaseType::defaultCommunicator(),
237 const DuneBoundaryProjectionType* bndProject = 0,
238 const DuneBoundaryProjectionVector* bndVector = 0,
239 const bool verb =
true ) :
240 BaseType(macroName, mpiComm, bndProject, bndVector,
nonconforming )
242 const bool verbose = verb && this->comm().rank() == 0;
245 std::cout <<
"\nCreated " << ALUGridParallelSerial() <<
" ALUSimplexGrid<"<<dim<<
","<<dimworld;
246 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
259 ALUSimplexGrid(
const MPICommunicatorType mpiComm,
260 const DuneBoundaryProjectionType* bndProject ,
261 const DuneBoundaryProjectionVector* bndVector,
262 const std::string macroName,
263 const bool verb =
true ) :
266 const bool verbose = verb && this->comm().rank() == 0;
269 std::cout <<
"\nCreated " << ALUGridParallelSerial() <<
" ALUSimplexGrid<"<<dim<<
","<<dimworld;
270 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
275 ALUSimplexGrid(
const MPICommunicatorType mpiComm = BaseType::defaultCommunicator()) :
276 BaseType(
"", mpiComm,
277 (const DuneBoundaryProjectionType *) 0,
278 (const DuneBoundaryProjectionVector* ) 0,
281 if(this->comm().rank() == 0)
283 std::cout <<
"\nCreated empty ALUSimplexGrid<"<<dim<<
","<<dimworld <<
">. \n\n";
287 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
288 typedef BaseType::ctype ctype;
289 typedef BaseType::GridFamily GridFamily;
290 typedef GridFamily::Traits Traits;
291 typedef BaseType::LocalIdSetImp LocalIdSetImp;
292 typedef Traits :: GlobalIdSet GlobalIdSet;
293 typedef Traits :: LocalIdSet LocalIdSet;
294 typedef GridFamily :: LevelIndexSetImp LevelIndexSetImp;
295 typedef GridFamily :: LeafIndexSetImp LeafIndexSetImp;
296 typedef BaseType::LeafIteratorImp LeafIteratorImp;
297 typedef Traits::Codim<0>::LeafIterator LeafIteratorType;
298 typedef Traits::Codim<0>::LeafIterator LeafIterator;
301 typedef BaseType::HierarchicIteratorImp HierarchicIteratorImp;
302 typedef BaseType::ObjectStreamType ObjectStreamType;
304 template< PartitionIteratorType pitype >
313 typedef Partition< All_Partition > :: LevelGridView LevelGridView;
314 typedef Partition< All_Partition > :: LeafGridView LeafGridView;
316 template< PartitionIteratorType pitype >
317 typename Partition< pitype >::LevelGridView levelView (
int level )
const
319 typedef typename Partition< pitype >::LevelGridView LevelGridView;
320 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
321 return LevelGridView( LevelGridViewImp( *
this, level ) );
324 template< PartitionIteratorType pitype >
325 typename Partition< pitype >::LeafGridView leafView ()
const
327 typedef typename Partition< pitype >::LeafGridView LeafGridView;
328 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
329 return LeafGridView( LeafGridViewImp( *
this ) );
332 LevelGridView levelView (
int level )
const
334 typedef LevelGridView::GridViewImp LevelGridViewImp;
335 return LevelGridView( LevelGridViewImp( *
this, level ) );
338 LeafGridView leafView ()
const
340 typedef LeafGridView::GridViewImp LeafGridViewImp;
341 return LeafGridView( LeafGridViewImp( *
this ) );
345 friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
346 friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
348 friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
349 friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
351 template<
class >
friend class ALU3dGridFactory;
354 ALUSimplexGrid(
const ALUSimplexGrid & g );
357 ALUSimplexGrid<dim,dimworld>&
358 operator = (
const ALUSimplexGrid& g);
380 template< ALUGr
idElementType elType, ALUGr
idRefinementType refineType,
class Comm >
381 class ALUGrid< 3, 3, elType, refineType, Comm >
382 :
public ALUGridBaseGrid< 3, 3, elType, Comm > :: BaseGrid
384 typedef ALUGrid< 3, 3, elType, refineType, Comm > This;
385 typedef typename ALUGridBaseGrid< 3, 3, elType, Comm > :: BaseGrid BaseType;
388 enum { dimworld = 3 };
390 typedef typename BaseType::MPICommunicatorType MPICommunicatorType;
394 typedef typename BaseType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
397 typedef typename BaseType :: DuneBoundaryProjectionVector DuneBoundaryProjectionVector;
409 ALUGrid(
const std::string macroName,
410 const MPICommunicatorType mpiComm = BaseType::defaultCommunicator(),
411 const DuneBoundaryProjectionType* bndProject = 0,
412 const DuneBoundaryProjectionVector* bndVector = 0,
413 const bool verb =
true ) :
414 BaseType(macroName, mpiComm, bndProject, bndVector, refineType )
416 const bool verbose = verb && this->comm().rank() == 0;
419 std::cout <<
"\nCreated " << ALUGridParallelSerial() <<
" " << name() << nameSuffix()
420 <<
" from macro grid file '" << macroName <<
"'. \n\n";
424 static std::string name () {
return std::string(
"ALUGrid"); }
426 static std::string nameSuffix()
428 std::string elt ( elType ==
cube ?
"cube," :
"simplex," );
429 std::string ref ( refineType ==
nonconforming ?
"nonconforming>" :
"conforming>" );
430 std::stringstream suffix;
431 suffix <<
"<"<<dim<<
","<<dimworld<<
"," << elt << ref;
445 ALUGrid(
const MPICommunicatorType mpiComm,
446 const DuneBoundaryProjectionType* bndProject ,
447 const DuneBoundaryProjectionVector* bndVector,
448 const std::string macroName,
449 const bool verb =
true ) :
450 BaseType(
"", mpiComm, bndProject, bndVector, refineType )
452 const bool verbose = verb && this->comm().rank() == 0;
455 std::cout <<
"\nCreated " << ALUGridParallelSerial() <<
" " << name() << nameSuffix()
456 <<
" from macro grid file '" << macroName <<
"'. \n\n";
461 ALUGrid(
const MPICommunicatorType mpiComm = BaseType::defaultCommunicator()) :
462 BaseType(
"", mpiComm,
463 (const DuneBoundaryProjectionType *) 0,
464 (const DuneBoundaryProjectionVector* ) 0,
467 if(this->comm().rank() == 0)
469 std::cout <<
"\nCreated empty " << ALUGridParallelSerial() <<
" " << name() << nameSuffix() <<
"." << std::endl << std::endl;
473 enum { dimension=BaseType::dimension, dimensionworld=BaseType::dimensionworld};
474 typedef typename BaseType::ctype ctype;
475 typedef typename BaseType::GridFamily GridFamily;
476 typedef typename GridFamily::Traits Traits;
477 typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
478 typedef typename Traits :: GlobalIdSet GlobalIdSet;
479 typedef typename Traits :: LocalIdSet LocalIdSet;
480 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
481 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
482 typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
483 typedef typename Traits:: template Codim<0>::LeafIterator LeafIteratorType;
484 typedef typename Traits:: template Codim<0>::LeafIterator LeafIterator;
487 typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
488 typedef typename BaseType::ObjectStreamType ObjectStreamType;
490 template< PartitionIteratorType pitype >
499 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
500 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
502 template< PartitionIteratorType pitype >
503 typename Partition< pitype >::LevelGridView levelView (
int level )
const
505 typedef typename Partition< pitype >::LevelGridView LevelGridView;
506 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
507 return LevelGridView( LevelGridViewImp( *
this, level ) );
510 template< PartitionIteratorType pitype >
511 typename Partition< pitype >::LeafGridView leafView ()
const
513 typedef typename Partition< pitype >::LeafGridView LeafGridView;
514 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
515 return LeafGridView( LeafGridViewImp( *
this ) );
518 LevelGridView levelView (
int level )
const
520 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
521 return LevelGridView( LevelGridViewImp( *
this, level ) );
524 LeafGridView leafView ()
const
526 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
527 return LeafGridView( LeafGridViewImp( *
this ) );
531 friend class Conversion< This , HasObjectStream > ;
532 friend class Conversion< const This, HasObjectStream > ;
534 friend class Conversion< This, HasHierarchicIndexSet > ;
535 friend class Conversion< const This, HasHierarchicIndexSet > ;
537 template<
class >
friend class ALU3dGridFactory;
540 ALUGrid(
const ALUGrid & g );
543 This& operator = (
const ALUGrid& g);
548 #endif // #if HAVE_ALUGRID