31 void hermite_compute_coefs(
const Elem * elem, std::vector<std::vector<Real>> & dxdxi
33 , std::vector<Real> & dxdeta, std::vector<Real> & dydxi
39 const int n_mapping_shape_functions =
43 std::vector<Point> dofpt;
44 dofpt.push_back(
Point(-1,-1));
45 dofpt.push_back(
Point(1,1));
47 for (
int p = 0; p != 2; ++p)
55 for (
int i = 0; i != n_mapping_shape_functions; ++i)
58 (mapping_elem_type, mapping_order, i, 0, dofpt[p]);
60 (mapping_elem_type, mapping_order, i, 1, dofpt[p]);
62 dxdxi[0][p] += elem->
point(i)(0) * ddxi;
63 dxdxi[1][p] += elem->
point(i)(1) * ddeta;
66 dxdeta[p] += elem->
point(i)(0) * ddeta;
67 dydxi[p] += elem->
point(i)(1) * ddxi;
71 libmesh_assert(dxdxi[0][p]);
72 libmesh_assert(dxdxi[1][p]);
75 libmesh_assert_less (
std::abs(dxdeta[p]), 1e-9);
76 libmesh_assert_less (
std::abs(dydxi[p]), 1e-9);
83 Real hermite_bases_2D (std::vector<unsigned int> & bases1D,
84 const std::vector<std::vector<Real>> & dxdxi,
112 libmesh_error_msg(
"Invalid basis node = " << i/4);
115 unsigned int basisnum = i%4;
122 coef = dxdxi[0][bases1D[0]];
123 bases1D[0] += 2;
break;
125 coef = dxdxi[1][bases1D[1]];
126 bases1D[1] += 2;
break;
128 coef = dxdxi[0][bases1D[0]] * dxdxi[1][bases1D[1]];
129 bases1D[0] += 2; bases1D[1] += 2;
break;
131 libmesh_error_msg(
"Invalid basisnum = " << basisnum);
135 else if (i < 16 + 4*2*e)
137 unsigned int basisnum = (i - 16) % (2*e);
138 switch ((i - 16) / (2*e))
141 bases1D[0] = basisnum/2 + 4;
142 bases1D[1] = basisnum%2*2;
147 bases1D[0] = basisnum%2*2 + 1;
148 bases1D[1] = basisnum/2 + 4;
153 bases1D[0] = basisnum/2 + 4;
154 bases1D[1] = basisnum%2*2 + 1;
159 bases1D[0] = basisnum%2*2;
160 bases1D[1] = basisnum/2 + 4;
165 libmesh_error_msg(
"Invalid basisnum = " << basisnum);
171 unsigned int basisnum = i - 16 - 8*e;
177 libmesh_assert(coef);
194 libmesh_error_msg(
"Hermite elements require the real element \nto construct gradient-based degrees of freedom.");
203 const unsigned int i,
206 libmesh_assert(elem);
208 std::vector<std::vector<Real>> dxdxi(2, std::vector<Real>(2, 0));
211 std::vector<Real> dxdeta(2), dydxi(2);
214 hermite_compute_coefs(elem,dxdxi
228 libmesh_assert_less (totalorder, 4);
229 libmesh_fallthrough();
234 libmesh_assert_less (i, (totalorder+1u)*(totalorder+1u));
236 std::vector<unsigned int> bases1D;
238 Real coef = hermite_bases_2D(bases1D, dxdxi, totalorder, i);
244 libmesh_error_msg(
"ERROR: Unsupported element type = " << type);
257 libmesh_error_msg(
"Hermite elements require the real element \nto construct gradient-based degrees of freedom.");
266 const unsigned int i,
267 const unsigned int j,
270 libmesh_assert(elem);
271 libmesh_assert (j == 0 || j == 1);
273 std::vector<std::vector<Real>> dxdxi(2, std::vector<Real>(2, 0));
276 std::vector<Real> dxdeta(2), dydxi(2);
279 hermite_compute_coefs(elem,dxdxi
293 libmesh_assert_less (totalorder, 4);
294 libmesh_fallthrough();
299 libmesh_assert_less (i, (totalorder+1u)*(totalorder+1u));
301 std::vector<unsigned int> bases1D;
303 Real coef = hermite_bases_2D(bases1D, dxdxi, totalorder, i);
316 libmesh_error_msg(
"Invalid derivative index j = " << j);
320 libmesh_error_msg(
"ERROR: Unsupported element type = " << type);
329 const unsigned int i,
330 const unsigned int j,
333 libmesh_assert(elem);
334 libmesh_assert (j == 0 || j == 1 || j == 2);
336 std::vector<std::vector<Real>> dxdxi(2, std::vector<Real>(2, 0));
339 std::vector<Real> dxdeta(2), dydxi(2);
342 hermite_compute_coefs(elem,dxdxi
356 libmesh_assert_less (totalorder, 4);
357 libmesh_fallthrough();
362 libmesh_assert_less (i, (totalorder+1u)*(totalorder+1u));
364 std::vector<unsigned int> bases1D;
366 Real coef = hermite_bases_2D(bases1D, dxdxi, totalorder, i);
383 libmesh_error_msg(
"Invalid derivative index j = " << j);
387 libmesh_error_msg(
"ERROR: Unsupported element type = " << type);
static OutputShape shape(const ElemType t, const Order o, const unsigned int i, const Point &p)
The base class for all geometric element types.
static OutputShape shape_deriv(const ElemType t, const Order o, const unsigned int i, const unsigned int j, const Point &p)
unsigned int p_level() const
static Real hermite_raw_shape_second_deriv(const unsigned int basis_num, const Real xi)
static Real hermite_raw_shape(const unsigned int basis_num, const Real xi)
const unsigned char square_number_column[]
virtual unsigned int n_shape_functions() const override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const unsigned char square_number_row[]
static Real hermite_raw_shape_deriv(const unsigned int basis_num, const Real xi)
virtual Order default_order() const =0
virtual ElemType type() const =0
A geometric point in (x,y,z) space.
const Point & point(const unsigned int i) const
static OutputShape shape_second_deriv(const ElemType t, const Order o, const unsigned int i, const unsigned int j, const Point &p)