dune-grid  2.4
alugrid/3d/alugrid.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_ALU3DGRID_ALUGRID_HH
4 #define DUNE_ALU3DGRID_ALUGRID_HH
5 
6 // only include this code, if ENABLE_ALUGRID is defined
7 #if HAVE_ALUGRID || DOXYGEN
8 
9 // 3d version
16 
22 namespace Dune
23 {
24 
25  static inline const char* ALUGridParallelSerial()
26  {
27 #if ALU3DGRID_PARALLEL
28  return "parallel";
29 #else
30  return "serial";
31 #endif
32  }
33 
34  /*-
35  (see ALUGrid homepage: http://www.mathematik.uni-freiburg.de/IAM/Research/alugrid/)
36 
37  \li Available Implementations
38  - quadrilateral and hexahedral elements only nonconforming refinement
39  - Dune::ALUGrid< 2, 2, cube, nonconforming >
40  - Dune::ALUGrid< 2, 3, cube, nonconforming >
41  - Dune::ALUGrid< 3, 3, cube, nonconforming >
42  - simplicial elements and nonconforming refinement
43  - Dune::ALUGrid< 2, 2, simplex, nonconforming >
44  - Dune::ALUGrid< 2, 3, simplex, nonconforming >
45  - Dune::ALUGrid< 3, 3, simplex, nonconforming >
46  - simplicial elements and bisection refinement
47  - Dune::ALUGrid< 2, 2, simplex, conforming >
48  - Dune::ALUGrid< 2, 3, simplex, conforming >
49  - Dune::ALUGrid< 3, 3, simplex, conforming > (work in progress)
50 
51  \note template parameter Comm defaults to MPI_Comm, if MPI is available, No_Comm otherwise.
52  */
53  template< ALUGridElementType elType, ALUGridRefinementType refineType, class Comm >
54  class ALUGrid< 3, 3, elType, refineType, Comm >
55  : public ALUGridBaseGrid< 3, 3, elType, Comm > :: BaseGrid
56  {
58  typedef typename ALUGridBaseGrid< 3, 3, elType, Comm > :: BaseGrid BaseType;
59 
60  enum { dim = 3 };
61  enum { dimworld = 3 };
62 
63  typedef typename BaseType::MPICommunicatorType MPICommunicatorType;
64 
65  public:
67  typedef typename BaseType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
68 
70  typedef typename BaseType :: DuneBoundaryProjectionVector DuneBoundaryProjectionVector;
71 
82  ALUGrid(const std::string macroName,
83  const MPICommunicatorType mpiComm = BaseType::defaultCommunicator(),
84  const DuneBoundaryProjectionType* bndProject = 0,
85  const DuneBoundaryProjectionVector* bndVector = 0,
86  const bool verb = true ) :
87  BaseType(macroName, mpiComm, bndProject, bndVector, refineType )
88  {
89  const bool verbose = verb && this->comm().rank() == 0;
90  if( verbose )
91  {
92  std::cout << "\nCreated " << ALUGridParallelSerial() << " " << name() << nameSuffix()
93  << " from macro grid file '" << macroName << "'. \n\n";
94  }
95  }
96 
97  static std::string name () { return std::string("ALUGrid"); }
98 
99  static std::string nameSuffix()
100  {
101  std::string elt ( elType == cube ? "cube," : "simplex," );
102  std::string ref ( refineType == nonconforming ? "nonconforming>" : "conforming>" );
103  std::stringstream suffix;
104  suffix << "<"<<dim<<","<<dimworld<<"," << elt << ref;
105  return suffix.str();
106  }
107 
108 
118  ALUGrid(const MPICommunicatorType mpiComm,
119  const DuneBoundaryProjectionType* bndProject ,
120  const DuneBoundaryProjectionVector* bndVector,
121  const std::string macroName,
122  const bool verb = true ) :
123  BaseType("", mpiComm, bndProject, bndVector, refineType )
124  {
125  const bool verbose = verb && this->comm().rank() == 0;
126  if( verbose )
127  {
128  std::cout << "\nCreated " << ALUGridParallelSerial() << " " << name() << nameSuffix()
129  << " from macro grid file '" << macroName << "'. \n\n";
130  }
131  }
132 
134  ALUGrid(const MPICommunicatorType mpiComm = BaseType::defaultCommunicator()) :
135  BaseType("", mpiComm,
136  (const DuneBoundaryProjectionType *) 0,
137  (const DuneBoundaryProjectionVector* ) 0,
138  refineType )
139  {
140  if(this->comm().rank() == 0)
141  {
142  std::cout << "\nCreated empty " << ALUGridParallelSerial() << " " << name() << nameSuffix() << "." << std::endl << std::endl;
143  }
144  }
145 
146  enum { dimension=BaseType::dimension, dimensionworld=BaseType::dimensionworld};
147  typedef typename BaseType::ctype ctype;
148  typedef typename BaseType::GridFamily GridFamily;
149  typedef typename GridFamily::Traits Traits;
150  typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
151  typedef typename Traits :: GlobalIdSet GlobalIdSet;
152  typedef typename Traits :: LocalIdSet LocalIdSet;
153  typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
154  typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
155  typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
156  typedef typename Traits:: template Codim<0>::LeafIterator LeafIteratorType;
157  typedef typename Traits:: template Codim<0>::LeafIterator LeafIterator;
158 
159  // ALUGrid only typedefs
160  typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
161  typedef typename BaseType::ObjectStreamType ObjectStreamType;
162 
163  template< PartitionIteratorType pitype >
164  struct Partition
165  {
170  };
171 
172  typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
173  typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
174 
175  template< PartitionIteratorType pitype >
176  typename Partition< pitype >::LevelGridView levelView ( int level ) const
177  {
178  typedef typename Partition< pitype >::LevelGridView LevelGridView;
179  typedef typename LevelGridView::GridViewImp LevelGridViewImp;
180  return LevelGridView( LevelGridViewImp( *this, level ) );
181  }
182 
183  template< PartitionIteratorType pitype >
185  {
186  typedef typename Partition< pitype >::LeafGridView LeafGridView;
187  typedef typename LeafGridView::GridViewImp LeafGridViewImp;
188  return LeafGridView( LeafGridViewImp( *this ) );
189  }
190 
191  LevelGridView levelView ( int level ) const
192  {
193  typedef typename LevelGridView::GridViewImp LevelGridViewImp;
194  return LevelGridView( LevelGridViewImp( *this, level ) );
195  }
196 
197  LeafGridView leafView () const
198  {
199  typedef typename LeafGridView::GridViewImp LeafGridViewImp;
200  return LeafGridView( LeafGridViewImp( *this ) );
201  }
202 
203  template< PartitionIteratorType pitype >
205  {
206  typedef typename Partition< pitype >::LevelGridView LevelGridView;
207  typedef typename LevelGridView::GridViewImp LevelGridViewImp;
208  return LevelGridView( LevelGridViewImp( *this, level ) );
209  }
210 
211  template< PartitionIteratorType pitype >
213  {
214  typedef typename Partition< pitype >::LeafGridView LeafGridView;
215  typedef typename LeafGridView::GridViewImp LeafGridViewImp;
216  return LeafGridView( LeafGridViewImp( *this ) );
217  }
218 
219  LevelGridView levelGridView ( int level ) const
220  {
221  typedef typename LevelGridView::GridViewImp LevelGridViewImp;
222  return LevelGridView( LevelGridViewImp( *this, level ) );
223  }
224 
225  LeafGridView leafGridView () const
226  {
227  typedef typename LeafGridView::GridViewImp LeafGridViewImp;
228  return LeafGridView( LeafGridViewImp( *this ) );
229  }
230 
231  private:
232  friend class Conversion< This , HasObjectStream > ;
233  friend class Conversion< const This, HasObjectStream > ;
234 
235  friend class Conversion< This, HasHierarchicIndexSet > ;
236  friend class Conversion< const This, HasHierarchicIndexSet > ;
237 
238  template< class > friend class ALU3dGridFactory;
239 
241  ALUGrid( const ALUGrid & g ); // : BaseType(g) {}
242 
244  This& operator = (const ALUGrid& g);
245  };
246 
247 } //end namespace Dune
248 
249 #endif // #if HAVE_ALUGRID || DOXYGEN
250 
251 #undef alu_inline
252 #endif
static std::string nameSuffix()
Definition: alugrid/3d/alugrid.hh:99
LevelGridView levelView(int level) const
Definition: alugrid/3d/alugrid.hh:191
Definition: alugrid/common/declaration.hh:67
Traits::template Codim< 0 >::LeafIterator LeafIteratorType
Definition: alugrid/3d/alugrid.hh:156
Partition< pitype >::LeafGridView leafGridView() const
Definition: alugrid/3d/alugrid.hh:212
Partition< pitype >::LevelGridView levelGridView(int level) const
Definition: alugrid/3d/alugrid.hh:204
ALUGrid(const MPICommunicatorType mpiComm, const DuneBoundaryProjectionType *bndProject, const DuneBoundaryProjectionVector *bndVector, const std::string macroName, const bool verb=true)
constructor called from ALUGridFactory for creating ALUGrid with conforming refinement from given mac...
Definition: alugrid/3d/alugrid.hh:118
GridFamily::Traits Traits
Definition: alugrid/3d/alugrid.hh:149
Include standard header files.
Definition: agrid.hh:59
Traits::GlobalIdSet GlobalIdSet
Definition: alugrid/3d/alugrid.hh:151
static std::string name()
Definition: alugrid/3d/alugrid.hh:97
Definition: alugrid/common/declaration.hh:18
Definition: alugrid/3d/alugrid.hh:54
[ provides Dune::Grid ]
Definition: alugrid/common/declaration.hh:63
Traits::LocalIdSet LocalIdSet
Definition: alugrid/3d/alugrid.hh:152
BaseType::ctype ctype
Definition: alugrid/3d/alugrid.hh:147
GridFamily::LevelIndexSetImp LevelIndexSetImp
Definition: alugrid/3d/alugrid.hh:153
Dune::GridView< DefaultLeafGridViewTraits< const This, pitype > > LeafGridView
Definition: alugrid/3d/alugrid.hh:169
Partition< All_Partition >::LeafGridView LeafGridView
Definition: alugrid/3d/alugrid.hh:173
LeafGridView leafView() const
Definition: alugrid/3d/alugrid.hh:197
BaseType::DuneBoundaryProjectionType DuneBoundaryProjectionType
type of boundary projection
Definition: alugrid/3d/alugrid.hh:67
BaseType::LeafIteratorImp LeafIteratorImp
Definition: alugrid/3d/alugrid.hh:155
Partition< pitype >::LeafGridView leafView() const
Definition: alugrid/3d/alugrid.hh:184
Partition< pitype >::LevelGridView levelView(int level) const
Definition: alugrid/3d/alugrid.hh:176
LevelGridView levelGridView(int level) const
Definition: alugrid/3d/alugrid.hh:219
BaseType::GridFamily GridFamily
Definition: alugrid/3d/alugrid.hh:148
BaseType::LocalIdSetImp LocalIdSetImp
Definition: alugrid/3d/alugrid.hh:150
Dune::GridView< DefaultLevelGridViewTraits< const This, pitype > > LevelGridView
Definition: alugrid/3d/alugrid.hh:167
LeafGridView leafGridView() const
Definition: alugrid/3d/alugrid.hh:225
BaseType::ObjectStreamType ObjectStreamType
Definition: alugrid/3d/alugrid.hh:161
static const char * ALUGridParallelSerial()
Definition: alugrid/3d/alugrid.hh:25
BaseType::DuneBoundaryProjectionVector DuneBoundaryProjectionVector
type of boundary projection
Definition: alugrid/3d/alugrid.hh:70
Grid view abstract base class.
Definition: common/gridview.hh:58
ALUGrid(const std::string macroName, const MPICommunicatorType mpiComm=BaseType::defaultCommunicator(), const DuneBoundaryProjectionType *bndProject=0, const DuneBoundaryProjectionVector *bndVector=0, const bool verb=true)
constructor for creating ALUGrid from given macro grid file
Definition: alugrid/3d/alugrid.hh:82
Definition: alugrid/common/declaration.hh:20
Tagging interface to indicate that Grid has HierarchicIndexSet.
Definition: interfaces.hh:51
ViewTraits::GridViewImp GridViewImp
Definition: common/gridview.hh:71
ALUGrid(const MPICommunicatorType mpiComm=BaseType::defaultCommunicator())
constructor creating empty grid, empty string creates empty grid
Definition: alugrid/3d/alugrid.hh:134
Traits::template Codim< 0 >::LeafIterator LeafIterator
Definition: alugrid/3d/alugrid.hh:157
Partition< All_Partition >::LevelGridView LevelGridView
Definition: alugrid/3d/alugrid.hh:172
Definition: alugrid/3d/grid.hh:84
BaseType::HierarchicIteratorImp HierarchicIteratorImp
Definition: alugrid/3d/alugrid.hh:160
GridFamily::LeafIndexSetImp LeafIndexSetImp
Definition: alugrid/3d/alugrid.hh:154
Tagging interface to indicate that Grid provides typedef ObjectStreamType.
Definition: interfaces.hh:16