identitygridintersections.hh

Go to the documentation of this file.
00001 #ifndef DUNE_IDENTITYGRID_INTERSECTIONS_HH
00002 #define DUNE_IDENTITYGRID_INTERSECTIONS_HH
00003 
00004 #include "identitygridleafiterator.hh"
00005 
00010 namespace Dune {
00011 
00020 template<class GridImp>
00021 class IdentityGridLeafIntersection
00022 {
00023     
00024     friend class IdentityGridLeafIntersectionIterator<GridImp>;
00025 
00026     enum {dim=GridImp::dimension};
00027     
00028     enum {dimworld=GridImp::dimensionworld};
00029     
00030     // The type used to store coordinates
00031     typedef typename GridImp::ctype ctype;
00032 
00033     typedef typename GridImp::HostGridType::template Codim<0>::Entity::LeafIntersectionIterator HostLeafIntersectionIterator;
00034     
00035 public:
00036     
00037     typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
00038     typedef typename GridImp::template Codim<1>::Geometry Geometry;
00039     typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
00040     typedef typename GridImp::template Codim<0>::Entity Entity;
00041     typedef FieldVector<ctype, dimworld> NormalVector;
00042     
00043     IdentityGridLeafIntersection(const GridImp* identityGrid,
00044                                          const HostLeafIntersectionIterator& hostIterator)
00045         : selfLocal_(NULL), neighborLocal_(NULL), intersectionGlobal_(NULL),
00046           identityGrid_(identityGrid), 
00047           hostIterator_(hostIterator)
00048     {}
00049         
00052     EntityPointer inside() const {
00053         return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->inside());
00054     }
00055 
00056     
00059     EntityPointer outside() const {
00060         return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->outside());
00061     }
00062 
00063     
00065     bool boundary () const {
00066         return hostIterator_->boundary();
00067     }
00068 
00074     NormalVector centerUnitOuterNormal () const {
00075         return hostIterator_->centerUnitOuterNormal();
00076     }
00077 
00079         bool neighbor () const {
00080             return hostIterator_->neighbor();
00081         }
00082         
00083         
00085         int boundaryId () const {
00086             return hostIterator_->boundaryId();
00087         }
00088 
00090         size_t boundarySegmentIndex() const {
00091             return hostIterator_->boundarySegmentIndex();
00092         }
00093 
00095         bool conforming () const {
00096             return hostIterator_->conforming();
00097         }
00098         
00100         GeometryType type () const {
00101             return hostIterator_->type();
00102         }
00103 
00104 
00109         const  LocalGeometry& geometryInInside () const {
00110             if (selfLocal_ == NULL)
00111                 selfLocal_ = new MakeableInterfaceObject<LocalGeometry>(hostIterator_->geometryInInside());
00112                 
00113             return *selfLocal_;
00114         }
00115     
00118         const  LocalGeometry& geometryInOutside () const {
00119             if (neighborLocal_ == NULL)
00120                 neighborLocal_ = new MakeableInterfaceObject<LocalGeometry>(hostIterator_->geometryInOutside());
00121                 
00122             return *neighborLocal_;
00123         }
00124         
00127         const  Geometry& geometry () const {
00128             if (intersectionGlobal_ == NULL)
00129                 intersectionGlobal_ = new MakeableInterfaceObject<Geometry>(hostIterator_->geometry());
00130                 
00131             return *intersectionGlobal_;
00132         }
00133     
00134         
00136         int indexInInside () const {
00137             return hostIterator_->indexInInside();
00138         }
00139     
00140         
00142         int indexInOutside () const {
00143             return hostIterator_->indexInOutside();
00144         }
00145     
00146     
00148         FieldVector<ctype, GridImp::dimensionworld> outerNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
00149             return hostIterator_->outerNormal(local);
00150         }
00151 
00153         FieldVector<ctype, GridImp::dimensionworld> integrationOuterNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
00154             return hostIterator_->integrationOuterNormal(local);
00155         }
00156 
00158         FieldVector<ctype, GridImp::dimensionworld> unitOuterNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
00159             return hostIterator_->unitOuterNormal(local);
00160         }
00161         
00162     
00163     private:
00164         //**********************************************************
00165         //  private methods
00166         //**********************************************************
00167 
00170     mutable MakeableInterfaceObject<LocalGeometry>* selfLocal_;
00171     mutable MakeableInterfaceObject<LocalGeometry>* neighborLocal_;
00172     
00175     mutable MakeableInterfaceObject<Geometry>* intersectionGlobal_;
00176 
00177     const GridImp* identityGrid_;
00178 
00179     HostLeafIntersectionIterator hostIterator_;
00180 };
00181 
00182 
00183 
00184 
00186 template<class GridImp>
00187 class IdentityGridLevelIntersection
00188 {
00189     
00190     friend class IdentityGridLevelIntersectionIterator<GridImp>;
00191 
00192         enum {dim=GridImp::dimension};
00193     
00194         enum {dimworld=GridImp::dimensionworld};
00195     
00196         // The type used to store coordinates
00197         typedef typename GridImp::ctype ctype;
00198     
00199     typedef typename GridImp::HostGridType::template Codim<0>::Entity::LevelIntersectionIterator HostLevelIntersectionIterator;
00200 
00201     public:
00202 
00203         typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
00204         typedef typename GridImp::template Codim<1>::Geometry Geometry;
00205         typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
00206         typedef typename GridImp::template Codim<0>::Entity Entity;
00207         typedef FieldVector<ctype, dimworld> NormalVector;
00208 
00209     IdentityGridLevelIntersection(const GridImp* identityGrid,
00210                                   const HostLevelIntersectionIterator& hostIterator)
00211         : selfLocal_(NULL), neighborLocal_(NULL), intersectionGlobal_(NULL),
00212           identityGrid_(identityGrid), hostIterator_(hostIterator)
00213     {}
00214 
00217         EntityPointer inside() const {
00218             return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->inside());
00219         }
00220 
00221         
00224         EntityPointer outside() const {
00225             return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->outside());
00226         }
00227         
00228         
00231     bool boundary () const {
00232         return hostIterator_->boundary();
00233     }
00234 
00240     NormalVector centerUnitOuterNormal () const {
00241         return hostIterator_->centerUnitOuterNormal();
00242     }
00243 
00245     bool neighbor () const {
00246         return hostIterator_->neighbor();
00247     }
00248     
00249     
00251     int boundaryId () const {
00252         return hostIterator_->boundaryId();
00253     }
00254 
00256     size_t boundarySegmentIndex() const {
00257         return hostIterator_->boundarySegmentIndex();
00258     }
00259 
00261     bool conforming () const {
00262         return hostIterator_->conforming();
00263     }
00264         
00266     GeometryType type () const {
00267         return hostIterator_->type();
00268     }
00269 
00270 
00275         const LocalGeometry& geometryInInside () const {
00276             if (selfLocal_ == NULL)
00277                 selfLocal_ = new MakeableInterfaceObject<LocalGeometry>(hostIterator_->geometryInInside());
00278                 
00279             return *selfLocal_;
00280         }
00281         
00284         const  LocalGeometry& geometryInOutside () const {
00285             if (neighborLocal_ == NULL)
00286                 neighborLocal_ = new MakeableInterfaceObject<LocalGeometry>(hostIterator_->geometryInOutside());
00287                 
00288             return *neighborLocal_;
00289         }
00290         
00293         const Geometry& geometry () const {
00294             if (intersectionGlobal_ == NULL)
00295                 intersectionGlobal_ = new MakeableInterfaceObject<Geometry>(hostIterator_->geometry());
00296                 
00297             return *intersectionGlobal_;
00298         }
00299         
00300         
00302         int indexInInside () const {
00303             return hostIterator_->indexInInside();
00304         }
00305         
00306         
00308         int indexInOutside () const {
00309             return hostIterator_->indexInOutside();
00310         }
00311         
00312           
00314         FieldVector<ctype, dimworld> outerNormal (const FieldVector<ctype, dim-1>& local) const {
00315             return hostIterator_->outerNormal(local);
00316         }
00317 
00319         FieldVector<ctype, dimworld> integrationOuterNormal (const FieldVector<ctype, dim-1>& local) const {
00320             return hostIterator_->integrationOuterNormal(local);
00321         }
00322 
00324         FieldVector<ctype, dimworld> unitOuterNormal (const FieldVector<ctype, dim-1>& local) const {
00325             return hostIterator_->unitOuterNormal(local);
00326         }
00327 
00328     private:
00329 
00332     mutable MakeableInterfaceObject<LocalGeometry>* selfLocal_;
00333     mutable MakeableInterfaceObject<LocalGeometry>* neighborLocal_;
00334     
00337     mutable MakeableInterfaceObject<Geometry>* intersectionGlobal_;
00338     
00339     const GridImp* identityGrid_;
00340 
00341     HostLevelIntersectionIterator hostIterator_;
00342 
00343 };
00344 
00345 
00346 }  // namespace Dune
00347 
00348 #endif
Generated on Sat Apr 24 11:13:38 2010 for dune-grid-dev-howto by  doxygen 1.6.3