Toast++  1.0.2 (r.539)
Forward and inverse modelling in optical tomography
vox8.h
1 // -*-C++-*-
2 // ==========================================================================
3 // Module libfe
4 // File vox8.h
5 // Declaration of class Voxel8
6 //
7 // 8-noded regular voxel element aligned with global coordinate axes,
8 // to form a regular mesh grid.
9 //
10 // Node arrangement:
11 //
12 // N6 N7 Side contains nodes
13 // +---------------+ 0 (z=0) 0,1,2,3
14 // z ^ /. /| 1 (z=1) 4,5,6,7
15 // | / . / | 2 (y=0) 0,1,4,5
16 // | / . ^ y / | 3 (y=1) 2,3,6,7
17 // / . / / | 4 (x=0) 0,2,4,6
18 // N4 +---------------+ N5 | 5 (x=1) 1,3,5,7
19 // | . | | ---------------------
20 // | .N2 | | N3 Node coords of local element:
21 // | +..........|....+ N0 = (0,0,0)
22 // | . | / N1 = (1,0,0)
23 // | . | / N2 = (0,1,0)
24 // | . | / N3 = (1,1,0)
25 // |. |/ N4 = (0,0,1)
26 // +---------------+ --> x N5 = (1,0,1)
27 // N0 N1 N6 = (0,1,1)
28 // N7 = (1,1,1)
29 // Inheritance:
30 // ------------
31 // Element
32 // ---> Element_Structured
33 // ---> Element_Structured_3D
34 // ---> Voxel8
35 // ==========================================================================
36 
37 #ifndef __VOX8_H
38 #define __VOX8_H
39 
40 class FELIB Voxel8: public Element_Structured_3D {
41 public:
42 
43  Voxel8 () { Node = new int[nNode()]; }
44  Voxel8 (const Voxel8 &el);
45  ~Voxel8 () { delete []Node; }
46 
50  Element *Copy();
51 
52  void Initialise (const NodeList &nlist);
53  void PostInitialisation (const NodeList &nlist);
54 
55  inline BYTE Type() const { return ELID_VOX8; }
56  BYTE VtkType() const { return 11; }
57  inline unsigned long GetCaps() const { return 0; }
58  inline int nNode() const { return 8; }
59  inline int nSide() const { return 6; }
60  inline int nSideNode (int /*side*/) const { return 4; }
61  int SideNode (int side, int node) const;
62 
63  double Size() const;
64 
65  Point Local (const NodeList &nlist, const Point &glob) const
66  { return Local (glob); }
67  Point Local (const Point &glob) const;
68  Point NodeLocal (int node) const;
69  const RVector &LNormal (int side) const;
70  inline RVector DirectionCosine (int side, RDenseMatrix& jacin)
71  { return LNormal (side); }
72  bool LContains (const Point &loc, bool pad = true) const;
73  bool GContains (const Point &glob, const NodeList&) const;
74 
75  RVector LocalShapeF (const Point &loc) const;
76  RDenseMatrix LocalShapeD (const Point &loc) const;
77  RVector GlobalShapeF (const Point &glob) const
78  { return LocalShapeF (Local (glob)); }
79  RDenseMatrix GlobalShapeD (const Point &glob) const
80  { return LocalShapeD (Local (glob)); }
81  RVector GlobalShapeF (const NodeList &nlist, const Point &glob) const
82  { return GlobalShapeF (glob); }
83  RDenseMatrix GlobalShapeD (const NodeList &nlist, const Point &glob) const
84  { return GlobalShapeD (glob); }
85 
86  double IntF (int i) const;
87 
88  double IntFF (int i, int j) const;
89 
90  RSymMatrix IntFF() const;
91 
92  double IntFFF (int i, int j, int k) const;
93 
94  double IntPFF (int i, int j, const RVector& P) const;
95  RSymMatrix IntPFF (const RVector& P) const;
96 
97  RSymMatrix IntDD () const;
98 
99  double IntDD (int i, int j) const;
100 
101  double IntFDD (int i, int j, int k) const;
102 
103  RSymMatrix IntPDD (const RVector& P) const;
104  double IntPDD (int i, int j, const RVector &P) const;
105  double BndIntFF (int i, int j);
106  double BndIntFFSide (int i, int j,int sd);
108  { ERROR_UNDEF; return RSymMatrix(); }
109  RSymMatrix BndIntPFF (const RVector &P) const
110  { ERROR_UNDEF; return RSymMatrix(); }
111  double BndIntPFF (int i, int j, const RVector &P) const;
112 
113  RSymMatrix Intdd() const;
114  // Int du_j/dx_l du_k/dx_m dr
115 
116  double IntFd (int i, int j, int k) const;
117  // Int [u_i du_j/dx_k] dr
118 
119  double IntFdd (int i, int j, int k, int l, int m) const;
120  // Int u_i du_j/dx_l du_k/dx_m dr
121  double IntPdd (const RVector &p, int j, int k, int l, int m) const;
122  // Int f(r) du_j/dx_l du_k/dx_m dr
123  // where f(r) is given as a nodal vector
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  RDenseMatrix StrainDisplacementMatrix (const Point &glob) const;
131  RDenseMatrix ElasticityStiffnessMatrix (double modulus, double pratio)
132  const;
133 
134  int GlobalIntersection (const NodeList &nlist, const Point &p1,
135  const Point &p2, Point **list)
136  { ERROR_UNDEF; return 0; }
137  int Intersection (const Point &p1, const Point &p2, Point** pi)
138  { ERROR_UNDEF; return 0; }
139 
140 protected:
141  void ComputeIntFF () const;
142  void ComputeIntFFF () const;
143  void ComputeIntDD () const;
144  void ComputeIntFDD () const;
145  void ComputeBndIntFF () const;
146  void ComputeBndIntFFF () const;
147 
148 private:
149  double x0, y0, z0; // global coords of node 0
150 
151  // shared properties
152  static double dx;
153  static double dy;
154  static double dz; // voxel edge lengths
155  static double size; // voxel volume
156  static double intf;
157  static RSymMatrix intff;
158  static RSymMatrix intfff[8];
159  static RSymMatrix intdd;
160  static RSymMatrix intfdd[8];
161  static RSymMatrix bndintff[6];
162  static RDenseMatrix bndintfff[6][8];
163 
164  static bool need_setup;
165 };
166 
167 #endif // !__VOX8_H
Definition: ndlist.h:14
int nNode() const
Returns the number of nodes associated with the element.
Definition: vox8.h:58
RVector GlobalShapeF(const NodeList &nlist, const Point &glob) const
Returns the values of the shape functions at a global point.
Definition: vox8.h:81
Templated vector class.
Definition: vector.h:39
Point Local(const NodeList &nlist, const Point &glob) const
Maps a point from global to local element coordinates.
Definition: vox8.h:65
virtual RSymMatrix IntFF() const =0
Integrals of all products of two shape functions over the element.
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 bool GContains(const Point &glob, const NodeList &nlist) const
Checks if a global point coordinate is inside the element.
virtual double Size() const =0
Returns the element size.
RSymMatrix BndIntFF() const
Boundary integral of all products of two shape functions over all boundary sides of the element...
Definition: vox8.h:107
RVector DirectionCosine(int side, RDenseMatrix &jacin)
Returns the direction cosines of a side normal.
Definition: vox8.h:70
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
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
Base class for all 3-D structured element types.
Definition: element.h:1211
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.
unsigned long GetCaps() const
Returns element capability flags.
Definition: vox8.h:57
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.
RDenseMatrix GlobalShapeD(const NodeList &nlist, const Point &glob) const
Returns the values of the shape function derivatives at a global point.
Definition: vox8.h:83
virtual RSymMatrix IntPFF(const RVector &P) const =0
Integrals of all products of two shape functions and a nodal function over the element.
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
RSymMatrix BndIntPFF(const RVector &P) const
Surface integrals of all products of a nodal function and two shape functions over all boundary sides...
Definition: vox8.h:109
virtual RSymMatrix BndIntFF() const =0
Boundary integral of all products of two shape functions over all boundary sides of the element...
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...
Definition: vox8.h:40
virtual int nNode() const =0
Returns the number of nodes associated with the element.
int nSide() const
Returns the number of element sides.
Definition: vox8.h:59
Base class for finite element types.
Definition: element.h:84
virtual RSymMatrix IntPDD(const RVector &P) const =0
All integrals of products of a nodal function and two shape function derivatives over the element...
BYTE VtkType() const
Returns the VTK element type identifier, or 0 if the element doesn't have a VTK representation.
Definition: vox8.h:56
int nSideNode(int) const
Returns the number of vertices associated with a side.
Definition: vox8.h:60
virtual double IntF(int i) const =0
Integral of a shape function over the element.
virtual void Initialise(const NodeList &nlist)
Element initialisation.
BYTE Type() const
Returns an element type identifier.
Definition: vox8.h:55
virtual RVector LocalShapeF(const Point &loc) const =0
Returns the values of the shape functions at a local point.
virtual RSymMatrix Intdd() const
Integral of the product of two partial shape function derivatives over the element.
Definition: element.h:836
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.
virtual void PostInitialisation(const NodeList &nlist)
Element setup after mesh initialisation.
Definition: element.h:129
virtual int SideNode(int side, int node) const =0
Returns relative node index for a side vertex.
virtual RSymMatrix IntDD() const =0
Integrals of all products of two shape function derivatives over the element.
virtual bool LContains(const Point &loc, bool pad=true) const =0
Checks if a local point coordinate is inside the element.
#define ELID_VOX8
8-noded voxel
Definition: element.h:35