1#ifndef DUNE_ALU3DGRID_ALUGRID_HH
2#define DUNE_ALU3DGRID_ALUGRID_HH
8#include <dune/alugrid/3d/alu3dinclude.hh>
9#include <dune/alugrid/3d/indexsets.hh>
10#include <dune/alugrid/3d/iterator.hh>
11#include <dune/alugrid/3d/entity.hh>
12#include <dune/alugrid/3d/geometry.hh>
13#include <dune/alugrid/3d/grid.hh>
24 static const char* ALUGridParallelSerial()
26 return ( std::is_same< Comm, ALUGridNoComm >::value ) ?
"serial" :
"parallel";
29 template<
int dim,
int dimworld, ALUGr
idElementType elType, ALUGr
idRefinementType refineType,
class Comm >
31 :
public ALUGridBaseGrid< dim, dimworld, elType, Comm > :: BaseGrid
33 typedef ::ALUGrid::ALUGridExternalParameters ALUGridExternalParameters;
36 static_assert( elType ==
cube ? refineType ==
nonconforming :
true,
"cube only works with nonconforming refinement");
39 typedef typename ALUGridBaseGrid< dim, dimworld, elType, Comm > :: BaseGrid BaseType;
47 if( getenv(
"ALUGRID_CONFORMING_REFINEMENT") )
49 const int conformingRefinement = atoi(getenv(
"ALUGRID_CONFORMING_REFINEMENT"));
50 if(
bool(ALUGridExternalParameters::verbosityLevel()) )
51 std::cout <<
"ALUGrid: setting conforming refinement in constructor!" <<std::endl;
56 return defaultRefType;
60 typedef typename BaseType::MPICommunicatorType MPICommunicatorType;
65 enum { dimension=BaseType::dimension, dimensionworld=BaseType::dimensionworld};
67 typedef typename BaseType::ctype ctype;
68 typedef typename BaseType::GridFamily GridFamily;
69 typedef typename GridFamily::Traits Traits;
70 typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
71 typedef typename Traits :: GlobalIdSet GlobalIdSet;
72 typedef typename Traits :: LocalIdSet LocalIdSet;
73 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
74 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
75 typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
90 const MPICommunicatorType mpiComm = BaseType::defaultCommunicator(),
92 const bool verb =
true ) :
93 BaseType(macroName, mpiComm, bndPrj, getRefinementType(refinementType) )
95 const bool verbose = verb && (this->comm().rank() == 0) &&
bool(ALUGridExternalParameters::verbosityLevel());
98 std::cout <<
"\nCreated " << ALUGridParallelSerial< Comm >() <<
" " << name() << nameSuffix( this->conformingRefinement() )
99 <<
" from macro grid file '" << macroName <<
"'. \n\n";
103 static std::string name () {
return std::string(
"ALUGrid"); }
105 static std::string nameSuffix(
const bool conformingRefinement =
false )
107 std::string elt ( elType ==
cube ?
"cube>" :
"simplex>" );
108 std::string ref ( conformingRefinement ?
" (conforming)":
"" );
109 std::stringstream suffix;
110 suffix <<
"<"<< dimension <<
","<< dimensionworld <<
"," << elt << ref;
126 const std::string macroName,
127 const bool verb =
true ) :
128 BaseType(
"", mpiComm, bndPrj, getRefinementType(refinementType) )
130 const bool verbose = verb && (this->comm().rank() == 0) &&
bool(ALUGridExternalParameters::verbosityLevel());
133 std::cout <<
"\nCreated " << ALUGridParallelSerial< Comm >() <<
" " << name() << nameSuffix( this->conformingRefinement() );
134 if( macroName.empty() )
135 std::cout <<
" from input stream. \n";
137 std::cout <<
" from macro grid file '" << macroName <<
"'. \n";
138 std::cout << std::endl;
143 ALUGrid(
const MPICommunicatorType mpiComm = BaseType::defaultCommunicator()) :
146 if(this->comm().rank() == 0 &&
bool(ALUGridExternalParameters::verbosityLevel()) )
148 std::cout <<
"\nCreated empty " << ALUGridParallelSerial< Comm >() <<
" "
149 << name() << nameSuffix( this->conformingRefinement() ) <<
"." << std::endl << std::endl;
154 typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
155 typedef typename BaseType::ObjectStreamType ObjectStreamType;
157 template< PartitionIteratorType pitype >
164 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
165 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
168 template< PartitionIteratorType pitype >
169 typename Partition< pitype >::LevelGridView levelView (
int level )
const {
return levelGridView< pitype >( level ); }
171 template< PartitionIteratorType pitype >
172 typename Partition< pitype >::LeafGridView leafView ()
const {
return leafGridView< pitype >(); }
174 LevelGridView levelView (
int level )
const {
return levelGridView( level ); }
176 LeafGridView leafView ()
const {
return leafGridView(); }
179 template< PartitionIteratorType pitype >
180 typename Partition< pitype >::LevelGridView levelGridView (
int level )
const
182 typedef typename Partition< pitype >::LevelGridView LevelGridView;
183 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
184 return LevelGridView( LevelGridViewImp( *
this, level ) );
187 template< PartitionIteratorType pitype >
188 typename Partition< pitype >::LeafGridView leafGridView ()
const
190 typedef typename Partition< pitype >::LeafGridView LeafGridView;
191 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
192 return LeafGridView( LeafGridViewImp( *
this ) );
195 LevelGridView levelGridView (
int level )
const
197 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
198 return LevelGridView( LevelGridViewImp( *
this, level ) );
201 LeafGridView leafGridView ()
const
203 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
204 return LeafGridView( LeafGridViewImp( *
this ) );
208 template<
class >
friend class ALU3dGridFactory;
214 This& operator = (
const ALUGrid& g);
unstructured parallel implementation of the DUNE grid interface
Definition: alugrid.hh:32
ALUGrid(const MPICommunicatorType mpiComm=BaseType::defaultCommunicator())
constructor creating empty grid, empty string creates empty grid
Definition: alugrid.hh:143
BaseType::ALUGridVertexProjectionPairType ALUGridVertexProjectionPairType
type of boundary projection
Definition: alugrid.hh:63
ALUGrid(const MPICommunicatorType mpiComm, const ALUGridVertexProjectionPairType &bndPrj, const std::string macroName, const bool verb=true)
constructor called from ALUGridFactory for creating ALUConformGrid from given macro grid file
Definition: alugrid.hh:124
ALUGrid(const std::string macroName, const MPICommunicatorType mpiComm=BaseType::defaultCommunicator(), const ALUGridVertexProjectionPairType &bndPrj=ALUGridVertexProjectionPairType(), const bool verb=true)
constructor for creating ALUGrid from given macro grid file
Definition: alugrid.hh:89
Grid view abstract base class.
Definition: gridview.hh:66
Capabilities for ALUGrid.
Dune namespace.
Definition: alignedallocator.hh:13
@ simplex
use only simplex elements (i.e., triangles or tetrahedra)
Definition: declaration.hh:18
@ cube
use only cube elements (i.e., quadrilaterals or hexahedra)
Definition: declaration.hh:19
ALUGridRefinementType
available refinement types for ALUGrid
Definition: declaration.hh:24
@ nonconforming
Definition: declaration.hh:26
@ conforming
use only conforming bisection refinement
Definition: declaration.hh:25
Static tag representing a codimension.
Definition: dimension.hh:24