ParametricFace.h
1 /******************************************************************************
2 
3  (c) 2004-2014 Scientific Computation Research Center,
4  Rensselaer Polytechnic Institute. All rights reserved.
5 
6  The LICENSE-SCOREC file included with this distribution describes the terms
7  of the SCOREC Non-Commercial License this program is distributed under.
8 
9 *******************************************************************************/
10 #ifndef PARAMETRICFACE_H_
11 #define PARAMETRICFACE_H_
12 
13 #include "CMAFwd.h"
14 
17  public:
18  ParametricFace(std::vector<Point3d> in_ordered_nodes);
19 
20  virtual ~ParametricFace() {
21  }
22 
23  inline void eval(Point2d in_xi,
24  Point3d & out_xyz) {
25  v_eval(in_xi, out_xyz);
26  }
27 
28  inline int order(void) {
29  return v_order();
30  }
31 
32  inline void deriv1(Point2d in_xi,
33  Point3d & out_dxyz_dxi1,
34  Point3d & out_dxyz_dxi2) {
35  v_deriv1(in_xi, out_dxyz_dxi1, out_dxyz_dxi2);
36  }
37 
40  inline void deriv1_fd(const Point2d in_xi,
41  Point3d & dxyz_dxi1,
42  Point3d & dxyz_dxi2,
43  double step = 1.0e-3) {
44  Point3d pt3, pt2, pt1;
45  Point2d xi = in_xi;
46  // evaluate the starting point
47  this->eval(xi, pt1);
48  // evaluate after increment in xi1 direction
49  this->eval(xi + Point2d(step, 0.0), pt2);
50  // evaluate after increment in xi2 direction
51  this->eval(xi + Point2d(0.0, step), pt3);
52  dxyz_dxi1 = (pt2 - pt1) / step;
53  dxyz_dxi2 = (pt3 - pt1) / step;
54  }
55 
56 
57  protected:
58  virtual void v_eval(Point2d in_xi, Point3d & out_xyz) = 0;
59  virtual int v_order(void) = 0;
60  virtual void v_deriv1(Point2d in_xi,
61  Point3d & out_xyz1,
62  Point3d & out_xyz2) = 0;
63 
65  std::vector<Point3d> m_ordered_nodes;
66 };
67 
69 class CADTri {
70  public:
71  CADTri(pMeshEnt in_vtx0, pMeshEnt in_vtx1, pMeshEnt in_vtx2);
72 
73  virtual ~CADTri() {
74  }
75 
76  inline int eval(Point2d in_xi,
77  Point3d & out_xyz) {
78  return v_eval(in_xi, out_xyz);
79  }
80 
81  inline int order(void) {
82  return v_order();
83  }
84 
85  inline int deriv1(Point2d in_xi,
86  Point3d & out_dxyz_dxi1,
87  Point3d & out_dxyz_dxi2) {
88  return v_deriv1(in_xi, out_dxyz_dxi1, out_dxyz_dxi2);
89  }
90 
93  inline void deriv1_fd(const Point2d in_xi,
94  Point3d & dxyz_dxi1,
95  Point3d & dxyz_dxi2,
96  double step = 1.0e-3) {
97  Point3d pt3, pt2, pt1;
98  Point2d xi = in_xi;
99  // evaluate the starting point
100  this->eval(xi, pt1);
101  // evaluate after increment in xi1 direction
102  this->eval(xi + Point2d(step, 0.0), pt2);
103  // evaluate after increment in xi2 direction
104  this->eval(xi + Point2d(0.0, step), pt3);
105  dxyz_dxi1 = (pt2 - pt1) / step;
106  dxyz_dxi2 = (pt3 - pt1) / step;
107  }
108 
109  protected:
110  int v_eval(Point2d in_xi, Point3d & out_xyz);
111  int v_order();
112  int v_deriv1(Point2d in_xi,
113  Point3d & out_xyz1,
114  Point3d & out_xyz2);
115  private:
116  pMeshEnt m_vtx0; // (1, 0, 0)
117  pMeshEnt m_vtx1; // (0, 1, 0)
118  pMeshEnt m_vtx2; // (0, 0, 1)
119  pMeshEnt m_face;
120  Point3d m_vert0;
121  Point3d m_vert1;
122  Point3d m_vert2;
123 };
124 
125 #endif // PARAMETRICFACE_H_
interface class for all parametric faces
Definition: ParametricFace.h:16
std::vector< Point3d > m_ordered_nodes
the container for storing ordered nodes
Definition: ParametricFace.h:65
triangular face with shape represented by the underlying CAD model
Definition: ParametricFace.h:69
CADTri(pMeshEnt in_vtx0, pMeshEnt in_vtx1, pMeshEnt in_vtx2)
Definition: CADTri.cc:26
void deriv1_fd(const Point2d in_xi, Point3d &dxyz_dxi1, Point3d &dxyz_dxi2, double step=1.0e-3)
Evaluate first derivative numerically by finite difference.
Definition: ParametricFace.h:40
void deriv1_fd(const Point2d in_xi, Point3d &dxyz_dxi1, Point3d &dxyz_dxi2, double step=1.0e-3)
Evaluate first derivative numerically by finite difference.
Definition: ParametricFace.h:93