00001
00031 #ifndef ELEMENT
00032 #define ELEMENT
00033
00034 #include <vector>
00035 #include "AuxDefs.h"
00036 #include "ElementGeometry.h"
00037 #include "BasisFunctions.h"
00038
00039
00040
00041
00080 class Element
00081 {
00082 public:
00083
00084 inline Element(){}
00085 inline virtual ~Element(){}
00086 inline Element(const Element &){}
00087 virtual Element * clone() const = 0;
00088
00089
00090
00092 virtual const size_t getNumFields() const = 0;
00093
00095 virtual const size_t getDof(size_t field) const = 0;
00096
00098 virtual const size_t getNumDerivatives(size_t field) const = 0;
00099
00101 virtual const std::vector <double> &getShapes(size_t field) const = 0;
00102
00104 virtual const std::vector <double> &getDShapes(size_t field) const = 0;
00105
00107 virtual const std::vector <double> &getIntegrationWeights(size_t field) const = 0;
00108
00110 virtual const std::vector <double> &getIntegrationPtCoords(size_t field) const = 0;
00111
00114 virtual const double getShape(size_t field, size_t quad, size_t shapenumber) const = 0;
00115
00118 virtual const double getDShape(size_t field, size_t quad, size_t shapenumber, size_t dir)
00119 const = 0;
00120
00122 virtual const ElementGeometry & getGeometry() const = 0;
00123
00124 };
00125
00126
00127
00128
00152 class Element_: public Element {
00153 private:
00154 void copy (const Element_& that) {
00155 for (size_t i = 0; i < that.LocalShapes.size (); i++) {
00156 LocalShapes.push_back ((that.LocalShapes[i])->clone ());
00157 }
00158 }
00159
00160 void destroy () {
00161 for (size_t i = 0; i < LocalShapes.size (); i++) {
00162 delete LocalShapes[i];
00163 LocalShapes[i] = NULL;
00164 }
00165 }
00166
00167 public:
00168 inline Element_ () : Element() {
00169 }
00170
00171 inline virtual ~Element_ () {
00172 destroy ();
00173 }
00174
00175 Element_ (const Element_ &OldElement_) :
00176 Element (OldElement_) {
00177 copy (OldElement_);
00178 }
00179
00180 Element_& operator = (const Element_& that) {
00181 if (this != &that) {
00182 destroy ();
00183 copy (that);
00184 }
00185 return (*this);
00186 }
00187
00188 virtual Element_ * clone () const = 0;
00189
00190 inline const size_t getDof (size_t field) const {
00191 return LocalShapes[getFieldShapes (field)]->getBasisDimension ();
00192 }
00193 inline const size_t getNumDerivatives (size_t field) const {
00194 return LocalShapes[getFieldShapes (field)]-> getNumberOfDerivativesPerFunction ();
00195 }
00196 inline const std::vector<double> &getShapes (size_t field) const {
00197 return LocalShapes[getFieldShapes (field)]->getShapes ();
00198 }
00199 inline const std::vector<double> &getDShapes (size_t field) const {
00200 return LocalShapes[getFieldShapes (field)]->getDShapes ();
00201 }
00202 inline const std::vector<double> &getIntegrationWeights (size_t field) const {
00203 return LocalShapes[getFieldShapes (field)]->getIntegrationWeights ();
00204 }
00205 inline const std::vector<double> &getIntegrationPtCoords (size_t field) const {
00206 return LocalShapes[getFieldShapes (field)]->getQuadraturePointCoordinates ();
00207 }
00208
00209 inline const double getShape (size_t field, size_t quad, size_t shapenumber) const {
00210 return getShapes (field)[quad * getDof (field) + shapenumber];
00211 }
00212
00213 inline const double getDShape (size_t field, size_t quad, size_t shapenumber, size_t dir) const {
00214 return getDShapes (field)[quad * getDof (field) * getNumDerivatives (field) + shapenumber
00215 * getNumDerivatives (field) + dir];
00216 }
00217
00218 protected:
00222 inline void addBasisFunctions (const BasisFunctions &BasisFunctionsPointer) {
00223 LocalShapes.push_back (BasisFunctionsPointer.clone ());
00224
00225
00226
00227 }
00228
00231 virtual size_t getFieldShapes (size_t Field) const = 0;
00232
00234 inline size_t getNumShapes () const {
00235 return LocalShapes.size ();
00236 }
00237
00238 private:
00239 std::vector<BasisFunctions *> LocalShapes;
00240 };
00241
00248 class SpecificElementFamily {
00249 };
00250
00268 class LocalToGlobalMap {
00269 public:
00270 inline LocalToGlobalMap () {
00271 }
00272 inline virtual ~LocalToGlobalMap () {
00273 }
00274 inline LocalToGlobalMap (const LocalToGlobalMap &) {
00275 }
00276 virtual LocalToGlobalMap * clone () const = 0;
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00301 virtual const GlobalDofIndex map (size_t field, size_t dof, const GlobalElementIndex & ElementMapped) const = 0;
00302
00305 virtual const size_t getNumElements () const = 0;
00306
00308 virtual const size_t getNumFields (const GlobalElementIndex & ElementMapped) const = 0;
00309
00311 virtual const size_t getNumDof (const GlobalElementIndex & ElementMapped, size_t field) const = 0;
00312
00314 virtual const size_t getTotalNumDof () const = 0;
00315 };
00316
00317 #endif
00318