00001 #ifndef BRICKFACETSET_H
00002 #define BRICKFACETSET_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
00020 class BrickFacetSet : public FacetSetBase
00021 {
00022 public:
00023 BrickFacetSet() : FacetSetBase() {;}
00024 virtual ~BrickFacetSet(){;}
00025
00026 virtual int numFacets(int facetDim) const {return n_[facetDim];}
00027 virtual int facetIndex(int facetDim, int facetNum) const
00028 {return f_[facetNum + p_[facetDim]];}
00029 virtual void setFacetIndex(int facetDim, int facetNum, int facetIndex)
00030 {f_[p_[facetDim] + facetNum] = facetIndex;}
00031
00032 virtual int byteCount() const {return sizeof(BrickFacetSet);}
00033 #ifndef NO_POOLMEM
00034 static inline void* operator new(size_t s);
00035 static inline void operator delete(void* p, size_t s);
00036 #endif
00037 private:
00038 static int p_[3];
00039 static int n_[3];
00040 int f_[26];
00041
00042 #ifndef NO_POOLMEM
00043 static Pool memPool_;
00044 #endif
00045 };
00046
00047 #ifndef NO_POOLMEM
00048 inline void* BrickFacetSet::operator new(size_t s)
00049 {
00050 if (s != sizeof(BrickFacetSet))
00051 {
00052 return ::operator new(s);
00053 }
00054 return memPool_.alloc();
00055
00056 }
00057
00058 inline void BrickFacetSet::operator delete(void* p, size_t s)
00059 {
00060 if (s != sizeof(BrickFacetSet)) ::operator delete(p);
00061 else memPool_.free(p);
00062
00063 }
00064 #endif
00065
00066
00067 }
00068 #endif