CrvEnt.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 CURVEMESH_CRVENT_H
11 #define CURVEMESH_CRVENT_H
12 
13 #include <string>
14 #include <vector>
15 #include <iostream>
16 
17 #include "CMAFwd.h"
18 
21 class CrvEnt {
22 
23 public:
27  CrvEnt(pMeshEnt in_mesh_ent);
28 
32  CrvEnt(VtxPtrVec in_vert_vec);
33 
36  virtual ~CrvEnt();
37 
38  /* coordinate system transformation */
39 
44  void get_xi_by_eta(Point3d in_eta, Point3d & out_xi);
45 
50  void get_eta_by_ceta(Point3d in_ceta, Point3d & out_eta);
51 
57  void get_xi_by_ceta(Point3d in_ceta, Point3d & out_xi);
58 
59  /* evaluation */
60 
66  void eval_by_xi(Point3d in, Point3d & out);
67 
73  void eval_by_eta(Point3d in, Point3d & out);
74 
80  void eval_by_coll_eta(Point3d in, Point3d & out);
81 
82  /* differentiate */
83 
88  void diff_by_xi(Point3d in, Mat3x3 & out);
89 
95  void diff_by_xi(Point3d in, int j, Point3d & out);
96 
101  void diff_by_eta(Point3d in, Mat3x3 & out);
102 
108  void diff_by_eta(Point3d in, int j, Point3d & out);
109 
110  /* helper */
111 
114  void set_id(int i);
115 
118  int get_id();
119 
122  int get_exp_dim();
123 
126  int get_coord_dim();
127 
131  pMeshEnt get_vertex(int i);
132 
136  int ent_type();
137 
140  int data_size();
141 
144  std::string tag_name();
145 
146  /* common interface */
147 
150  int save_nodal_data_to_mesh(double * in_data);
151 
154  int load_nodal_data_from_mesh(double ** out_data);
155 
158  bool has_data();
159 
162  bool edge_on_model_bdry(pMeshEnt vtx0, pMeshEnt vtx1);
163 
166  bool face_on_model_bdry(pMeshEnt vtx0, pMeshEnt vtx1, pMeshEnt vtx2);
167 
168  protected:
169 
170  /* pure virtual functions */
171 
172  /* -- eval -- */
173  virtual void v_eval_by_xi (Point3d in, Point3d & out) = 0;
174  virtual void v_eval_by_eta(Point3d in, Point3d & out) = 0;
175  virtual void v_eval_by_coll_eta(Point3d in, Point3d & out) = 0;
176 
177  /* -- diff -- */
178  virtual void v_diff_by_xi(Point3d in, Mat3x3 & out) = 0;
179  virtual void v_diff_by_xi(Point3d in, int j, Point3d & out) = 0;
180  virtual void v_diff_by_eta(Point3d in, Mat3x3 & out) = 0;
181  virtual void v_diff_by_eta(Point3d in, int j, Point3d & out) = 0;
182 
183  /* -- help -- */
184  virtual int v_ent_type() const = 0;
185  virtual int v_data_size() const = 0;
186  virtual std::string v_tag_name() const = 0;
187  virtual int v_get_exp_dim() = 0;
188 
190  virtual int v_get_coord_dim() {
191  return 3;
192  }
193 
196  pMeshEnt get_mesh_ent();
197 
200  void set_mesh_ent(pMeshEnt in_ent);
201 
204  VtxPtrVec m_vert_vec;
205 
208  pMeshEnt m_mesh_ent;
209 
211  std::vector<Point3d> m_ctrl_pt_vec;
212 
213  private:
215  int m_id;
216 };
217 #endif//CURVEMESH_CRVENT_H
int save_nodal_data_to_mesh(double *in_data)
save the data to the underlying mesh database
Definition: CrvEnt.cc:32
std::string tag_name()
return the name string of the data
Definition: CrvEnt.cc:176
bool has_data()
return whether the entity has high-order shape data
Definition: CrvEnt.cc:69
void get_xi_by_eta(Point3d in_eta, Point3d &out_xi)
evaluate barycentric coordinates given the standard coordinates
Definition: CrvEnt.cc:181
virtual ~CrvEnt()
dtor
Definition: CrvEnt.cc:28
int get_id()
gets entity id
Definition: CrvEnt.cc:207
void eval_by_eta(Point3d in, Point3d &out)
evaluate xyz by standard cartesian coordinates
Definition: CrvEnt.cc:120
bool face_on_model_bdry(pMeshEnt vtx0, pMeshEnt vtx1, pMeshEnt vtx2)
return whether the mesh face is classified on model face
Definition: CrvEnt.cc:105
void get_eta_by_ceta(Point3d in_ceta, Point3d &out_eta)
evaluate standard coordinates given the collapsed/tensor coordinates
bool edge_on_model_bdry(pMeshEnt vtx0, pMeshEnt vtx1)
return whether the mesh edge is classified on model edge or face
Definition: CrvEnt.cc:95
void diff_by_xi(Point3d in, Mat3x3 &out)
evaluate dxyz/dxi, return all derivs in a matrix form
Definition: CrvEnt.cc:130
int ent_type()
return the topological entity type. 0 – vertex, 1 – edge, 2 – face, 3 – region ...
Definition: CrvEnt.cc:166
std::vector< Point3d > m_ctrl_pt_vec
container used to store the control point values
Definition: CrvEnt.h:211
pMeshEnt get_mesh_ent()
get the mesh entity
Definition: CrvEnt.cc:87
int get_coord_dim()
return coordinate dimension in xyz
Definition: CrvEnt.cc:155
pMeshEnt m_mesh_ent
topological mesh entity
Definition: CrvEnt.h:208
int data_size()
return the number of doubles associated with the current mesh entity
Definition: CrvEnt.cc:171
void get_xi_by_ceta(Point3d in_ceta, Point3d &out_xi)
evaluate barycentric coordinates given the collapsed/tensor coordinates
VtxPtrVec m_vert_vec
ordered set of mesh vertices
Definition: CrvEnt.h:204
void set_id(int i)
sets entity id
Definition: CrvEnt.cc:201
virtual int v_get_coord_dim()
all curved entities are assumed to be embeded in 3D space
Definition: CrvEnt.h:190
CrvEnt(pMeshEnt in_mesh_ent)
ctor
Definition: CrvEnt.cc:16
void eval_by_xi(Point3d in, Point3d &out)
evaluate xyz by barycentric coordinates
Definition: CrvEnt.cc:115
int m_id
the ID of the curved mesh entity
Definition: CrvEnt.h:215
void diff_by_eta(Point3d in, Mat3x3 &out)
evaluate derivatives w.r.t. standard cartesian coordinates
Definition: CrvEnt.cc:140
int get_exp_dim()
return dimension in xi or eta
Definition: CrvEnt.cc:150
void eval_by_coll_eta(Point3d in, Point3d &out)
evaluate xyz by collapsed/tensor coordinates
Definition: CrvEnt.cc:125
pMeshEnt get_vertex(int i)
return the ith bounding vertex of the mesh entity
Definition: CrvEnt.cc:160
base class for curved mesh entity
Definition: CrvEnt.h:21
void set_mesh_ent(pMeshEnt in_ent)
set the mesh entity
Definition: CrvEnt.cc:91
int load_nodal_data_from_mesh(double **out_data)
fetch data from mesh database
Definition: CrvEnt.cc:51