302 {
303 LOG_UNIT_TEST;
304
306 const std::vector<Point> points =
307 { { 0, -2, 0}, {-1, -1, 0}, {-1, 1, 0},
308 { 0, 2, 0}, { 1, 1, 0}, { 1, -1, 0},
309 { 0, -2, 1}, {-1, -1, 1}, {-1, 1, 1},
310 { 0, 2, 1}, { 1, 1, 1}, { 1, -1, 1} };
311
312 const std::vector<std::vector<unsigned int>> nodes_on_side =
313 { {0, 1, 2, 3, 4, 5},
314 {0, 1, 7, 6},
315 {1, 2, 8, 7},
316 {2, 3, 9, 8},
317 {3, 4, 10, 9},
318 {4, 5, 11, 10},
319 {5, 0, 6, 11},
320 {6, 7, 8, 9, 10, 11} };
321
323
324 std::vector<std::vector<dof_id_type>> expected_nodes_on_side;
326 const bool have_output_elem = output_elem;
327 bool found_output_elem = have_output_elem;
329 CPPUNIT_ASSERT(found_output_elem);
330
331 if (output_elem)
332 {
333 expected_nodes_on_side.reserve(output_elem->
n_sides());
334 for (auto s : output_elem->side_index_range())
335 {
336 expected_nodes_on_side.emplace_back();
337 for (const auto n : output_elem->nodes_on_side(s))
338 expected_nodes_on_side.back().push_back(output_elem->node_id(n));
339 }
340 }
341
342 {
344 exii.write("write_exodus_C0POLYHEDRON_HEXPRISM_READ.e");
345 }
346
347 Mesh input_mesh(*TestCommWorld);
349 if (input_mesh.processor_id() == 0)
350 exii_input.read("write_exodus_C0POLYHEDRON_HEXPRISM_READ.e");
351
353 input_mesh.prepare_for_use();
354
355 CPPUNIT_ASSERT_EQUAL(cast_int<dof_id_type>(1), input_mesh.n_elem());
356
357 const Elem *elem = input_mesh.query_elem_ptr(0);
358 bool found_elem = elem;
359 input_mesh.comm().max(found_elem);
360 CPPUNIT_ASSERT(found_elem);
361
362 const bool can_compare = have_output_elem && elem;
363 bool found_comparable_elem = can_compare;
364 input_mesh.comm().max(found_comparable_elem);
365 CPPUNIT_ASSERT(found_comparable_elem);
366
367 if (!can_compare)
368 return;
369
371 CPPUNIT_ASSERT_EQUAL(12u, elem->n_vertices());
372 CPPUNIT_ASSERT_EQUAL(8u, elem->n_sides());
373
375 {
376 const auto side_nodes = elem->nodes_on_side(s);
377 CPPUNIT_ASSERT_EQUAL(expected_nodes_on_side[s].size(), side_nodes.size());
378 for (
auto n :
index_range(expected_nodes_on_side[s]))
379 CPPUNIT_ASSERT_EQUAL(expected_nodes_on_side[s][n],
380 elem->node_id(side_nodes[n]));
381 }
382 }
void build_c0polyhedron(Mesh &mesh, const std::vector< Point > &points, const std::vector< std::vector< unsigned int > > &nodes_on_side)
void max(const T &r, T &o, Request &req) const
virtual unsigned int n_sides() const =0
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
This is the MeshCommunication class.
void broadcast(MeshBase &) const
This method takes a mesh (which is assumed to reside on processor 0) and broadcasts it to all the oth...
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
const Parallel::Communicator & comm() const