geometrytraits.hh

Go to the documentation of this file.
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/matrixhelper.hh>
00007 #include <dune/grid/genericgeometry/cornermapping.hh>
00008 
00009 namespace Dune
00010 {
00011 
00012   namespace GenericGeometry
00013   {
00014 
00015     // DuneCoordTraits
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       // This limit is, e.g., used in the termination criterion of the Newton
00036       // scheme within the generic implementation of the method local
00037       static const ctype epsilon ()
00038       {
00039         return 1e-6;
00040       }
00041     };
00042 
00043 
00044 
00045     // MappingTraits
00046     // -------------
00051     template< class CT, unsigned int dim, unsigned int dimW >
00052     struct MappingTraits
00053     {
00054       typedef CT CoordTraits;
00055 
00056       static const unsigned int dimension = dim;
00057       static const unsigned int dimWorld = dimW;
00058 
00059       typedef typename CoordTraits :: ctype FieldType;
00060       typedef typename CoordTraits :: template Vector< dimension > :: type LocalCoordinate;
00061       typedef typename CoordTraits :: template Vector< dimWorld > :: type GlobalCoordinate;
00062 
00063       typedef typename CoordTraits :: template Matrix< dimWorld, dimension > :: type
00064         JacobianType;
00065       typedef typename CoordTraits :: template Matrix< dimension, dimWorld > :: type
00066         JacobianTransposedType; 
00067 
00068       typedef GenericGeometry :: MatrixHelper< CoordTraits > MatrixHelper;
00069 
00070       template< unsigned int codim >
00071       struct Codim
00072       {
00073         typedef GenericGeometry :: MappingTraits< CoordTraits, dimension - codim, dimWorld >
00074           MappingTraits;
00075       };
00076     };
00077 
00078 
00079 
00080     // If not affine only volume is cached (based on intElCompute)
00081     // otherwise all quantities can be cached using:
00082     //   ComputeOnDemand:    assign if method called using barycenter
00083     //   PreCompute:         assign in constructor using barycenter
00084     enum EvaluationType
00085     {
00087       ComputeOnDemand,
00089       PreCompute
00090     };
00091 
00092 
00093 
00094     // DefaultGeometryTraits
00095     // ---------------------
00096 
00114     template< class ctype, int dimG, int dimW, bool alwaysAffine = false >
00115     struct DefaultGeometryTraits
00116     {
00118       typedef DuneCoordTraits< ctype > CoordTraits;
00119 
00121       static const int dimGrid = dimG;
00123       static const int dimWorld = dimW;
00124 
00144       static const bool hybrid = true;
00145 
00157       template< class Topology >
00158       struct Mapping
00159       {
00160         typedef CoordStorage< CoordTraits, Topology, dimWorld > CornerStorage;
00161         typedef CornerMapping< CoordTraits, Topology, dimWorld, CornerStorage, alwaysAffine > type;
00162       };
00163 
00175       struct Caching
00176       {
00177         static const EvaluationType evaluateJacobianTransposed = ComputeOnDemand;
00178         static const EvaluationType evaluateJacobianInverseTransposed = ComputeOnDemand;
00179         static const EvaluationType evaluateIntegrationElement = ComputeOnDemand;
00180       };
00181 
00182     };
00183 
00184 
00185 
00238     template< class Grid >
00239     struct GlobalGeometryTraits;
00240 
00241     template< class Grid >
00242     struct GlobalGeometryTraits< const Grid >
00243     : public GlobalGeometryTraits< Grid >
00244     {};
00245 
00246 
00247 
00300     template< class Grid >
00301     struct LocalGeometryTraits;
00302 
00303     template< class Grid >
00304     struct LocalGeometryTraits< const Grid >
00305     : public LocalGeometryTraits< Grid >
00306     {};
00307   }
00308 
00309 }
00310 
00311 #endif // #ifndef DUNE_GENERICGEOMETRY_GEOMETRYTRAITS_HH

Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].