32 const Real minpos = 1.5, maxpos = 5.5;
33 const unsigned int N = 2;
35 _mesh = std::make_unique<Mesh>(*TestCommWorld);
37 std::unique_ptr<Elem> test_elem;
40 test_elem = Elem::build(elem_type);
42 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 44 if (test_elem.get() && test_elem->infinite())
46 Elem * elem =
_mesh->add_elem(std::move(test_elem));
48 const auto add_point =
49 [
this, elem](
const unsigned int i,
61 auto node =
_mesh->add_point(
Point(x, y, z), i);
66 const Real halfpos = (minpos + maxpos) / 2.;
73 add_point(0, minpos, minpos, minpos);
74 add_point(1, maxpos, minpos, minpos);
75 add_point(2+is_quad, maxpos, maxpos, minpos);
76 add_point(3-is_quad, minpos, maxpos, minpos);
80 add_point(4, halfpos, minpos, minpos);
81 add_point(5, halfpos, maxpos, minpos);
86 add_point(4, minpos, minpos, maxpos);
87 add_point(5, maxpos, minpos, maxpos);
88 add_point(6, maxpos, maxpos, maxpos);
89 add_point(7, minpos, maxpos, maxpos);
93 add_point(8, halfpos, minpos, minpos);
94 add_point(9, maxpos, halfpos, minpos);
95 add_point(10, halfpos, maxpos, minpos);
96 add_point(11, minpos, halfpos, minpos);
97 add_point(12, halfpos, minpos, maxpos);
98 add_point(13, maxpos, halfpos, maxpos);
99 add_point(14, halfpos, maxpos, maxpos);
100 add_point(15, minpos, halfpos, maxpos);
104 add_point(16, halfpos, halfpos, minpos);
105 add_point(17, halfpos, halfpos, maxpos);
110 add_point(0, minpos, minpos, minpos);
111 add_point(1, maxpos, minpos, minpos);
112 add_point(2, halfpos, maxpos, minpos);
113 add_point(3, minpos, minpos, maxpos);
114 add_point(4, maxpos, minpos, maxpos);
115 add_point(5, halfpos, maxpos, maxpos);
119 add_point(6, halfpos, minpos, minpos);
120 add_point(7, (halfpos + maxpos) / 2., halfpos, minpos);
121 add_point(8, (halfpos + minpos) / 2., halfpos, minpos);
122 add_point(9, halfpos, minpos, maxpos);
123 add_point(10, (halfpos + maxpos) / 2., halfpos, maxpos);
124 add_point(11, (halfpos + minpos) / 2., halfpos, maxpos);
128 _mesh->prepare_for_use();
131 #endif // LIBMESH_DIM > 1 132 #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS 148 std::unique_ptr<Elem> polygon = std::make_unique<C0Polygon>(5);
150 polygon->set_node(i,
_mesh->node_ptr(i));
151 polygon->set_id() = 0;
153 _mesh->add_elem(std::move(polygon));
154 _mesh->prepare_for_use();
199 const std::vector<std::vector<unsigned int>> nodes_on_side =
200 { {0, 1, 2, 3, 4, 5, 6, 7},
201 {0, 1, 9, 13, 17, 16, 12, 8},
202 {2, 3, 10, 14, 19, 18, 13, 9},
203 {4, 5, 11, 15, 21, 20, 14, 10},
204 {6, 7, 8, 12, 23, 22, 15, 11},
205 {16, 17, 18, 19, 20, 21, 22, 23},
234 const std::vector<std::vector<unsigned int>> nodes_on_side =
247 std::vector<std::shared_ptr<Polygon>> sides(nodes_on_side.size());
251 const auto & nodes_on_s = nodes_on_side[s];
252 sides[s] = std::make_shared<C0Polygon>(nodes_on_s.size());
254 sides[s]->set_node(i,
_mesh->node_ptr(nodes_on_s[i]));
257 std::unique_ptr<libMesh::Node> mid_elem_node;
258 std::unique_ptr<Elem> polyhedron = std::make_unique<C0Polyhedron>(sides, mid_elem_node);
259 _mesh->add_elem(std::move(polyhedron));
261 _mesh->add_node(std::move(mid_elem_node));
262 _mesh->prepare_for_use();
266 const unsigned int dim = test_elem->dim();
267 const unsigned int use_x =
dim > 0;
268 const unsigned int use_y =
dim > 1;
269 const unsigned int use_z =
dim > 2;
272 N*use_x, N*use_y, N*use_z,
274 minpos, use_y*maxpos,
275 minpos, use_z*maxpos,
284 for (
const auto & elem :
285 this->
_mesh->element_ptr_range())
289 std::ostringstream sbdname;
291 "a_very_long_subdomain_name_for_the_subdomain_with_number_" << sbdid;
292 this->
_mesh->subdomain_name(sbdid) = sbdname.str();
297 this->
_mesh->cache_elem_data();
302 this->
_mesh->sync_subdomain_name_map();
virtual Node *& set_node(const unsigned int i)
std::unique_ptr< Mesh > _mesh
This is the base class from which all geometric element types are derived.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
subdomain_id_type subdomain_id() const
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...
A Point defines a location in LIBMESH_DIM dimensional Real space.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...