3#ifndef DUNE_ALU2D_ALUGRID_HH
4#define DUNE_ALU2D_ALUGRID_HH
7#if HAVE_ALUGRID || DOXYGEN
9#include <dune/grid/alugrid/common/declaration.hh>
10#include <dune/grid/alugrid/common/capabilities.hh>
11#include <dune/grid/alugrid/2d/capabilities.hh>
12#include <dune/grid/alugrid/2d/grid.hh>
31 enum { dimworld = dimw };
53 const bool verbose =
true )
54 :
BaseType(macroName,1, bndProject, bndVector)
58 std::cout <<
"\nCreated serial ALUCubeGrid<"<<dim<<
","<<dimworld;
59 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
75 std::istream& macroFile,
78 const bool verbose =
true )
79 :
BaseType(
"",1, bndProject, bndVector, ¯oFile)
83 std::cout <<
"\nCreated serial ALUCubeGrid<"<<dim<<
","<<dimworld;
85 std::cout <<
">. \n\n";
87 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
96 std::cout <<
"\nCreated empty ALUCubeGrid<"<<dim<<
","<<dimworld <<
">. \n\n";
99 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
100 enum { refineStepsForHalf = 1 };
101 typedef typename BaseType::ctype ctype;
102 typedef typename BaseType::GridFamily GridFamily;
103 typedef typename GridFamily::Traits Traits;
104 typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
105 typedef typename Traits :: GlobalIdSet GlobalIdSet;
106 typedef typename Traits :: LocalIdSet LocalIdSet;
107 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
108 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
109 typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
110 typedef typename Traits::template Codim<0>::LeafIterator LeafIteratorType;
111 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
112 typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
114 template< PartitionIteratorType pitype >
123 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
124 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
126 template< PartitionIteratorType pitype >
127 typename Partition< pitype >::LevelGridView levelView (
int level )
const
129 typedef typename Partition< pitype >::LevelGridView LevelGridView;
130 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
131 return LevelGridView( LevelGridViewImp( *
this, level ) );
134 template< PartitionIteratorType pitype >
135 typename Partition< pitype >::LeafGridView leafView ()
const
137 typedef typename Partition< pitype >::LeafGridView LeafGridView;
138 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
139 return LeafGridView( LeafGridViewImp( *
this ) );
142 LevelGridView levelView (
int level )
const
144 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
145 return LevelGridView( LevelGridViewImp( *
this, level ) );
148 LeafGridView leafView ()
const
150 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
151 return LeafGridView( LeafGridViewImp( *
this ) );
154 template< PartitionIteratorType pitype >
155 typename Partition< pitype >::LevelGridView levelGridView (
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 leafGridView ()
const
165 typedef typename Partition< pitype >::LeafGridView LeafGridView;
166 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
167 return LeafGridView( LeafGridViewImp( *
this ) );
170 LevelGridView levelGridView (
int level )
const
172 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
173 return LevelGridView( LevelGridViewImp( *
this, level ) );
176 LeafGridView leafGridView ()
const
178 typedef typename 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 > ;
190 friend class ALU2dGridFactory;
193 ALUCubeGrid(
const ALUCubeGrid & g ) ;
196 ALUCubeGrid<dim,dimworld>&
197 operator = (
const ALUCubeGrid& g);
214 enum { dimworld = dimw };
236 const bool verbose =
true )
237 :
BaseType(macroName,1, bndProject, bndVector)
241 std::cout <<
"\nCreated serial ALUSimplexGrid<"<<dim<<
","<<dimworld;
242 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
258 std::istream& macroFile,
261 const bool verbose =
true )
262 :
BaseType(
"",1, bndProject, bndVector, ¯oFile)
266 std::cout <<
"\nCreated serial ALUSimplexGrid<"<<dim<<
","<<dimworld;
267 if( macroName ==
"" )
268 std::cout <<
">. \n\n";
270 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
279 std::cout <<
"\nCreated empty ALUSimplexGrid<"<<dim<<
","<<dimworld <<
">. \n\n";
282 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
283 enum { refineStepsForHalf = 1 };
284 typedef typename BaseType::ctype ctype;
285 typedef typename BaseType::GridFamily GridFamily;
286 typedef typename GridFamily::Traits Traits;
287 typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
288 typedef typename Traits :: GlobalIdSet GlobalIdSet;
289 typedef typename Traits :: LocalIdSet LocalIdSet;
290 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
291 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
292 typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
293 typedef typename Traits::template Codim<0>::LeafIterator LeafIteratorType;
294 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
295 typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
297 template< PartitionIteratorType pitype >
306 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
307 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
309 template< PartitionIteratorType pitype >
310 typename Partition< pitype >::LevelGridView levelView (
int level )
const
312 typedef typename Partition< pitype >::LevelGridView LevelGridView;
313 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
314 return LevelGridView( LevelGridViewImp( *
this, level ) );
317 template< PartitionIteratorType pitype >
318 typename Partition< pitype >::LeafGridView leafView ()
const
320 typedef typename Partition< pitype >::LeafGridView LeafGridView;
321 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
322 return LeafGridView( LeafGridViewImp( *
this ) );
325 LevelGridView levelView (
int level )
const
327 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
328 return LevelGridView( LevelGridViewImp( *
this, level ) );
331 LeafGridView leafView ()
const
333 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
334 return LeafGridView( LeafGridViewImp( *
this ) );
337 template< PartitionIteratorType pitype >
338 typename Partition< pitype >::LevelGridView levelGridView (
int level )
const
340 typedef typename Partition< pitype >::LevelGridView LevelGridView;
341 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
342 return LevelGridView( LevelGridViewImp( *
this, level ) );
345 template< PartitionIteratorType pitype >
346 typename Partition< pitype >::LeafGridView leafGridView ()
const
348 typedef typename Partition< pitype >::LeafGridView LeafGridView;
349 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
350 return LeafGridView( LeafGridViewImp( *
this ) );
353 LevelGridView levelGridView (
int level )
const
355 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
356 return LevelGridView( LevelGridViewImp( *
this, level ) );
359 LeafGridView leafGridView ()
const
361 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
362 return LeafGridView( LeafGridViewImp( *
this ) );
366 friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
367 friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasObjectStream > ;
369 friend class Conversion< ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
370 friend class Conversion< const ALUSimplexGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
373 friend class ALU2dGridFactory;
376 ALUSimplexGrid(
const ALUSimplexGrid & g ) ;
379 ALUSimplexGrid<dim,dimworld>&
380 operator = (
const ALUSimplexGrid& g);
411 template <
int dim,
int dimworld>
414 "The unspecialized version of ALUConformGrid is defined "
415 "for documentation purposes only, only the "
416 "specializations can actually be used.");
419 namespace Capabilities {
431 template<
int dim,
int dimw,
int cdim >
434 static const bool v =
true;
440 template<
int dim,
int dimw>
442 static const bool v =
false;
448 template<
int dim,
int dimw>
451 static const bool v =
false;
457 template<
int dim,
int dimw>
460 static const bool v =
true;
466 template<
int dim,
int dimw>
469 static const bool v =
true;
490 enum { dimworld = dimw };
511 const bool verbose =
true)
512 :
BaseType(macroName, 0, bndProject, bndVector)
516 std::cout <<
"\nCreated serial ALUConformGrid<"<<dim<<
","<<dimworld;
517 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
533 std::istream& macroFile,
536 const bool verbose =
true )
537 :
BaseType(
"", 0, bndProject, bndVector, ¯oFile)
541 std::cout <<
"\nCreated serial ALUConformGrid<"<<dim<<
","<<dimworld;
542 if( macroName ==
"" )
543 std::cout <<
">. \n\n";
545 std::cout <<
"> from macro grid file '" << macroName <<
"'. \n\n";
554 std::cout <<
"\nCreated empty ALUConformGrid<"<<dim<<
","<<dimworld <<
">. \n\n";
558 static inline std::string
name () {
return "ALUConformGrid"; }
560 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
561 enum { refineStepsForHalf = 2 };
562 typedef typename BaseType::ctype ctype;
563 typedef typename BaseType::GridFamily GridFamily;
564 typedef typename GridFamily::Traits Traits;
565 typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
566 typedef typename Traits :: GlobalIdSet GlobalIdSet;
567 typedef typename Traits :: LocalIdSet LocalIdSet;
568 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
569 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
570 typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
571 typedef typename Traits::template Codim<0>::LeafIterator LeafIteratorType;
572 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
573 typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
575 template< PartitionIteratorType pitype >
584 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
585 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
587 template< PartitionIteratorType pitype >
588 typename Partition< pitype >::LevelGridView levelView (
int level )
const
590 typedef typename Partition< pitype >::LevelGridView LevelGridView;
591 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
592 return LevelGridView( LevelGridViewImp( *
this, level ) );
595 template< PartitionIteratorType pitype >
596 typename Partition< pitype >::LeafGridView leafView ()
const
598 typedef typename Partition< pitype >::LeafGridView LeafGridView;
599 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
600 return LeafGridView( LeafGridViewImp( *
this ) );
603 LevelGridView levelView (
int level )
const
605 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
606 return LevelGridView( LevelGridViewImp( *
this, level ) );
609 LeafGridView leafView ()
const
611 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
612 return LeafGridView( LeafGridViewImp( *
this ) );
615 template< PartitionIteratorType pitype >
616 typename Partition< pitype >::LevelGridView levelGridView (
int level )
const
618 typedef typename Partition< pitype >::LevelGridView LevelGridView;
619 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
620 return LevelGridView( LevelGridViewImp( *
this, level ) );
623 template< PartitionIteratorType pitype >
624 typename Partition< pitype >::LeafGridView leafGridView ()
const
626 typedef typename Partition< pitype >::LeafGridView LeafGridView;
627 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
628 return LeafGridView( LeafGridViewImp( *
this ) );
631 LevelGridView levelGridView (
int level )
const
633 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
634 return LevelGridView( LevelGridViewImp( *
this, level ) );
637 LeafGridView leafGridView ()
const
639 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
640 return LeafGridView( LeafGridViewImp( *
this ) );
644 friend class Conversion< ALUConformGrid<dimension,dimensionworld> , HasObjectStream > ;
645 friend class Conversion< const ALUConformGrid<dimension,dimensionworld> , HasObjectStream > ;
647 friend class Conversion< ALUConformGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
648 friend class Conversion< const ALUConformGrid<dimension,dimensionworld> , HasHierarchicIndexSet > ;
651 friend class ALU2dGridFactory;
654 ALUConformGrid(
const ALUConformGrid & g ) ;
657 ALUConformGrid<dim,dimworld>&
658 operator = (
const ALUConformGrid& g);
680 template<
int dimw, ALUGr
idElementType elType, ALUGr
idRefinementType refinementType,
class Comm >
681 class ALUGrid< 2, dimw, elType, refinementType, Comm >
682 :
public ALUGridBaseGrid < 2, dimw, elType, Comm > :: BaseGrid
684 typedef ALUGrid< 2, dimw, elType, refinementType, Comm > This;
685 typedef typename ALUGridBaseGrid < 2, dimw, elType, Comm > :: BaseGrid BaseType;
688 enum { dimworld = dimw };
692 typedef typename BaseType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
695 typedef typename BaseType :: DuneBoundaryProjectionVector DuneBoundaryProjectionVector;
705 ALUGrid(
const std::string macroName,
706 const DuneBoundaryProjectionType* bndProject = 0,
707 const DuneBoundaryProjectionVector* bndVector = 0,
708 const bool verbose =
true )
709 : BaseType(macroName, hangingNodes(), bndProject, bndVector)
713 std::cout <<
"\nCreated serial " << name() << nameSuffix()
714 <<
" from macro grid file '" << macroName <<
"'." << std::endl << std::endl;
727 ALUGrid(
const std::string macroName,
728 std::istream& macroFile,
729 const DuneBoundaryProjectionType* bndProject = 0,
730 const DuneBoundaryProjectionVector* bndVector = 0,
731 const bool verbose =
true )
732 : BaseType(
"", hangingNodes(), bndProject, bndVector, ¯oFile)
736 std::cout <<
"\nCreated serial " << name() << nameSuffix();
737 if( macroName !=
"" )
738 std::cout <<
" from macro grid file '" << macroName;
739 std::cout <<
"." << std::endl << std::endl;
743 static std::string name () {
return std::string(
"ALUGrid"); }
746 ALUGrid( ) : BaseType( hangingNodes() )
748 std::cout <<
"\nCreated serial " << name() << nameSuffix() <<
"." << std::endl << std::endl;
751 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
752 enum { refineStepsForHalf = 1 };
753 typedef typename BaseType::ctype ctype;
754 typedef typename BaseType::GridFamily GridFamily;
755 typedef typename GridFamily::Traits Traits;
756 typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
757 typedef typename Traits :: GlobalIdSet GlobalIdSet;
758 typedef typename Traits :: LocalIdSet LocalIdSet;
759 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
760 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
761 typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
762 typedef typename Traits::template Codim<0>::LeafIterator LeafIteratorType;
763 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
764 typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
766 template< PartitionIteratorType pitype >
775 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
776 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
778 template< PartitionIteratorType pitype >
779 typename Partition< pitype >::LevelGridView levelView (
int level )
const
781 typedef typename Partition< pitype >::LevelGridView LevelGridView;
782 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
783 return LevelGridView( LevelGridViewImp( *
this, level ) );
786 template< PartitionIteratorType pitype >
787 typename Partition< pitype >::LeafGridView leafView ()
const
789 typedef typename Partition< pitype >::LeafGridView LeafGridView;
790 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
791 return LeafGridView( LeafGridViewImp( *
this ) );
794 LevelGridView levelView (
int level )
const
796 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
797 return LevelGridView( LevelGridViewImp( *
this, level ) );
800 LeafGridView leafView ()
const
802 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
803 return LeafGridView( LeafGridViewImp( *
this ) );
806 template< PartitionIteratorType pitype >
807 typename Partition< pitype >::LevelGridView levelGridView (
int level )
const
809 typedef typename Partition< pitype >::LevelGridView LevelGridView;
810 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
811 return LevelGridView( LevelGridViewImp( *
this, level ) );
814 template< PartitionIteratorType pitype >
815 typename Partition< pitype >::LeafGridView leafGridView ()
const
817 typedef typename Partition< pitype >::LeafGridView LeafGridView;
818 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
819 return LeafGridView( LeafGridViewImp( *
this ) );
822 LevelGridView levelGridView (
int level )
const
824 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
825 return LevelGridView( LevelGridViewImp( *
this, level ) );
828 LeafGridView leafGridView ()
const
830 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
831 return LeafGridView( LeafGridViewImp( *
this ) );
835 static std::string nameSuffix()
837 std::string elt ( elType == cube ?
"cube," :
"simplex," );
838 std::string ref ( refinementType == nonconforming ?
"nonconforming>" :
"conforming>" );
839 std::stringstream suffix;
840 suffix <<
"<"<<dim<<
","<<dimworld<<
"," << elt << ref;
845 int hangingNodes()
const
847 return ((elType == simplex) && (refinementType == conforming)) ? 0 : 1;
850 friend class Conversion< This, HasObjectStream > ;
851 friend class Conversion< const This, HasObjectStream > ;
853 friend class Conversion< This, HasHierarchicIndexSet > ;
854 friend class Conversion< const This, HasHierarchicIndexSet > ;
857 friend class ALU2dGridFactory;
860 ALUGrid(
const ALUGrid & g ) ;
863 This& operator = (
const ALUGrid& g);
869#error "Trying to use <dune/grid/alugrid.hh> without ALUGRID_CPPFLAGS."
[ provides Dune::Grid ]
Definition: grid.hh:213
constructor for creating ALUSimplexGrid from given macro grid file
Definition: alugrid.hh:26
DUNE_DEPRECATED ALUCubeGrid(const std::string macroName, const DuneBoundaryProjectionType *bndProject=0, const DuneBoundaryProjectionVector *bndVector=0, const bool verbose=true)
constructor for creating ALUSimplexGrid from given macro grid file
Definition: alugrid.hh:50
DUNE_DEPRECATED ALUCubeGrid()
Definition: alugrid.hh:94
BaseType::DuneBoundaryProjectionVector DuneBoundaryProjectionVector
type of boundary projection
Definition: alugrid.hh:38
DUNE_DEPRECATED ALUCubeGrid(const std::string macroName, std::istream ¯oFile, const DuneBoundaryProjectionType *bndProject=0, const DuneBoundaryProjectionVector *bndVector=0, const bool verbose=true)
constructor for creating ALUSimplexGrid from given macro grid file
Definition: alugrid.hh:74
BaseType::DuneBoundaryProjectionType DuneBoundaryProjectionType
type of boundary projection
Definition: alugrid.hh:35
[ provides Dune::Grid ]
Definition: alugrid.hh:53
constructor for creating ALUSimplexGrid from given macro grid file
Definition: alugrid.hh:209
BaseType::DuneBoundaryProjectionVector DuneBoundaryProjectionVector
type of boundary projection
Definition: alugrid.hh:221
BaseType::DuneBoundaryProjectionType DuneBoundaryProjectionType
type of boundary projection
Definition: alugrid.hh:218
DUNE_DEPRECATED ALUSimplexGrid(const std::string macroName, std::istream ¯oFile, const DuneBoundaryProjectionType *bndProject=0, const DuneBoundaryProjectionVector *bndVector=0, const bool verbose=true)
constructor for creating ALUSimplexGrid from given macro grid file
Definition: alugrid.hh:257
DUNE_DEPRECATED ALUSimplexGrid(const std::string macroName, const DuneBoundaryProjectionType *bndProject=0, const DuneBoundaryProjectionVector *bndVector=0, const bool verbose=true)
constructor for creating ALUSimplexGrid from given macro grid file
Definition: alugrid.hh:233
DUNE_DEPRECATED ALUSimplexGrid()
Definition: alugrid.hh:277
[ provides Dune::Grid ]
Definition: alugrid.hh:85
Grid view abstract base class.
Definition: gridview.hh:57
#define DUNE_DEPRECATED
Mark some entity as deprecated.
Definition: deprecated.hh:84
Dune namespace.
Definition: alignment.hh:14
template which always yields a false value
Definition: static_assert.hh:127
Specialize with 'true' if implementation provides backup and restore facilities. (default=false)
Definition: capabilities.hh:105
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: capabilities.hh:56
Specialize with 'true' if implementation supports parallelism. (default=false)
Definition: capabilities.hh:65
Interface class for vertex projection at the boundary.
Definition: boundaryprojection.hh:24
Generate a type for a given integral constant.
Definition: typetraits.hh:457