00001 #ifndef __FE_VECTOR_H_
00002 #define __FE_VECTOR_H_
00003
00004 #include <string>
00005 #include "feVec.h"
00006 #include "timeInfo.h"
00007
00008 namespace ot {
00009 namespace fem {
00010
00011 template <typename T>
00012 class feVector : public feVec {
00013 public:
00014
00015 enum stdElemType {
00016 ST_0,ST_1,ST_2,ST_3,ST_4,ST_5,ST_6,ST_7
00017 };
00018
00019 enum exhaustiveElemType {
00020
00021
00022 ET_N = 0,
00023 ET_Y = 2,
00024 ET_X = 1,
00025 ET_XY = 3,
00026 ET_Z = 8,
00027 ET_ZY = 10,
00028 ET_ZX = 9,
00029 ET_ZXY = 11,
00030 ET_XY_XY = 7,
00031 ET_XY_ZXY = 15,
00032 ET_YZ_ZY = 42,
00033 ET_YZ_ZXY = 43,
00034 ET_YZ_XY_ZXY = 47,
00035 ET_ZX_ZX = 25,
00036 ET_ZX_ZXY = 27,
00037 ET_ZX_XY_ZXY = 31,
00038 ET_ZX_YZ_ZXY = 59,
00039 ET_ZX_YZ_XY_ZXY = 63
00040 };
00041
00042 feVector();
00043 feVector(daType da);
00044 ~feVector();
00045
00046
00047 void setStencil(void* stencil);
00048
00049 void setName(std::string name);
00050
00051 virtual bool addVec(Vec _in, double scale=1.0, int indx = -1);
00052
00053 virtual bool computeVec(Vec _in, Vec _out, double scale = 1.0);
00054
00055 inline bool ElementalAddVec(int i, int j, int k, PetscScalar ***in, double scale) {
00056 return asLeaf().ElementalAddVec(i,j,k,in,scale);
00057 }
00058
00059 inline bool ElementalAddVec(unsigned int idx, PetscScalar *in, double scale) {
00060 return asLeaf().ElementalAddVec(idx, in, scale);
00061 }
00062
00063 inline bool ComputeNodalFunction(int i, int j, int k, PetscScalar ***in, PetscScalar ***out,double scale) {
00064 return asLeaf().ComputeNodalFunction(i,j,k,in,out,scale);
00065 }
00066
00067 inline bool ComputeNodalFunction(PetscScalar *in, PetscScalar *out,double scale) {
00068 return asLeaf().ComputeNodalFunction(in, out,scale);
00069 }
00070
00076 T& asLeaf() { return static_cast<T&>(*this);}
00077
00078 bool initStencils() {
00079 return asLeaf().initStencils();
00080 }
00081
00082 bool preAddVec() {
00083 return asLeaf().preAddVec();
00084 }
00085
00086 bool postAddVec() {
00087 return asLeaf().postAddVec();
00088 }
00089
00090 bool preComputeVec() {
00091 return asLeaf().preComputeVec();
00092 }
00093
00094 bool postComputeVec() {
00095 return asLeaf().postComputeVec();
00096 }
00097
00098 void setDof(unsigned int dof) { m_uiDof = dof; }
00099 unsigned int getDof() { return m_uiDof; }
00100
00101 void setTimeInfo(timeInfo *t) { m_time =t; }
00102 timeInfo* getTimeInfo() { return m_time; }
00103
00104 void initOctLut();
00105
00106
00107 inline PetscErrorCode alignElementAndVertices(ot::DA * da,
00108 stdElemType & sType, ot::index* indices);
00109 inline PetscErrorCode mapVtxAndFlagsToOrientation(int childNum,
00110 ot::index* indices, unsigned char & mask);
00111 inline PetscErrorCode reOrderIndices(unsigned char eType,
00112 ot::index* indices);
00113
00114 protected:
00115 void * m_stencil;
00116
00117 std::string m_strVectorType;
00118
00119 timeInfo *m_time;
00120
00121 unsigned int m_uiDof;
00122
00123
00124 unsigned char ** m_ucpLut;
00125 };
00126
00127 #include "feVector.txx"
00128
00129 }
00130 }
00131
00132 #endif