Programming tasks to Scientific Computing I
basefunctionSetShellFE.h
Go to the documentation of this file.
1 #ifndef __BASEFUNCTIONSETSHELLFE_H
2 #define __BASEFUNCTIONSETSHELLFE_H
3 
4 #include<aol.h>
5 
6 using namespace aol;
7 
8 namespace shellFE {
9 
11 template <typename DataTypeContainer, class QuadRuleType >
13 public:
15  typedef typename DataTypeContainer::DomVecType DomVecType;
16 
18 
20  int numQuadPoints() const {
21  return QuadRuleType::numQuadPoints;
22  }
23 
25  inline RealType getWeight ( int QuadPoint ) const {
26  return _quadRule.getWeight ( QuadPoint );
27  }
28 
30  inline const DomVecType& getRefCoord ( int QuadPoint ) const {
31  return _quadRule.getRefCoord ( QuadPoint );
32  }
33 
34 protected:
35  QuadRuleType _quadRule;
36 };
37 
40 template <typename DataTypeContainer, typename QuadType, typename TriangleType>
41 class UnitTriangMeshBaseFunctionSetP1 : public UnitTriangleBaseFunctionSetInterface< DataTypeContainer, QuadType > {
42 public:
44  typedef typename DataTypeContainer::DomVecType DomVecType;
45 
46 protected:
47  static RealType _b1 ( const DomVecType &c ) { return 1. - c[0] - c[1]; }
48  static RealType _b2 ( const DomVecType &c ) { return c[0]; }
49  static RealType _b3 ( const DomVecType &c ) { return c[1]; }
50 
51  typedef RealType ( *BASIS_FUNC_TYPE ) ( const DomVecType &RefCoord );
52  BASIS_FUNC_TYPE _basis[3];
53 
54  const typename DataTypeContainer::TangentVecType _d1b, _d2b;
55 
56 public:
57 
58  UnitTriangMeshBaseFunctionSetP1() : _d1b(-1.,1.,0.), _d2b(-1.,0.,1.) {
59  _basis[0] = _b1;
60  _basis[1] = _b2;
61  _basis[2] = _b3;
62  }
63 
64  enum { numBaseFuncs = 3 };
65 
66  void setTriangle ( const TriangleType &/*T*/ ) {}
67 
72  void evaluateGradient ( int BaseFuncNum, const DomVecType &/*RefCoord*/, DomVecType &Gradient ) const {
73  Gradient[0] = _d1b[BaseFuncNum];
74  Gradient[1] = _d2b[BaseFuncNum];
75  }
76 
81  inline DomVecType evaluateGradient ( int BaseFuncNum, int /*QuadPoint*/ ) const {
82  return DomVecType( _d1b[BaseFuncNum], _d2b[BaseFuncNum] );
83  }
84 
89  RealType evaluate ( int BaseFuncNum, const DomVecType &RefCoord ) const {
90  return _basis[BaseFuncNum] ( RefCoord );
91  }
92 
97  inline const RealType evaluate ( int BaseFuncNum, int QuadPoint ) const {
98  return evaluate ( BaseFuncNum, this->_quadRule.getRefCoord ( QuadPoint ) );
99  }
100 };
101 
102 } // end namespace
103 
104 
105 
106 
107 #endif //__BASEFUNCTIONSETSHELLFE_H
const DataTypeContainer::TangentVecType _d2b
RealType evaluate(int BaseFuncNum, const DomVecType &RefCoord) const
Evaluates a base function at.
int numQuadPoints() const
Returns the number of quadrature points.
RealType getWeight(int QuadPoint) const
Returns the quadrature weight at QuadPointa quadrature point.
void evaluateGradient(int BaseFuncNum, const DomVecType &, DomVecType &Gradient) const
Evaluates the gradient of a base function at RefCoord.
const DomVecType & getRefCoord(int QuadPoint) const
Returns the coordinates of a quadrature point.
DomVecType evaluateGradient(int BaseFuncNum, int) const
Evaluates the gradient of a base function in a quadrature point.
static RealType _b2(const DomVecType &c)
const RealType evaluate(int BaseFuncNum, int QuadPoint) const
Evaluates a base function in a quadrature point.
Definition: rhs.h:14
static RealType _b1(const DomVecType &c)
double RealType
Definition: ex1.cpp:22
Base function set for unit triangle. Unit triangle embedded in R^2 is given by the three positions (0...
Definition: aol.cpp:3
Triangle which has a tangent space at each node.
static RealType _b3(const DomVecType &c)