44 auto create_reference_element = [&moab_ref]() {
46 constexpr
double base_coords[] = {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1};
48 for (
int nn = 0; nn < 4; nn++) {
50 moab_ref.create_vertex(&base_coords[3 * nn], nodes[nn]);
53 CHKERR moab_ref.create_element(MBTET, nodes, 4, tet);
60 auto refine_ref_tetrahedron = [
this, &m_field_ref, max_level]() {
65 m_field_ref.
getInterface<BitRefManager>()->setBitRefLevelByDim(
67 for (
int ll = 0; ll != max_level; ++ll) {
72 ->getEntitiesByTypeAndRefLevel(
BitRefLevel().set(ll),
76 ->getEntitiesByTypeAndRefLevel(
BitRefLevel().set(ll),
79 MeshRefinement *m_ref;
81 CHKERR m_ref->addVerticesInTheMiddleOfEdges(edges,
88 auto get_ref_gauss_pts_and_shape_functions = [
this, max_level, &moab_ref,
91 for (
int ll = 0; ll != max_level + 1; ++ll) {
94 m_field_ref.
getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
98 CHKERR moab_ref.create_meshset(MESHSET_SET, meshset);
99 CHKERR moab_ref.add_entities(meshset, tets);
100 CHKERR moab_ref.convert_entities(meshset,
true,
false,
false);
101 CHKERR moab_ref.delete_entities(&meshset, 1);
104 CHKERR moab_ref.get_connectivity(tets, elem_nodes,
false);
107 gauss_pts.resize(elem_nodes.size(), 4,
false);
108 std::map<EntityHandle, int> little_map;
109 Range::iterator nit = elem_nodes.begin();
110 for (
int gg = 0; nit != elem_nodes.end(); nit++, gg++) {
111 CHKERR moab_ref.get_coords(&*nit, 1, &gauss_pts(gg, 0));
112 little_map[*nit] = gg;
114 gauss_pts = trans(gauss_pts);
117 Range::iterator tit = tets.begin();
118 for (
int tt = 0; tit != tets.end(); ++tit, ++tt) {
121 CHKERR moab_ref.get_connectivity(*tit, conn, num_nodes,
false);
123 ref_tets.resize(tets.size(), num_nodes);
125 for (
int nn = 0; nn != num_nodes; ++nn) {
126 ref_tets(tt, nn) = little_map[conn[nn]];
131 shape_functions.resize(elem_nodes.size(), 4);
133 &gauss_pts(1, 0), &gauss_pts(2, 0), elem_nodes.size());
142 CHKERR create_reference_element();
143 CHKERR refine_ref_tetrahedron();
144 CHKERR get_ref_gauss_pts_and_shape_functions();