Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

MaximalCell.h

Go to the documentation of this file.
00001 #ifndef MAXIMALCELL_H
00002 #define MAXIMALCELL_H
00003 
00004 #include "SundanceDefs.h"
00005 
00006 #include "CellBase.h"
00007 #include "ReferenceCell.h"
00008 #include "Pool.h"
00009 #include "FacetSetBase.h"
00010 
00011 
00012 namespace Sundance
00013 {
00014 
00015   using namespace TSF;
00016   using std::string;
00017 
00018   using std::ostream;
00019 
00020   /** \ingroup LowLevelGeometry
00021    * Cell subclass that represents cells with dimension=spatialDim.
00022    */
00023 
00024 
00025   class MaximalCell : public CellBase
00026     {
00027     public:
00028       MaximalCell(MeshData* meshData,
00029                   int localIndex,
00030                   int globalIndex,
00031                   const TSFArray<int>& nodes,
00032                   const ReferenceCell& refCell,
00033                   short int labelIndex);
00034       virtual ~MaximalCell(){delete facets_;}
00035 
00036       virtual int dim() const {return refCell_.dim();}
00037       virtual bool isMaximalCell() const {return true;}
00038 
00039       virtual bool topologicallyEquals(const TSFArray<int>& otherNodes) const ;
00040 
00041       virtual int numNodes() const {return nodes_.length();}
00042       virtual int numVertices() const {return refCell_.numVertices();}
00043       virtual int numFacets(int d) const {return facets_->numFacets(d);}
00044       virtual int numCofacets(int /*d*/) const {return 0;}
00045       virtual void getNodes(TSFArray<int>& nodes) const {nodes = nodes_;}
00046 
00047       virtual const TSFArray<int>& nodes() const {return nodes_;}
00048       //  virtual const TSFArray<TSFArray<int> >& facets() const {return facets_;}
00049       const FacetSetBase* facets() const {return facets_;}
00050       virtual void getFacetIndices(TSFArray<TSFArray<int> >& facetIndices) const ;
00051       virtual void getCofacetIndices(TSFArray<TSFArray<int> >& cofacetIndices) const ;
00052 
00053       virtual const Cell& facet(int d, int facetNumber) const ;
00054       virtual const Cell& cofacet(int d, int cofacetNumber) const ;
00055       virtual int myFacetIndex() const ;
00056 
00057       virtual const ReferenceCell& refCell() const {return refCell_;}
00058 
00059       virtual const Point& point(int i) const ;
00060 
00061       virtual void registerFacet(int dim, int facetNum, int facetCellIndex) ;
00062       virtual void registerCofacet(int d, int cofacetCellIndex);
00063 
00064       virtual int byteCount() const ;
00065 
00066 #ifndef NO_POOLMEM
00067       static inline void* operator new(size_t s);
00068       static inline void operator delete(void* p, size_t s);
00069 #endif
00070 
00071     protected:
00072 
00073       ReferenceCell refCell_;
00074 
00075       // index into the mesh's table of Points
00076       TSFArray<int> nodes_;
00077 
00078       // table of indices for facets:
00079       // facets_[facet dim][facet index]
00080       //TSFArray<TSFArray<int> > facets_;
00081       FacetSetBase* facets_;
00082 
00083       // memory pool
00084 #ifndef NO_POOLMEM
00085       static Pool memPool_;
00086 #endif
00087     };
00088 
00089 #ifndef NO_POOLMEM
00090 
00091   inline void* MaximalCell::operator new(size_t s)
00092     {
00093       if (s != sizeof(MaximalCell))
00094         {
00095           return ::operator new(s);
00096         }
00097       return memPool_.alloc();
00098       //return ::operator new(s);
00099     }
00100 
00101   inline void MaximalCell::operator delete(void* p, size_t s)
00102     {
00103       if (s != sizeof(MaximalCell)) ::operator delete(p);
00104       else memPool_.free(p);
00105       //else ::operator delete(p);
00106     }
00107 
00108 #endif
00109 
00110 }
00111 #endif
00112 
00113 
00114 
00115 
00116 

Contact:
Kevin Long (krlong@ca.sandia.gov)


Documentation generated by