1 #ifndef DUNE_ALBERTA_GEOMETRY_HH
2 #define DUNE_ALBERTA_GEOMETRY_HH
4 #include <dune/geometry/genericgeometry/geometry.hh>
18 template<
int dim,
int dimworld >
26 template<
int codim,
class Gr
idImp >
29 typedef typename remove_const< GridImp >::type
Grid;
45 elementInfo_( elementInfo ),
46 subEntity_( subEntity )
56 assert( !elementInfo_ ==
false );
59 const int k = mapVertices( subEntity_, i );
77 static int mapVertices (
int subEntity,
int i )
92 template<
class CoordTraits,
class Topology,
unsigned int dimW >
98 static const unsigned int size = Topology::numCorners;
102 typedef typename CoordTraits::template Vector< dimWorld >::type
105 template<
class SubTopology >
115 template<
class CoordReader >
118 for(
unsigned int i = 0; i <
size; ++i )
119 coordReader.coordinate( i, coords_[ i ] );
122 template<
class Mapping,
unsigned int codim >
125 for(
unsigned int i = 0; i <
size; ++i )
126 coords_[ i ] = coords[ i ];
140 template<
class Gr
idImp,
int cdim >
143 typedef typename remove_const< GridImp >::type
Grid;
145 typedef GenericGeometry::DuneCoordTraits< Alberta::Real >
CoordTraits;
151 static const unsigned int topologyId = GenericGeometry::SimplexTopology< dimGrid >::type::id;
153 template<
class Topology >
157 typedef GenericGeometry::CornerMapping< CoordTraits, Topology, dimWorld, CornerStorage >
type;
165 static const GenericGeometry::EvaluationType
evaluateNormal = GenericGeometry::ComputeOnDemand;
176 #if DUNE_ALBERTA_USE_GENERICGEOMETRY
177 template<
int mydim,
int cdim,
class Gr
idImp >
179 :
public GenericGeometry::BasicGeometry
180 < mydim, AlbertaGridGeometryTraits< GridImp, cdim > >
183 typedef GenericGeometry::BasicGeometry
197 template<
class CoordReader >
199 : Base(
GeometryType( GenericGeometry::SimplexTopology< mydim >::
type::id, mydim ), coordReader )
202 template<
class CoordReader >
203 void build (
const CoordReader &coordReader )
208 #endif // #if DUNE_ALBERTA_USE_GENERICGEOMETRY
210 #if !DUNE_ALBERTA_USE_GENERICGEOMETRY
223 template<
int mydim,
int cdim,
class Gr
idImp >
229 typedef GridImp Grid;
232 static const int dimbary = mydim + 1;
246 typedef FieldMatrix< ctype, mydimension, coorddimension >
248 typedef FieldMatrix< ctype, coorddimension, mydimension >
255 typedef FieldMatrix< ctype, numCorners, coorddimension > CoordMatrix;
263 template<
class CoordReader >
266 build( coordReader );
272 typedef typename GenericGeometry::SimplexTopology< mydimension >::type Topology;
288 assert( (i >= 0) && (i <
corners()) );
301 assert( (i >= 0) && (i <
corners()) );
318 assert( calcedDet_ );
375 template<
class CoordReader >
376 void build (
const CoordReader &coordReader );
378 void print ( std::ostream &out )
const;
382 ctype elDeterminant ()
const
400 mutable bool builtJT_;
402 mutable bool builtJTInv_;
404 mutable bool calcedDet_;
405 mutable ctype elDet_;
407 #endif // #if !DUNE_ALBERTA_USE_GENERICGEOMETRY
414 template<
int mydim,
int cdim,
class Gr
idImp >
426 template<
class CoordReader >
428 :
Base( coordReader )
433 #if !DUNE_ALBERTA_USE_GENERICGEOMETRY
434 #if !DUNE_ALBERTA_CACHE_COORDINATES
435 template<
int dim,
int cdim >
444 static const int dimbary = dim + 1;
460 typedef FieldMatrix< ctype, mydimension, coorddimension >
462 typedef FieldMatrix< ctype, coorddimension, mydimension >
469 typedef FieldMatrix< ctype, numCorners, coorddimension > CoordMatrix;
477 template<
class CoordReader >
480 build( coordReader );
486 typedef typename GenericGeometry::SimplexTopology< mydimension >::type Topology;
499 assert( (i >= 0) && (i <
corners()) );
500 const Alberta::GlobalCoordinate &x = elementInfo_.coordinate( i );
510 return reinterpret_cast< const GlobalCoordinate &
>( elementInfo_.coordinate( i ) );
517 for(
int i = 1; i < numCorners; ++i )
519 centroid_ *=
ctype( 1 ) /
ctype( numCorners );
536 return elementInfo_.geometryCache().integrationElement();
558 return elementInfo_.geometryCache().jacobianTransposed();
575 return elementInfo_.geometryCache().jacobianInverseTransposed();
596 template<
class CoordReader >
597 void build (
const CoordReader &coordReader )
599 elementInfo_ = coordReader.elementInfo();
603 ElementInfo elementInfo_;
605 #endif // #if !DUNE_ALBERTA_CACHE_COORDINATES
606 #endif // #if !DUNE_ALBERTA_USE_GENERICGEOMETRY
613 template<
class Gr
id >
623 template<
int codim >
645 buildGeometryInFather();
653 delete geometryInFather_[ child ][ 0 ];
654 delete geometryInFather_[ child ][ 1 ];
660 delete faceGeometry_[ i ][ j ];
664 void buildGeometryInFather();
665 void buildFaceGeometry();
671 assert( (child >= 0) && (child < numChildren) );
672 assert( (orientation == 1) || (orientation == -1) );
673 return *geometryInFather_[ child ][ (orientation + 1) / 2 ];
679 assert( (face >= 0) && (face < numFaces) );
686 static This theInstance;
691 template<
int codim >
692 static int mapVertices (
int subEntity,
int i )
706 namespace FacadeOptions
709 template<
int mydim,
int cdim,
class Gr
id >
712 static const bool v =
false;
719 #endif // #if HAVE_ALBERTA
721 #endif // #ifndef DUNE_ALBERTA_GEOMETRY_HH