00001
00029 #ifndef STRESSWORK
00030 #define STRESSWORK
00031
00032 #include <vector>
00033 #include <algorithm>
00034
00035 #include <cassert>
00036
00037 #include "Galois/Runtime/PerCPU.h"
00038
00039 #include "ElementalOperation.h"
00040 #include "AuxDefs.h"
00041
00070 class StressWork: public DResidue {
00071 protected:
00072 enum GetValMode {
00073 VAL,
00074 DVAL,
00075 };
00076
00078 bool getDValIntern(const MatDouble &argval, MatDouble& funcval, FourDVecDouble& dfuncval, const GetValMode& mode) const;
00079
00080 private:
00081
00088 struct StressWorkTmpVec {
00089 static const size_t MAT_SIZE = SimpleMaterial::MAT_SIZE;
00090
00091 std::vector<size_t> nDof;
00092 std::vector<size_t> nDiv;
00093
00094 MatDouble DShape;
00095 MatDouble IntWeights;
00096
00097 VecDouble A;
00098 VecDouble F;
00099 VecDouble P;
00100
00101 StressWorkTmpVec ()
00102 : A (MAT_SIZE * MAT_SIZE, 0.0),
00103 F (MAT_SIZE, 0.0),
00104 P (MAT_SIZE, 0.0) {}
00105
00106 explicit StressWorkTmpVec (size_t Dim)
00107 : nDof(Dim),
00108 nDiv(Dim),
00109 DShape(Dim),
00110 IntWeights(Dim),
00111 A (MAT_SIZE * MAT_SIZE, 0.0),
00112 F (MAT_SIZE, 0.0),
00113 P (MAT_SIZE, 0.0) {}
00114
00115
00116
00117 };
00118
00122 typedef GaloisRuntime::PerCPU<StressWorkTmpVec> PerCPUtmpVecTy;
00123
00124 static PerCPUtmpVecTy perCPUtmpVec;
00125
00126 public:
00137 StressWork(const Element& IElm, const SimpleMaterial &SM, const std::vector<size_t>& fieldsUsed)
00138 : DResidue (IElm, SM, fieldsUsed) {
00139
00140 assert (fieldsUsed.size() > 0 && fieldsUsed.size () <= 3);
00141
00142 }
00143
00144 virtual ~StressWork() {}
00145
00146
00147 StressWork(const StressWork & SW) : DResidue (SW) {}
00148
00149
00150 virtual StressWork * clone() const {
00151 return new StressWork(*this);
00152 }
00153
00154
00155 VecDouble getIntegrationWeights(size_t fieldnumber) const {
00156 return BaseResidue::element.getIntegrationWeights(fieldnumber);
00157 }
00158
00160 bool getDVal(const MatDouble &argval, MatDouble& funcval, FourDVecDouble& dfuncval) const {
00161 return getDValIntern (argval, funcval, dfuncval, DVAL);
00162 }
00163
00165 bool getVal(const MatDouble &argval, MatDouble& funcval) const {
00166 FourDVecDouble d;
00167 return getDValIntern(argval, funcval, d, VAL);
00168 }
00169
00170 };
00171
00172 #endif