geometrytraits.hh
00001 #ifndef DUNE_GENERICGEOMETRY_GEOMETRYTRAITS_HH
00002 #define DUNE_GENERICGEOMETRY_GEOMETRYTRAITS_HH
00003
00004 #include <dune/common/geometrytype.hh>
00005
00006 #include <dune/grid/genericgeometry/matrix.hh>
00007 #include <dune/grid/genericgeometry/cornermapping.hh>
00008
00009 namespace Dune
00010 {
00011
00012 namespace GenericGeometry
00013 {
00014
00015
00016
00017
00018 template< class ct >
00019 struct DuneCoordTraits
00020 {
00021 typedef ct ctype;
00022
00023 template< int dim >
00024 struct Vector
00025 {
00026 typedef FieldVector< ctype, dim > type;
00027 };
00028
00029 template< int rows, int cols >
00030 struct Matrix
00031 {
00032 typedef FieldMatrix< ctype, rows, cols > type;
00033 };
00034 };
00035
00036
00037
00038
00039
00045 template< class CT, unsigned int dim, unsigned int dimW >
00046 struct MappingTraits
00047 {
00048 typedef CT CoordTraits;
00049
00050 static const unsigned int dimension = dim;
00051 static const unsigned int dimWorld = dimW;
00052
00053 typedef typename CoordTraits :: ctype FieldType;
00054 typedef typename CoordTraits :: template Vector< dimension > :: type LocalCoordType;
00055 typedef typename CoordTraits :: template Vector< dimWorld > :: type GlobalCoordType;
00056
00057 typedef typename CoordTraits :: template Matrix< dimWorld, dimension > :: type
00058 JacobianType;
00059 typedef typename CoordTraits :: template Matrix< dimension, dimWorld > :: type
00060 JacobianTransposedType;
00061
00062 typedef GenericGeometry :: MatrixHelper< CoordTraits > MatrixHelper;
00063
00064 template< unsigned int codim >
00065 struct Codim
00066 {
00067 typedef GenericGeometry :: MappingTraits< CoordTraits, dimension - codim, dimWorld >
00068 MappingTraits;
00069 };
00070 };
00071
00072
00073
00074
00075
00076
00077
00078 enum EvaluationType
00079 {
00081 ComputeOnDemand,
00083 PreCompute
00084 };
00085
00086
00087
00088
00089
00090
00109 template< class ctype, int dimG, int dimW, bool alwaysAffine = false >
00110 struct DefaultGeometryTraits
00111 {
00113 typedef DuneCoordTraits< ctype > CoordTraits;
00114
00116 static const int dimGrid = dimG;
00118 static const int dimWorld = dimW;
00119
00138 static const bool hybrid = true;
00139
00140
00141
00143 static const GeometryType :: BasicType linetype = GeometryType :: simplex;
00144
00156 template< class Topology >
00157 struct Mapping
00158 {
00159 typedef CoordStorage< CoordTraits, Topology, dimWorld > CornerStorage;
00160 typedef CornerMapping< CoordTraits, Topology, dimWorld, CornerStorage, alwaysAffine > type;
00161 };
00162
00175 struct Caching
00176 {
00177 static const EvaluationType evaluateJacobianTransposed = ComputeOnDemand;
00178 static const EvaluationType evaluateJacobianInverseTransposed = ComputeOnDemand;
00179 static const EvaluationType evaluateIntegrationElement = ComputeOnDemand;
00180 static const EvaluationType evaluateNormal = ComputeOnDemand;
00181 };
00182 };
00183
00184
00185
00244 template< class Grid >
00245 struct GlobalGeometryTraits;
00246
00247 template< class Grid >
00248 struct GlobalGeometryTraits< const Grid >
00249 : public GlobalGeometryTraits< Grid >
00250 {};
00251
00252
00253
00312 template< class Grid >
00313 struct LocalGeometryTraits;
00314
00315 template< class Grid >
00316 struct LocalGeometryTraits< const Grid >
00317 : public LocalGeometryTraits< Grid >
00318 {};
00319 }
00320
00321 }
00322
00323 #endif