00001 #ifndef REFERENCECELL_H
00002 #define REFERENCECELL_H
00003
00004 #include "SundanceDefs.h"
00005
00006 #include "Pool.h"
00007 #include "TSFSmartPtr.h"
00008 #include "ReferenceCellBase.h"
00009
00010
00011 namespace Sundance
00012 {
00013
00014 using namespace TSF;
00015 using std::string;
00016
00017 using std::ostream;
00018
00019 class Cell;
00020
00021 class FacetSetBase;
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class ReferenceCell
00036 {
00037 public:
00038
00039 ReferenceCell() : ptr_(0) {;}
00040
00041 ReferenceCell(ReferenceCellBase* ptr) : ptr_(ptr) {;}
00042
00043
00044
00045
00046
00047 const string& typeName() const {return ptr_->typeName();}
00048
00049 CellTopologyCode topologyCode() const {return ptr_->topologyCode();}
00050
00051
00052
00053 bool isAffine() const {return ptr_->isAffine();}
00054
00055
00056 int dim() const {return ptr_->dim();}
00057
00058 int numNodes() const {return ptr_->numNodes();}
00059
00060 int numVertices() const {return ptr_->numVertices();}
00061
00062 int numFacets(int d) const {return ptr_->numFacets(d);}
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 const TSFArray<TSFArray<int> >& facetNodePtrs(int facetDim) const
00074 {return ptr_->facetNodePtrs(facetDim);}
00075
00076
00077
00078 const TSFArray<TSFArray<int> >& facetFacetPtrs(int d, int facetNum) const
00079 {return ptr_->facetFacetPtrs(d, facetNum);}
00080
00081
00082 const ReferenceCell& facetReferenceCell(int facetDim,
00083 int facetNumber) const
00084 {return ptr_->facetReferenceCell(facetDim, facetNumber);}
00085
00086
00087 FacetSetBase* newFacetSet() const
00088 {return ptr_->newFacetSet();}
00089
00090
00091
00092
00093
00094 void jacobian(const Cell& cell,
00095 const TSFArray<Point>& refpts,
00096 TSFArray<CellJacobian>& J) const ;
00097
00098
00099 void detJacobian(const Cell& cell,
00100 const TSFArray<Point>& refpts,
00101 TSFArray<double>& detJ) const ;
00102
00103
00104
00105 void constantJacobian(const Cell& cell,
00106 CellJacobian& J) const ;
00107
00108
00109
00110 void constantDetJacobian(const Cell& cell,
00111 double& detJ) const ;
00112
00113
00114 void pushFwd(const Cell& cell,
00115 const TSFArray<Point>& ref,
00116 TSFArray<Point>& phys) const ;
00117
00118
00119
00120 double diameter(const Cell& cell) const ;
00121
00122
00123 Point normal(const Cell& cell) const ;
00124
00125
00126
00127
00128 static void* operator new(size_t s);
00129
00130 static void operator delete(void* p);
00131
00132 private:
00133 TSFSmartPtr<ReferenceCellBase> ptr_;
00134
00135 static Pool memPool_;
00136 };
00137
00138 inline void* ReferenceCell::operator new(size_t s)
00139 {
00140 if (s != sizeof(ReferenceCell))
00141 {
00142 return ::operator new(s);
00143 }
00144 return memPool_.alloc();
00145 }
00146
00147 inline void ReferenceCell::operator delete(void* p)
00148 {
00149 memPool_.free(p);
00150 }
00151 }
00152 #endif
00153
00154