37 #ifndef CORE_BASIS_TRICUBICHMTSCALEFACTORS_H
38 #define CORE_BASIS_TRICUBICHMTSCALEFACTORS_H 1
53 static int dofs() {
return 12; }
77 template<
class VECTOR>
78 inline void get_weights(
const VECTOR& coords,
double *w)
const
81 template<
class VECTOR>
87 template <
class ElemData,
class VECTOR>
91 unsigned int elem=cd.elem_index();
92 const double x=
static_cast<double>(coords[0]), y=static_cast<double>(coords[1]);
93 const double x2=x*x, x3=x2*x, y2=y*y, y3=y2*y;
104 const double sdxy1=this->scalefactors_[elem][0]*this->scalefactors_[elem][1];
105 const double sdxy2=this->scalefactors_[elem][0]*this->scalefactors_[elem][1];
108 w[0] = (-1 + x + y)*(-1 - x + 2*x2 - y - 2*x*y + 2*y2);
109 w[1] = x*(1 - 2*x + x2 - 3*y2 + 2*y3)*sdx0;
110 w[2] = y*(1 - 3*x2 + 2*x3 - 2*y + y2)*sdy0;
111 w[3] = x*y*(1 - 2*x + x2 - 2*y + y2)*sdxy0;
112 w[4] = -(x2*(-3 + 2*x));
113 w[5] = (-1 + x)*x2*sdx1;
114 w[6] = -(x2*(-3 + 2*x)*y)*sdy1;
115 w[7] = (-1 + x)*x2*y*sdxy1;
116 w[8] = -y2*(-3 + 2*y);
117 w[9] = -(x*y2*(-3 + 2*y))*sdx2;
118 w[10] = (-1 + y)*y2*sdy2;
119 w[11] = x*(-1 + y)*y2*sdxy2;
121 return (T)(w[0] * cd.node0()
122 +w[1] * this->
derivs_[cd.node0_index()][0]
123 +w[2] * this->
derivs_[cd.node0_index()][1]
124 +w[3] * this->
derivs_[cd.node0_index()][2]
126 +w[5] * this->
derivs_[cd.node1_index()][0]
127 +w[6] * this->
derivs_[cd.node1_index()][1]
128 +w[7] * this->
derivs_[cd.node1_index()][2]
130 +w[9] * this->
derivs_[cd.node2_index()][0]
131 +w[10] * this->
derivs_[cd.node2_index()][1]
132 +w[11] * this->
derivs_[cd.node2_index()][2]);
138 template <
class ElemData,
class VECTOR1,
class VECTOR2>
139 void derivate(
const VECTOR1 &coords,
const ElemData &cd,
140 VECTOR2 &derivs)
const
143 unsigned elem=cd.elem_index();
144 const double x=
static_cast<double>(coords[0]), y=static_cast<double>(coords[1]);
145 const double x2=x*x, x3=x2*x, y2=y*y;
146 const double y12=(y-1)*(y-1);
157 const double sdxy1=this->scalefactors_[elem][0]*this->scalefactors_[elem][1];
158 const double sdxy2=this->scalefactors_[elem][0]*this->scalefactors_[elem][1];
161 w[1] = (-4*x + 3*x2 + y12*(1 + 2*y))*sdx0;
162 w[2] = 6*(-1 + x)*x*y*sdy0;
163 w[3] = (-4*x + 3*x2 + y12)*y*sdxy0;
164 w[4] = -6*(-1 + x)*x;
165 w[5] = x*(-2 + 3*x)*sdx1;
166 w[6] = -6*(-1 + x)*x*y*sdy1;
167 w[7] = x*(-2 + 3*x)*y*sdxy1;
169 w[9] = (3 - 2*y)*y2*sdx2;
171 w[11] = (-1 + y)*y2*sdxy2;
173 w[12] = 6*(-1 + y)*y;
174 w[13] = 6*x*(-1 + y)*y*sdx0;
175 w[14] = (1 - 3*x2 + 2*x3 - 4*y + 3*y2)*sdy0;
176 w[15] = x*(1 - 2*x + x2 - 4*y + 3*y2)*sdxy0;
179 w[18] = (3 - 2*x)*x2*sdy1;
180 w[19] = (-1 + x)*x2*sdxy1;
181 w[20] = -6*(-1 + y)*y;
182 w[21] = -6*x*(-1 + y)*sdx2;
183 w[22] = y*(-2 + 3*y)*sdy2;
184 w[23] = x*y*(-2 + 3*y)*sdxy2;
187 derivs[0]=
static_cast<typename VECTOR2::value_type
>(w[0] * cd.node0()
188 +w[1] * this->
derivs_[cd.node0_index()][0]
189 +w[2] * this->
derivs_[cd.node0_index()][1]
190 +w[3] * this->
derivs_[cd.node0_index()][2]
192 +w[5] * this->
derivs_[cd.node1_index()][0]
193 +w[6] * this->
derivs_[cd.node1_index()][1]
194 +w[7] * this->
derivs_[cd.node1_index()][2]
196 +w[9] * this->
derivs_[cd.node2_index()][0]
197 +w[10] * this->
derivs_[cd.node2_index()][1]
198 +w[11] * this->
derivs_[cd.node2_index()][2]);
200 derivs[1]=
static_cast<typename VECTOR2::value_type
>(w[12] * cd.node0()
201 +w[13] * this->
derivs_[cd.node0_index()][0]
202 +w[14] * this->
derivs_[cd.node0_index()][1]
203 +w[15] * this->
derivs_[cd.node0_index()][2]
205 +w[17] * this->
derivs_[cd.node1_index()][0]
206 +w[18] * this->
derivs_[cd.node1_index()][1]
207 +w[19] * this->
derivs_[cd.node1_index()][2]
209 +w[21] * this->
derivs_[cd.node2_index()][0]
210 +w[22] * this->
derivs_[cd.node2_index()][1]
211 +w[23] * this->
derivs_[cd.node2_index()][2]);
215 template <
class ElemData,
class VECTOR>
217 const ElemData &cd)
const
220 return CL.
get_coords(
this, coords, value, cd);
224 template <
class ElemData>
227 return get_arc2d_length<CrvGaussian2<double> >(
this, edge, cd);
231 template <
class ElemData>
232 double get_area(
const unsigned face,
const ElemData &cd)
const
234 return get_area2<TriGaussian3<double> >(
this, face, cd);
238 template <
class ElemData>
245 static const std::string
type_name(
int n = -1);
260 ASSERT((n >= -1) && n <= 1);
268 static const std::string nm(
"TriCubicHmtScaleFactors");
290 std::string(__FILE__),
304 Pio(stream, this->derivs_);
305 Pio(stream, this->scalefactors_);
const int TRICUBICHMTSCALEFACTORS_VERSION
Definition: TriCubicHmtScaleFactors.h:297
void get_cubic_derivate_weights(const VECTOR &coords, double *w) const
get derivative weight factors at parametric coordinate
Definition: TriElementWeights.h:116
void get_weights(const VECTOR &coords, double *w) const
Definition: TriCubicHmtScaleFactors.h:78
bool get_coords(const ElemBasis *pEB, VECTOR &coords, const T &value, const ElemData &cd) const
find value in interpolation for given value
Definition: TriLinearLgn.h:194
void derivate(const VECTOR1 &coords, const ElemData &cd, VECTOR2 &derivs) const
get first derivative at parametric coordinate
Definition: TriCubicHmtScaleFactors.h:139
Definition: Persistent.h:89
Class for creating geometrical approximations of Tri meshes.
Definition: TriLinearLgn.h:109
T interpolate(const VECTOR &coords, const ElemData &cd) const
get value at parametric coordinate
Definition: TriCubicHmtScaleFactors.h:88
Definition: TypeDescription.h:45
std::vector< const TypeDescription * > td_vec
Definition: TypeDescription.h:56
#define ASSERT(condition)
Definition: Assert.h:110
Class for describing unit geometry of TetCubicHmt.
Definition: TriCubicHmtScaleFactors.h:48
virtual int begin_class(const std::string &name, int current_version)
Definition: Persistent.cc:143
static int dofs()
return degrees of freedom
Definition: TriCubicHmtScaleFactors.h:53
const string find_type_name(float *)
Definition: TypeName.cc:63
const char * name[]
Definition: BoostGraphExampleTests.cc:87
Persistent i/o for STL containers.
std::vector< std::vector< double > > scalefactors_
Definition: Basis.h:161
static int polynomial_order()
Definition: TriCubicHmtScaleFactors.h:73
void get_cubic_weights(const VECTOR &coords, double *w) const
Definition: TriElementWeights.h:95
void get_derivate_weights(const VECTOR &coords, double *w) const
Definition: TriCubicHmtScaleFactors.h:82
static const std::string type_name(int n=-1)
Definition: TriCubicHmtScaleFactors.h:258
static const std::string make_template_id(const std::string &templateName, const std::string &templateParam)
Definition: TypeName.h:62
double get_arc_length(const unsigned edge, const ElemData &cd) const
get arc length for edge
Definition: TriCubicHmtScaleFactors.h:225
double get_area(const unsigned face, const ElemData &cd) const
get area
Definition: TriCubicHmtScaleFactors.h:232
Class for describing unit geometry of TriLinearLgn.
Definition: TriLinearLgn.h:46
T value_type
Definition: TriCubicHmtScaleFactors.h:68
Definition: TriElementWeights.h:36
double get_volume(const ElemData &) const
get volume
Definition: TriCubicHmtScaleFactors.h:239
void Pio(Piostream &stream, Array1< T > &array)
Definition: Array1.h:65
std::vector< std::vector< T > > derivs_
Definition: Basis.h:160
virtual void end_class()
Definition: Persistent.cc:178
TriCubicHmtScaleFactors()
Definition: TriCubicHmtScaleFactors.h:70
virtual ~TriCubicScaleFactorsHmtUnitElement()
Definition: TriCubicHmtScaleFactors.h:51
Definition: TriSamplingSchemes.h:43
int n
Definition: eab.py:9
virtual void io(Piostream &str)
Definition: TriCubicHmtScaleFactors.h:300
bool get_coords(VECTOR &coords, const T &value, const ElemData &cd) const
get the parametric coordinate for value within the element.
Definition: TriCubicHmtScaleFactors.h:216
Class with weights and coordinates for 3rd order Gaussian integration.
Definition: TriLinearLgn.h:292
virtual ~TriCubicHmtScaleFactors()
Definition: TriCubicHmtScaleFactors.h:71
Definition: TriLinearLgn.h:185
Definition: TriCubicHmtScaleFactors.h:60
TriCubicScaleFactorsHmtUnitElement()
Definition: TriCubicHmtScaleFactors.h:50
Definition: TypeDescription.h:49
const TypeDescription * get_type_description(Core::Basis::ConstantBasis< T > *)
Definition: Constant.h:209