dune-geometry  2.2.0
geometrytraits.hh
Go to the documentation of this file.
00001 #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_GEOMETRYTRAITS_HH
00002 #define DUNE_GEOMETRY_GENERICGEOMETRY_GEOMETRYTRAITS_HH
00003 
00004 #include "../type.hh"
00005 #include "matrixhelper.hh"
00006 #include "cornermapping.hh"
00007 
00008 namespace Dune
00009 {
00010   namespace GenericGeometry
00011   {
00012 
00013     // DuneCoordTraits
00014     // ---------------
00015 
00016     template< class ct >
00017     struct DuneCoordTraits
00018     {
00019       typedef ct ctype;
00020       
00021       template< int dim >
00022       struct Vector
00023       {
00024         typedef FieldVector< ctype, dim > type;
00025       };
00026 
00027       template< int rows, int cols >
00028       struct Matrix
00029       {
00030         typedef FieldMatrix< ctype, rows, cols > type;
00031       };
00032 
00033       // This limit is, e.g., used in the termination criterion of the Newton
00034       // scheme within the generic implementation of the method local
00035       static const ctype epsilon ()
00036       {
00037         return 1e-6;
00038       }
00039     };
00040 
00041 
00042 
00043     // MappingTraits
00044     // -------------
00049     template< class CT, unsigned int dim, unsigned int dimW >
00050     struct MappingTraits
00051     {
00052       typedef CT CoordTraits;
00053 
00054       static const unsigned int dimension = dim;
00055       static const unsigned int dimWorld = dimW;
00056 
00057       typedef typename CoordTraits :: ctype FieldType;
00058       typedef typename CoordTraits :: template Vector< dimension > :: type LocalCoordinate;
00059       typedef typename CoordTraits :: template Vector< dimWorld > :: type GlobalCoordinate;
00060 
00061       typedef typename CoordTraits :: template Matrix< dimWorld, dimension > :: type
00062         JacobianType;
00063       typedef typename CoordTraits :: template Matrix< dimension, dimWorld > :: type
00064         JacobianTransposedType; 
00065 
00066       typedef GenericGeometry :: MatrixHelper< CoordTraits > MatrixHelper;
00067 
00068       template< unsigned int codim >
00069       struct Codim
00070       {
00071         typedef GenericGeometry :: MappingTraits< CoordTraits, dimension - codim, dimWorld >
00072           MappingTraits;
00073       };
00074     };
00075 
00076 
00077 
00078     // If not affine only volume is cached (based on intElCompute)
00079     // otherwise all quantities can be cached using:
00080     //   ComputeOnDemand:    assign if method called using barycenter
00081     //   PreCompute:         assign in constructor using barycenter
00082     enum EvaluationType
00083     {
00085       ComputeOnDemand,
00087       PreCompute
00088     };
00089 
00090 
00091 
00092     // DefaultGeometryTraits
00093     // ---------------------
00094 
00112     template< class ctype, int dimG, int dimW, bool alwaysAffine = false >
00113     struct DefaultGeometryTraits
00114     {
00116       typedef DuneCoordTraits< ctype > CoordTraits;
00117 
00119       static const int dimGrid = dimG;
00121       static const int dimWorld = dimW;
00122 
00142       static const bool hybrid = true;
00143 
00155       template< class Topology >
00156       struct Mapping
00157       {
00158         typedef CoordStorage< CoordTraits, Topology, dimWorld > CornerStorage;
00159         typedef CornerMapping< CoordTraits, Topology, dimWorld, CornerStorage, alwaysAffine > type;
00160       };
00161 
00173       struct Caching
00174       {
00175         static const EvaluationType evaluateJacobianTransposed = ComputeOnDemand;
00176         static const EvaluationType evaluateJacobianInverseTransposed = ComputeOnDemand;
00177         static const EvaluationType evaluateIntegrationElement = ComputeOnDemand;
00178       };
00179 
00185       struct UserData {};
00186     };
00187 
00188 
00189 
00242     template< class Grid >
00243     struct GlobalGeometryTraits;
00244 
00245     template< class Grid >
00246     struct GlobalGeometryTraits< const Grid >
00247     : public GlobalGeometryTraits< Grid >
00248     {};
00249 
00250 
00251 
00304     template< class Grid >
00305     struct LocalGeometryTraits;
00306 
00307     template< class Grid >
00308     struct LocalGeometryTraits< const Grid >
00309     : public LocalGeometryTraits< Grid >
00310     {};
00311   }
00312 
00313 }
00314 
00315 #endif // #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_GEOMETRYTRAITS_HH