00001 #ifndef TRIANGLEFACETSET_H
00002 #define TRIANGLEFACETSET_H
00003
00004 #include "SundanceDefs.h"
00005
00006 #include "FacetSetBase.h"
00007 #include "Pool.h"
00008
00009
00010 namespace Sundance
00011 {
00012
00013 using namespace TSF;
00014
00015
00016
00017
00018
00019 class TriangleFacetSet : public FacetSetBase
00020 {
00021 public:
00022 TriangleFacetSet() : FacetSetBase() {;}
00023 virtual ~TriangleFacetSet(){;}
00024
00025 virtual int numFacets(int ) const {return 3;}
00026 virtual int facetIndex(int facetDim, int facetNum) const
00027 {return f_[facetNum+3*facetDim];}
00028 virtual void setFacetIndex(int facetDim, int facetNum, int facetIndex)
00029 {f_[3*facetDim+facetNum] = facetIndex;}
00030
00031 virtual int byteCount() const {return sizeof(TriangleFacetSet);}
00032 #ifndef NO_POOLMEM
00033 static inline void* operator new(size_t s);
00034 static inline void operator delete(void* p, size_t s);
00035 #endif
00036 private:
00037 int f_[6];
00038 #ifndef NO_POOLMEM
00039 static Pool memPool_;
00040 #endif
00041 };
00042
00043 #ifndef NO_POOLMEM
00044 inline void* TriangleFacetSet::operator new(size_t s)
00045 {
00046 if (s != sizeof(TriangleFacetSet))
00047 {
00048 return ::operator new(s);
00049 }
00050 return memPool_.alloc();
00051
00052 }
00053
00054 inline void TriangleFacetSet::operator delete(void* p, size_t s)
00055 {
00056 if (s != sizeof(TriangleFacetSet)) ::operator delete(p);
00057 else memPool_.free(p);
00058
00059 }
00060 #endif
00061
00062
00063 }
00064 #endif