368 {
369 _mesh = std::make_unique<Mesh>(*TestCommWorld);
371 const unsigned int build_ny = (
_dim > 1) * build_nx;
372 const unsigned int build_nz = (
_dim > 2) * build_nx;
373
374 unsigned char weight_index = 0;
375
377 {
378
379 _mesh->add_node_integer(
"buffer integer");
380
381
382
383 const Real default_weight = 1.0;
384 weight_index = cast_int<unsigned char>
385 (
_mesh->add_node_datum<
Real>(
"rational_weight",
true,
386 &default_weight));
387 libmesh_assert_not_equal_to(weight_index, 0);
388
389
390
391
392 _mesh->set_default_mapping_data(weight_index);
393 }
394
396 {
397
398
399
400
406
407 std::unique_ptr<Elem> polygon = std::make_unique<C0Polygon>(5);
409 polygon->set_node(i,
_mesh->node_ptr(i));
410 polygon->set_id() = 0;
411
412 _mesh->add_elem(std::move(polygon));
413 _mesh->prepare_for_use();
414 }
416 {
417
418
419
420
421
422
423
432
433
434 std::vector<std::vector<unsigned int>> nodes_on_side;
436 nodes_on_side = { {0, 1, 2, 3},
437 {0, 1, 5, 4},
438 {2, 6, 5, 1},
439 {2, 3, 7, 6},
440 {0, 4, 7, 3},
441 {5, 6, 7, 4} };
443 nodes_on_side = { {0, 1, 2, 3},
444 {0, 1, 5, 4},
445 {1, 2, 6, 5},
446 {2, 3, 7, 6},
447 {3, 0, 4, 7},
448 {4, 5, 6, 7} };
449 else
450 libmesh_error_msg(
"Unknown case name: " +
_case_name);
451
452
453 std::vector<std::shared_ptr<Polygon>> sides(nodes_on_side.size());
454
456 {
457 const auto & nodes_on_s = nodes_on_side[s];
458 sides[s] = std::make_shared<C0Polygon>(nodes_on_s.size());
460 sides[s]->set_node(i,
_mesh->node_ptr(nodes_on_s[i]));
461 }
462
463 std::unique_ptr<libMesh::Node> mid_elem_node;
464 std::unique_ptr<Elem> polyhedron = std::make_unique<C0Polyhedron>(sides, mid_elem_node);
465 _mesh->add_elem(std::move(polyhedron));
466 if (mid_elem_node)
467 _mesh->add_node(std::move(mid_elem_node));
468 _mesh->prepare_for_use();
469 }
470 else
471 {
473 build_nx, build_ny, build_nz,
474 0., 1., 0., 1., 0., 1.,
475 elem_type);
476 }
477
478
479
480
481#if 0
483 {
485 if (elem && elem->
id())
486 _mesh->delete_elem(elem);
487 }
488 _mesh->prepare_for_use();
490#endif
491
492
493
494
495
496
497
500 {
502
503
507
510 }
511
512
514 {
515 for (
auto elem :
_mesh->active_element_ptr_range())
516 {
517
519
521 const unsigned int nn = elem->
n_nodes();
522
523
524 const unsigned int n_edges =
525 (elem->
type() ==
EDGE3) ? 1 : elem->n_edges();
526 const unsigned int n_faces =
527 (elem->
type() ==
QUAD9) ? 1 : elem->n_faces();
528 const unsigned int nve = std::min(nv + n_edges, nn);
529 const unsigned int nvef = std::min(nve + n_faces, nn);
530
531 for (unsigned int i = 0; i != nv; ++i)
533 for (unsigned int i = nv; i != nve; ++i)
536 for (unsigned int i = nve; i != nvef; ++i)
539 for (unsigned int i = nvef; i != nn; ++i)
541 }
542 }
543
544 _mesh->complete_preparation();
545 _es = std::make_unique<EquationSystems>(*
_mesh);
549
551 {
553 }
554 else if (order > 3)
555 {
557 }
558
559
560 else if (FE_CAN_TEST_CUBIC)
561 {
563 }
564 else if (order > 1)
565 {
567 }
568 else
569 {
571 }
572
575
576
578 _fe->attach_quadrature_rule(
_qrule.get());
579
580 auto rng =
_mesh->active_local_element_ptr_range();
581 this->
_elem = rng.begin() == rng.end() ? nullptr : *(rng.begin());
582
584
588
590
591
592
593
594
595
597
599
600
601
602
604
605
606
607
608
609
610
612 Real t_prev = 1, t = x;
613 for (unsigned int k = 1; k < static_cast<unsigned int>(order); ++k)
614 t_prev = std::exchange(t, 2 * x * t - t_prev);
616
617
621#if LIBMESH_DIM > 1
623#endif
624#if LIBMESH_DIM > 2
626#endif
627
628#if LIBMESH_ENABLE_SECOND_DERIVATIVES
629
630
632 return;
633
636#if LIBMESH_DIM > 1
637 _fe->get_d2phidxdy();
639#endif
640#if LIBMESH_DIM > 2
641 _fe->get_d2phidxdz();
642 _fe->get_d2phidydz();
644#endif
645
646#endif
647 }
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...