albertagrid/entityseed.hh

Go to the documentation of this file.
00001 #ifndef DUNE_ALBERTA_ENTITYSEED_HH
00002 #define DUNE_ALBERTA_ENTITYSEED_HH
00003 
00004 #include <dune/grid/albertagrid/elementinfo.hh>
00005 #include <dune/grid/albertagrid/meshpointer.hh>
00006 
00007 namespace Dune
00008 {
00009 
00010   // Internal Forward Declarations
00011   // -----------------------------
00012 
00013   template< int codim, class Grid >
00014   class AlbertaGridEntitySeed;
00015 
00016 
00017 
00018   // External Forward Declarations
00019   // -----------------------------
00020 
00021   template< int dim, int dimworld >
00022   class AlbertaGrid;
00023 
00024 
00025 
00026 #if HAVE_ALBERTA
00027 
00028   // AlbertaGridEntitySeed (for higher codimension)
00029   // ----------------------------------------------
00030 
00031   template< int codim, int dim, int dimworld >
00032   class AlbertaGridEntitySeed< codim, const AlbertaGrid< dim, dimworld > >
00033   {
00034   public:
00035     typedef AlbertaGrid< dim, dimworld > Grid;
00036 
00037     static const int codimension = codim;
00038     static const int dimension = dim;
00039     static const int mydimension = dimension - codimension;
00040     static const int dimensionworld = dimworld;
00041 
00042     typedef Alberta::MeshPointer< dimension > MeshPointer;
00043     typedef Alberta::ElementInfo< dimension > ElementInfo;
00044     typedef typename ElementInfo::Seed Seed;
00045 
00046     typedef typename Grid::template Codim< codimension >::Entity Entity;
00047 
00048     AlbertaGridEntitySeed ( const ElementInfo &elementInfo, int subEntity )
00049     : seed_( elementInfo.seed() ),
00050       subEntity_( subEntity )
00051     {}
00052 
00053     ElementInfo elementInfo ( const MeshPointer &mesh ) const { return ElementInfo( mesh, seed_ ); }
00054     int subEntity () const { return subEntity_; }
00055 
00056   private:
00057     Seed seed_;
00058     int subEntity_;
00059   };
00060 
00061 
00062 
00063   // AlbertaGridEntitySeed (for codimension 0)
00064   // -----------------------------------------
00065 
00066   template< int dim, int dimworld >
00067   class AlbertaGridEntitySeed< 0, const AlbertaGrid< dim, dimworld > >
00068   {
00069   public:
00070     typedef AlbertaGrid< dim, dimworld > Grid;
00071 
00072     static const int codimension = 0;
00073     static const int dimension = dim;
00074     static const int mydimension = dimension - codimension;
00075     static const int dimensionworld = dimworld;
00076 
00077     typedef Alberta::MeshPointer< dimension > MeshPointer;
00078     typedef Alberta::ElementInfo< dimension > ElementInfo;
00079     typedef typename ElementInfo::Seed Seed;
00080 
00081     typedef typename Grid::template Codim< codimension >::Entity Entity;
00082 
00083     explicit AlbertaGridEntitySeed ( const ElementInfo &elementInfo )
00084     : seed_( elementInfo.seed() )
00085     {}
00086 
00087     ElementInfo elementInfo ( const MeshPointer &mesh ) const { return ElementInfo( mesh, seed_ ); }
00088     int subEntity () const { return 0; }
00089 
00090   private:
00091     Seed seed_;
00092   };
00093 
00094 #endif // #if HAVE_ALBERTA
00095 
00096 } // end namespace Dune
00097 
00098 #endif // #ifndef DUNE_ALBERTA_ENTITYSEED_HH

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