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