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/grid.hh>
35 template<
int dimw, ALUGr
idElementType elType, ALUGr
idRefinementType refinementType,
class Comm >
36 class ALUGrid< 2, dimw, elType, refinementType, Comm >
37 :
public ALUGridBaseGrid < 2, dimw, elType, Comm > :: BaseGrid
39 typedef ALUGrid< 2, dimw, elType, refinementType, Comm > This;
40 typedef typename ALUGridBaseGrid < 2, dimw, elType, Comm > :: BaseGrid BaseType;
43 enum { dimworld = dimw };
47 typedef typename BaseType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
50 typedef typename BaseType :: DuneBoundaryProjectionVector DuneBoundaryProjectionVector;
60 ALUGrid(
const std::string macroName,
61 const DuneBoundaryProjectionType* bndProject = 0,
62 const DuneBoundaryProjectionVector* bndVector = 0,
63 const bool verbose =
true )
64 : BaseType(macroName, hangingNodes(), bndProject, bndVector)
68 std::cout <<
"\nCreated serial " << name() << nameSuffix()
69 <<
" from macro grid file '" << macroName <<
"'." << std::endl << std::endl;
82 ALUGrid(
const std::string macroName,
83 std::istream& macroFile,
84 const DuneBoundaryProjectionType* bndProject = 0,
85 const DuneBoundaryProjectionVector* bndVector = 0,
86 const bool verbose =
true )
87 : BaseType(
"", hangingNodes(), bndProject, bndVector, ¯oFile)
91 std::cout <<
"\nCreated serial " << name() << nameSuffix();
93 std::cout <<
" from macro grid file '" << macroName;
94 std::cout <<
"." << std::endl << std::endl;
98 static std::string name () {
return std::string(
"ALUGrid"); }
101 ALUGrid( ) : BaseType( hangingNodes() )
103 std::cout <<
"\nCreated serial " << name() << nameSuffix() <<
"." << std::endl << std::endl;
106 enum {dimension=BaseType::dimension,dimensionworld=BaseType::dimensionworld};
107 enum { refineStepsForHalf = 1 };
108 typedef typename BaseType::ctype ctype;
109 typedef typename BaseType::GridFamily GridFamily;
110 typedef typename GridFamily::Traits Traits;
111 typedef typename BaseType::LocalIdSetImp LocalIdSetImp;
112 typedef typename Traits :: GlobalIdSet GlobalIdSet;
113 typedef typename Traits :: LocalIdSet LocalIdSet;
114 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
115 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
116 typedef typename BaseType::LeafIteratorImp LeafIteratorImp;
117 typedef typename Traits::template Codim<0>::LeafIterator LeafIteratorType;
118 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
119 typedef typename BaseType::HierarchicIteratorImp HierarchicIteratorImp;
121 template< PartitionIteratorType pitype >
130 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
131 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
133 template< PartitionIteratorType pitype >
134 typename Partition< pitype >::LevelGridView levelView (
int level )
const
136 typedef typename Partition< pitype >::LevelGridView LevelGridView;
137 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
138 return LevelGridView( LevelGridViewImp( *
this, level ) );
141 template< PartitionIteratorType pitype >
142 typename Partition< pitype >::LeafGridView leafView ()
const
144 typedef typename Partition< pitype >::LeafGridView LeafGridView;
145 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
146 return LeafGridView( LeafGridViewImp( *
this ) );
149 LevelGridView levelView (
int level )
const
151 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
152 return LevelGridView( LevelGridViewImp( *
this, level ) );
155 LeafGridView leafView ()
const
157 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
158 return LeafGridView( LeafGridViewImp( *
this ) );
161 template< PartitionIteratorType pitype >
162 typename Partition< pitype >::LevelGridView levelGridView (
int level )
const
164 typedef typename Partition< pitype >::LevelGridView LevelGridView;
165 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
166 return LevelGridView( LevelGridViewImp( *
this, level ) );
169 template< PartitionIteratorType pitype >
170 typename Partition< pitype >::LeafGridView leafGridView ()
const
172 typedef typename Partition< pitype >::LeafGridView LeafGridView;
173 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
174 return LeafGridView( LeafGridViewImp( *
this ) );
177 LevelGridView levelGridView (
int level )
const
179 typedef typename LevelGridView::GridViewImp LevelGridViewImp;
180 return LevelGridView( LevelGridViewImp( *
this, level ) );
183 LeafGridView leafGridView ()
const
185 typedef typename LeafGridView::GridViewImp LeafGridViewImp;
186 return LeafGridView( LeafGridViewImp( *
this ) );
190 static std::string nameSuffix()
192 std::string elt ( elType == cube ?
"cube," :
"simplex," );
193 std::string ref ( refinementType == nonconforming ?
"nonconforming>" :
"conforming>" );
194 std::stringstream suffix;
195 suffix <<
"<"<<dim<<
","<<dimworld<<
"," << elt << ref;
200 int hangingNodes()
const
202 return ((elType == simplex) && (refinementType == conforming)) ? 0 : 1;
205 friend class Conversion< This, HasObjectStream > ;
206 friend class Conversion< const This, HasObjectStream > ;
208 friend class Conversion< This, HasHierarchicIndexSet > ;
209 friend class Conversion< const This, HasHierarchicIndexSet > ;
212 friend class ALU2dGridFactory;
215 ALUGrid(
const ALUGrid & g ) ;
218 This& operator = (
const ALUGrid& g);
224#error "Trying to use <dune/grid/alugrid.hh> without ALUGRID_CPPFLAGS."
Grid view abstract base class.
Definition: gridview.hh:59
Dune namespace.
Definition: alignment.hh:10