00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef CELEMENT_H
00014 #define CELEMENT_H
00015
00016 #include "CMaterial.h"
00017
00018 #include <iosfwd>
00019 #include <functional>
00020 #include <vector>
00021
00022
00023 namespace shells {
00024 struct SElementS;
00025 struct SVertexS;
00026 }
00027
00028
00029 namespace fragment {
00030 class CElement;
00031 class ComputeInternalForceFunctor;
00032
00033
00034 enum ElementType {LE=0, RI=1};
00035
00036
00037 const int tgauss = 3;
00038 const double eta[3] = {-0.5, 0, 0.5};
00039 const double weta[3] = {0.166666666666667, 0.666666666666667, 0.16666666666667};
00040
00041
00042 const int egauss = 3;
00043 const double wcsi[3] = {0.277777777777778, 0.444444444444444, 0.27777777777778};
00044 }
00045
00046
00047
00048 class fragment::CElement {
00049 public:
00050 CElement(shells::SElementS * const left,
00051 shells::SVertexS * const leftVtxA, shells::SVertexS * const leftVtxB,
00052 shells::SElementS * const right,
00053 shells::SVertexS * const rightVtxA, shells::SVertexS * const rightVtxB,
00054 bool halfWeight):
00055 _left(left), _leftVtxA(leftVtxA), _leftVtxB(leftVtxB),
00056 _right(right), _rightVtxA(rightVtxA), _rightVtxB(rightVtxB),
00057 _halfWeight(halfWeight)
00058 {
00059 _mat = NULL;
00060 }
00061
00062 void setMaterial(fragment::CMaterial * const mat);
00063 void computeResidual(const double thick);
00064
00065 void ptrToHistory(double **data, int *size);
00066 void resetHistory(double *data);
00067
00068
00069 void printCoordinates (std::ostream& os) const;
00070 void printActiveCoordinates (std::ostream& os) const;
00071
00072 private:
00073 CElement(const CElement &);
00074 const CElement & operator=(const CElement &);
00075
00076 private:
00077 shells::SElementS * const _left;
00078 shells::SVertexS * const _leftVtxA;
00079 shells::SVertexS * const _leftVtxB;
00080
00081 shells::SElementS * const _right;
00082 shells::SVertexS * const _rightVtxA;
00083 shells::SVertexS * const _rightVtxB;
00084
00085 CMaterial *_mat;
00086
00087 std::vector<double> _internal;
00088
00089 bool _halfWeight;
00090 };
00091
00092
00093
00094 class fragment::ComputeInternalForceFunctor :
00095 public std::unary_function<fragment::CElement *, void > {
00096
00097 public:
00098 ComputeInternalForceFunctor(const double thick):_thick(thick){}
00099
00100 void operator()(CElement * const elem) const
00101 {
00102 elem->computeResidual(_thick);
00103 }
00104
00105 private:
00106 const double _thick;
00107 };
00108
00109 #endif