1 #ifndef DUNE_ALU2D_ALUGRID_HH
2 #define DUNE_ALU2D_ALUGRID_HH
21 class ALUCubeGrid< 2, dimw >
24 typedef ALUCubeGrid< 2, dimw > This;
28 enum { dimworld = dimw };
32 typedef typename BaseType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
35 typedef typename BaseType :: DuneBoundaryProjectionVector DuneBoundaryProjectionVector;
45 ALUCubeGrid(
const std::string macroName,
46 const DuneBoundaryProjectionType* bndProject = 0,
47 const DuneBoundaryProjectionVector* bndVector = 0,
48 const bool verbose =
true )
49 : BaseType(macroName,1, bndProject, bndVector)
53 std::cout <<
"\nCreated serial ALUCubeGrid<"<<dim<<
","<<dimworld;
54 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
67 ALUCubeGrid(
const std::string macroName,
68 std::istream& macroFile,
69 const DuneBoundaryProjectionType* bndProject = 0,
70 const DuneBoundaryProjectionVector* bndVector = 0,
71 const bool verbose =
true )
72 : BaseType(
"",1, bndProject, bndVector, ¯oFile)
76 std::cout <<
"\nCreated serial ALUCubeGrid<"<<dim<<
","<<dimworld;
78 std::cout <<
">. \n\n";
80 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
85 ALUCubeGrid( ) : BaseType(1)
87 std::cout <<
"\nCreated empty ALUCubeGrid<"<<dim<<
","<<dimworld <<
">. \n\n";
90 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
91 enum { refineStepsForHalf = 1 };
92 typedef typename BaseType::ctype ctype;
93 typedef typename BaseType::GridFamily GridFamily;
94 typedef typename GridFamily::Traits Traits;
95 typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
96 typedef typename Traits :: GlobalIdSet GlobalIdSet;
97 typedef typename Traits :: LocalIdSet LocalIdSet;
98 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
99 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
100 typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
101 typedef typename Traits::template Codim<0>::LeafIterator LeafIteratorType;
102 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
103 typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
105 template< PartitionIteratorType pitype >
114 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
115 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
117 template< PartitionIteratorType pitype >
118 typename Partition< pitype >::LevelGridView levelView (
int level )
const
120 typedef typename Partition< pitype >::LevelGridView LevelGridView;
121 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
122 return LevelGridView( LevelGridViewImp( *
this, level ) );
125 template< PartitionIteratorType pitype >
126 typename Partition< pitype >::LeafGridView leafView ()
const
128 typedef typename Partition< pitype >::LeafGridView LeafGridView;
129 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
130 return LeafGridView( LeafGridViewImp( *
this ) );
133 LevelGridView levelView (
int level )
const
135 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
136 return LevelGridView( LevelGridViewImp( *
this, level ) );
139 LeafGridView leafView ()
const
141 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
142 return LeafGridView( LeafGridViewImp( *
this ) );
146 friend class Conversion< ALUCubeGrid<dimension,dimensionworld> , HasObjectStream > ;
147 friend class Conversion< const ALUCubeGrid<dimension,dimensionworld> , HasObjectStream > ;
149 friend class Conversion< ALUCubeGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
150 friend class Conversion< const ALUCubeGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
153 friend class ALU2dGridFactory;
156 ALUCubeGrid(
const ALUCubeGrid & g ) ;
159 ALUCubeGrid<dim,dimworld>&
160 operator = (
const ALUCubeGrid& g);
169 class ALUSimplexGrid< 2, dimw >
172 typedef ALUSimplexGrid< 2, dimw > This;
176 enum { dimworld = dimw };
180 typedef typename BaseType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
183 typedef typename BaseType :: DuneBoundaryProjectionVector DuneBoundaryProjectionVector;
193 ALUSimplexGrid(
const std::string macroName,
194 const DuneBoundaryProjectionType* bndProject = 0,
195 const DuneBoundaryProjectionVector* bndVector = 0,
196 const bool verbose =
true )
197 : BaseType(macroName,1, bndProject, bndVector)
201 std::cout <<
"\nCreated serial ALUSimplexGrid<"<<dim<<
","<<dimworld;
202 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
215 ALUSimplexGrid(
const std::string macroName,
216 std::istream& macroFile,
217 const DuneBoundaryProjectionType* bndProject = 0,
218 const DuneBoundaryProjectionVector* bndVector = 0,
219 const bool verbose =
true )
220 : BaseType(
"",1, bndProject, bndVector, ¯oFile)
224 std::cout <<
"\nCreated serial ALUSimplexGrid<"<<dim<<
","<<dimworld;
225 if( macroName ==
"" )
226 std::cout <<
">. \n\n";
228 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
233 ALUSimplexGrid( ) : BaseType(1)
235 std::cout <<
"\nCreated empty ALUSimplexGrid<"<<dim<<
","<<dimworld <<
">. \n\n";
238 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
239 enum { refineStepsForHalf = 1 };
240 typedef typename BaseType::ctype ctype;
241 typedef typename BaseType::GridFamily GridFamily;
242 typedef typename GridFamily::Traits Traits;
243 typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
244 typedef typename Traits :: GlobalIdSet GlobalIdSet;
245 typedef typename Traits :: LocalIdSet LocalIdSet;
246 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
247 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
248 typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
249 typedef typename Traits::template Codim<0>::LeafIterator LeafIteratorType;
250 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
251 typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
253 template< PartitionIteratorType pitype >
262 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
263 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
265 template< PartitionIteratorType pitype >
266 typename Partition< pitype >::LevelGridView levelView (
int level )
const
268 typedef typename Partition< pitype >::LevelGridView LevelGridView;
269 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
270 return LevelGridView( LevelGridViewImp( *
this, level ) );
273 template< PartitionIteratorType pitype >
274 typename Partition< pitype >::LeafGridView leafView ()
const
276 typedef typename Partition< pitype >::LeafGridView LeafGridView;
277 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
278 return LeafGridView( LeafGridViewImp( *
this ) );
281 LevelGridView levelView (
int level )
const
283 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
284 return LevelGridView( LevelGridViewImp( *
this, level ) );
287 LeafGridView leafView ()
const
289 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
290 return LeafGridView( LeafGridViewImp( *
this ) );
294 friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
295 friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
297 friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
298 friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
301 friend class ALU2dGridFactory;
304 ALUSimplexGrid(
const ALUSimplexGrid & g ) ;
307 ALUSimplexGrid<dim,dimworld>&
308 operator = (
const ALUSimplexGrid& g);
338 template <
int dim,
int dimworld>
339 class ALUConformGrid {
340 dune_static_assert((AlwaysFalse<integral_constant<int,dim> >::value),
341 "The unspecialized version of ALUConformGrid is defined "
342 "for documentation purposes only, only the "
343 "specializations can actually be used.");
346 namespace Capabilities {
358 template<
int dim,
int dimw,
int cdim >
359 struct hasEntity<Dune::ALUConformGrid<dim, dimw>, cdim >
361 static const bool v =
true;
367 template<
int dim,
int dimw>
368 struct isParallel<const ALUConformGrid<dim, dimw> > {
369 static const bool v =
false;
375 template<
int dim,
int dimw>
376 struct isLevelwiseConforming< ALUConformGrid<dim,dimw> >
378 static const bool v =
false;
384 template<
int dim,
int dimw>
385 struct isLeafwiseConforming< ALUConformGrid<dim,dimw> >
387 static const bool v =
true;
393 template<
int dim,
int dimw>
394 struct hasBackupRestoreFacilities< ALUConformGrid<dim,dimw> >
396 static const bool v =
true;
409 class ALUConformGrid< 2, dimw >
412 typedef ALUConformGrid< 2, dimw > This;
416 enum { dimworld = dimw };
419 typedef typename BaseType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
422 typedef typename BaseType :: DuneBoundaryProjectionVector DuneBoundaryProjectionVector;
432 ALUConformGrid(
const std::string macroName,
433 const DuneBoundaryProjectionType* bndProject = 0,
434 const DuneBoundaryProjectionVector* bndVector = 0,
435 const bool verbose =
true)
436 : BaseType(macroName, 0, bndProject, bndVector)
440 std::cout <<
"\nCreated serial ALUConformGrid<"<<dim<<
","<<dimworld;
441 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
454 ALUConformGrid(
const std::string macroName,
455 std::istream& macroFile,
456 const DuneBoundaryProjectionType* bndProject = 0,
457 const DuneBoundaryProjectionVector* bndVector = 0,
458 const bool verbose =
true )
459 : BaseType(
"", 0, bndProject, bndVector, ¯oFile)
463 std::cout <<
"\nCreated serial ALUConformGrid<"<<dim<<
","<<dimworld;
464 if( macroName ==
"" )
465 std::cout <<
">. \n\n";
467 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
472 ALUConformGrid( ) : BaseType(0)
474 std::cout <<
"\nCreated empty ALUConformGrid<"<<dim<<
","<<dimworld <<
">. \n\n";
478 static inline std::string name () {
return "ALUConformGrid"; }
480 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
481 enum { refineStepsForHalf = 2 };
482 typedef typename BaseType::ctype ctype;
483 typedef typename BaseType::GridFamily GridFamily;
484 typedef typename GridFamily::Traits Traits;
485 typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
486 typedef typename Traits :: GlobalIdSet GlobalIdSet;
487 typedef typename Traits :: LocalIdSet LocalIdSet;
488 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
489 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
490 typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
491 typedef typename Traits::template Codim<0>::LeafIterator LeafIteratorType;
492 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
493 typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
495 template< PartitionIteratorType pitype >
504 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
505 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
507 template< PartitionIteratorType pitype >
508 typename Partition< pitype >::LevelGridView levelView (
int level )
const
510 typedef typename Partition< pitype >::LevelGridView LevelGridView;
511 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
512 return LevelGridView( LevelGridViewImp( *
this, level ) );
515 template< PartitionIteratorType pitype >
516 typename Partition< pitype >::LeafGridView leafView ()
const
518 typedef typename Partition< pitype >::LeafGridView LeafGridView;
519 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
520 return LeafGridView( LeafGridViewImp( *
this ) );
523 LevelGridView levelView (
int level )
const
525 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
526 return LevelGridView( LevelGridViewImp( *
this, level ) );
529 LeafGridView leafView ()
const
531 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
532 return LeafGridView( LeafGridViewImp( *
this ) );
536 friend class Conversion< ALUConformGrid<dimension,dimensionworld> , HasObjectStream > ;
537 friend class Conversion< const ALUConformGrid<dimension,dimensionworld> , HasObjectStream > ;
539 friend class Conversion< ALUConformGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
540 friend class Conversion< const ALUConformGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
543 friend class ALU2dGridFactory;
546 ALUConformGrid(
const ALUConformGrid & g ) ;
549 ALUConformGrid<dim,dimworld>&
550 operator = (
const ALUConformGrid& g);
572 template<
int dimw, ALUGr
idElementType elType, ALUGr
idRefinementType refinementType,
class Comm >
573 class ALUGrid< 2, dimw, elType, refinementType, Comm >
574 :
public ALUGridBaseGrid < 2, dimw, elType, Comm > :: BaseGrid
576 typedef ALUGrid< 2, dimw, elType, refinementType, Comm > This;
577 typedef typename ALUGridBaseGrid < 2, dimw, elType, Comm > :: BaseGrid BaseType;
580 enum { dimworld = dimw };
584 typedef typename BaseType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
587 typedef typename BaseType :: DuneBoundaryProjectionVector DuneBoundaryProjectionVector;
597 ALUGrid(
const std::string macroName,
598 const DuneBoundaryProjectionType* bndProject = 0,
599 const DuneBoundaryProjectionVector* bndVector = 0,
600 const bool verbose =
true )
601 : BaseType(macroName, hangingNodes(), bndProject, bndVector)
605 std::cout <<
"\nCreated serial " << name() << nameSuffix()
606 <<
" from macro grid file '" << macroName <<
"'." << std::endl << std::endl;
619 ALUGrid(
const std::string macroName,
620 std::istream& macroFile,
621 const DuneBoundaryProjectionType* bndProject = 0,
622 const DuneBoundaryProjectionVector* bndVector = 0,
623 const bool verbose =
true )
624 : BaseType(
"", hangingNodes(), bndProject, bndVector, ¯oFile)
628 std::cout <<
"\nCreated serial " << name() << nameSuffix();
629 if( macroName !=
"" )
630 std::cout <<
" from macro grid file '" << macroName;
631 std::cout <<
"." << std::endl << std::endl;
635 static std::string name () {
return std::string(
"ALUGrid"); }
638 ALUGrid( ) : BaseType( hangingNodes() )
640 std::cout <<
"\nCreated serial " << name() << nameSuffix() <<
"." << std::endl << std::endl;
643 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
644 enum { refineStepsForHalf = 1 };
645 typedef typename BaseType::ctype ctype;
646 typedef typename BaseType::GridFamily GridFamily;
647 typedef typename GridFamily::Traits Traits;
648 typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
649 typedef typename Traits :: GlobalIdSet GlobalIdSet;
650 typedef typename Traits :: LocalIdSet LocalIdSet;
651 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
652 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
653 typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
654 typedef typename Traits::template Codim<0>::LeafIterator LeafIteratorType;
655 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
656 typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
658 template< PartitionIteratorType pitype >
667 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
668 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
670 template< PartitionIteratorType pitype >
671 typename Partition< pitype >::LevelGridView levelView (
int level )
const
673 typedef typename Partition< pitype >::LevelGridView LevelGridView;
674 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
675 return LevelGridView( LevelGridViewImp( *
this, level ) );
678 template< PartitionIteratorType pitype >
679 typename Partition< pitype >::LeafGridView leafView ()
const
681 typedef typename Partition< pitype >::LeafGridView LeafGridView;
682 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
683 return LeafGridView( LeafGridViewImp( *
this ) );
686 LevelGridView levelView (
int level )
const
688 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
689 return LevelGridView( LevelGridViewImp( *
this, level ) );
692 LeafGridView leafView ()
const
694 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
695 return LeafGridView( LeafGridViewImp( *
this ) );
699 static std::string nameSuffix()
701 std::string elt ( elType ==
cube ?
"cube," :
"simplex," );
702 std::string ref ( refinementType ==
nonconforming ?
"nonconforming>" :
"conforming>" );
703 std::stringstream suffix;
704 suffix <<
"<"<<dim<<
","<<dimworld<<
"," << elt << ref;
709 int hangingNodes()
const
714 friend class Conversion< This, HasObjectStream > ;
715 friend class Conversion< const This, HasObjectStream > ;
717 friend class Conversion< This, HasHierarchicIndexSet > ;
718 friend class Conversion< const This, HasHierarchicIndexSet > ;
721 friend class ALU2dGridFactory;
724 ALUGrid(
const ALUGrid & g ) ;
727 This& operator = (
const ALUGrid& g);
733 #error "Trying to use <dune/grid/alugrid.hh> without ALUGRID_CPPFLAGS."
734 #endif // #if HAVE_ALUGRID