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