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