dune-grid
2.1.1
|
00001 #ifndef DUNE_ALU_BNDPROJECTION_HH 00002 #define DUNE_ALU_BNDPROJECTION_HH 00003 00004 namespace Dune { 00005 00008 template <class GridImp, class ctype = double > 00009 class ALUGridBoundaryProjection 00010 #ifdef ALUGRID_VERTEX_PROJECTION 00011 : public GridImp :: ALUGridVertexProjectionType 00012 #endif 00013 { 00014 typedef GridImp GridType; 00015 // type of double coordinate vector 00016 typedef ctype coord_t[ GridType :: dimensionworld ]; 00017 protected: 00018 00020 const GridType& grid_; 00021 public: 00023 typedef typename GridType :: DuneBoundaryProjectionType DuneBoundaryProjectionType; 00024 00026 typedef typename DuneBoundaryProjectionType :: CoordinateType CoordinateType; 00027 00029 ALUGridBoundaryProjection(const GridType& grid) 00030 : grid_( grid ) 00031 { 00032 } 00033 00035 int operator () (const coord_t &orig, 00036 coord_t &prj) const 00037 { 00038 return this->operator()( orig, 0, prj); 00039 } 00040 00042 int operator () (const coord_t &orig, 00043 const int segmentIndex, 00044 coord_t &prj) const 00045 { 00046 #ifdef ALUGRID_VERTEX_PROJECTION 00047 // get boundary projection 00048 const DuneBoundaryProjectionType* bndPrj = 00049 grid_.boundaryProjection( segmentIndex ); 00050 00051 // if pointer is zero we do nothing, i.e. identity mapping 00052 if( bndPrj ) 00053 { 00054 // call projection operator 00055 reinterpret_cast<CoordinateType &> (* (&prj[0])) = 00056 (*bndPrj)( reinterpret_cast<const CoordinateType &> (* (&orig[0])) ); 00057 } 00058 #endif 00059 00060 // return 1 for success 00061 return 1; 00062 } 00063 }; 00064 00065 } // end namespace Dune 00066 #endif