mockgeometry.hh

Go to the documentation of this file.
00001 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002 // vi: set et ts=8 sw=2 sts=2:
00003 
00004 #ifndef DUNE_GRID_UTILITY_MOCKGEOMETRY_HH
00005 #define DUNE_GRID_UTILITY_MOCKGEOMETRY_HH
00006 
00007 #include <cstddef>
00008 
00009 #include <dune/common/fmatrix.hh>
00010 #include <dune/common/geometrytype.hh>
00011 
00012 #include <dune/grid/genericgeometry/geometry.hh>
00013 #include <dune/grid/genericgeometry/geometrytraits.hh>
00014 
00015 namespace Dune {
00016 
00018 
00032   template<class ctype, std::size_t mydim, std::size_t coorddim>
00033   class MockGeometry :
00034     public GenericGeometry::BasicGeometry<
00035       mydim, GenericGeometry::DefaultGeometryTraits<ctype, coorddim, coorddim>
00036       >
00037   {
00038     typedef GenericGeometry::DefaultGeometryTraits<ctype, coorddim, coorddim>
00039       Traits;
00040     typedef GenericGeometry::BasicGeometry<mydim, Traits> Base;
00041 
00042     // Hide members of BasicGeometry that are not part of Dune::Geometry
00043     using Base::JacobianInverseTransposed;
00044     using Base::operator[];
00045     using Base::normal;
00046 
00047   public:
00049     typedef FieldMatrix<ctype, coorddim, mydim> Jacobian;
00051     typedef FieldMatrix<ctype, mydim, coorddim> JacobianTransposed;
00052 
00054     MockGeometry() {}
00056     template<class CoordVector>
00057     MockGeometry(const GeometryType &type, const CoordVector &coords) :
00058       Base(type, coords)
00059     { }
00061     template<int fatherdim>
00062     MockGeometry(const MockGeometry<ctype, fatherdim, coorddim> &father,
00063                  int i) :
00064       Base(static_cast<const GenericGeometry::BasicGeometry<
00065              fatherdim,
00066              GenericGeometry::DefaultGeometryTraits<ctype, coorddim, coorddim>
00067              > &>(father),
00068            i)
00069     { }
00070 
00072     JacobianTransposed jacobianTransposed
00073     (const typename Base::LocalCoordinate &local) const
00074     { return Base::jacobianTransposed(local); }
00076     Jacobian jacobianInverseTransposed
00077     (const typename Base::LocalCoordinate &local) const
00078     { return Base::jacobianInverseTransposed(local); }
00079   };
00080 
00081 }  // namespace Dune
00082 
00083 #endif // DUNE_GRID_UTILITY_MOCKGEOMETRY_HH

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