21 #ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES 39 libmesh_error_msg(
"Bernstein polynomials require the element type \nbecause edge orientation is needed.");
70 const Real eta = p(1);
72 libmesh_assert_less (i, (totalorder+1u)*(totalorder+1u));
93 else if (i < totalorder + 3u)
94 { i0 = i - 2; i1 = 0; }
95 else if (i < 2u*totalorder + 2)
96 { i0 = 1; i1 = i - totalorder - 1; }
97 else if (i < 3u*totalorder + 1)
98 { i0 = i - 2u*totalorder; i1 = 1; }
99 else if (i < 4u*totalorder)
100 { i0 = 0; i1 = i - 3u*totalorder + 1; }
104 unsigned int basisnum = i - 4*totalorder;
112 if ((i>= 4 && i<= 4+ totalorder-2u) && elem->
point(0) > elem->
point(1)) i0=totalorder+2-i0;
113 else if ((i>= 4+ totalorder-1u && i<= 4+2*totalorder-3u) && elem->
point(1) > elem->
point(2)) i1=totalorder+2-i1;
114 else if ((i>= 4+2*totalorder-2u && i<= 4+3*totalorder-4u) && elem->
point(3) > elem->
point(2)) i0=totalorder+2-i0;
115 else if ((i>= 4+3*totalorder-3u && i<= 4+4*totalorder-5u) && elem->
point(0) > elem->
point(3)) i1=totalorder+2-i1;
125 libmesh_assert_less (totalorder, 3);
127 const Real xi = p(0);
128 const Real eta = p(1);
130 libmesh_assert_less (i, 8);
133 static const unsigned int i0[] = {0, 1, 1, 0, 2, 1, 2, 0, 2};
134 static const unsigned int i1[] = {0, 0, 1, 1, 0, 2, 1, 2, 2};
135 static const Real scal[] = {-0.25, -0.25, -0.25, -0.25, 0.5, 0.5, 0.5, 0.5};
148 libmesh_assert_less (totalorder, 2);
149 libmesh_fallthrough();
159 libmesh_assert_less (i, 3);
168 libmesh_error_msg(
"Invalid shape function index i = " << i);
177 libmesh_assert_less (i, 6);
185 case 3:
return 2.*x*r;
186 case 4:
return 2.*x*y;
187 case 5:
return 2.*r*y;
190 libmesh_error_msg(
"Invalid shape function index i = " << i);
198 libmesh_assert_less (i, 10);
200 unsigned int shape=i;
203 if ((i==3||i==4) && elem->
point(0) > elem->
point(1)) shape=7-i;
204 if ((i==5||i==6) && elem->
point(1) > elem->
point(2)) shape=11-i;
205 if ((i==7||i==8) && elem->
point(0) > elem->
point(2)) shape=15-i;
209 case 0:
return r*r*r;
210 case 1:
return x*x*x;
211 case 2:
return y*y*y;
213 case 3:
return 3.*x*r*r;
214 case 4:
return 3.*x*x*r;
216 case 5:
return 3.*y*x*x;
217 case 6:
return 3.*y*y*x;
219 case 7:
return 3.*y*r*r;
220 case 8:
return 3.*y*y*r;
222 case 9:
return 6.*x*y*r;
225 libmesh_error_msg(
"Invalid shape function index shape = " << shape);
233 unsigned int shape=i;
235 libmesh_assert_less (i, 15);
237 if ((i==3||i== 5) && elem->
point(0) > elem->
point(1)) shape=8-i;
238 if ((i==6||i== 8) && elem->
point(1) > elem->
point(2)) shape=14-i;
239 if ((i==9||i==11) && elem->
point(0) > elem->
point(2)) shape=20-i;
245 case 0:
return r*r*r*r;
246 case 1:
return x*x*x*x;
247 case 2:
return y*y*y*y;
250 case 3:
return 4.*x*r*r*r;
251 case 4:
return 6.*x*x*r*r;
252 case 5:
return 4.*x*x*x*r;
254 case 6:
return 4.*y*x*x*x;
255 case 7:
return 6.*y*y*x*x;
256 case 8:
return 4.*y*y*y*x;
258 case 9:
return 4.*y*r*r*r;
259 case 10:
return 6.*y*y*r*r;
260 case 11:
return 4.*y*y*y*r;
263 case 12:
return 12.*x*y*r*r;
264 case 13:
return 12.*x*x*y*r;
265 case 14:
return 12.*x*y*y*r;
268 libmesh_error_msg(
"Invalid shape function index shape = " << shape);
276 unsigned int shape=i;
278 libmesh_assert_less (i, 21);
280 if ((i>= 3&&i<= 6) && elem->
point(0) > elem->
point(1)) shape=9-i;
281 if ((i>= 7&&i<=10) && elem->
point(1) > elem->
point(2)) shape=17-i;
282 if ((i>=11&&i<=14) && elem->
point(0) > elem->
point(2)) shape=25-i;
287 case 0:
return pow<5>(r);
288 case 1:
return pow<5>(x);
289 case 2:
return pow<5>(y);
292 case 3:
return 5.*x *pow<4>(r);
293 case 4:
return 10.*pow<2>(x)*pow<3>(r);
294 case 5:
return 10.*pow<3>(x)*pow<2>(r);
295 case 6:
return 5.*pow<4>(x)*r;
297 case 7:
return 5.*y *pow<4>(x);
298 case 8:
return 10.*pow<2>(y)*pow<3>(x);
299 case 9:
return 10.*pow<3>(y)*pow<2>(x);
300 case 10:
return 5.*pow<4>(y)*x;
302 case 11:
return 5.*y *pow<4>(r);
303 case 12:
return 10.*pow<2>(y)*pow<3>(r);
304 case 13:
return 10.*pow<3>(y)*pow<2>(r);
305 case 14:
return 5.*pow<4>(y)*r;
308 case 15:
return 20.*x*y*pow<3>(r);
309 case 16:
return 30.*x*pow<2>(y)*pow<2>(r);
310 case 17:
return 30.*pow<2>(x)*y*pow<2>(r);
311 case 18:
return 20.*x*pow<3>(y)*r;
312 case 19:
return 20.*pow<3>(x)*y*r;
313 case 20:
return 30.*pow<2>(x)*pow<2>(y)*r;
316 libmesh_error_msg(
"Invalid shape function index shape = " << shape);
324 unsigned int shape=i;
326 libmesh_assert_less (i, 28);
328 if ((i>= 3&&i<= 7) && elem->
point(0) > elem->
point(1)) shape=10-i;
329 if ((i>= 8&&i<=12) && elem->
point(1) > elem->
point(2)) shape=20-i;
330 if ((i>=13&&i<=17) && elem->
point(0) > elem->
point(2)) shape=30-i;
335 case 0:
return pow<6>(r);
336 case 1:
return pow<6>(x);
337 case 2:
return pow<6>(y);
340 case 3:
return 6.*x *pow<5>(r);
341 case 4:
return 15.*pow<2>(x)*pow<4>(r);
342 case 5:
return 20.*pow<3>(x)*pow<3>(r);
343 case 6:
return 15.*pow<4>(x)*pow<2>(r);
344 case 7:
return 6.*pow<5>(x)*r;
346 case 8:
return 6.*y *pow<5>(x);
347 case 9:
return 15.*pow<2>(y)*pow<4>(x);
348 case 10:
return 20.*pow<3>(y)*pow<3>(x);
349 case 11:
return 15.*pow<4>(y)*pow<2>(x);
350 case 12:
return 6.*pow<5>(y)*x;
352 case 13:
return 6.*y *pow<5>(r);
353 case 14:
return 15.*pow<2>(y)*pow<4>(r);
354 case 15:
return 20.*pow<3>(y)*pow<3>(r);
355 case 16:
return 15.*pow<4>(y)*pow<2>(r);
356 case 17:
return 6.*pow<5>(y)*r;
359 case 18:
return 30.*x*y*pow<4>(r);
360 case 19:
return 60.*x*pow<2>(y)*pow<3>(r);
361 case 20:
return 60.* pow<2>(x)*y*pow<3>(r);
362 case 21:
return 60.*x*pow<3>(y)*pow<2>(r);
363 case 22:
return 60.*pow<3>(x)*y*pow<2>(r);
364 case 23:
return 90.*pow<2>(x)*pow<2>(y)*pow<2>(r);
365 case 24:
return 30.*x*pow<4>(y)*r;
366 case 25:
return 60.*pow<2>(x)*pow<3>(y)*r;
367 case 26:
return 60.*pow<3>(x)*pow<2>(y)*r;
368 case 27:
return 30.*pow<4>(x)*y*r;
371 libmesh_error_msg(
"Invalid shape function index shape = " << shape);
375 libmesh_error_msg(
"Invalid totalorder = " << totalorder);
379 libmesh_error_msg(
"ERROR: Unsupported element type = " << type);
392 libmesh_error_msg(
"Bernstein polynomials require the element type \nbecause edge orientation is needed.");
401 const unsigned int i,
402 const unsigned int j,
405 libmesh_assert(elem);
418 const Real xi = p(0);
419 const Real eta = p(1);
421 libmesh_assert_less (i, (totalorder+1u)*(totalorder+1u));
437 else if (i < totalorder + 3u)
438 { i0 = i - 2; i1 = 0; }
439 else if (i < 2u*totalorder + 2)
440 { i0 = 1; i1 = i - totalorder - 1; }
441 else if (i < 3u*totalorder + 1)
442 { i0 = i - 2u*totalorder; i1 = 1; }
443 else if (i < 4u*totalorder)
444 { i0 = 0; i1 = i - 3u*totalorder + 1; }
448 unsigned int basisnum = i - 4*totalorder;
456 if ((i>= 4 && i<= 4+ totalorder-2u) && elem->
point(0) > elem->
point(1)) i0=totalorder+2-i0;
457 else if ((i>= 4+ totalorder-1u && i<= 4+2*totalorder-3u) && elem->
point(1) > elem->
point(2)) i1=totalorder+2-i1;
458 else if ((i>= 4+2*totalorder-2u && i<= 4+3*totalorder-4u) && elem->
point(3) > elem->
point(2)) i0=totalorder+2-i0;
459 else if ((i>= 4+3*totalorder-3u && i<= 4+4*totalorder-5u) && elem->
point(0) > elem->
point(3)) i1=totalorder+2-i1;
474 libmesh_error_msg(
"Invalid shape function derivative j = " << j);
483 libmesh_assert_less (totalorder, 3);
485 const Real xi = p(0);
486 const Real eta = p(1);
488 libmesh_assert_less (i, 8);
491 static const unsigned int i0[] = {0, 1, 1, 0, 2, 1, 2, 0, 2};
492 static const unsigned int i1[] = {0, 0, 1, 1, 0, 2, 1, 2, 2};
493 static const Real scal[] = {-0.25, -0.25, -0.25, -0.25, 0.5, 0.5, 0.5, 0.5};
513 libmesh_error_msg(
"Invalid shape function derivative j = " << j);
519 libmesh_assert_less (totalorder, 2);
520 libmesh_fallthrough();
525 const Real eps = 1.e-6;
532 const Point pp(p(0)+eps, p(1));
533 const Point pm(p(0)-eps, p(1));
542 const Point pp(p(0), p(1)+eps);
543 const Point pm(p(0), p(1)-eps);
551 libmesh_error_msg(
"Invalid shape function derivative j = " << j);
556 libmesh_error_msg(
"ERROR: Unsupported element type = " << type);
569 static bool warning_given =
false;
572 libMesh::err <<
"Second derivatives for Bernstein elements " 573 <<
"are not yet implemented!" 576 warning_given =
true;
589 static bool warning_given =
false;
592 libMesh::err <<
"Second derivatives for Bernstein elements " 593 <<
"are not yet implemented!" 596 warning_given =
true;
603 #endif// LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
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
const unsigned char square_number_column[]
Template class which generates the different FE families and orders.
OStreamProxy err(std::cerr)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const unsigned char square_number_row[]
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)