00001
00029 #ifndef ELEMENTALOPERATION
00030 #define ELEMENTALOPERATION
00031
00032 #include <vector>
00033 #include <iostream>
00034
00035 #include <cstdlib>
00036
00037 #include "AuxDefs.h"
00038 #include "Element.h"
00039 #include "Material.h"
00040
00041
00091 class Residue
00092 {
00093 public:
00094 Residue() {}
00095 virtual ~Residue() {}
00096 Residue(const Residue &NewEl) {}
00097 virtual Residue * clone() const = 0;
00098
00104 virtual const std::vector<size_t> & getFields() const = 0;
00105
00106
00115 virtual size_t getFieldDof(size_t fieldnumber) const = 0;
00116
00117
00131 virtual bool getVal(const MatDouble &argval, MatDouble& funcval ) const = 0;
00132
00133 virtual const Element& getElement () const = 0;
00134
00135 virtual const SimpleMaterial& getMaterial () const = 0;
00136
00137
00172
00173
00174 static bool assemble(std::vector<Residue *> &ResArray,
00175 const LocalToGlobalMap & L2G,
00176 const VecDouble & Dofs,
00177 VecDouble& ResVec);
00178 };
00179
00180
00185 class BaseResidue: public Residue {
00186
00187 protected:
00188 const Element& element;
00189 const SimpleMaterial& material;
00190 const std::vector<size_t>& fieldsUsed;
00191
00192
00193 BaseResidue (const Element& element, const SimpleMaterial& material, const std::vector<size_t>& fieldsUsed)
00194 : element (element), material (material), fieldsUsed (fieldsUsed) {
00195 }
00196
00197 BaseResidue (const BaseResidue& that) : element (that.element), material (that.material)
00198 , fieldsUsed (that.fieldsUsed) {
00199
00200 }
00201
00202 public:
00203 virtual const Element& getElement () const {
00204 return element;
00205 }
00206
00207 virtual const std::vector<size_t>& getFields () const {
00208 return fieldsUsed;
00209 }
00210
00211 virtual const SimpleMaterial& getMaterial () const {
00212 return material;
00213 }
00214
00215 virtual size_t getFieldDof (size_t fieldNum) const {
00216 return element.getDof (fieldsUsed[fieldNum]);
00217 }
00218
00219 };
00220
00221
00222
00223
00234 class DResidue: public BaseResidue {
00235 public:
00236 DResidue (const Element& element, const SimpleMaterial& material, const std::vector<size_t>& fieldsUsed)
00237 : BaseResidue(element, material, fieldsUsed) {}
00238
00239 DResidue(const DResidue &NewEl): BaseResidue(NewEl) {}
00240
00241 virtual DResidue * clone() const = 0;
00242
00243
00262 virtual bool getDVal(const MatDouble& argval, MatDouble& funcval,
00263 FourDVecDouble& dfuncval) const = 0;
00264
00265
00267 static bool consistencyTest(const DResidue & DRes,
00268 const std::vector<size_t> & DofPerField,
00269 const MatDouble &argval);
00270
00304
00306
00307
00308 static bool assemble(std::vector<DResidue *> &DResArray,
00309 const LocalToGlobalMap & L2G,
00310 const VecDouble & Dofs,
00311 VecDouble& ResVec,
00312 MatDouble& DResMat);
00313 };
00314
00315
00316
00317 #endif
00318