369 {
370 _mesh = std::make_unique<Mesh>(*TestCommWorld);
372 const unsigned int build_ny = (
_dim > 1) * build_nx;
373 const unsigned int build_nz = (
_dim > 2) * build_nx;
374
375 unsigned char weight_index = 0;
376
378 {
379
380 _mesh->add_node_integer(
"buffer integer");
381
382
383
384 const Real default_weight = 1.0;
385 weight_index = cast_int<unsigned char>
386 (
_mesh->add_node_datum<
Real>(
"rational_weight",
true,
387 &default_weight));
388 libmesh_assert_not_equal_to(weight_index, 0);
389
390
391
392
393 _mesh->set_default_mapping_data(weight_index);
394 }
395
397 {
398
399
400
401
407
408 std::unique_ptr<Elem> polygon = std::make_unique<C0Polygon>(5);
410 polygon->set_node(i,
_mesh->node_ptr(i));
411 polygon->set_id() = 0;
412
413 _mesh->add_elem(std::move(polygon));
414 _mesh->prepare_for_use();
415 }
417 {
418
419
420
421
422
423
424
433
434
435 std::vector<std::vector<unsigned int>> nodes_on_side;
437 nodes_on_side = { {0, 1, 2, 3},
438 {0, 1, 5, 4},
439 {2, 6, 5, 1},
440 {2, 3, 7, 6},
441 {0, 4, 7, 3},
442 {5, 6, 7, 4} };
444 nodes_on_side = { {0, 1, 2, 3},
445 {0, 1, 5, 4},
446 {1, 2, 6, 5},
447 {2, 3, 7, 6},
448 {3, 0, 4, 7},
449 {4, 5, 6, 7} };
450 else
451 libmesh_error_msg(
"Unknown case name: " +
_case_name);
452
453
454 std::vector<std::shared_ptr<Polygon>> sides(nodes_on_side.size());
455
457 {
458 const auto & nodes_on_s = nodes_on_side[s];
459 sides[s] = std::make_shared<C0Polygon>(nodes_on_s.size());
461 sides[s]->set_node(i,
_mesh->node_ptr(nodes_on_s[i]));
462 }
463
464 std::unique_ptr<libMesh::Node> mid_elem_node;
465 std::unique_ptr<Elem> polyhedron = std::make_unique<C0Polyhedron>(sides, mid_elem_node);
466 _mesh->add_elem(std::move(polyhedron));
467 if (mid_elem_node)
468 _mesh->add_node(std::move(mid_elem_node));
469 _mesh->prepare_for_use();
470 }
471 else
472 {
474 build_nx, build_ny, build_nz,
475 0., 1., 0., 1., 0., 1.,
476 elem_type);
477 }
478
479
480
481
482#if 0
484 {
486 if (elem && elem->
id())
487 _mesh->delete_elem(elem);
488 }
489 _mesh->prepare_for_use();
491#endif
492
493
494
495
496
497
498
501 {
503
504
508
511 }
512
513
515 {
516 for (
auto elem :
_mesh->active_element_ptr_range())
517 {
518
520
522 const unsigned int nn = elem->
n_nodes();
523
524
525 const unsigned int n_edges =
526 (elem->
type() ==
EDGE3) ? 1 : elem->n_edges();
527 const unsigned int n_faces =
528 (elem->
type() ==
QUAD9) ? 1 : elem->n_faces();
529 const unsigned int nve = std::min(nv + n_edges, nn);
530 const unsigned int nvef = std::min(nve + n_faces, nn);
531
532 for (unsigned int i = 0; i != nv; ++i)
534 for (unsigned int i = nv; i != nve; ++i)
537 for (unsigned int i = nve; i != nvef; ++i)
540 for (unsigned int i = nvef; i != nn; ++i)
542 }
543 }
544
545 _mesh->complete_preparation();
546 _es = std::make_unique<EquationSystems>(*
_mesh);
550
552 {
554 }
555 else if (order > 3)
556 {
558 }
559
560
561 else if (FE_CAN_TEST_CUBIC)
562 {
564 }
565 else if (order > 1)
566 {
568 }
569 else
570 {
572 }
573
576
577
579 _fe->attach_quadrature_rule(
_qrule.get());
580
581 auto rng =
_mesh->active_local_element_ptr_range();
582 this->
_elem = rng.begin() == rng.end() ? nullptr : *(rng.begin());
583
585
589
591
592
593
594
595
596
598
600
601
602
603
605
606
607
608
609
610
611
613 Real t_prev = 1, t = x;
614 for (unsigned int k = 1; k < static_cast<unsigned int>(order); ++k)
615 t_prev = std::exchange(t, 2 * x * t - t_prev);
617
618
622#if LIBMESH_DIM > 1
624#endif
625#if LIBMESH_DIM > 2
627#endif
628
629#if LIBMESH_ENABLE_SECOND_DERIVATIVES
630
631
633 return;
634
637#if LIBMESH_DIM > 1
638 _fe->get_d2phidxdy();
640#endif
641#if LIBMESH_DIM > 2
642 _fe->get_d2phidxdz();
643 _fe->get_d2phidydz();
645#endif
646
647#endif
648 }
Real _past_vertex_tol_factor
The factor by which the tolerances grow at the points past the vertices.
std::string _case_name
Name of the case, can be used in the test to switch cases.
std::unique_ptr< EquationSystems > _es
std::unique_ptr< Mesh > _mesh
std::unique_ptr< QGauss > _qrule
Real _past_vertex_offset
The offset, as a fraction of an edge, of the points past the vertices.
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
void set_extra_datum(const unsigned int index, const T value)
Sets the value on this object of the extra datum associated with index, which should have been obtain...
This is the base class from which all geometric element types are derived.
virtual unsigned int n_vertices() const =0
const Node & node_ref(const unsigned int i) const
virtual unsigned int n_nodes() const =0
static const unsigned int type_to_dim_map[INVALID_ELEM]
This array maps the integer representation of the ElemType enum to the geometric dimension of the ele...
virtual ElemType type() const =0
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
Order default_quadrature_order() const
Manages consistently variables, degrees of freedom, and coefficient vectors.
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, std::optional< ConstElemRange > active_local_range=std::nullopt, std::optional< std::vector< unsigned int > > variable_numbers=std::nullopt) const
Projects arbitrary functions onto the current solution.
const FEType & variable_type(const unsigned int i) const
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
const DofMap & get_dof_map() const
static const Real rational_w
Gradient quadratic_test_grad(const Point &p, const Parameters &, const std::string &, const std::string &)
Number quadratic_test(const Point &p, const Parameters &, const std::string &, const std::string &)
Gradient fe_quartic_test_grad(const Point &p, const Parameters &, const std::string &, const std::string &)
Gradient linear_test_grad(const Point &, const Parameters &, const std::string &, const std::string &)
Gradient rational_test_grad(const Point &p, const Parameters &, const std::string &, const std::string &)
Gradient fe_cubic_test_grad(const Point &p, const Parameters &, const std::string &, const std::string &)
Number linear_test(const Point &p, const Parameters &, const std::string &, const std::string &)
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...