Toast++  1.0.2 (r.539)
Forward and inverse modelling in optical tomography
tet4.h
1 // -*-C++-*-
2 // ==========================================================================
3 // Module libfe
4 // File tet4.h
5 // Declaration of class Tetrahedron4
6 //
7 // 4-noded triangle for implementation of linear shape functions
8 //
9 // Node arrangement:
10 //
11 // ^ z
12 // |
13 // ^ y Side contains nodes
14 // N3+-_ / 0 (z=0) 0,1,2
15 // |\ --_ 1 (y=0) 0,3,1
16 // | \ --+N2 2 (x=0) 0,2,3
17 // | \ . \ 3 (1-x-y-z=0) 1,3,2
18 // | \ \ -------------------
19 // | . \ \ Node coords of local element:
20 // | . \ \ N0 = (0,0,0)
21 // | . \ \ N1 = (1,0,0)
22 // | . \ \ N2 = (0,1,0)
23 // |. \ \ N3 = (0,0,1)
24 // +---------------+ --> x
25 // N0 N1
26 //
27 // Inheritance:
28 // ------------
29 // Element
30 // ---> Element_Unstructured
31 // ---> Element_Unstructured_3D
32 // ---> Tetrahedron4
33 // ==========================================================================
34 
35 #ifndef __TET4_H
36 #define __TET4_H
37 
62 public:
63 
64  Tetrahedron4() { Node = new int[nNode()]; }
65  Tetrahedron4( const Tetrahedron4 &el);
66  ~Tetrahedron4() { delete []Node; }
67 
71  Element *Copy();
72 
73  void Initialise (const NodeList &nlist);
74 
75  BYTE Type() const { return ELID_TET4; }
76  BYTE VtkType() const { return 10; }
77  unsigned long GetCaps () const { return ELCAPS_SUBSAMPLING; }
78  int nNode() const { return 4; }
79  int nSide() const { return 4; }
80  int nSideNode (int /*side*/) const { return 3; }
81  int SideNode (int side, int node) const;
82  double SideSize (int sd, const NodeList &nlist) const;
83 
84  double DetJ (const Point &loc, const NodeList *nlist = 0) const
85  { return Size()*6.0; }
86 
87  Point Local (const NodeList& nlist, const Point& glob) const;
88  Point NodeLocal (int node) const;
89  Point SurfToLocal (int side, const Point &p) const;
90  void MapToSide (int side, Point &loc) const;
91  RVector DirectionCosine (int side, RDenseMatrix& jacin);
92  const RVector &LNormal (int side) const;
93  bool LContains (const Point& loc, bool pad = true) const;
94 
95  RVector LocalShapeF (const Point &loc) const;
96  RDenseMatrix LocalShapeD (const Point &loc) const;
97  RVector GlobalShapeF (const NodeList& nlist, const Point& glob) const;
98  RDenseMatrix GlobalShapeD (const NodeList& nlist, const Point& glob) const;
99 
100  RSymMatrix IntFF() const;
101  double IntF (int i) const;
102  double IntFF (int i, int j) const;
103  double IntFFF (int i, int j, int k) const;
104  RSymMatrix IntPFF (const RVector& P) const;
105  double IntPFF (int i, int j, const RVector& P) const;
106  double IntFDD (int i, int j, int k) const;
107  RSymMatrix IntPDD (const RVector& P) const;
108  double IntPDD (int i, int j, const RVector &P) const;
109 
110  double IntFd (int i, int j, int k) const;
111  // Int [u_i du_k/dx_k] dr
112 
113  double IntPd (const RVector &P, int j, int k) const;
114  // Returns Int [p(r) du_j/dx_k] dr where p(r) is defined by its nodal
115  // basis coefficients P.
116 
117  double IntFdd (int i, int j, int k, int l, int m) const;
118  double IntPdd (const RVector &p, int j, int k, int l, int m) const;
119 
120  RSymMatrix Intdd() const;
121  // returns matrix of mixed derivatives
122 
123  double Intd (int i, int k) const;
124 
125  double IntFfd (int i, int j, int k, int l) const;
126  // Int u_i u_j du_k/dx_l dr
127  double IntPfd(const RVector &p,int j,int k,int l) const;
128  // Int f(r) u_j du_k/du_l dr
129 
130  RVector BndIntF () const;
131 
132  double BndIntFSide (int i, int sd);
133 
134  double BndIntFFSide (int i, int j, int sd);
135 
136  RSymMatrix BndIntPFF (const RVector &P) const
137  { ERROR_UNDEF; return RSymMatrix(); }
138  double BndIntPFF (int i, int j, const RVector &P) const;
139 
151  double BndIntFD (int sd, int i, int j, int k);
152 
168  //double BndIntFD (Mesh &mesh, int sd, int el2, int sd2, int i, int j, int k);
169 
170  RVector BndIntFX (int side, double (*func)(const Point&),
171  const NodeList &nlist) const;
172  RVector BndIntFCos (int side, const RVector &cntcos, double a,
173  const NodeList &nlist) const;
174  int GetLocalSubsampleAbsc (const Point *&absc) const;
175  int GetBndSubsampleAbsc (int side, const Point *&absc) const;
176  RDenseMatrix StrainDisplacementMatrix (const Point &glob) const;
177  RDenseMatrix ElasticityStiffnessMatrix (const RDenseMatrix &D) const;
178  RDenseMatrix ElasticityStiffnessMatrix (double modulus, double pratio)
179  const;
180  RVector InitialStrainVector (double E, double nu, const RVector &e0);
181  RVector ThermalExpansionVector (double E, double nu, double alpha,
182  double dT);
183  RVector DThermalExpansionVector (double E, double nu);
184 
185  int GlobalIntersection (const NodeList &nlist, const Point &p1,
186  const Point &p2, Point **list);
187 
201  int Intersection (const Point &p1, const Point &p2, Point** pi);
202 
203 protected:
204 
205  double ComputeSize (const NodeList &nlist) const;
206  RSymMatrix ComputeIntDD (const NodeList &nlist) const;
207  RSymMatrix ComputeBndIntFF (const NodeList& nlist) const;
208 
209  double a0, a1, a2, a3, b0, b1, b2, b3, c0, c1, c2, c3, d0, d1, d2, d3;
210  double side_size[4]; // surface triangle areas
211 
212 private:
213 
214 #ifdef TET4_STORE_INTFF
215  RSymMatrix intff;
216  // stores integral over element of product of shape functions
217  // Int_el { F_i(r) F_j(r) } dr
218  // set by Initialise
219 #endif
220 
221 };
222 
223 #endif // !__TET4_H
BYTE Type() const
Returns an element type identifier.
Definition: tet4.h:75
Definition: ndlist.h:14
Templated vector class.
Definition: vector.h:39
virtual RSymMatrix IntFF() const =0
Integrals of all products of two shape functions over the element.
double Size() const
Returns the element size.
Definition: element.h:1128
Definition: node.h:39
virtual double IntFdd(int i, int j, int k, int l, int m) const
Integral of the product of a shape function and two partial shape function derivatives over the eleme...
Definition: element.h:850
virtual double IntPd(const RVector &P, int j, int k) const
Integral of the product of a nodal function and a partial shape function derivative over the element...
Definition: element.h:823
Base class for all 3-D unstructured element types.
Definition: element.h:1257
unsigned long GetCaps() const
Returns element capability flags.
Definition: tet4.h:77
virtual RVector DirectionCosine(int side, RDenseMatrix &jacin)=0
Returns the direction cosines of a side normal.
virtual RVector GlobalShapeF(const NodeList &nlist, const Point &glob) const
Returns the values of the shape functions at a global point.
Definition: element.h:490
A 4-noded 3-dimensional tetrahedron element with straight edges and linear shape functions.
Definition: tet4.h:61
virtual double IntFFF(int i, int j, int k) const =0
Integral of a product of three shape functions over the element.
Definition: point.h:18
virtual double BndIntFFSide(int i, int j, int sd)=0
Surface integral of a product of two shape functions over one of the sides of the element...
virtual RDenseMatrix LocalShapeD(const Point &loc) const =0
Returns the values of the shape function derivatives at a local point.
virtual double IntFd(int i, int j, int k) const
Integral of the product of a shape function and a partial shape function derivative over the element...
Definition: element.h:810
virtual const RVector & LNormal(int side) const =0
Returns a side normal in local coordinates.
virtual RSymMatrix IntPFF(const RVector &P) const =0
Integrals of all products of two shape functions and a nodal function over the element.
virtual double BndIntFSide(int i, int sd)
Surface integral of a shape function over one of the sides of the element.
Definition: element.h:707
virtual void Initialise(const NodeList &nlist)
Element initialisation.
virtual double Intd(int i, int k) const
Integral of partial shape function derivative over the element.
Definition: element.h:796
virtual RDenseMatrix GlobalShapeD(const NodeList &nlist, const Point &glob) const
Returns the values of the shape function derivatives at a global point.
Definition: element.h:502
virtual RSymMatrix BndIntPFF(const RVector &P) const =0
Surface integrals of all products of a nodal function and two shape functions over all boundary sides...
RSymMatrix BndIntPFF(const RVector &P) const
Surface integrals of all products of a nodal function and two shape functions over all boundary sides...
Definition: tet4.h:136
virtual void MapToSide(int side, Point &loc) const
Translates a point to an element surface.
virtual int nNode() const =0
Returns the number of nodes associated with the element.
virtual RVector BndIntF() const
Boundary integral of all shape functions over all boundary sides of the element.
Definition: element.h:694
Base class for finite element types.
Definition: element.h:84
int nNode() const
Returns the number of nodes associated with the element.
Definition: tet4.h:78
int nSideNode(int) const
Returns the number of vertices associated with a side.
Definition: tet4.h:80
virtual RSymMatrix IntPDD(const RVector &P) const =0
All integrals of products of a nodal function and two shape function derivatives over the element...
virtual double IntF(int i) const =0
Integral of a shape function over the element.
virtual double SideSize(int side, const NodeList &nlist) const
Returns the size of an element side.
Definition: element.h:397
virtual RVector LocalShapeF(const Point &loc) const =0
Returns the values of the shape functions at a local point.
double DetJ(const Point &loc, const NodeList *nlist=0) const
Returns determinant of Jacobian at a given point inside the element in the local frame.
Definition: tet4.h:84
int nSide() const
Returns the number of element sides.
Definition: tet4.h:79
virtual Point SurfToLocal(int side, const Point &p) const
Maps a point from surface coordinates to local element coordinates.
Definition: element.h:302
virtual RSymMatrix Intdd() const
Integral of the product of two partial shape function derivatives over the element.
Definition: element.h:836
#define ELID_TET4
4-noded tetrahedron
Definition: element.h:33
virtual Element * Copy()=0
Create a copy of the element and return a pointer to it.
Dense matrix class.
Definition: crmatrix.h:38
virtual Point Local(const NodeList &nlist, const Point &glob) const =0
Maps a point from global to local element coordinates.
virtual double IntFDD(int i, int j, int k) const =0
Integral of a product of a shape function and two shape function derivatives over the element...
virtual Point NodeLocal(int node) const =0
Returns the local coordinates of an element node.
#define ELCAPS_SUBSAMPLING
element implements IntFFF and IntFDD by subsampling
Definition: element.h:61
virtual int SideNode(int side, int node) const =0
Returns relative node index for a side vertex.
BYTE VtkType() const
Returns the VTK element type identifier, or 0 if the element doesn't have a VTK representation.
Definition: tet4.h:76
virtual bool LContains(const Point &loc, bool pad=true) const =0
Checks if a local point coordinate is inside the element.