Dune Core Modules (2.4.2)

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
10#include <dune/grid/alugrid/common/capabilities.hh>
11#include <dune/grid/alugrid/3d/indexsets.hh>
12#include <dune/grid/alugrid/3d/iterator.hh>
13#include <dune/grid/alugrid/3d/entity.hh>
14#include <dune/grid/alugrid/3d/geometry.hh>
15#include <dune/grid/alugrid/3d/grid.hh>
16
22namespace 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 {
57 typedef ALUGrid< 3, 3, elType, refineType, Comm > This;
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 {
167 LevelGridView;
169 LeafGridView;
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 >
184 typename Partition< pitype >::LeafGridView leafView () const
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 >
204 typename Partition< pitype >::LevelGridView levelGridView ( int level ) const
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 >
212 typename Partition< pitype >::LeafGridView leafGridView () const
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
Grid view abstract base class.
Definition: gridview.hh:59
Dune namespace.
Definition: alignment.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)