32 #ifndef CORE_BASIS_TETLINEARLGN_H
33 #define CORE_BASIS_TETLINEARLGN_H 1
97 static inline double length(
int edge)
101 const double dx = v1[0] - v0[0];
102 const double dy = v1[1] - v0[1];
103 const double dz = v1[2] - v0[2];
104 return sqrt(dx*dx+dy*dy+dz*dz);
121 template<
class VECTOR>
123 const unsigned div_per_unit,
124 VECTOR &coords)
const
126 typedef typename VECTOR::value_type VECTOR2;
128 coords.resize(div_per_unit + 1);
133 const double &p1x = v0[0];
134 const double &p1y = v0[1];
135 const double &p1z = v0[2];
136 const double dx = v1[0] - p1x;
137 const double dy = v1[1] - p1y;
138 const double dz = v1[2] - p1z;
140 for(
unsigned int i = 0; i <= div_per_unit; i++) {
141 const double d = (double)i / (
double)div_per_unit;
142 typename VECTOR::value_type &tmp = coords[i];
144 tmp[0] =
static_cast<typename VECTOR2::value_type
>(p1x + d * dx);
145 tmp[1] =
static_cast<typename VECTOR2::value_type
>(p1y + d * dy);
146 tmp[2] =
static_cast<typename VECTOR2::value_type
>(p1z + d * dz);
158 template <
class VECTOR>
160 const unsigned div_per_unit,
161 VECTOR &coords)
const
163 typedef typename VECTOR::value_type VECTOR2;
164 typedef typename VECTOR2::value_type VECTOR3;
169 coords.resize(div_per_unit);
170 const double d = 1. / div_per_unit;
171 for(
unsigned int j = 0; j<div_per_unit; j++)
173 const double dj = (double)j / (
double)div_per_unit;
175 coords[j].resize((div_per_unit - j) * 2 + 1);
176 typename VECTOR2::value_type &tmp = coords[j][e++];
178 tmp[0] =
static_cast<typename VECTOR3::value_type
>(v0[0] + dj * (v2[0] - v0[0]));
179 tmp[1] =
static_cast<typename VECTOR3::value_type
>(v0[1] + dj * (v2[1] - v0[1]));
180 tmp[2] =
static_cast<typename VECTOR3::value_type
>(v0[2] + dj * (v2[2] - v0[2]));
182 for(
unsigned int i = 0; i<div_per_unit - j; i++)
184 const double di = (double)i / (
double)div_per_unit;
185 typename VECTOR2::value_type &tmp1 = coords[j][e++];
187 tmp1[0] =
static_cast<typename VECTOR3::value_type
>(v0[0] + (dj + d) * (v2[0] - v0[0]) + di * (v1[0] - v0[0]));
188 tmp1[1] =
static_cast<typename VECTOR3::value_type
>(v0[1] + (dj + d) * (v2[1] - v0[1]) + di * (v1[1] - v0[1]));
189 tmp1[2] =
static_cast<typename VECTOR3::value_type
>(v0[2] + (dj + d) * (v2[2] - v0[2]) + di * (v1[2] - v0[2]));
191 typename VECTOR2::value_type &tmp2 = coords[j][e++];
193 tmp2[0] =
static_cast<typename VECTOR3::value_type
>(v0[0] + dj * (v2[0] - v0[0]) + (di + d) * (v1[0] - v0[0]));
194 tmp2[1] =
static_cast<typename VECTOR3::value_type
>(v0[1] + dj * (v2[1] - v0[1]) + (di + d) * (v1[1] - v0[1]));
195 tmp2[2] =
static_cast<typename VECTOR3::value_type
>(v0[2] + dj * (v2[2] - v0[2]) + (di + d) * (v1[2] - v0[2]));
204 template <
class ElemBasis>
207 typedef typename ElemBasis::value_type
T;
213 template <
class ElemData,
class VECTOR>
215 const T& value,
const ElemData &cd)
const
224 template <
class VECTOR>
237 template <
class ElemData,
class VECTOR>
239 VECTOR & guess)
const
241 double dist = DBL_MAX;
248 for (
int x = 1; x < end; x++)
250 coord[0] = x / (double) end;
251 for (
int y = 1; y < end; y++)
253 coord[1] = y / (double) end;
256 for (
int z = 1; z < end; z++)
258 coord[2] = z / (double) end;
266 pElem->derivate(coord, cd, derivs);
301 {1./4., 1./4., 1./4.}};
313 static T GaussianPoints[4][3];
314 static T GaussianWeights[4];
327 {0.138196601125011, 0.138196601125011, 0.138196601125011},
328 {0.585410196624969, 0.138196601125011, 0.138196601125011},
329 {0.138196601125011, 0.585410196624969, 0.138196601125011},
330 {0.138196601125011, 0.138196601125011, 0.585410196624969}};
336 T TetGaussian2<T>::GaussianWeights[] = {.25, .25, .25, .25};
345 static T GaussianPoints[11][3];
346 static T GaussianWeights[11];
351 {0.2500000, 0.2500000, 0.2500000},
352 {0.7857143, 0.07142857, 0.07142857},
353 {0.07142857, 0.7857143, 0.07142857},
354 {0.07142857, 0.07142857, 0.7857143},
355 {0.07142857, 0.07142857, 0.07142857},
356 {0.1005964, 0.1005964, 0.3994034},
357 {0.1005964, 0.3994034, 0.1005964},
358 {0.1005964, 0.3994034, 0.3994034},
359 {0.3994034, 0.1005964, 0.1005964},
360 {0.3994034, 0.1005964, 0.3994034},
361 {0.3994034, 0.3994034, 0.1005964}};
364 T TetGaussian3<T>::GaussianWeights[] = {
378 int TetGaussian3<T>::GaussianNum = 11;
399 template<
class VECTOR>
401 { get_linear_weights(coords,w); }
403 template<
class VECTOR>
405 { get_linear_derivate_weights(coords,w); }
409 template <
class ElemData,
class VECTOR>
413 get_linear_weights(coords, w);
415 return (T)(w[0] * cd.node0() +
422 template <
class ElemData,
class VECTOR1,
class VECTOR2>
424 VECTOR2 &derivs)
const
428 derivs[0] =
static_cast<typename VECTOR2::value_type
>(-1. * cd.node0() + cd.node1());
429 derivs[1] =
static_cast<typename VECTOR2::value_type
>(-1. * cd.node0() + cd.node2());
430 derivs[2] =
static_cast<typename VECTOR2::value_type
>(-1. * cd.node0() + cd.node3());
434 template <
class ElemData,
class VECTOR>
436 const ElemData &cd)
const
439 return CL.
get_coords(
this, coords, value, cd);
443 template <
class ElemData>
446 return get_arc3d_length<CrvGaussian1<double> >(
this, edge, cd);
450 template <
class ElemData>
451 double get_area(
const unsigned face,
const ElemData &cd)
const
453 return get_area3<TriGaussian2<double> >(
this, face, cd);
457 template <
class ElemData>
464 static const std::string type_name(
int n = -1);
477 ASSERT((n >= -1) && n <= 1);
485 static const std::string nm(
"TetLinearLgn");
506 std::string(__FILE__),
Class with weights and coordinates for 3rd order Gaussian integration.
Definition: TetLinearLgn.h:341
static int number_of_vertices()
return number of vertices
Definition: TetLinearLgn.h:74
T interpolate(const VECTOR &coords, const ElemData &cd) const
get value at parametric coordinate
Definition: TetLinearLgn.h:410
static const std::string type_name(int n=-1)
Definition: TetLinearLgn.h:475
double check_zero(const VECTOR &derivs, double epsilon=1e-7)
Definition: Locate.h:709
Class for describing unit geometry of TetLinearLgn.
Definition: TetLinearLgn.h:47
double get_arc_length(const unsigned edge, const ElemData &cd) const
get arc length for edge
Definition: TetLinearLgn.h:444
Definition: Persistent.h:89
static double area(int face)
return area
Definition: TetLinearLgn.h:106
static int number_of_mesh_vertices()
return number of vertices in mesh
Definition: TetLinearLgn.h:78
static int number_of_edges()
return number of edges
Definition: TetLinearLgn.h:82
Definition: TypeDescription.h:45
#define SCISHARE
Definition: share.h:39
std::vector< const TypeDescription * > td_vec
Definition: TypeDescription.h:56
static SCISHARE double unit_vertices[4][3]
Parametric coordinates of vertices of unit edge.
Definition: TetLinearLgn.h:50
Definition: TetElementWeights.h:36
ElemBasis::value_type T
Definition: Locate.h:549
static SCISHARE double unit_center[3]
Center of the unit element.
Definition: TetLinearLgn.h:60
#define ASSERT(condition)
Definition: Assert.h:110
Class for describing interfaces to basis elements.
Definition: Basis.h:48
double get_area(const unsigned face, const ElemData &cd) const
get area
Definition: TetLinearLgn.h:451
Definition: TetLinearLgn.h:205
virtual int begin_class(const std::string &name, int current_version)
Definition: Persistent.cc:143
void approx_face(const unsigned face, const unsigned div_per_unit, VECTOR &coords) const
Definition: TetLinearLgn.h:159
static double domain_size()
return size of the domain
Definition: TetLinearLgn.h:70
const string find_type_name(float *)
Definition: TypeName.cc:63
virtual void io(Piostream &str)
Definition: TetLinearLgn.h:516
bool check_coords(const VECTOR &x) const
Definition: TetLinearLgn.h:225
const char * name[]
Definition: BoostGraphExampleTests.cc:87
TetLinearLgn()
Definition: TetLinearLgn.h:394
static double length(int edge)
Definition: TetLinearLgn.h:97
static int vertices_of_face()
return number of vertices per face
Definition: TetLinearLgn.h:90
Class with weights and coordinates for 1nd order Gaussian integration.
Definition: TetLinearLgn.h:283
Definition: StackVector.h:50
double get_volume(const ElemData &cd) const
get volume
Definition: TetLinearLgn.h:458
T value_type
Definition: TetLinearLgn.h:392
bool get_coords(VECTOR &coords, const T &value, const ElemData &cd) const
get parametric coordinate for value within the element
Definition: TetLinearLgn.h:435
void initial_guess(const ElemBasis *pElem, const T &val, const ElemData &cd, VECTOR &guess) const
find a reasonable initial guess
Definition: TetLinearLgn.h:238
void get_derivate_weights(const VECTOR &coords, double *w) const
Definition: TetLinearLgn.h:404
Class for creating geometrical approximations of Tet meshes.
Definition: TetLinearLgn.h:112
static const std::string make_template_id(const std::string &templateName, const std::string &templateParam)
Definition: TypeName.h:62
virtual ~TetLocate()
Definition: TetLinearLgn.h:210
static T GaussianWeights[1]
Definition: TetLinearLgn.h:288
static int polynomial_order()
Definition: TetLinearLgn.h:397
TetLinearLgnUnitElement()
Definition: TetLinearLgn.h:62
const int TETLINEARLGN_VERSION
Definition: TetLinearLgn.h:513
Class with weights and coordinates for 2nd order Gaussian integration.
Definition: TetLinearLgn.h:309
static int GaussianNum
Definition: TetLinearLgn.h:286
Definition: TetSamplingSchemes.h:42
bool compare_distance(const T &interp, const T &val, double &cur_d, double dist)
Definition: Locate.h:667
static double volume()
return volume
Definition: TetLinearLgn.h:107
virtual void end_class()
Definition: Persistent.cc:178
virtual ~TetLinearLgnUnitElement()
Definition: TetLinearLgn.h:63
static SCISHARE double unit_face_areas[4]
Precalculated area of faces.
Definition: TetLinearLgn.h:58
TetApprox()
Definition: TetLinearLgn.h:115
void resize(size_t size, const value_type &val=value_type())
Definition: StackVector.h:61
ElemBasis::value_type T
Definition: TetLinearLgn.h:207
static SCISHARE double unit_face_normals[4][3]
Normals of unit faces.
Definition: TetLinearLgn.h:56
void get_weights(const VECTOR &coords, double *w) const
Definition: TetLinearLgn.h:400
Definition: TetLinearLgn.h:383
void approx_edge(const unsigned edge, const unsigned div_per_unit, VECTOR &coords) const
Definition: TetLinearLgn.h:122
static int GaussianNum
Definition: TetLinearLgn.h:312
virtual int get_approx_face_elements() const
Definition: TetLinearLgn.h:152
int n
Definition: eab.py:9
static SCISHARE int unit_edges[6][2]
References to vertices of unit edge.
Definition: TetLinearLgn.h:52
static int GaussianNum
Definition: TetLinearLgn.h:344
static int dofs()
return degrees of freedom
Definition: TetLinearLgn.h:86
bool get_iterative(const ElemBasis *pEB, VECTOR &x, const T &value, const ElemData &cd) const
find value in interpolation for given value
Definition: Locate.h:559
static SCISHARE int unit_faces[4][3]
References to vertices of unit face.
Definition: TetLinearLgn.h:54
TetLocate()
Definition: TetLinearLgn.h:209
double get_volume3(const ElemBasis *pEB, const ElemData &cd)
Definition: Locate.h:179
static int faces_of_cell()
return number of faces per cell
Definition: TetLinearLgn.h:94
void derivate(const VECTOR1 &, const ElemData &cd, VECTOR2 &derivs) const
get first derivative at parametric coordinate
Definition: TetLinearLgn.h:423
virtual ~TetApprox()
Definition: TetLinearLgn.h:116
bool get_coords(const ElemBasis *pEB, VECTOR &coords, const T &value, const ElemData &cd) const
find coodinate in interpolation for given value
Definition: TetLinearLgn.h:214
Definition: TypeDescription.h:49
const TypeDescription * get_type_description(Core::Basis::ConstantBasis< T > *)
Definition: Constant.h:209
virtual ~TetLinearLgn()
Definition: TetLinearLgn.h:395
static T GaussianPoints[1][3]
Definition: TetLinearLgn.h:287
static int domain_dimension()
return dimension of domain
Definition: TetLinearLgn.h:66