Loading [MathJax]/jax/output/HTML-CSS/config.js
libMesh
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | List of all members
MeshInputTest Class Reference
Inheritance diagram for MeshInputTest:
[legend]

Public Member Functions

 LIBMESH_CPPUNIT_TEST_SUITE (MeshInputTest)
 
 CPPUNIT_TEST (testVTKPreserveElemIds)
 
 CPPUNIT_TEST (testVTKPreserveSubdomainIds)
 
 CPPUNIT_TEST (testExodusCopyNodalSolutionDistributed)
 
 CPPUNIT_TEST (testExodusCopyElementSolutionDistributed)
 
 CPPUNIT_TEST (testExodusCopyNodalSolutionReplicated)
 
 CPPUNIT_TEST (testExodusCopyElementSolutionReplicated)
 
 CPPUNIT_TEST (testExodusReadHeader)
 
 CPPUNIT_TEST (testExodusIGASidesets)
 
 CPPUNIT_TEST (testLowOrderEdgeBlocks)
 
 CPPUNIT_TEST (testExodusCopyElementVectorDistributed)
 
 CPPUNIT_TEST (testExodusCopyElementVectorReplicated)
 
 CPPUNIT_TEST (testExodusWriteElementDataFromDiscontinuousNodalData)
 
 CPPUNIT_TEST (testExodusWriteAddedSidesEdgeC0)
 
 CPPUNIT_TEST (testExodusDiscWriteAddedSidesEdgeC0)
 
 CPPUNIT_TEST (testExodusWriteAddedSidesMixedEdgeC0)
 
 CPPUNIT_TEST (testExodusDiscWriteAddedSidesMixedEdgeC0)
 
 CPPUNIT_TEST (testExodusWriteAddedSidesTriC0)
 
 CPPUNIT_TEST (testExodusDiscWriteAddedSidesTriC0)
 
 CPPUNIT_TEST (testExodusWriteAddedSidesMixedTriC0)
 
 CPPUNIT_TEST (testExodusDiscWriteAddedSidesMixedTriC0)
 
 CPPUNIT_TEST (testExodusWriteAddedSidesQuadC0)
 
 CPPUNIT_TEST (testExodusDiscWriteAddedSidesQuadC0)
 
 CPPUNIT_TEST (testExodusWriteAddedSidesMixedQuadC0)
 
 CPPUNIT_TEST (testExodusDiscWriteAddedSidesMixedQuadC0)
 
 CPPUNIT_TEST (testExodusWriteAddedSidesHexC0)
 
 CPPUNIT_TEST (testExodusDiscWriteAddedSidesHexC0)
 
 CPPUNIT_TEST (testExodusWriteAddedSidesMixedHexC0)
 
 CPPUNIT_TEST (testExodusDiscWriteAddedSidesMixedHexC0)
 
 CPPUNIT_TEST (testExodusWriteAddedSidesHexDisc)
 
 CPPUNIT_TEST (testExodusDiscWriteAddedSidesHexDisc)
 
 CPPUNIT_TEST (testExodusFileMappingsPlateWithHole)
 
 CPPUNIT_TEST (testExodusFileMappingsTwoBlocks)
 
 CPPUNIT_TEST (testExodusFileMappingsTwoElemIGA)
 
 CPPUNIT_TEST (testExodusFileMappingsCyl3d)
 
 CPPUNIT_TEST (testExodusDiscPlateWithHole)
 
 CPPUNIT_TEST (testExodusDiscTwoBlocks)
 
 CPPUNIT_TEST (testExodusDiscTwoElemIGA)
 
 CPPUNIT_TEST (testExodusDiscCyl3d)
 
 CPPUNIT_TEST (testNemesisReadReplicated)
 
 CPPUNIT_TEST (testNemesisReadDistributed)
 
 CPPUNIT_TEST (testNemesisCopyNodalSolutionDistributed)
 
 CPPUNIT_TEST (testNemesisCopyNodalSolutionReplicated)
 
 CPPUNIT_TEST (testNemesisCopyElementSolutionDistributed)
 
 CPPUNIT_TEST (testNemesisCopyElementSolutionReplicated)
 
 CPPUNIT_TEST (testNemesisSingleElementDistributed)
 
 CPPUNIT_TEST (testNemesisSingleElementReplicated)
 
 CPPUNIT_TEST (testNemesisCopyElementVectorDistributed)
 
 CPPUNIT_TEST (testNemesisCopyElementVectorReplicated)
 
 CPPUNIT_TEST (testAbaqusReadFirst)
 
 CPPUNIT_TEST (testAbaqusReadSecond)
 
 CPPUNIT_TEST (testDynaReadElem)
 
 CPPUNIT_TEST (testDynaNoSplines)
 
 CPPUNIT_TEST (testDynaReadPatch)
 
 CPPUNIT_TEST (testDynaFileMappingsFEMEx5)
 
 CPPUNIT_TEST (testDynaFileMappingsBlockWithHole)
 
 CPPUNIT_TEST (testDynaFileMappingsPlateWithHole)
 
 CPPUNIT_TEST (testDynaFileMappingsCyl3d)
 
 CPPUNIT_TEST (testBadGmsh)
 
 CPPUNIT_TEST (testGoodGmsh)
 
 CPPUNIT_TEST (testGoodSTL)
 
 CPPUNIT_TEST (testGoodSTLBinary)
 
 CPPUNIT_TEST (testGmshBCIDOverlap)
 
 CPPUNIT_TEST (testTetgenIO)
 
 CPPUNIT_TEST_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void testVTKPreserveElemIds ()
 
void testVTKPreserveSubdomainIds ()
 
void testExodusReadHeader ()
 
void testLowOrderEdgeBlocks ()
 
void testExodusIGASidesets ()
 
template<typename MeshType , typename IOType >
void testCopyNodalSolutionImpl (const std::string &filename)
 
void testExodusCopyNodalSolutionReplicated ()
 
void testExodusCopyNodalSolutionDistributed ()
 
void testNemesisCopyNodalSolutionReplicated ()
 
void testNemesisCopyNodalSolutionDistributed ()
 
template<typename MeshType , typename IOType >
void testCopyElementSolutionImpl (const std::string &filename)
 
void testExodusCopyElementSolutionReplicated ()
 
void testExodusCopyElementSolutionDistributed ()
 
void testNemesisCopyElementSolutionReplicated ()
 
void testNemesisCopyElementSolutionDistributed ()
 
template<typename MeshType , typename IOType >
void testSingleElementImpl (const std::string &filename)
 
void testNemesisSingleElementReplicated ()
 
void testNemesisSingleElementDistributed ()
 
template<typename MeshType , typename IOType >
void testCopyElementVectorImpl (const std::string &filename)
 
void testExodusCopyElementVectorReplicated ()
 
void testExodusCopyElementVectorDistributed ()
 
void testNemesisCopyElementVectorReplicated ()
 
void testNemesisCopyElementVectorDistributed ()
 
void testExodusWriteElementDataFromDiscontinuousNodalData ()
 
void testExodusWriteAddedSides (Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
 
void testExodusWriteAddedSidesEdgeC0 ()
 
void testExodusDiscWriteAddedSidesEdgeC0 ()
 
void testExodusWriteAddedSidesMixedEdgeC0 ()
 
void testExodusDiscWriteAddedSidesMixedEdgeC0 ()
 
void testExodusWriteAddedSidesEdgeDisc ()
 
void testExodusDiscWriteAddedSidesEdgeDisc ()
 
void testExodusWriteAddedSidesTriC0 ()
 
void testExodusDiscWriteAddedSidesTriC0 ()
 
void testExodusWriteAddedSidesMixedTriC0 ()
 
void testExodusDiscWriteAddedSidesMixedTriC0 ()
 
void testExodusWriteAddedSidesTriDisc ()
 
void testExodusDiscWriteAddedSidesTriDisc ()
 
void testExodusWriteAddedSidesQuadC0 ()
 
void testExodusDiscWriteAddedSidesQuadC0 ()
 
void testExodusWriteAddedSidesMixedQuadC0 ()
 
void testExodusDiscWriteAddedSidesMixedQuadC0 ()
 
void testExodusWriteAddedSidesQuadDisc ()
 
void testExodusDiscWriteAddedSidesQuadDisc ()
 
void testExodusWriteAddedSidesTetC0 ()
 
void testExodusDiscWriteAddedSidesTetC0 ()
 
void testExodusWriteAddedSidesTetDisc ()
 
void testExodusDiscWriteAddedSidesTetDisc ()
 
void testExodusWriteAddedSidesHexC0 ()
 
void testExodusDiscWriteAddedSidesHexC0 ()
 
void testExodusWriteAddedSidesMixedHexC0 ()
 
void testExodusDiscWriteAddedSidesMixedHexC0 ()
 
void testExodusWriteAddedSidesHexDisc ()
 
void testExodusDiscWriteAddedSidesHexDisc ()
 
template<typename MeshType >
void testNemesisReadImpl ()
 
void testNemesisReadReplicated ()
 
void testNemesisReadDistributed ()
 
void testMasterCenters (const MeshBase &mesh)
 
void helperTestingDynaQuad (const MeshBase &mesh)
 
void testAbaqusRead (const std::string &fname, dof_id_type n_elem, dof_id_type n_nodes)
 
void testAbaqusReadFirst ()
 
void testAbaqusReadSecond ()
 
void testDynaReadElem ()
 
void testBadGmsh ()
 
void testGoodGmsh ()
 
void testGmshBCIDOverlap ()
 
void testGoodSTL ()
 
void testGoodSTLBinary ()
 
void testTetgenIO ()
 
void testDynaNoSplines ()
 
void testDynaReadPatch ()
 
void testProjectionRegression (MeshBase &mesh, std::array< Real, 4 > expected_norms)
 
void testDynaFileMappings (const std::string &filename, std::array< Real, 4 > expected_norms)
 
void testDynaFileMappingsFEMEx5 ()
 
void testDynaFileMappingsBlockWithHole ()
 
void testDynaFileMappingsPlateWithHole ()
 
void testDynaFileMappingsCyl3d ()
 
void testExodusFileMappings (const std::string &filename, std::array< Real, 4 > expected_norms, bool use_disc_bex=false)
 
void testExodusFileMappingsPlateWithHole ()
 
void testExodusFileMappingsTwoBlocks ()
 
void testExodusFileMappingsTwoElemIGA ()
 
void testExodusFileMappingsCyl3d ()
 
void testExodusDiscPlateWithHole ()
 
void testExodusDiscTwoBlocks ()
 
void testExodusDiscTwoElemIGA ()
 
void testExodusDiscCyl3d ()
 

Detailed Description

Definition at line 99 of file mesh_input.C.

Member Function Documentation

◆ CPPUNIT_TEST() [1/63]

MeshInputTest::CPPUNIT_TEST ( testVTKPreserveElemIds  )

◆ CPPUNIT_TEST() [2/63]

MeshInputTest::CPPUNIT_TEST ( testVTKPreserveSubdomainIds  )

◆ CPPUNIT_TEST() [3/63]

MeshInputTest::CPPUNIT_TEST ( testExodusCopyNodalSolutionDistributed  )

◆ CPPUNIT_TEST() [4/63]

MeshInputTest::CPPUNIT_TEST ( testExodusCopyElementSolutionDistributed  )

◆ CPPUNIT_TEST() [5/63]

MeshInputTest::CPPUNIT_TEST ( testExodusCopyNodalSolutionReplicated  )

◆ CPPUNIT_TEST() [6/63]

MeshInputTest::CPPUNIT_TEST ( testExodusCopyElementSolutionReplicated  )

◆ CPPUNIT_TEST() [7/63]

MeshInputTest::CPPUNIT_TEST ( testExodusReadHeader  )

◆ CPPUNIT_TEST() [8/63]

MeshInputTest::CPPUNIT_TEST ( testExodusIGASidesets  )

◆ CPPUNIT_TEST() [9/63]

MeshInputTest::CPPUNIT_TEST ( testLowOrderEdgeBlocks  )

◆ CPPUNIT_TEST() [10/63]

MeshInputTest::CPPUNIT_TEST ( testExodusCopyElementVectorDistributed  )

◆ CPPUNIT_TEST() [11/63]

MeshInputTest::CPPUNIT_TEST ( testExodusCopyElementVectorReplicated  )

◆ CPPUNIT_TEST() [12/63]

MeshInputTest::CPPUNIT_TEST ( testExodusWriteElementDataFromDiscontinuousNodalData  )

◆ CPPUNIT_TEST() [13/63]

MeshInputTest::CPPUNIT_TEST ( testExodusWriteAddedSidesEdgeC0  )

◆ CPPUNIT_TEST() [14/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscWriteAddedSidesEdgeC0  )

◆ CPPUNIT_TEST() [15/63]

MeshInputTest::CPPUNIT_TEST ( testExodusWriteAddedSidesMixedEdgeC0  )

◆ CPPUNIT_TEST() [16/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscWriteAddedSidesMixedEdgeC0  )

◆ CPPUNIT_TEST() [17/63]

MeshInputTest::CPPUNIT_TEST ( testExodusWriteAddedSidesTriC0  )

◆ CPPUNIT_TEST() [18/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscWriteAddedSidesTriC0  )

◆ CPPUNIT_TEST() [19/63]

MeshInputTest::CPPUNIT_TEST ( testExodusWriteAddedSidesMixedTriC0  )

◆ CPPUNIT_TEST() [20/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscWriteAddedSidesMixedTriC0  )

◆ CPPUNIT_TEST() [21/63]

MeshInputTest::CPPUNIT_TEST ( testExodusWriteAddedSidesQuadC0  )

◆ CPPUNIT_TEST() [22/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscWriteAddedSidesQuadC0  )

◆ CPPUNIT_TEST() [23/63]

MeshInputTest::CPPUNIT_TEST ( testExodusWriteAddedSidesMixedQuadC0  )

◆ CPPUNIT_TEST() [24/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscWriteAddedSidesMixedQuadC0  )

◆ CPPUNIT_TEST() [25/63]

MeshInputTest::CPPUNIT_TEST ( testExodusWriteAddedSidesHexC0  )

◆ CPPUNIT_TEST() [26/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscWriteAddedSidesHexC0  )

◆ CPPUNIT_TEST() [27/63]

MeshInputTest::CPPUNIT_TEST ( testExodusWriteAddedSidesMixedHexC0  )

◆ CPPUNIT_TEST() [28/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscWriteAddedSidesMixedHexC0  )

◆ CPPUNIT_TEST() [29/63]

MeshInputTest::CPPUNIT_TEST ( testExodusWriteAddedSidesHexDisc  )

◆ CPPUNIT_TEST() [30/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscWriteAddedSidesHexDisc  )

◆ CPPUNIT_TEST() [31/63]

MeshInputTest::CPPUNIT_TEST ( testExodusFileMappingsPlateWithHole  )

◆ CPPUNIT_TEST() [32/63]

MeshInputTest::CPPUNIT_TEST ( testExodusFileMappingsTwoBlocks  )

◆ CPPUNIT_TEST() [33/63]

MeshInputTest::CPPUNIT_TEST ( testExodusFileMappingsTwoElemIGA  )

◆ CPPUNIT_TEST() [34/63]

MeshInputTest::CPPUNIT_TEST ( testExodusFileMappingsCyl3d  )

◆ CPPUNIT_TEST() [35/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscPlateWithHole  )

◆ CPPUNIT_TEST() [36/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscTwoBlocks  )

◆ CPPUNIT_TEST() [37/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscTwoElemIGA  )

◆ CPPUNIT_TEST() [38/63]

MeshInputTest::CPPUNIT_TEST ( testExodusDiscCyl3d  )

◆ CPPUNIT_TEST() [39/63]

MeshInputTest::CPPUNIT_TEST ( testNemesisReadReplicated  )

◆ CPPUNIT_TEST() [40/63]

MeshInputTest::CPPUNIT_TEST ( testNemesisReadDistributed  )

◆ CPPUNIT_TEST() [41/63]

MeshInputTest::CPPUNIT_TEST ( testNemesisCopyNodalSolutionDistributed  )

◆ CPPUNIT_TEST() [42/63]

MeshInputTest::CPPUNIT_TEST ( testNemesisCopyNodalSolutionReplicated  )

◆ CPPUNIT_TEST() [43/63]

MeshInputTest::CPPUNIT_TEST ( testNemesisCopyElementSolutionDistributed  )

◆ CPPUNIT_TEST() [44/63]

MeshInputTest::CPPUNIT_TEST ( testNemesisCopyElementSolutionReplicated  )

◆ CPPUNIT_TEST() [45/63]

MeshInputTest::CPPUNIT_TEST ( testNemesisSingleElementDistributed  )

◆ CPPUNIT_TEST() [46/63]

MeshInputTest::CPPUNIT_TEST ( testNemesisSingleElementReplicated  )

◆ CPPUNIT_TEST() [47/63]

MeshInputTest::CPPUNIT_TEST ( testNemesisCopyElementVectorDistributed  )

◆ CPPUNIT_TEST() [48/63]

MeshInputTest::CPPUNIT_TEST ( testNemesisCopyElementVectorReplicated  )

◆ CPPUNIT_TEST() [49/63]

MeshInputTest::CPPUNIT_TEST ( testAbaqusReadFirst  )

◆ CPPUNIT_TEST() [50/63]

MeshInputTest::CPPUNIT_TEST ( testAbaqusReadSecond  )

◆ CPPUNIT_TEST() [51/63]

MeshInputTest::CPPUNIT_TEST ( testDynaReadElem  )

◆ CPPUNIT_TEST() [52/63]

MeshInputTest::CPPUNIT_TEST ( testDynaNoSplines  )

◆ CPPUNIT_TEST() [53/63]

MeshInputTest::CPPUNIT_TEST ( testDynaReadPatch  )

◆ CPPUNIT_TEST() [54/63]

MeshInputTest::CPPUNIT_TEST ( testDynaFileMappingsFEMEx5  )

◆ CPPUNIT_TEST() [55/63]

MeshInputTest::CPPUNIT_TEST ( testDynaFileMappingsBlockWithHole  )

◆ CPPUNIT_TEST() [56/63]

MeshInputTest::CPPUNIT_TEST ( testDynaFileMappingsPlateWithHole  )

◆ CPPUNIT_TEST() [57/63]

MeshInputTest::CPPUNIT_TEST ( testDynaFileMappingsCyl3d  )

◆ CPPUNIT_TEST() [58/63]

MeshInputTest::CPPUNIT_TEST ( testBadGmsh  )

◆ CPPUNIT_TEST() [59/63]

MeshInputTest::CPPUNIT_TEST ( testGoodGmsh  )

◆ CPPUNIT_TEST() [60/63]

MeshInputTest::CPPUNIT_TEST ( testGoodSTL  )

◆ CPPUNIT_TEST() [61/63]

MeshInputTest::CPPUNIT_TEST ( testGoodSTLBinary  )

◆ CPPUNIT_TEST() [62/63]

MeshInputTest::CPPUNIT_TEST ( testGmshBCIDOverlap  )

◆ CPPUNIT_TEST() [63/63]

MeshInputTest::CPPUNIT_TEST ( testTetgenIO  )

◆ CPPUNIT_TEST_SUITE_END()

MeshInputTest::CPPUNIT_TEST_SUITE_END ( )

◆ helperTestingDynaQuad()

void MeshInputTest::helperTestingDynaQuad ( const MeshBase mesh)
inline

Definition at line 1423 of file mesh_input.C.

References libMesh::MeshBase::default_mapping_data(), libMesh::MeshBase::default_mapping_type(), TIMPI::Communicator::max(), mesh, libMesh::NODEELEM, libMesh::QUAD9, libMesh::RATIONAL_BERNSTEIN_MAP, libMesh::Real, and TestCommWorld.

1424  {
1425  CPPUNIT_ASSERT_EQUAL(mesh.default_mapping_type(),
1427 
1428  unsigned char weight_index = mesh.default_mapping_data();
1429 
1430  bool found_the_quad = false;
1431 
1432  for (auto & elem : mesh.element_ptr_range())
1433  {
1434  if (elem->type() == NODEELEM)
1435  continue;
1436 
1437  CPPUNIT_ASSERT_EQUAL(elem->type(), QUAD9);
1438  found_the_quad = true;
1439 
1440  for (unsigned int n=0; n != 9; ++n)
1441  CPPUNIT_ASSERT_EQUAL
1442  (elem->node_ref(n).get_extra_datum<Real>(weight_index),
1443  Real(0.75));
1444 
1445  CPPUNIT_ASSERT_EQUAL(elem->point(0)(0), Real(0.5));
1446  CPPUNIT_ASSERT_EQUAL(elem->point(0)(1), Real(0.5));
1447  CPPUNIT_ASSERT_EQUAL(elem->point(1)(0), Real(1.5));
1448  CPPUNIT_ASSERT_EQUAL(elem->point(1)(1), Real(0.5));
1449  CPPUNIT_ASSERT_EQUAL(elem->point(2)(0), Real(1.5));
1450  CPPUNIT_ASSERT_EQUAL(elem->point(2)(1), Real(1.5));
1451  CPPUNIT_ASSERT_EQUAL(elem->point(3)(0), Real(0.5));
1452  CPPUNIT_ASSERT_EQUAL(elem->point(3)(1), Real(1.5));
1453  CPPUNIT_ASSERT(elem->has_affine_map());
1454 #if LIBMESH_DIM > 2
1455  for (unsigned int v=0; v != 4; ++v)
1456  CPPUNIT_ASSERT_EQUAL(elem->point(v)(2), Real(0));
1457 #endif
1458  }
1459 
1460  TestCommWorld->max(found_the_quad);
1461  CPPUNIT_ASSERT(found_the_quad);
1462 
1464  }
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
MeshBase & mesh
ElemMappingType default_mapping_type() const
Returns the default master space to physical space mapping basis functions to be used on newly added ...
Definition: mesh_base.h:812
unsigned char default_mapping_data() const
Returns any default data value used by the master space to physical space mapping.
Definition: mesh_base.h:830
void testMasterCenters(const MeshBase &mesh)
Definition: mesh_input.C:1382
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void max(const T &r, T &o, Request &req) const

◆ LIBMESH_CPPUNIT_TEST_SUITE()

MeshInputTest::LIBMESH_CPPUNIT_TEST_SUITE ( MeshInputTest  )

◆ setUp()

void MeshInputTest::setUp ( )
inline

Definition at line 218 of file mesh_input.C.

219  {}

◆ tearDown()

void MeshInputTest::tearDown ( )
inline

Definition at line 221 of file mesh_input.C.

222  {}

◆ testAbaqusRead()

void MeshInputTest::testAbaqusRead ( const std::string &  fname,
dof_id_type  n_elem,
dof_id_type  n_nodes 
)
inline

Definition at line 1467 of file mesh_input.C.

References libMesh::MeshCommunication::broadcast(), mesh, libMesh::MeshTools::n_elem(), libMesh::MeshBase::n_elem(), n_nodes, libMesh::MeshBase::n_nodes(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::AbaqusIO::read(), and TestCommWorld.

1470  {
1472 
1473  AbaqusIO abaqus(mesh);
1474 
1475  if (mesh.processor_id() == 0)
1476  abaqus.read(fname);
1478 
1480 
1481  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), n_elem);
1482  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), n_nodes);
1483  }
The AbaqusIO class is a preliminary implementation for reading Abaqus mesh files in ASCII format...
Definition: abaqus_io.h:41
dof_id_type n_elem(const MeshBase::const_element_iterator &begin, const MeshBase::const_element_iterator &end)
Count up the number of elements of a specific type (as defined by an iterator range).
Definition: mesh_tools.C:969
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
MeshBase & mesh
const dof_id_type n_nodes
Definition: tecplot_io.C:67
This is the MeshCommunication class.
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const
virtual dof_id_type n_nodes() const =0

◆ testAbaqusReadFirst()

void MeshInputTest::testAbaqusReadFirst ( )
inline

Definition at line 1486 of file mesh_input.C.

1487  {
1488  LOG_UNIT_TEST;
1489  testAbaqusRead("meshes/tensile_sample_test1.inp.gz", 728, 1166);
1490  }
void testAbaqusRead(const std::string &fname, dof_id_type n_elem, dof_id_type n_nodes)
Definition: mesh_input.C:1467

◆ testAbaqusReadSecond()

void MeshInputTest::testAbaqusReadSecond ( )
inline

Definition at line 1493 of file mesh_input.C.

1494  {
1495  LOG_UNIT_TEST;
1496  testAbaqusRead("meshes/poly_sample_test2.inp.gz", 1280, 1625);
1497  }
void testAbaqusRead(const std::string &fname, dof_id_type n_elem, dof_id_type n_nodes)
Definition: mesh_input.C:1467

◆ testBadGmsh()

void MeshInputTest::testBadGmsh ( )
inline

Definition at line 1522 of file mesh_input.C.

References TIMPI::Communicator::broadcast(), mesh, libMesh::ParallelObject::processor_id(), libMesh::GmshIO::read(), and TestCommWorld.

1523  {
1524  LOG_UNIT_TEST;
1525 
1527 
1528  GmshIO gmsh_io(mesh);
1529 
1530 #ifdef LIBMESH_ENABLE_EXCEPTIONS
1531  std::string what = "";
1532  try
1533  {
1534  if (mesh.processor_id() == 0)
1535  gmsh_io.read("meshes/block.msh");
1536  }
1537  catch (libMesh::LogicError & e)
1538  {
1539  what = e.what();
1540  }
1541 
1542  TestCommWorld->broadcast(what);
1543  std::regex msg_regex("outside entity physical bounding box");
1544  CPPUNIT_ASSERT(std::regex_search(what, msg_regex));
1545 #endif
1546  }
Reading and writing meshes in the Gmsh format.
Definition: gmsh_io.h:51
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
MeshBase & mesh
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
A class to represent the internal "this should never happen" errors, to be thrown by "libmesh_error()...
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const

◆ testCopyElementSolutionImpl()

template<typename MeshType , typename IOType >
void MeshInputTest::testCopyElementSolutionImpl ( const std::string &  filename)
inline

Definition at line 591 of file mesh_input.C.

References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshBase::allow_renumbering(), libMesh::MeshCommunication::broadcast(), libMesh::MeshTools::Generation::build_square(), libMesh::CONSTANT, libMesh::EquationSystems::init(), mesh, libMesh::MONOMIAL, libMesh::EquationSystems::parameters, libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::System::project_solution(), libMesh::Real, six_x_plus_sixty_y(), libMesh::MeshBase::skip_noncritical_partitioning(), TestCommWorld, and libMesh::TOLERANCE.

592  {
593  {
594  MeshType mesh(*TestCommWorld);
595 
596  EquationSystems es(mesh);
597  System &sys = es.add_system<System> ("SimpleSystem");
598  sys.add_variable("e", CONSTANT, MONOMIAL);
599 
601  3, 3,
602  0., 1., 0., 1.);
603 
604  es.init();
605  sys.project_solution(six_x_plus_sixty_y, nullptr, es.parameters);
606 
607  IOType meshinput(mesh);
608 
609  // Don't try to write element data as nodal data
610  std::set<std::string> sys_list;
611  meshinput.write_equation_systems(filename, es, &sys_list);
612 
613  // Just write it as element data
614  meshinput.write_element_data(es);
615  }
616 
617  {
618  MeshType mesh(*TestCommWorld);
619  IOType meshinput(mesh);
620 
621  // Avoid getting Nemesis solution values mixed up
622  if (meshinput.is_parallel_format())
623  {
624  mesh.allow_renumbering(false);
626  }
627 
628  EquationSystems es(mesh);
629  System &sys = es.add_system<System> ("SimpleSystem");
630  sys.add_variable("teste", CONSTANT, MONOMIAL);
631 
632  if (mesh.processor_id() == 0 || meshinput.is_parallel_format())
633  meshinput.read(filename);
634  if (!meshinput.is_parallel_format())
637 
638  es.init();
639 
640  // Read the solution e into variable teste.
641  //
642  // With complex numbers, we'll only bother reading the real
643  // part.
644 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
645  meshinput.copy_elemental_solution(sys, "teste", "r_e");
646 #else
647  meshinput.copy_elemental_solution(sys, "teste", "e");
648 #endif
649 
650  // Exodus only handles double precision
651  Real exotol = std::max(TOLERANCE*TOLERANCE, Real(1e-12));
652 
653  for (Real x = Real(1.L/6.L); x < 1; x += Real(1.L/3.L))
654  for (Real y = Real(1.L/6.L); y < 1; y += Real(1.L/3.L))
655  {
656  Point p(x,y);
657  LIBMESH_ASSERT_NUMBERS_EQUAL
658  (sys.point_value(0,p), 6*x+60*y, exotol);
659  }
660  }
661  }
This is the EquationSystems class.
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use...
Definition: mesh_base.h:1196
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
static constexpr Real TOLERANCE
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
MeshBase & mesh
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2421
void skip_noncritical_partitioning(bool skip)
If true is passed in then the elements on this mesh will no longer be (re)partitioned, and the nodes on this mesh will only be repartitioned if they are found "orphaned" via coarsening or other removal of the last element responsible for their node/element processor id consistency.
Definition: mesh_base.h:1236
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
Projects arbitrary functions onto the current solution.
This is the MeshCommunication class.
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
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.
Definition: system.C:1357
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
processor_id_type processor_id() const
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39

◆ testCopyElementVectorImpl()

template<typename MeshType , typename IOType >
void MeshInputTest::testCopyElementVectorImpl ( const std::string &  filename)
inline

Definition at line 746 of file mesh_input.C.

References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshBase::allow_renumbering(), libMesh::MeshCommunication::broadcast(), libMesh::MeshTools::Generation::build_square(), libMesh::CONSTANT, libMesh::System::current_local_solution, libMesh::EquationSystems::init(), mesh, libMesh::MONOMIAL, libMesh::MONOMIAL_VEC, libMesh::System::number(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::Real, sin_x_plus_cos_y(), six_x_plus_sixty_y(), libMesh::MeshBase::skip_noncritical_partitioning(), TestCommWorld, and libMesh::TOLERANCE.

747  {
748  {
749  MeshType mesh(*TestCommWorld);
750 
751  EquationSystems es(mesh);
752  System & sys = es.add_system<System> ("SimpleSystem");
753  auto e_var = sys.add_variable("e", CONSTANT, MONOMIAL_VEC);
754 
756  3, 3,
757  0., 1., 0., 1.);
758 
759  es.init();
760 
761  // Here, we're going to manually set up the solution because the 'project_solution()' and
762  // 'project_vector()' methods don't work so well with CONSTANT MONOMIAL_VEC variables. They
763  // each lead to an error downstream asserting positive-definiteness when Cholesky decomposing.
764  // Interestingly, the error is only invoked for CONSTANT MONOMIAL_VEC, and not, e.g.,
765  // CONSTANT MONOMIAL nor FIRST LAGRANGE_VEC.
766  //
767  // Anyways, the important thing here is that we test the ExodusII and Nemesis writers, how
768  // the solution is set is hardly important, and we're pretty much following the same
769  // philosophy as the 'test2DProjectVectorFE()' unit tester in 'systems_test.C'
770  Parameters params;
771  for (const auto & elem : mesh.active_local_element_ptr_range())
772  {
773  const Point & p = elem->vertex_average();
774 
775  // Set the x-component with the value from 'six_x_plus_sixty_y()' and the y-component
776  // with that from 'sin_x_plus_cos_y()' at the element centroid (vertex average)
777  sys.current_local_solution->set(
778  elem->dof_number(sys.number(), e_var, 0), six_x_plus_sixty_y(p, params, "", ""));
779  sys.current_local_solution->set(
780  elem->dof_number(sys.number(), e_var, 1), sin_x_plus_cos_y(p, params, "", ""));
781  }
782 
783  // After setting values, we need to assemble
784  sys.current_local_solution->close();
785 
786  IOType meshinput(mesh);
787 
788  // Don't try to write element data as nodal data
789  std::set<std::string> sys_list;
790  meshinput.write_equation_systems(filename, es, &sys_list);
791 
792  // Just write it as element data
793  meshinput.write_element_data(es);
794  }
795 
796  {
797  MeshType mesh(*TestCommWorld);
798  IOType meshinput(mesh);
799 
800  // Avoid getting Nemesis solution values mixed up
801  if (meshinput.is_parallel_format())
802  {
803  mesh.allow_renumbering(false);
805  }
806 
807  EquationSystems es(mesh);
808  System & sys = es.add_system<System> ("SimpleSystem");
809 
810  // We have to read the CONSTANT MONOMIAL_VEC var "e" into separate CONSTANT MONOMIAL vars
811  // "e_x" and "e_y" because 'copy_elemental_solution()' currently doesn't support vectors.
812  // Again, this isn't a test for reading/copying an elemental vector solution, only writing.
813  sys.add_variable("teste_x", CONSTANT, MONOMIAL);
814  sys.add_variable("teste_y", CONSTANT, MONOMIAL);
815 
816  if (mesh.processor_id() == 0 || meshinput.is_parallel_format())
817  meshinput.read(filename);
818  if (!meshinput.is_parallel_format())
821 
822  es.init();
823 
824  // Read the solution e_x and e_y into variable teste_x and teste_y, respectively.
825  meshinput.copy_elemental_solution(sys, "teste_x", "e_x");
826  meshinput.copy_elemental_solution(sys, "teste_y", "e_y");
827 
828  // Exodus only handles double precision
829  Real exotol = std::max(TOLERANCE*TOLERANCE, Real(1e-12));
830 
831  for (Real x = Real(1.L/6.L); x < 1; x += Real(1.L/3.L))
832  for (Real y = Real(1.L/6.L); y < 1; y += Real(1.L/3.L))
833  {
834  Point p(x,y);
835  LIBMESH_ASSERT_NUMBERS_EQUAL
836  (sys.point_value(0,p), 6*x+60*y, exotol);
837  LIBMESH_ASSERT_NUMBERS_EQUAL
838  (sys.point_value(1,p), sin(x)+cos(y), exotol);
839  }
840  }
841  }
This is the EquationSystems class.
This class provides the ability to map between arbitrary, user-defined strings and several data types...
Definition: parameters.h:67
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use...
Definition: mesh_base.h:1196
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
static constexpr Real TOLERANCE
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
MeshBase & mesh
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2421
void skip_noncritical_partitioning(bool skip)
If true is passed in then the elements on this mesh will no longer be (re)partitioned, and the nodes on this mesh will only be repartitioned if they are found "orphaned" via coarsening or other removal of the last element responsible for their node/element processor id consistency.
Definition: mesh_base.h:1236
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
unsigned int number() const
Definition: system.h:2350
This is the MeshCommunication class.
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
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.
Definition: system.C:1357
Number sin_x_plus_cos_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:42
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1605
processor_id_type processor_id() const
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39

◆ testCopyNodalSolutionImpl()

template<typename MeshType , typename IOType >
void MeshInputTest::testCopyNodalSolutionImpl ( const std::string &  filename)
inline

Definition at line 507 of file mesh_input.C.

References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshBase::allow_renumbering(), libMesh::MeshCommunication::broadcast(), libMesh::MeshTools::Generation::build_square(), libMesh::FIRST, libMesh::EquationSystems::init(), libMesh::LAGRANGE, mesh, libMesh::EquationSystems::parameters, libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::System::project_solution(), libMesh::Real, six_x_plus_sixty_y(), libMesh::MeshBase::skip_noncritical_partitioning(), TestCommWorld, and libMesh::TOLERANCE.

508  {
509  {
510  MeshType mesh(*TestCommWorld);
511 
512  EquationSystems es(mesh);
513  System &sys = es.add_system<System> ("SimpleSystem");
514  sys.add_variable("n", FIRST, LAGRANGE);
515 
517  3, 3,
518  0., 1., 0., 1.);
519 
520  es.init();
521  sys.project_solution(six_x_plus_sixty_y, nullptr, es.parameters);
522 
523  IOType meshoutput(mesh);
524 
525  meshoutput.write_equation_systems(filename, es);
526  }
527 
528  {
529  MeshType mesh(*TestCommWorld);
530  IOType meshinput(mesh);
531 
532  // Avoid getting Nemesis solution values mixed up
533  if (meshinput.is_parallel_format())
534  {
535  mesh.allow_renumbering(false);
537  }
538 
539  EquationSystems es(mesh);
540  System &sys = es.add_system<System> ("SimpleSystem");
541  sys.add_variable("testn", FIRST, LAGRANGE);
542 
543  if (mesh.processor_id() == 0 || meshinput.is_parallel_format())
544  meshinput.read(filename);
545  if (!meshinput.is_parallel_format())
548 
549  es.init();
550 
551  // Read the solution e into variable teste.
552  //
553  // With complex numbers, we'll only bother reading the real
554  // part.
555 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
556  meshinput.copy_nodal_solution(sys, "testn", "r_n");
557 #else
558  meshinput.copy_nodal_solution(sys, "testn", "n");
559 #endif
560 
561  // Exodus only handles double precision
562  Real exotol = std::max(TOLERANCE*TOLERANCE, Real(1e-12));
563 
564  for (Real x = 0; x < 1 + TOLERANCE; x += Real(1.L/3.L))
565  for (Real y = 0; y < 1 + TOLERANCE; y += Real(1.L/3.L))
566  {
567  Point p(x,y);
568  LIBMESH_ASSERT_NUMBERS_EQUAL
569  (sys.point_value(0,p), 6*x+60*y, exotol);
570  }
571  }
572  }
This is the EquationSystems class.
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use...
Definition: mesh_base.h:1196
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
static constexpr Real TOLERANCE
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
MeshBase & mesh
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2421
void skip_noncritical_partitioning(bool skip)
If true is passed in then the elements on this mesh will no longer be (re)partitioned, and the nodes on this mesh will only be repartitioned if they are found "orphaned" via coarsening or other removal of the last element responsible for their node/element processor id consistency.
Definition: mesh_base.h:1236
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
Projects arbitrary functions onto the current solution.
This is the MeshCommunication class.
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
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.
Definition: system.C:1357
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
processor_id_type processor_id() const
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39

◆ testDynaFileMappings()

void MeshInputTest::testDynaFileMappings ( const std::string &  filename,
std::array< Real, 4 >  expected_norms 
)
inline

Definition at line 1793 of file mesh_input.C.

References libMesh::MeshCommunication::broadcast(), libMesh::MeshBase::default_mapping_type(), mesh, libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::RATIONAL_BERNSTEIN_MAP, libMesh::DynaIO::read(), and TestCommWorld.

1794  {
1796 
1797  DynaIO dyna(mesh);
1798  if (mesh.processor_id() == 0)
1799  dyna.read(filename);
1801 
1803 
1804  CPPUNIT_ASSERT_EQUAL(mesh.default_mapping_type(),
1806 
1807  // Useful when trying out different projection functions
1808  // std::cout << filename << ":" << std::endl;
1809 
1811 
1812  testProjectionRegression(mesh, expected_norms);
1813  }
Reading and writing meshes in (a subset of) LS-DYNA format.
Definition: dyna_io.h:52
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
MeshBase & mesh
ElemMappingType default_mapping_type() const
Returns the default master space to physical space mapping basis functions to be used on newly added ...
Definition: mesh_base.h:812
This is the MeshCommunication class.
void testMasterCenters(const MeshBase &mesh)
Definition: mesh_input.C:1382
void testProjectionRegression(MeshBase &mesh, std::array< Real, 4 > expected_norms)
Definition: mesh_input.C:1746
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const

◆ testDynaFileMappingsBlockWithHole()

void MeshInputTest::testDynaFileMappingsBlockWithHole ( )
inline

Definition at line 1825 of file mesh_input.C.

1826  {
1827  LOG_UNIT_TEST;
1828 
1829  testDynaFileMappings("meshes/BlockWithHole_Patch9.bxt.gz",
1830  // Regression values for sin_x_plus_cos_y
1831  {{3.22612556930183, 1.97405365384733,
1832  2.53376235803176, 1.41374070517223}});
1833  }
void testDynaFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms)
Definition: mesh_input.C:1793

◆ testDynaFileMappingsCyl3d()

void MeshInputTest::testDynaFileMappingsCyl3d ( )
inline

Definition at line 1845 of file mesh_input.C.

1846  {
1847  LOG_UNIT_TEST;
1848 
1849  testDynaFileMappings("meshes/PressurizedCyl3d_Patch1_8Elem.bxt.gz",
1850  // Regression values for sin_x_plus_cos_y
1851  {{0.963612880188165, 1.82329452603503,
1852  0.707998701597943, 1.31399222566683}});
1853  }
void testDynaFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms)
Definition: mesh_input.C:1793

◆ testDynaFileMappingsFEMEx5()

void MeshInputTest::testDynaFileMappingsFEMEx5 ( )
inline

Definition at line 1815 of file mesh_input.C.

1816  {
1817  LOG_UNIT_TEST;
1818 
1819  testDynaFileMappings("meshes/PressurizedCyl_Patch6_256Elem.bxt.gz",
1820  // Regression values for sin_x_plus_cos_y
1821  {{0.9639857809698268, 1.839870171669186,
1822  0.7089812562241862, 1.306121188539059}});
1823  }
void testDynaFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms)
Definition: mesh_input.C:1793

◆ testDynaFileMappingsPlateWithHole()

void MeshInputTest::testDynaFileMappingsPlateWithHole ( )
inline

Definition at line 1835 of file mesh_input.C.

1836  {
1837  LOG_UNIT_TEST;
1838 
1839  testDynaFileMappings("meshes/PlateWithHole_Patch8.bxt.gz",
1840  // Regression values for sin_x_plus_cos_y
1841  {{2.2812154374012, 1.974049990211937,
1842  1.791640772215248, 1.413679237529376}});
1843  }
void testDynaFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms)
Definition: mesh_input.C:1793

◆ testDynaNoSplines()

void MeshInputTest::testDynaNoSplines ( )
inline

Definition at line 1660 of file mesh_input.C.

References libMesh::MeshCommunication::broadcast(), mesh, libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::DynaIO::read(), and TestCommWorld.

1661  {
1662  LOG_UNIT_TEST;
1663 
1665 
1666  DynaIO dyna(mesh, /* keep_spline_nodes = */ false);
1667 
1668  if (mesh.processor_id() == 0)
1669  dyna.read("meshes/1_quad.bxt.gz");
1671 
1673 
1674  // We have 1 QUAD9 finite element
1675  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), static_cast<dof_id_type>(1));
1676  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), static_cast<dof_id_type>(9));
1677 
1679  }
Reading and writing meshes in (a subset of) LS-DYNA format.
Definition: dyna_io.h:52
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
MeshBase & mesh
This is the MeshCommunication class.
void helperTestingDynaQuad(const MeshBase &mesh)
Definition: mesh_input.C:1423
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

◆ testDynaReadElem()

void MeshInputTest::testDynaReadElem ( )
inline

Definition at line 1500 of file mesh_input.C.

References libMesh::MeshCommunication::broadcast(), mesh, libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::DynaIO::read(), and TestCommWorld.

1501  {
1502  LOG_UNIT_TEST;
1503 
1505 
1506  DynaIO dyna(mesh);
1507 
1508  if (mesh.processor_id() == 0)
1509  dyna.read("meshes/1_quad.bxt.gz");
1511 
1513 
1514  // We have 1 QUAD9 finite element, attached via a trivial map to 9
1515  // spline Node+NodeElem objects
1516  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), static_cast<dof_id_type>(10));
1517  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), static_cast<dof_id_type>(18));
1518 
1520  }
Reading and writing meshes in (a subset of) LS-DYNA format.
Definition: dyna_io.h:52
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
MeshBase & mesh
This is the MeshCommunication class.
void helperTestingDynaQuad(const MeshBase &mesh)
Definition: mesh_input.C:1423
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

◆ testDynaReadPatch()

void MeshInputTest::testDynaReadPatch ( )
inline

Definition at line 1682 of file mesh_input.C.

References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshCommunication::broadcast(), libMesh::MeshBase::default_mapping_data(), libMesh::MeshBase::default_mapping_type(), libMesh::System::get_dof_map(), libMesh::EquationSystems::init(), mesh, libMesh::DofMap::n_constrained_dofs(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::NODEELEM, libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::RATIONAL_BERNSTEIN_MAP, libMesh::DynaIO::read(), libMesh::Real, libMesh::SECOND, TestCommWorld, and libMesh::TOLERANCE.

1683  {
1684  LOG_UNIT_TEST;
1685 
1687 
1688  DynaIO dyna(mesh);
1689  if (mesh.processor_id() == 0)
1690  dyna.read("meshes/25_quad.bxt.gz");
1692 
1694 
1695  // We have 5^2 QUAD9 elements, with 11^2 nodes,
1696  // tied to 49 Node/NodeElem spline nodes
1697  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), static_cast<dof_id_type>(25+49));
1698  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), static_cast<dof_id_type>(121+49));
1699 
1700  CPPUNIT_ASSERT_EQUAL(mesh.default_mapping_type(),
1702 
1703  unsigned char weight_index = mesh.default_mapping_data();
1704 
1705  for (const auto & elem : mesh.active_element_ptr_range())
1706  {
1707  if (elem->type() == NODEELEM)
1708  continue;
1709  LIBMESH_ASSERT_FP_EQUAL(Real(0.04), elem->volume(), TOLERANCE);
1710 
1711  for (unsigned int n=0; n != 9; ++n)
1712  CPPUNIT_ASSERT_EQUAL
1713  (elem->node_ref(n).get_extra_datum<Real>(weight_index),
1714  Real(1.0));
1715 
1716  unsigned int n_neighbors = 0, n_neighbors_expected = 2;
1717  for (unsigned int side=0; side != 4; ++side)
1718  if (elem->neighbor_ptr(side))
1719  n_neighbors++;
1720  Point c = elem->vertex_average();
1721 
1722  if (c(0) > 0.2 && c(0) < 0.8)
1723  n_neighbors_expected++;
1724  if (c(1) > 0.2 && c(1) < 0.8)
1725  n_neighbors_expected++;
1726 
1727  CPPUNIT_ASSERT_EQUAL(n_neighbors, n_neighbors_expected);
1728  }
1729 
1731 
1732 #ifdef LIBMESH_HAVE_SOLVER
1733 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1734  // Now test whether we can assign the desired constraint equations
1735  EquationSystems es(mesh);
1736  System & sys = es.add_system<LinearImplicitSystem>("test");
1737  sys.add_variable("u", SECOND); // to match QUAD9
1738  es.init();
1739 
1740  // We should have a constraint on every FE dof
1741  CPPUNIT_ASSERT_EQUAL(sys.get_dof_map().n_constrained_dofs(), static_cast<dof_id_type>(121));
1742 #endif // LIBMESH_ENABLE_CONSTRAINTS
1743 #endif // LIBMESH_HAVE_SOLVER
1744  }
This is the EquationSystems class.
Reading and writing meshes in (a subset of) LS-DYNA format.
Definition: dyna_io.h:52
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
static constexpr Real TOLERANCE
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
MeshBase & mesh
ElemMappingType default_mapping_type() const
Returns the default master space to physical space mapping basis functions to be used on newly added ...
Definition: mesh_base.h:812
This is the MeshCommunication class.
unsigned char default_mapping_data() const
Returns any default data value used by the master space to physical space mapping.
Definition: mesh_base.h:830
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
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.
Definition: system.C:1357
void testMasterCenters(const MeshBase &mesh)
Definition: mesh_input.C:1382
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
dof_id_type n_constrained_dofs() const
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2374
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

◆ testExodusCopyElementSolutionDistributed()

void MeshInputTest::testExodusCopyElementSolutionDistributed ( )
inline

Definition at line 667 of file mesh_input.C.

668  { LOG_UNIT_TEST; testCopyElementSolutionImpl<DistributedMesh,ExodusII_IO>("dist_with_elem_soln.e"); }

◆ testExodusCopyElementSolutionReplicated()

void MeshInputTest::testExodusCopyElementSolutionReplicated ( )
inline

Definition at line 664 of file mesh_input.C.

665  { LOG_UNIT_TEST; testCopyElementSolutionImpl<ReplicatedMesh,ExodusII_IO>("repl_with_elem_soln.e"); }

◆ testExodusCopyElementVectorDistributed()

void MeshInputTest::testExodusCopyElementVectorDistributed ( )
inline

Definition at line 846 of file mesh_input.C.

847  { LOG_UNIT_TEST; testCopyElementVectorImpl<DistributedMesh,ExodusII_IO>("dist_with_elem_vec.e"); }

◆ testExodusCopyElementVectorReplicated()

void MeshInputTest::testExodusCopyElementVectorReplicated ( )
inline

Definition at line 843 of file mesh_input.C.

844  { LOG_UNIT_TEST; testCopyElementVectorImpl<ReplicatedMesh, ExodusII_IO>("repl_with_elem_vec.e"); }

◆ testExodusCopyNodalSolutionDistributed()

void MeshInputTest::testExodusCopyNodalSolutionDistributed ( )
inline

Definition at line 578 of file mesh_input.C.

579  { LOG_UNIT_TEST; testCopyNodalSolutionImpl<DistributedMesh,ExodusII_IO>("dist_with_nodal_soln.e"); }

◆ testExodusCopyNodalSolutionReplicated()

void MeshInputTest::testExodusCopyNodalSolutionReplicated ( )
inline

Definition at line 575 of file mesh_input.C.

576  { LOG_UNIT_TEST; testCopyNodalSolutionImpl<ReplicatedMesh,ExodusII_IO>("repl_with_nodal_soln.e"); }

◆ testExodusDiscCyl3d()

void MeshInputTest::testExodusDiscCyl3d ( )
inline

Definition at line 1977 of file mesh_input.C.

1978  {
1979  LOG_UNIT_TEST;
1980 
1981  testExodusFileMappings("meshes/PressurizedCyl3d_Patch1_8Elem.e",
1982  {{0.963855209590556, 1.8234396424318,
1983  0.708286572453382, 1.31468940958327}},
1984  true);
1985  }
void testExodusFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms, bool use_disc_bex=false)
Definition: mesh_input.C:1855

◆ testExodusDiscPlateWithHole()

void MeshInputTest::testExodusDiscPlateWithHole ( )
inline

Definition at line 1938 of file mesh_input.C.

1939  {
1940  LOG_UNIT_TEST;
1941 
1942  testExodusFileMappings("meshes/PlateWithHole_Patch8.e",
1943  // Regression values for sin_x_plus_cos_y
1944  //
1945  // These are *not* the same as for the continuous plate, because
1946  // we do the C^TKCx=C^Tf trick to pull back projections to the
1947  // spline nodes, and the pseudoinverse here minimizes the error in
1948  // a discretization-dependent norm, not in a Sobolev norm. For
1949  // these coarse meshes, our Sobolev norms can end up being ~0.1%
1950  // different.
1951  {{2.28234312456534, 1.97439548757586,
1952  1.79290449809266, 1.41075128955985}},
1953  true);
1954  }
void testExodusFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms, bool use_disc_bex=false)
Definition: mesh_input.C:1855

◆ testExodusDiscTwoBlocks()

void MeshInputTest::testExodusDiscTwoBlocks ( )
inline

Definition at line 1956 of file mesh_input.C.

1957  {
1958  LOG_UNIT_TEST;
1959 
1960  testExodusFileMappings("meshes/two_quads_two_blocks.e",
1961  // Regression values for sin_x_plus_cos_y
1962  {{2.03496953073072, 1.97996853164955,
1963  1.18462134113435, 1.03085301158959}},
1964  true);
1965  }
void testExodusFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms, bool use_disc_bex=false)
Definition: mesh_input.C:1855

◆ testExodusDiscTwoElemIGA()

void MeshInputTest::testExodusDiscTwoElemIGA ( )
inline

Definition at line 1966 of file mesh_input.C.

1967  {
1968  LOG_UNIT_TEST;
1969 
1970  testExodusFileMappings("meshes/two_element_iga_in.e",
1971  // Regression values for sin_x_plus_cos_y
1972  {{1.26877626663365, 1.42553698909339,
1973  1.54810114917177, 1.29792704408979}},
1974  true);
1975  }
void testExodusFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms, bool use_disc_bex=false)
Definition: mesh_input.C:1855

◆ testExodusDiscWriteAddedSidesEdgeC0()

void MeshInputTest::testExodusDiscWriteAddedSidesEdgeC0 ( )
inline

Definition at line 1193 of file mesh_input.C.

References libMesh::EDGE3, libMesh::FIRST, libMesh::SECOND, and six_x_plus_sixty_y().

1194  {
1197  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusDiscWriteAddedSidesEdgeDisc()

void MeshInputTest::testExodusDiscWriteAddedSidesEdgeDisc ( )
inline

Definition at line 1216 of file mesh_input.C.

References designed_for_side_elems(), libMesh::EDGE3, and libMesh::SECOND.

1217  {
1219  }
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945
Number designed_for_side_elems(const Point &p, const Parameters &param, const std::string &, const std::string &)
Definition: mesh_input.C:55

◆ testExodusDiscWriteAddedSidesHexC0()

void MeshInputTest::testExodusDiscWriteAddedSidesHexC0 ( )
inline

Definition at line 1317 of file mesh_input.C.

References libMesh::FIRST, libMesh::HEX27, libMesh::SECOND, and six_x_plus_sixty_y().

1318  {
1321  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusDiscWriteAddedSidesHexDisc()

void MeshInputTest::testExodusDiscWriteAddedSidesHexDisc ( )
inline

Definition at line 1340 of file mesh_input.C.

References designed_for_side_elems(), libMesh::HEX27, and libMesh::SECOND.

1341  {
1343  }
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945
Number designed_for_side_elems(const Point &p, const Parameters &param, const std::string &, const std::string &)
Definition: mesh_input.C:55

◆ testExodusDiscWriteAddedSidesMixedEdgeC0()

void MeshInputTest::testExodusDiscWriteAddedSidesMixedEdgeC0 ( )
inline

Definition at line 1205 of file mesh_input.C.

References libMesh::EDGE3, libMesh::FIRST, libMesh::LAGRANGE, libMesh::SECOND, and six_x_plus_sixty_y().

1206  {
1209  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusDiscWriteAddedSidesMixedHexC0()

void MeshInputTest::testExodusDiscWriteAddedSidesMixedHexC0 ( )
inline

Definition at line 1329 of file mesh_input.C.

References libMesh::FIRST, libMesh::HEX27, libMesh::HIERARCHIC, libMesh::LAGRANGE, libMesh::SECOND, and six_x_plus_sixty_y().

1330  {
1333  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusDiscWriteAddedSidesMixedQuadC0()

void MeshInputTest::testExodusDiscWriteAddedSidesMixedQuadC0 ( )
inline

Definition at line 1273 of file mesh_input.C.

References libMesh::FIRST, libMesh::LAGRANGE, libMesh::QUAD9, libMesh::SECOND, and six_x_plus_sixty_y().

1274  {
1277  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusDiscWriteAddedSidesMixedTriC0()

void MeshInputTest::testExodusDiscWriteAddedSidesMixedTriC0 ( )
inline

Definition at line 1239 of file mesh_input.C.

References libMesh::FIRST, libMesh::HIERARCHIC, libMesh::SECOND, six_x_plus_sixty_y(), libMesh::SZABAB, and libMesh::TRI6.

1240  {
1243  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusDiscWriteAddedSidesQuadC0()

void MeshInputTest::testExodusDiscWriteAddedSidesQuadC0 ( )
inline

Definition at line 1261 of file mesh_input.C.

References libMesh::FIRST, libMesh::QUAD9, libMesh::SECOND, and six_x_plus_sixty_y().

1262  {
1265  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusDiscWriteAddedSidesQuadDisc()

void MeshInputTest::testExodusDiscWriteAddedSidesQuadDisc ( )
inline

Definition at line 1284 of file mesh_input.C.

References designed_for_side_elems(), libMesh::QUAD9, and libMesh::SECOND.

1285  {
1287  }
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945
Number designed_for_side_elems(const Point &p, const Parameters &param, const std::string &, const std::string &)
Definition: mesh_input.C:55

◆ testExodusDiscWriteAddedSidesTetC0()

void MeshInputTest::testExodusDiscWriteAddedSidesTetC0 ( )
inline

Definition at line 1295 of file mesh_input.C.

References libMesh::FIRST, libMesh::SECOND, six_x_plus_sixty_y(), and libMesh::TET14.

1296  {
1299  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusDiscWriteAddedSidesTetDisc()

void MeshInputTest::testExodusDiscWriteAddedSidesTetDisc ( )
inline

Definition at line 1306 of file mesh_input.C.

References designed_for_side_elems(), libMesh::SECOND, and libMesh::TET14.

1307  {
1309  }
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945
Number designed_for_side_elems(const Point &p, const Parameters &param, const std::string &, const std::string &)
Definition: mesh_input.C:55

◆ testExodusDiscWriteAddedSidesTriC0()

void MeshInputTest::testExodusDiscWriteAddedSidesTriC0 ( )
inline

Definition at line 1227 of file mesh_input.C.

References libMesh::FIRST, libMesh::SECOND, six_x_plus_sixty_y(), and libMesh::TRI6.

1228  {
1231  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusDiscWriteAddedSidesTriDisc()

void MeshInputTest::testExodusDiscWriteAddedSidesTriDisc ( )
inline

Definition at line 1250 of file mesh_input.C.

References designed_for_side_elems(), libMesh::SECOND, and libMesh::TRI6.

1251  {
1253  }
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945
Number designed_for_side_elems(const Point &p, const Parameters &param, const std::string &, const std::string &)
Definition: mesh_input.C:55

◆ testExodusFileMappings()

void MeshInputTest::testExodusFileMappings ( const std::string &  filename,
std::array< Real, 4 >  expected_norms,
bool  use_disc_bex = false 
)
inline

Definition at line 1855 of file mesh_input.C.

References libMesh::MeshCommunication::broadcast(), libMesh::MeshBase::default_mapping_type(), libMesh::ExodusII_IO::get_exodus_version(), mesh, libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::RATIONAL_BERNSTEIN_MAP, libMesh::ExodusII_IO::read(), libMesh::ExodusII_IO::set_discontinuous_bex(), TestCommWorld, libMesh::VTKIO::write(), and libMesh::ExodusII_IO::write().

1858  {
1860 
1861  ExodusII_IO exii(mesh);
1862  // IGA Exodus meshes require ExodusII 8 or higher
1863  if (exii.get_exodus_version() < 800)
1864  return;
1865 
1866  // This should default to false
1867  if (use_disc_bex)
1868  exii.set_discontinuous_bex(true);
1869 
1870  if (mesh.processor_id() == 0)
1871  exii.read(filename);
1873 
1875 
1876  CPPUNIT_ASSERT_EQUAL(mesh.default_mapping_type(),
1878 
1880 
1881  testProjectionRegression(mesh, expected_norms);
1882 
1883  // Test a write when we're done reading; I was getting weirdness
1884  // from NetCDF at this point in a Moose output test.
1885  {
1886  ExodusII_IO exii(mesh);
1887 
1888  exii.write("exodus_file_mapping_out.e");
1889  }
1890 
1891 #ifdef LIBMESH_HAVE_VTK
1892  {
1893  VTKIO vtkout(mesh);
1894 
1895  vtkout.write("vtk_file_mapping_out.pvtu");
1896  }
1897 #endif
1898  }
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Definition: exodusII_io.h:52
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
MeshBase & mesh
This class implements reading and writing meshes in the VTK format.
Definition: vtk_io.h:60
ElemMappingType default_mapping_type() const
Returns the default master space to physical space mapping basis functions to be used on newly added ...
Definition: mesh_base.h:812
This is the MeshCommunication class.
void testMasterCenters(const MeshBase &mesh)
Definition: mesh_input.C:1382
void testProjectionRegression(MeshBase &mesh, std::array< Real, 4 > expected_norms)
Definition: mesh_input.C:1746
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const

◆ testExodusFileMappingsCyl3d()

void MeshInputTest::testExodusFileMappingsCyl3d ( )
inline

Definition at line 1929 of file mesh_input.C.

1930  {
1931  LOG_UNIT_TEST;
1932 
1933  testExodusFileMappings("meshes/PressurizedCyl3d_Patch1_8Elem.e",
1934  {{0.963612880188165, 1.82329452603503,
1935  0.707998701597943, 1.31399222566683}});
1936  }
void testExodusFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms, bool use_disc_bex=false)
Definition: mesh_input.C:1855

◆ testExodusFileMappingsPlateWithHole()

void MeshInputTest::testExodusFileMappingsPlateWithHole ( )
inline

Definition at line 1900 of file mesh_input.C.

1901  {
1902  LOG_UNIT_TEST;
1903 
1904  testExodusFileMappings("meshes/PlateWithHole_Patch8.e",
1905  // Regression values for sin_x_plus_cos_y
1906  {{2.2812154374012, 1.974049990211937,
1907  1.791640772215248, 1.413679237529376}});
1908  }
void testExodusFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms, bool use_disc_bex=false)
Definition: mesh_input.C:1855

◆ testExodusFileMappingsTwoBlocks()

void MeshInputTest::testExodusFileMappingsTwoBlocks ( )
inline

Definition at line 1910 of file mesh_input.C.

1911  {
1912  LOG_UNIT_TEST;
1913 
1914  testExodusFileMappings("meshes/two_quads_two_blocks.e",
1915  // Regression values for sin_x_plus_cos_y
1916  {{2.03496953073072, 1.97996853164955,
1917  1.18462134113435, 1.03085301158959}});
1918  }
void testExodusFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms, bool use_disc_bex=false)
Definition: mesh_input.C:1855

◆ testExodusFileMappingsTwoElemIGA()

void MeshInputTest::testExodusFileMappingsTwoElemIGA ( )
inline

Definition at line 1919 of file mesh_input.C.

1920  {
1921  LOG_UNIT_TEST;
1922 
1923  testExodusFileMappings("meshes/two_element_iga_in.e",
1924  // Regression values for sin_x_plus_cos_y
1925  {{1.26865962862531, 1.42562070158386,
1926  1.54905363492342, 1.29782906548366}});
1927  }
void testExodusFileMappings(const std::string &filename, std::array< Real, 4 > expected_norms, bool use_disc_bex=false)
Definition: mesh_input.C:1855

◆ testExodusIGASidesets()

void MeshInputTest::testExodusIGASidesets ( )
inline

Definition at line 416 of file mesh_input.C.

References libMesh::BoundaryInfo::boundary_ids(), libMesh::MeshCommunication::broadcast(), libMesh::ParallelObject::comm(), libMesh::BoundaryInfo::get_boundary_ids(), libMesh::MeshBase::get_boundary_info(), libMesh::ExodusII_IO::get_exodus_version(), libMesh::MeshBase::is_serial(), TIMPI::Communicator::max(), mesh, libMesh::BoundaryInfo::n_boundary_ids(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::NODEELEM, libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::ExodusII_IO::read(), TIMPI::Communicator::sum(), TestCommWorld, and libMesh::ExodusII_IO::write().

417  {
418  LOG_UNIT_TEST;
419 
421 
422  // Block here so we trigger exii destructor early; I thought I
423  // might have had a bug in there at one point
424  {
425  ExodusII_IO exii(mesh);
426  // IGA Exodus meshes require ExodusII 8 or higher
427  if (exii.get_exodus_version() < 800)
428  return;
429 
430  if (mesh.processor_id() == 0)
431  exii.read("meshes/Cube_With_Sidesets.e");
432 
433  }
434 
437 
438  // 5^3 spline nodes + 7^3 Rational Bezier nodes
439  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), static_cast<dof_id_type>(468));
440  // 5^3 spline elements + 3^3 Rational Bezier elements
441  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), static_cast<dof_id_type>(152));
442 
443  // Check that we see the boundary ids we expect
445 
446  // On a ReplicatedMesh, we should see all 6 boundary ids on each processor
447  if (mesh.is_serial())
448  CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(6), bi.n_boundary_ids());
449 
450  // On any mesh, we should see each id on *some* processor
451  {
452  const std::set<boundary_id_type> & bc_ids = bi.get_boundary_ids();
453  // CoreForm gave me a file with 1-based numbering! (faints)
454  for (boundary_id_type i = 1 ; i != 7; ++i)
455  {
456  bool has_bcid = bc_ids.count(i);
457  mesh.comm().max(has_bcid);
458  CPPUNIT_ASSERT(has_bcid);
459  }
460  }
461 
462  // Indexed by bcid-1, because we count from 0, like God and
463  // Dijkstra intended!
464  std::vector<int> side_counts(6, 0);
465 
466  // Map from our side numbers to the file's BCIDs
467  const boundary_id_type libmesh_side_to_bcid[] = {1, 4, 6, 3, 5, 2};
468 
469  for (const auto & elem : mesh.active_local_element_ptr_range())
470  {
471  if (elem->type() == NODEELEM)
472  continue;
473 
474  for (unsigned short side=0; side<elem->n_sides(); side++)
475  {
476  if (elem->neighbor_ptr(side))
477  CPPUNIT_ASSERT_EQUAL(bi.n_boundary_ids(elem, side), 0u);
478  else
479  {
480  CPPUNIT_ASSERT_EQUAL(bi.n_boundary_ids(elem, side), 1u);
481  std::vector<boundary_id_type> bids;
482  bi.boundary_ids(elem, side, bids);
483  side_counts[bids[0]-1]++;
484  CPPUNIT_ASSERT_EQUAL(libmesh_side_to_bcid[side], bids[0]);
485  }
486  }
487  }
488 
489  for (auto bc_count : side_counts)
490  {
491  // We should have 3^2 sides with each id
492  mesh.comm().sum(bc_count);
493  CPPUNIT_ASSERT_EQUAL(bc_count, 9);
494  }
495 
496  // Test a write when we're done reading; I was getting weirdness
497  // from NetCDF at this point in a Moose output test.
498  {
499  ExodusII_IO exii(mesh);
500 
501  exii.write("Cube_With_Sidesets_out.e");
502  }
503  }
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Definition: exodusII_io.h:52
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
void sum(T &r) const
MeshBase & mesh
const Parallel::Communicator & comm() const
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:165
std::size_t n_boundary_ids() const
virtual bool is_serial() const
Definition: mesh_base.h:211
int8_t boundary_id_type
Definition: id_types.h:51
This is the MeshCommunication class.
The BoundaryInfo class contains information relevant to boundary conditions including storing faces...
Definition: boundary_info.h:57
const std::set< boundary_id_type > & get_boundary_ids() const
void max(const T &r, T &o, Request &req) const
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

◆ testExodusReadHeader()

void MeshInputTest::testExodusReadHeader ( )
inline

Definition at line 336 of file mesh_input.C.

References TIMPI::Communicator::barrier(), libMesh::MeshTools::Generation::build_square(), mesh, libMesh::ExodusHeaderInfo::num_dim, libMesh::ExodusHeaderInfo::num_edge, libMesh::ExodusHeaderInfo::num_edge_blk, libMesh::ExodusHeaderInfo::num_elem, libMesh::ExodusHeaderInfo::num_elem_blk, libMesh::ExodusHeaderInfo::num_node_sets, libMesh::ExodusHeaderInfo::num_side_sets, libMesh::ExodusII_IO::read_header(), TestCommWorld, libMesh::ExodusHeaderInfo::title, and libMesh::MeshBase::write().

337  {
338  LOG_UNIT_TEST;
339 
340  // first scope: write file
341  {
343  MeshTools::Generation::build_square (mesh, 3, 3, 0., 1., 0., 1.);
344  ExodusII_IO exii(mesh);
345  mesh.write("read_header_test.e");
346  }
347 
348  // Make sure that the writing is done before the reading starts.
350 
351  // second scope: read header
352  // Note: The header information is read from file on processor 0
353  // and then broadcast to the other procs, so with this test we are
354  // checking both that the header information is read correctly and
355  // that it is correctly communicated to other procs.
356  {
358  ExodusII_IO exii(mesh);
359  ExodusHeaderInfo header_info = exii.read_header("read_header_test.e");
360 
361  // Make sure the header information is as expected.
362  CPPUNIT_ASSERT_EQUAL(std::string(header_info.title.data()), std::string("read_header_test.e"));
363  CPPUNIT_ASSERT_EQUAL(header_info.num_dim, 2);
364  CPPUNIT_ASSERT_EQUAL(header_info.num_elem, 9);
365  CPPUNIT_ASSERT_EQUAL(header_info.num_elem_blk, 1);
366  CPPUNIT_ASSERT_EQUAL(header_info.num_node_sets, 4);
367  CPPUNIT_ASSERT_EQUAL(header_info.num_side_sets, 4);
368  CPPUNIT_ASSERT_EQUAL(header_info.num_edge_blk, 0);
369  CPPUNIT_ASSERT_EQUAL(header_info.num_edge, 0);
370  }
371  }
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
This class is used as both an external data structure for passing around Exodus file header informati...
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Definition: exodusII_io.h:52
void barrier() const
MeshBase & mesh
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
std::vector< char > title
virtual void write(const std::string &name) const =0

◆ testExodusWriteAddedSides()

void MeshInputTest::testExodusWriteAddedSides ( Number(*)(const Point &, const Parameters &, const std::string &, const std::string &)  exact_sol,
const ElemType  elem_type,
const Order  order,
const bool  write_discontinuous = false,
const std::vector< FEType earlier_vars = {},
const std::vector< FEType later_vars = {} 
)
inline

Definition at line 945 of file mesh_input.C.

950  {},
951  const std::vector<FEType> later_vars = {})
952  {
953  constexpr unsigned int nx = added_sides_nxyz[0],
954  ny = added_sides_nxyz[1],
955  nz = added_sides_nxyz[2];
956 
957  const unsigned int dim = Elem::type_to_dim_map[elem_type];
958  const bool is_tensor = (Elem::build(elem_type)->n_sides() == dim * 2);
959 
960  // Figure out how many fake and true elements to expect
961  dof_id_type n_fake_elem = 0;
962  dof_id_type n_true_elem = 0;
963 
964  dof_id_type n_fake_nodes = 0;
965  dof_id_type n_true_nodes = 0;
966 
967  const std::string filename =
968  "side_discontinuous_"+Utility::enum_to_string<ElemType>(elem_type)+(write_discontinuous?"_disc":"")+".e";
969 
970  // first scope: write file
971  {
973 
974  EquationSystems es(mesh);
975  System & sys = es.add_system<System> ("SimpleSystem");
976  int varnum = 1;
977  for (auto vartype : earlier_vars)
978  sys.add_variable("earlier_"+std::to_string(varnum++), vartype);
979 
980  sys.add_variable("u", order, SIDE_HIERARCHIC);
981 
982  varnum = 1;
983  for (auto vartype : later_vars)
984  sys.add_variable("later_"+std::to_string(varnum++), vartype);
985 
986  if (dim == 3)
988  (mesh, nx, ny, nz, 0., 1., 0., 1., 0., 1., elem_type);
989  else if (dim == 2)
991  (mesh, nx, ny, 0., 1., 0., 1., elem_type);
992  else
994  (mesh, nx, 0., 1., elem_type);
995 
996  n_true_elem = mesh.n_elem();
997  n_true_nodes = mesh.n_nodes();
998  CPPUNIT_ASSERT_LESS(n_true_nodes, n_true_elem); // Ne < Nn
999 
1000  const unsigned int our_ny = dim>1 ? ny : 1;
1001  const unsigned int our_nz = dim>2 ? nz : 1;
1002 
1003  dof_id_type min_n_elem = nx * our_ny * our_nz;
1004  CPPUNIT_ASSERT_LESSEQUAL(n_true_elem, min_n_elem); // "backwards" API...
1005 
1006  for (const auto & elem : mesh.active_local_element_ptr_range())
1007  {
1008  for (auto s : make_range(elem->n_sides()))
1009  if (!elem->neighbor_ptr(s) || elem->neighbor_ptr(s)->id() < elem->id())
1010  {
1011  ++n_fake_elem;
1012  auto side = elem->build_side_ptr(s);
1013  n_fake_nodes += side->n_nodes();
1014  }
1015  }
1016  mesh.comm().sum(n_fake_elem);
1017  mesh.comm().sum(n_fake_nodes);
1018 
1019  const dof_id_type expected_fakes = [elem_type]() {
1020  switch (elem_type)
1021  {
1022  case EDGE3:
1023  return nx+1;
1024  case TRI6:
1025  return 3*nx*ny + nx + ny;
1026  case QUAD8:
1027  case QUAD9:
1028  return 2*nx*ny + nx + ny;
1029  case TET14:
1030  return 48*nx*ny*nz + 4*(nx*ny+nx*nz+ny*nz);
1031  case HEX27:
1032  return 3*nx*ny*nz + nx*ny + nx*nz + ny*nz;
1033  default:
1034  libmesh_error();
1035  }
1036  } (); // Invoke anonymous lambda
1037 
1038  CPPUNIT_ASSERT_EQUAL(n_fake_elem, expected_fakes); // "backwards" API...
1039 
1040  es.init();
1041  sys.project_solution(exact_sol, nullptr,
1042  es.parameters);
1043 
1044  // Set solution u^e_i = i, for the ith vertex of a given element e.
1045 
1046  // Now write to file.
1047  ExodusII_IO exii(mesh);
1048  exii.write_added_sides(true);
1049 
1050  if (write_discontinuous)
1051  exii.write_discontinuous_equation_systems(filename, es);
1052  else
1053  exii.write_equation_systems(filename, es);
1054  } // end first scope
1055 
1056  // second scope: read file, verify extra elements exist
1057  {
1059  mesh.allow_renumbering(false);
1060 
1061  ExodusII_IO exii(mesh);
1062 
1063  if (mesh.processor_id() == 0)
1064  exii.read(filename);
1067 
1068  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), n_true_elem + n_fake_elem);
1069  if (write_discontinuous)
1070  {
1071  const dof_id_type nodes_per_elem = Elem::build(elem_type)->n_nodes();
1072  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
1073  n_true_elem*nodes_per_elem + n_fake_nodes);
1074  }
1075  else
1076  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), n_true_nodes + n_fake_nodes);
1077 
1078  EquationSystems es(mesh);
1079  System & sys = es.add_system<System> ("SimpleSystem");
1080  // Read back into a LAGRANGE variable for testing; we still
1081  // can't use Exodus for a proper restart.
1082  sys.add_variable("ul", SECOND);
1083  es.init();
1084 
1085  const DofMap & dof_map = sys.get_dof_map();
1086 
1087 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
1088  exii.copy_nodal_solution(sys, "ul", "r_u");
1089 #else
1090  exii.copy_nodal_solution(sys, "ul", "u");
1091 #endif
1092 
1093  dof_id_type n_side_nodes = 0;
1094  const std::string nullstr;
1095  const std::string facestr = "face";
1096 
1097  // Debugging this in parallel is tricky. Let's make sure that
1098  // if we have a failure on one rank we see it on all the others
1099  // and we can go on to other tests.
1100 #ifdef LIBMESH_ENABLE_EXCEPTIONS
1101  bool threw_exception = false;
1102  try
1103 #endif // LIBMESH_ENABLE_EXCEPTIONS
1104  {
1105  for (const auto & elem : mesh.active_local_element_ptr_range())
1106  {
1107  // Just look at side elements, not interiors
1108  if (elem->dim() == dim)
1109  continue;
1110 
1111  std::vector<dof_id_type> dof_indices;
1112  dof_map.dof_indices(elem, dof_indices, 0);
1113 
1114  // Find what face direction we're looking at, to
1115  // disambiguate when testing against a discontinuous
1116  // function, since we're evaluating on nodes that overlap
1117  // multiple faces
1118  const Point normal = [elem](){
1119  if (elem->dim() == 2)
1120  return Point((elem->point(1) - elem->point(0)).cross
1121  (elem->point(2) - elem->point(0)));
1122  else if (elem->dim() == 1)
1123  return Point
1124  (elem->point(1)(1)-elem->point(0)(1),
1125  elem->point(0)(0)-elem->point(1)(0));
1126  else
1127  return Point(1);
1128  } (); // Invoke anonymous lambda
1129 
1130  short faceval = -1;
1131  if (is_tensor)
1132  {
1133  if (std::abs(normal(0)) > TOLERANCE)
1134  {
1135  faceval = 0;
1136  libmesh_assert_less(std::abs(normal(1)), TOLERANCE);
1137  libmesh_assert_less(std::abs(normal(2)), TOLERANCE);
1138  }
1139  else if (std::abs(normal(1)) > TOLERANCE)
1140  {
1141  faceval = 1;
1142  libmesh_assert_less(std::abs(normal(2)), TOLERANCE);
1143  }
1144  else
1145  {
1146  faceval = 2;
1147  libmesh_assert_greater(std::abs(normal(2)), TOLERANCE);
1148  }
1149  libmesh_assert_greater_equal(faceval, 0);
1150  es.parameters.set<short>(facestr) = faceval;
1151  }
1152 
1153  for (auto i : index_range(dof_indices))
1154  {
1155  const Point node_pt = elem->point(i);
1156  const Real nodal_coef =
1157  libmesh_real((*sys.current_local_solution)(dof_indices[i]));
1158  const Real exact_val =
1159  libmesh_real(exact_sol
1160  (node_pt, es.parameters, nullstr,
1161  nullstr));
1162  LIBMESH_ASSERT_FP_EQUAL
1163  (nodal_coef, exact_val,
1164  std::max(Real(2),nodal_coef+exact_val)*
1165  TOLERANCE*std::sqrt(TOLERANCE));
1166  ++n_side_nodes;
1167  }
1168  }
1169  }
1170 #ifdef LIBMESH_ENABLE_EXCEPTIONS
1171  catch (...)
1172  {
1173  threw_exception = true;
1174  TestCommWorld->max(threw_exception);
1175  throw;
1176  }
1177  if (!threw_exception)
1178  TestCommWorld->max(threw_exception);
1179  CPPUNIT_ASSERT(!threw_exception);
1180 #endif // LIBMESH_ENABLE_EXCEPTIONS
1181 
1182  TestCommWorld->sum(n_side_nodes);
1183  CPPUNIT_ASSERT_EQUAL(n_side_nodes, n_fake_nodes);
1184  } // end second scope
1185  } // end testExodusWriteAddedSides
T libmesh_real(T a)
This is the EquationSystems class.
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use...
Definition: mesh_base.h:1196
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Definition: dof_map.C:2164
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
static constexpr Real TOLERANCE
unsigned int dim
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Definition: exodusII_io.h:52
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
void sum(T &r) const
MeshBase & mesh
const Parallel::Communicator & comm() const
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
This class handles the numbering of degrees of freedom on a mesh.
Definition: dof_map.h:179
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
Projects arbitrary functions onto the current solution.
This is the MeshCommunication class.
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
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.
Definition: system.C:1357
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void max(const T &r, T &o, Request &req) const
constexpr int added_sides_nxyz[]
Definition: mesh_input.C:53
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
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...
Definition: int_range.h:140
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1605
void build_line(UnstructuredMesh &mesh, const unsigned int nx, const Real xmin=0., const Real xmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 1D meshes.
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2374
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:117
void build_cube(UnstructuredMesh &mesh, const unsigned int nx=0, const unsigned int ny=0, const unsigned int nz=0, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const Real zmin=0., const Real zmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
Builds a (elements) cube.
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

◆ testExodusWriteAddedSidesEdgeC0()

void MeshInputTest::testExodusWriteAddedSidesEdgeC0 ( )
inline

Definition at line 1187 of file mesh_input.C.

References libMesh::EDGE3, libMesh::FIRST, libMesh::SECOND, and six_x_plus_sixty_y().

1188  {
1191  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusWriteAddedSidesEdgeDisc()

void MeshInputTest::testExodusWriteAddedSidesEdgeDisc ( )
inline

Definition at line 1211 of file mesh_input.C.

References designed_for_side_elems(), libMesh::EDGE3, and libMesh::SECOND.

1212  {
1214  }
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945
Number designed_for_side_elems(const Point &p, const Parameters &param, const std::string &, const std::string &)
Definition: mesh_input.C:55

◆ testExodusWriteAddedSidesHexC0()

void MeshInputTest::testExodusWriteAddedSidesHexC0 ( )
inline

Definition at line 1311 of file mesh_input.C.

References libMesh::FIRST, libMesh::HEX27, libMesh::SECOND, and six_x_plus_sixty_y().

1312  {
1315  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusWriteAddedSidesHexDisc()

void MeshInputTest::testExodusWriteAddedSidesHexDisc ( )
inline

Definition at line 1335 of file mesh_input.C.

References designed_for_side_elems(), libMesh::HEX27, and libMesh::SECOND.

1336  {
1338  }
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945
Number designed_for_side_elems(const Point &p, const Parameters &param, const std::string &, const std::string &)
Definition: mesh_input.C:55

◆ testExodusWriteAddedSidesMixedEdgeC0()

void MeshInputTest::testExodusWriteAddedSidesMixedEdgeC0 ( )
inline

Definition at line 1199 of file mesh_input.C.

References libMesh::EDGE3, libMesh::FIRST, libMesh::LAGRANGE, libMesh::SECOND, and six_x_plus_sixty_y().

1200  {
1203  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusWriteAddedSidesMixedHexC0()

void MeshInputTest::testExodusWriteAddedSidesMixedHexC0 ( )
inline

Definition at line 1323 of file mesh_input.C.

References libMesh::FIRST, libMesh::HEX27, libMesh::HIERARCHIC, libMesh::LAGRANGE, libMesh::SECOND, and six_x_plus_sixty_y().

1324  {
1327  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusWriteAddedSidesMixedQuadC0()

void MeshInputTest::testExodusWriteAddedSidesMixedQuadC0 ( )
inline

Definition at line 1267 of file mesh_input.C.

References libMesh::FIRST, libMesh::LAGRANGE, libMesh::QUAD9, libMesh::SECOND, and six_x_plus_sixty_y().

1268  {
1271  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusWriteAddedSidesMixedTriC0()

void MeshInputTest::testExodusWriteAddedSidesMixedTriC0 ( )
inline

Definition at line 1233 of file mesh_input.C.

References libMesh::FIRST, libMesh::HIERARCHIC, libMesh::SECOND, six_x_plus_sixty_y(), libMesh::SZABAB, and libMesh::TRI6.

1234  {
1237  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusWriteAddedSidesQuadC0()

void MeshInputTest::testExodusWriteAddedSidesQuadC0 ( )
inline

Definition at line 1255 of file mesh_input.C.

References libMesh::FIRST, libMesh::QUAD9, libMesh::SECOND, and six_x_plus_sixty_y().

1256  {
1259  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusWriteAddedSidesQuadDisc()

void MeshInputTest::testExodusWriteAddedSidesQuadDisc ( )
inline

Definition at line 1279 of file mesh_input.C.

References designed_for_side_elems(), libMesh::QUAD9, and libMesh::SECOND.

1280  {
1282  }
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945
Number designed_for_side_elems(const Point &p, const Parameters &param, const std::string &, const std::string &)
Definition: mesh_input.C:55

◆ testExodusWriteAddedSidesTetC0()

void MeshInputTest::testExodusWriteAddedSidesTetC0 ( )
inline

Definition at line 1289 of file mesh_input.C.

References libMesh::FIRST, libMesh::SECOND, six_x_plus_sixty_y(), and libMesh::TET14.

1290  {
1293  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusWriteAddedSidesTetDisc()

void MeshInputTest::testExodusWriteAddedSidesTetDisc ( )
inline

Definition at line 1301 of file mesh_input.C.

References designed_for_side_elems(), libMesh::SECOND, and libMesh::TET14.

1302  {
1304  }
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945
Number designed_for_side_elems(const Point &p, const Parameters &param, const std::string &, const std::string &)
Definition: mesh_input.C:55

◆ testExodusWriteAddedSidesTriC0()

void MeshInputTest::testExodusWriteAddedSidesTriC0 ( )
inline

Definition at line 1221 of file mesh_input.C.

References libMesh::FIRST, libMesh::SECOND, six_x_plus_sixty_y(), and libMesh::TRI6.

1222  {
1225  }
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945

◆ testExodusWriteAddedSidesTriDisc()

void MeshInputTest::testExodusWriteAddedSidesTriDisc ( )
inline

Definition at line 1245 of file mesh_input.C.

References designed_for_side_elems(), libMesh::SECOND, and libMesh::TRI6.

1246  {
1248  }
void testExodusWriteAddedSides(Number(*exact_sol)(const Point &, const Parameters &, const std::string &, const std::string &), const ElemType elem_type, const Order order, const bool write_discontinuous=false, const std::vector< FEType > earlier_vars={}, const std::vector< FEType > later_vars={})
Definition: mesh_input.C:945
Number designed_for_side_elems(const Point &p, const Parameters &param, const std::string &, const std::string &)
Definition: mesh_input.C:55

◆ testExodusWriteElementDataFromDiscontinuousNodalData()

void MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData ( )
inline

Definition at line 858 of file mesh_input.C.

References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshCommunication::broadcast(), libMesh::MeshTools::Generation::build_cube(), libMesh::CONSTANT, libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::DofMap::dof_indices(), libMesh::FIRST, libMesh::System::get_dof_map(), libMesh::HEX8, libMesh::index_range(), libMesh::EquationSystems::init(), libMesh::L2_LAGRANGE, mesh, libMesh::MONOMIAL, libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::ExodusII_IO::read(), libMesh::Real, libMesh::System::solution, TestCommWorld, libMesh::TOLERANCE, libMesh::System::variable_name(), libMesh::ExodusII_IO::write_element_data_from_discontinuous_nodal_data(), and libMesh::ExodusII_IO::write_equation_systems().

859  {
860  LOG_UNIT_TEST;
861 
862  // first scope: write file
863  {
865 
866  EquationSystems es(mesh);
867  System & sys = es.add_system<System> ("SimpleSystem");
868  sys.add_variable("u", FIRST, L2_LAGRANGE);
869 
871  (mesh, 2, 2, 2, 0., 1., 0., 1., 0., 1., HEX8);
872 
873  es.init();
874 
875  // Set solution u^e_i = i, for the ith vertex of a given element e.
876  const DofMap & dof_map = sys.get_dof_map();
877  std::vector<dof_id_type> dof_indices;
878  for (const auto & elem : mesh.element_ptr_range())
879  {
880  dof_map.dof_indices(elem, dof_indices, /*var_id=*/0);
881  for (unsigned int i=0; i<dof_indices.size(); ++i)
882  sys.solution->set(dof_indices[i], i);
883  }
884  sys.solution->close();
885 
886  // Now write to file.
887  ExodusII_IO exii(mesh);
888 
889  // Don't try to write element data as averaged nodal data.
890  std::set<std::string> sys_list;
891  exii.write_equation_systems("elemental_from_nodal.e", es, &sys_list);
892 
893  // Write one elemental data field per vertex value.
894  sys_list = {"SimpleSystem"};
895 
896  exii.write_element_data_from_discontinuous_nodal_data
897  (es, &sys_list, /*var_suffix=*/"_elem_corner_");
898  } // end first scope
899 
900  // second scope: read values back in, verify they are correct.
901  {
902  std::vector<std::string> file_var_names =
903  {"u_elem_corner_0",
904  "u_elem_corner_1",
905  "u_elem_corner_2",
906  "u_elem_corner_3"};
907  std::vector<Real> expected_values = {0., 1., 2., 3.};
908 
909  // copy_elemental_solution currently requires ReplicatedMesh
911 
912  EquationSystems es(mesh);
913  System & sys = es.add_system<System> ("SimpleSystem");
914  for (auto i : index_range(file_var_names))
915  sys.add_variable(file_var_names[i], CONSTANT, MONOMIAL);
916 
917  ExodusII_IO exii(mesh);
918 
919  if (mesh.processor_id() == 0)
920  exii.read("elemental_from_nodal.e");
923 
924  es.init();
925 
926  for (auto i : index_range(file_var_names))
927  exii.copy_elemental_solution
928  (sys, sys.variable_name(i), file_var_names[i]);
929 
930  // Check that the values we read back in are as expected.
931  for (const auto & elem : mesh.active_element_ptr_range())
932  for (auto i : index_range(file_var_names))
933  {
934  Real read_val = sys.point_value(i, elem->vertex_average());
935  LIBMESH_ASSERT_FP_EQUAL
936  (expected_values[i], read_val, TOLERANCE*TOLERANCE);
937  }
938  } // end second scope
939  } // end testExodusWriteElementDataFromDiscontinuousNodalData
This is the EquationSystems class.
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Definition: dof_map.C:2164
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
static constexpr Real TOLERANCE
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Definition: exodusII_io.h:52
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
MeshBase & mesh
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2421
This class handles the numbering of degrees of freedom on a mesh.
Definition: dof_map.h:179
This is the MeshCommunication class.
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1593
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.
Definition: system.C:1357
const std::string & variable_name(const unsigned int i) const
Definition: system.h:2478
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2374
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:117
void build_cube(UnstructuredMesh &mesh, const unsigned int nx=0, const unsigned int ny=0, const unsigned int nz=0, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const Real zmin=0., const Real zmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
Builds a (elements) cube.

◆ testGmshBCIDOverlap()

void MeshInputTest::testGmshBCIDOverlap ( )
inline

Definition at line 1563 of file mesh_input.C.

References libMesh::MeshCommunication::broadcast(), libMesh::MeshBase::get_boundary_info(), libMesh::BoundaryInfo::get_sideset_name_map(), libMesh::MeshBase::get_subdomain_name_map(), mesh, libMesh::ParallelObject::processor_id(), libMesh::GmshIO::read(), libMesh::BoundaryInfo::sideset_name(), libMesh::MeshBase::subdomain_name(), and TestCommWorld.

1564  {
1565  LOG_UNIT_TEST;
1566 
1568 
1569  GmshIO gmsh_io(mesh);
1570 
1571  if (mesh.processor_id() == 0)
1572  gmsh_io.read("meshes/bcid_overlap.msh");
1574 
1575  CPPUNIT_ASSERT_EQUAL(mesh.get_boundary_info().get_sideset_name_map().size(),
1576  std::size_t(2));
1577  CPPUNIT_ASSERT_EQUAL(mesh.get_boundary_info().sideset_name(1),
1578  std::string("srfBC4A"));
1579  CPPUNIT_ASSERT_EQUAL(mesh.get_boundary_info().sideset_name(2),
1580  std::string("srfBC4B"));
1581  CPPUNIT_ASSERT_EQUAL(mesh.get_subdomain_name_map().size(),
1582  std::size_t(2));
1583  CPPUNIT_ASSERT_EQUAL(mesh.subdomain_name(1),
1584  std::string("volBC3A"));
1585  CPPUNIT_ASSERT_EQUAL(mesh.subdomain_name(2),
1586  std::string("volBC3B"));
1587  }
Reading and writing meshes in the Gmsh format.
Definition: gmsh_io.h:51
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
const std::map< boundary_id_type, std::string > & get_sideset_name_map() const
MeshBase & mesh
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:165
This is the MeshCommunication class.
const std::map< subdomain_id_type, std::string > & get_subdomain_name_map() const
Definition: mesh_base.h:1694
std::string & subdomain_name(subdomain_id_type id)
Definition: mesh_base.C:1692
std::string & sideset_name(boundary_id_type id)
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const

◆ testGoodGmsh()

void MeshInputTest::testGoodGmsh ( )
inline

Definition at line 1548 of file mesh_input.C.

References libMesh::MeshCommunication::broadcast(), mesh, libMesh::MeshBase::n_elem(), libMesh::ParallelObject::processor_id(), libMesh::GmshIO::read(), and TestCommWorld.

1549  {
1550  LOG_UNIT_TEST;
1551 
1553 
1554  GmshIO gmsh_io(mesh);
1555 
1556  if (mesh.processor_id() == 0)
1557  gmsh_io.read("meshes/circle.msh");
1559 
1560  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), dof_id_type(14));
1561  }
Reading and writing meshes in the Gmsh format.
Definition: gmsh_io.h:51
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
MeshBase & mesh
This is the MeshCommunication class.
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const
uint8_t dof_id_type
Definition: id_types.h:67

◆ testGoodSTL()

void MeshInputTest::testGoodSTL ( )
inline

Definition at line 1589 of file mesh_input.C.

References libMesh::MeshCommunication::broadcast(), mesh, libMesh::MeshBase::n_elem(), libMesh::ParallelObject::processor_id(), libMesh::STLIO::read(), and TestCommWorld.

1590  {
1591  LOG_UNIT_TEST;
1592 
1594 
1595  STLIO stl_io(mesh);
1596 
1597  if (mesh.processor_id() == 0)
1598  stl_io.read("meshes/Cluster_34.stl");
1600 
1601  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), dof_id_type(40));
1602  }
This class implements reading and writing triangle meshes in the STL format.
Definition: stl_io.h:45
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
MeshBase & mesh
This is the MeshCommunication class.
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const
uint8_t dof_id_type
Definition: id_types.h:67

◆ testGoodSTLBinary()

void MeshInputTest::testGoodSTLBinary ( )
inline

Definition at line 1604 of file mesh_input.C.

References libMesh::MeshCommunication::broadcast(), mesh, libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::ParallelObject::processor_id(), libMesh::STLIO::read(), and TestCommWorld.

1605  {
1606  LOG_UNIT_TEST;
1607 
1609 
1610  STLIO stl_io(mesh);
1611 
1612  if (mesh.processor_id() == 0)
1613  stl_io.read("meshes/engraving.stl");
1615 
1616  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), dof_id_type(426));
1617  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), dof_id_type(215));
1618  }
This class implements reading and writing triangle meshes in the STL format.
Definition: stl_io.h:45
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
MeshBase & mesh
This is the MeshCommunication class.
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

◆ testLowOrderEdgeBlocks()

void MeshInputTest::testLowOrderEdgeBlocks ( )
inline

Definition at line 373 of file mesh_input.C.

References libMesh::MeshCommunication::broadcast(), libMesh::BoundaryInfo::build_edge_list(), libMesh::MeshBase::get_boundary_info(), libMesh::MeshBase::is_serial(), mesh, libMesh::BoundaryInfo::n_boundary_ids(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::ExodusII_IO::read(), and TestCommWorld.

374  {
375  LOG_UNIT_TEST;
376 
378  ExodusII_IO exii(mesh);
379 
380  if (mesh.processor_id() == 0)
381  exii.read("meshes/mesh_with_low_order_edge_blocks.e");
382 
385 
386  // Check that we see the boundary ids we expect
388 
389  // On a ReplicatedMesh, check that the number of edge boundary
390  // conditions is as expected. The real test is that we can read
391  // this file in at all. Prior to the changes in #3491, the Exodus
392  // reader threw an exception while trying to read this mesh.
393  if (mesh.is_serial())
394  {
395  // Mesh has 26 boundary ids total (including edge and side ids).
396  // ss_prop1 = 200, 201 ;
397  // ed_prop1 = 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010,
398  // 8011, 9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009, 9010,
399  // 9011, 9012 ;
400  CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(26), bi.n_boundary_ids());
401 
402  // We can binary_search() the build_edge_list() which is sorted
403  // in lexicographical order before it's returned.
404  auto edge_list = bi.build_edge_list();
405 
406  // Search for some tuples we expect to be present
407  CPPUNIT_ASSERT(std::binary_search(edge_list.begin(), edge_list.end(), std::make_tuple(4, 1, 8007)));
408  CPPUNIT_ASSERT(std::binary_search(edge_list.begin(), edge_list.end(), std::make_tuple(10, 6, 8001)));
409 
410  // And make sure we don't have entries we shouldn't have
411  CPPUNIT_ASSERT(!std::binary_search(edge_list.begin(), edge_list.end(), std::make_tuple(1, 8, 8009)));
412  CPPUNIT_ASSERT(!std::binary_search(edge_list.begin(), edge_list.end(), std::make_tuple(2, 10, 9011)));
413  }
414  }
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Definition: exodusII_io.h:52
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
MeshBase & mesh
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:165
std::size_t n_boundary_ids() const
virtual bool is_serial() const
Definition: mesh_base.h:211
This is the MeshCommunication class.
The BoundaryInfo class contains information relevant to boundary conditions including storing faces...
Definition: boundary_info.h:57
void build_edge_list(std::vector< dof_id_type > &element_id_list, std::vector< unsigned short int > &edge_list, std::vector< boundary_id_type > &bc_id_list) const
Creates a list of element numbers, edges, and boundary ids for those edges.
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const

◆ testMasterCenters()

void MeshInputTest::testMasterCenters ( const MeshBase mesh)
inline

Definition at line 1382 of file mesh_input.C.

References libMesh::FEMap::inverse_map(), libMesh::FEMap::map(), mesh, libMesh::TensorTools::norm(), libMesh::MeshBase::sub_point_locator(), and libMesh::TOLERANCE.

1383  {
1384  auto locator = mesh.sub_point_locator();
1385 
1386  for (auto & elem : mesh.element_ptr_range())
1387  {
1388  Point master_pt = {}; // center, for tensor product elements
1389 
1390  // But perturb it to try and trigger any mapping weirdness
1391  if (elem->dim() > 0)
1392  master_pt(0) = 0.25;
1393 
1394  if (elem->dim() > 1)
1395  master_pt(1) = -0.25;
1396 
1397  if (elem->dim() > 2)
1398  master_pt(2) = 0.75;
1399 
1400  Point physical_pt = FEMap::map(elem->dim(), elem, master_pt);
1401 
1402  Point inverse_pt = FEMap::inverse_map(elem->dim(), elem,
1403  physical_pt);
1404 
1405  CPPUNIT_ASSERT((inverse_pt-master_pt).norm() < TOLERANCE);
1406 
1407  CPPUNIT_ASSERT(elem->contains_point(physical_pt));
1408 
1409  // We only want to find elements in the same block
1410  std::set<subdomain_id_type> my_subdomain { elem->subdomain_id() };
1411 
1412  // We can *still* have overlapping NodeElem from a slit mesh
1413  // input file; better check them all
1414  std::set<const Elem * > located_elems;
1415  (*locator)(physical_pt, located_elems, &my_subdomain);
1416 
1417  CPPUNIT_ASSERT(located_elems.count(elem));
1418  }
1419  }
std::unique_ptr< PointLocatorBase > sub_point_locator() const
Definition: mesh_base.C:1638
static constexpr Real TOLERANCE
MeshBase & mesh
auto norm(const T &a) -> decltype(std::abs(a))
Definition: tensor_tools.h:74
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39

◆ testNemesisCopyElementSolutionDistributed()

void MeshInputTest::testNemesisCopyElementSolutionDistributed ( )
inline

Definition at line 674 of file mesh_input.C.

675  { LOG_UNIT_TEST; testCopyElementSolutionImpl<DistributedMesh,Nemesis_IO>("dist_with_elem_soln.nem"); }

◆ testNemesisCopyElementSolutionReplicated()

void MeshInputTest::testNemesisCopyElementSolutionReplicated ( )
inline

Definition at line 671 of file mesh_input.C.

672  { LOG_UNIT_TEST; testCopyElementSolutionImpl<ReplicatedMesh,Nemesis_IO>("repl_with_elem_soln.nem"); }

◆ testNemesisCopyElementVectorDistributed()

void MeshInputTest::testNemesisCopyElementVectorDistributed ( )
inline

Definition at line 853 of file mesh_input.C.

854  { LOG_UNIT_TEST; testCopyElementVectorImpl<DistributedMesh,Nemesis_IO>("dist_with_elem_vec.nem"); }

◆ testNemesisCopyElementVectorReplicated()

void MeshInputTest::testNemesisCopyElementVectorReplicated ( )
inline

Definition at line 850 of file mesh_input.C.

851  { LOG_UNIT_TEST; testCopyElementVectorImpl<ReplicatedMesh,Nemesis_IO>("repl_with_elem_vec.nem"); }

◆ testNemesisCopyNodalSolutionDistributed()

void MeshInputTest::testNemesisCopyNodalSolutionDistributed ( )
inline

Definition at line 585 of file mesh_input.C.

586  { LOG_UNIT_TEST; testCopyNodalSolutionImpl<DistributedMesh,Nemesis_IO>("dist_with_nodal_soln.nem"); }

◆ testNemesisCopyNodalSolutionReplicated()

void MeshInputTest::testNemesisCopyNodalSolutionReplicated ( )
inline

Definition at line 582 of file mesh_input.C.

583  { LOG_UNIT_TEST; testCopyNodalSolutionImpl<ReplicatedMesh,Nemesis_IO>("repl_with_nodal_soln.nem"); }

◆ testNemesisReadDistributed()

void MeshInputTest::testNemesisReadDistributed ( )
inline

Definition at line 1377 of file mesh_input.C.

1378  { LOG_UNIT_TEST; testNemesisReadImpl<DistributedMesh>(); }

◆ testNemesisReadImpl()

template<typename MeshType >
void MeshInputTest::testNemesisReadImpl ( )
inline

Definition at line 1350 of file mesh_input.C.

References TIMPI::Communicator::barrier(), libMesh::MeshTools::Generation::build_square(), mesh, libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::prepare_for_use(), libMesh::Nemesis_IO::read(), TestCommWorld, and libMesh::MeshBase::write().

1351  {
1352  // first scope: write file
1353  {
1354  MeshType mesh(*TestCommWorld);
1355  MeshTools::Generation::build_square (mesh, 3, 3, 0., 1., 0., 1.);
1356  mesh.write("test_nemesis_read.nem");
1357  }
1358 
1359  // Make sure that the writing is done before the reading starts.
1361 
1362  // second scope: read file
1363  {
1364  MeshType mesh(*TestCommWorld);
1365  Nemesis_IO nem(mesh);
1366 
1367  nem.read("test_nemesis_read.nem");
1369  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), static_cast<dof_id_type>(9));
1370  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), static_cast<dof_id_type>(16));
1371  }
1372  }
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
void barrier() const
MeshBase & mesh
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
The Nemesis_IO class implements reading parallel meshes in the Nemesis file format from Sandia Nation...
Definition: nemesis_io.h:51
virtual void write(const std::string &name) const =0
virtual dof_id_type n_elem() const =0
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

◆ testNemesisReadReplicated()

void MeshInputTest::testNemesisReadReplicated ( )
inline

Definition at line 1374 of file mesh_input.C.

1375  { LOG_UNIT_TEST; testNemesisReadImpl<ReplicatedMesh>(); }

◆ testNemesisSingleElementDistributed()

void MeshInputTest::testNemesisSingleElementDistributed ( )
inline

Definition at line 735 of file mesh_input.C.

736  { LOG_UNIT_TEST; testSingleElementImpl<DistributedMesh,Nemesis_IO>("dist_with_single_elem.nem"); }

◆ testNemesisSingleElementReplicated()

void MeshInputTest::testNemesisSingleElementReplicated ( )
inline

Definition at line 732 of file mesh_input.C.

733  { LOG_UNIT_TEST; testSingleElementImpl<ReplicatedMesh,Nemesis_IO>("repl_with_single_elem.nem"); }

◆ testProjectionRegression()

void MeshInputTest::testProjectionRegression ( MeshBase mesh,
std::array< Real, 4 >  expected_norms 
)
inline

Definition at line 1746 of file mesh_input.C.

References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::System::calculate_norm(), libMesh::MeshBase::clone(), libMesh::H1_SEMINORM, libMesh::EquationSystems::init(), libMesh::L2, libMesh::L_INF, TIMPI::Communicator::max(), mesh, libMesh::EquationSystems::parameters, libMesh::System::project_solution(), libMesh::RATIONAL_BERNSTEIN, libMesh::Real, sin_x_plus_cos_y(), libMesh::System::solution, TestCommWorld, libMesh::TOLERANCE, and libMesh::W1_INF_SEMINORM.

1747  {
1748  int order = 0;
1749  for (const auto elem : mesh.element_ptr_range())
1750  order = std::max(order, int(elem->default_order()));
1751  TestCommWorld->max(order);
1752  CPPUNIT_ASSERT (order > 0);
1753 
1754  // Let's test that IGA constraints are preserved (in a relative
1755  // sense) when we clone a mesh.
1756  std::unique_ptr<MeshBase> mesh_clone = mesh.clone();
1757  CPPUNIT_ASSERT(*mesh_clone == mesh);
1758 
1759  EquationSystems es(mesh);
1760  System &sys = es.add_system<System> ("SimpleSystem");
1761  sys.add_variable("n", Order(order), RATIONAL_BERNSTEIN);
1762 
1763  es.init();
1764 
1765  sys.project_solution(sin_x_plus_cos_y, nullptr, es.parameters);
1766 
1767  // Make this easy to tweak in the future
1768  const Real my_tolerance = TOLERANCE;
1769 
1770  // Calculate some norms, skipping the spline points, and compare
1771  // to regression standard values
1772  std::set<unsigned int> skip_dimensions {0};
1773  const Real L2_norm =
1774  sys.calculate_norm(*sys.solution, 0, L2, &skip_dimensions);
1775 // std::cout.precision(16);
1776 // std::cout << "L2_norm = " << L2_norm << std::endl;
1777  LIBMESH_ASSERT_FP_EQUAL(L2_norm, expected_norms[0], my_tolerance);
1778  const Real Linf_norm =
1779  sys.calculate_norm(*sys.solution, 0, L_INF, &skip_dimensions);
1780 // std::cout << "Linf_norm = " << Linf_norm << std::endl;
1781  LIBMESH_ASSERT_FP_EQUAL(Linf_norm, expected_norms[1], my_tolerance);
1782  const Real H1_norm =
1783  sys.calculate_norm(*sys.solution, 0, H1_SEMINORM, &skip_dimensions);
1784 // std::cout << "H1_norm = " << H1_norm << std::endl;
1785  LIBMESH_ASSERT_FP_EQUAL(H1_norm, expected_norms[2], my_tolerance);
1786  const Real W1inf_norm =
1787  sys.calculate_norm(*sys.solution, 0, W1_INF_SEMINORM, &skip_dimensions);
1788 // std::cout << "W1inf_norm = " << W1inf_norm << std::endl;
1789  // W1_inf seems more sensitive to FP error...
1790  LIBMESH_ASSERT_FP_EQUAL(W1inf_norm, expected_norms[3], 10*my_tolerance);
1791  }
This is the EquationSystems class.
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
static constexpr Real TOLERANCE
MeshBase & mesh
virtual std::unique_ptr< MeshBase > clone() const =0
Virtual "copy constructor".
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
Projects arbitrary functions onto the current solution.
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1593
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
Definition: system.C:1724
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.
Definition: system.C:1357
Number sin_x_plus_cos_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:42
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void max(const T &r, T &o, Request &req) const

◆ testSingleElementImpl()

template<typename MeshType , typename IOType >
void MeshInputTest::testSingleElementImpl ( const std::string &  filename)
inline

Definition at line 682 of file mesh_input.C.

References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshTools::Generation::build_square(), libMesh::CONSTANT, libMesh::Nemesis_IO::copy_elemental_solution(), libMesh::EquationSystems::init(), libMesh::MeshInput< MT >::is_parallel_format(), libMesh::libmesh_real(), mesh, libMesh::MONOMIAL, libMesh::EquationSystems::parameters, libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::Nemesis_IO::read(), libMesh::Real, six_x_plus_sixty_y(), TestCommWorld, libMesh::Nemesis_IO::write_element_data(), and libMesh::MeshOutput< MT >::write_equation_systems().

683  {
684  {
685  // Generate a single 1x1 square element mesh
686  MeshType mesh(*TestCommWorld);
688 
689  EquationSystems es(mesh);
690  auto & sys = es.add_system<System>("SimpleSystem");
691  sys.add_variable("e", CONSTANT, MONOMIAL);
692 
693  // Set an arbitrary solution for the single element DOF
694  es.init();
695  sys.project_solution(six_x_plus_sixty_y, nullptr, es.parameters);
696 
697  // Write the solution to Nemesis file(s) - only proc 0 should have anything to write!
698  Nemesis_IO nem_io(mesh);
699  std::set<std::string> sys_list;
700  nem_io.write_equation_systems(filename, es, &sys_list);
701  nem_io.write_element_data(es);
702  }
703 
704  // If we can read and copy the correct element value back into the mesh, we know the Nemesis
705  // file(s) were written properly.
706  {
707  MeshType mesh(*TestCommWorld);
708  EquationSystems es(mesh);
709  auto & sys = es.add_system<System>("SimpleSystem");
710  sys.add_variable("teste", CONSTANT, MONOMIAL);
711 
712  Nemesis_IO nem_io(mesh);
713  if (mesh.processor_id() == 0 || nem_io.is_parallel_format())
714  nem_io.read(filename);
715 
717  es.init();
718 
719 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
720  nem_io.copy_elemental_solution(sys, "teste", "r_e");
721 #else
722  nem_io.copy_elemental_solution(sys, "teste", "e");
723 #endif
724 
725  // The result should be '\frac{6 + 60}{2} = 33' at all points in the element domain
726  CPPUNIT_ASSERT_EQUAL(int(sys.solution->size()), 1);
727  CPPUNIT_ASSERT_EQUAL(libmesh_real(sys.point_value(0, Point(0.5, 0.5))), Real(33));
728  }
729  }
T libmesh_real(T a)
This is the EquationSystems class.
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
Number six_x_plus_sixty_y(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: mesh_input.C:30
MeshBase & mesh
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
The Nemesis_IO class implements reading parallel meshes in the Nemesis file format from Sandia Nation...
Definition: nemesis_io.h:51
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
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.
Definition: system.C:1357
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
processor_id_type processor_id() const
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39

◆ testTetgenIO()

void MeshInputTest::testTetgenIO ( )
inline

Definition at line 1620 of file mesh_input.C.

References libMesh::MeshCommunication::broadcast(), libMesh::ParallelObject::comm(), libMesh::MeshBase::is_serial(), TIMPI::Communicator::max(), mesh, libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::MeshBase::query_elem_ptr(), libMesh::TetGenIO::read(), libMesh::Real, TestCommWorld, libMesh::TOLERANCE, and libMesh::Elem::volume().

1621  {
1622 #ifdef LIBMESH_HAVE_TETGEN
1623  LOG_UNIT_TEST;
1624 
1626 
1627  TetGenIO tetgen_io(mesh);
1628 
1629  if (mesh.processor_id() == 0)
1630  tetgen_io.read("meshes/tetgen_one_tet10.ele");
1632 
1634 
1635  // Mesh should contain 1 TET10 finite element
1636  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), static_cast<dof_id_type>(1));
1637  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), static_cast<dof_id_type>(10));
1638 
1639  // Element should have TET10 reference element volume
1640  const Elem * const elem = mesh.query_elem_ptr(0);
1641 
1642  // On a serial mesh we have every element everywhere
1643  if (mesh.is_serial())
1644  CPPUNIT_ASSERT(elem);
1645  else
1646  {
1647  bool have_elem = elem;
1648  mesh.comm().max(have_elem);
1649  CPPUNIT_ASSERT(have_elem);
1650  }
1651 
1652  if (elem)
1653  {
1654  const Real vol = elem->volume();
1655  LIBMESH_ASSERT_FP_EQUAL(vol, 1./6, TOLERANCE*TOLERANCE);
1656  }
1657 #endif
1658  }
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
static constexpr Real TOLERANCE
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
MeshBase & mesh
const Parallel::Communicator & comm() const
This class implements reading and writing meshes in the TetGen format.
Definition: tetgen_io.h:47
virtual bool is_serial() const
Definition: mesh_base.h:211
This is the MeshCommunication class.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
void max(const T &r, T &o, Request &req) const
void broadcast(MeshBase &) const
Finds all the processors that may contain elements that neighbor my elements.
virtual Real volume() const
Definition: elem.C:3429
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
processor_id_type processor_id() const
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

◆ testVTKPreserveElemIds()

void MeshInputTest::testVTKPreserveElemIds ( )
inline

Definition at line 225 of file mesh_input.C.

References libMesh::MeshBase::allow_renumbering(), TIMPI::Communicator::barrier(), libMesh::MeshTools::Generation::build_square(), int, libMesh::MeshBase::max_elem_id(), mesh, libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::prepare_for_use(), libMesh::MeshBase::read(), libMesh::MeshBase::renumber_elem(), TestCommWorld, and libMesh::VTKIO::write().

226  {
227  LOG_UNIT_TEST;
228 
229  // Come up with some crazy numbering. Make all the new ids higher
230  // than the existing ids so we don't have to worry about conflicts
231  // while renumbering.
232  dof_id_type start_id;
233 
234  // first scope: write file
235  {
237  mesh.allow_renumbering(false);
238  MeshTools::Generation::build_square (mesh, 3, 3, 0., 1., 0., 1.);
239 
240  start_id = mesh.max_elem_id();
241 
242  // Use a separate container that won't invalidate iterators when
243  // we renumber
244  std::set<Elem *> elements {mesh.elements_begin(), mesh.elements_end()};
245  for (Elem * elem : elements)
246  {
247  const Point center = elem->vertex_average();
248  const int xn = int(center(0)*3);
249  const int yn = int(center(1)*3);
250  const dof_id_type new_id = start_id + yn*5 + xn;
251  mesh.renumber_elem(elem->id(), new_id);
252  }
253 
254  // Explicit writer object here to be absolutely sure we get VTK
255  VTKIO vtk(mesh);
256  vtk.write("read_elem_ids_test.pvtu");
257  }
258 
259  // Make sure that the writing is done before the reading starts.
261 
262  // second scope: read file
263  {
265  mesh.allow_renumbering(false);
266 
267  mesh.read("read_elem_ids_test.pvtu");
269 
270  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), dof_id_type(16));
271  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), dof_id_type(9));
272 
273  for (const auto & elem : mesh.element_ptr_range())
274  {
275  const Point center = elem->vertex_average();
276  const int xn = int(center(0)*3);
277  const int yn = int(center(1)*3);
278  const dof_id_type expected_id = start_id + yn*5 + xn;
279  CPPUNIT_ASSERT_EQUAL(elem->id(), expected_id);
280  }
281  }
282  }
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
Interfaces for reading/writing a mesh to/from a file.
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use...
Definition: mesh_base.h:1196
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
void barrier() const
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
MeshBase & mesh
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
This class implements reading and writing meshes in the VTK format.
Definition: vtk_io.h:60
virtual dof_id_type max_elem_id() const =0
virtual void renumber_elem(dof_id_type old_id, dof_id_type new_id)=0
Changes the id of element old_id, both by changing elem(old_id)->id() and by moving elem(old_id) in t...
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

◆ testVTKPreserveSubdomainIds()

void MeshInputTest::testVTKPreserveSubdomainIds ( )
inline

Definition at line 284 of file mesh_input.C.

References libMesh::MeshBase::allow_renumbering(), TIMPI::Communicator::barrier(), libMesh::MeshTools::Generation::build_square(), int, mesh, libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::prepare_for_use(), libMesh::MeshBase::read(), TestCommWorld, and libMesh::VTKIO::write().

285  {
286  LOG_UNIT_TEST;
287 
288  // first scope: write file
289  {
291  mesh.allow_renumbering(false);
292  MeshTools::Generation::build_square (mesh, 3, 3, 0., 1., 0., 1.);
293 
294  for (const auto & elem : mesh.element_ptr_range())
295  {
296  const Point center = elem->vertex_average();
297  const int xn = int(center(0)*3);
298  const int yn = int(center(1)*3);
299  const subdomain_id_type new_id = yn*4 + xn;
300  elem->subdomain_id() = new_id;
301  }
302 
303  // Explicit writer object here to be absolutely sure we get VTK
304  VTKIO vtk(mesh);
305  vtk.write("read_sbd_ids_test.pvtu");
306  }
307 
308  // Make sure that the writing is done before the reading starts.
310 
311  // second scope: read file
312  {
314  mesh.allow_renumbering(false);
315 
316  mesh.read("read_sbd_ids_test.pvtu");
318 
319  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(), dof_id_type(16));
320  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), dof_id_type(9));
321 
322  for (const auto & elem : mesh.element_ptr_range())
323  {
324  const Point center = elem->vertex_average();
325  const int xn = int(center(0)*3);
326  const int yn = int(center(1)*3);
327  const subdomain_id_type expected_id = yn*4 + xn;
328  CPPUNIT_ASSERT_EQUAL(elem->subdomain_id(), expected_id);
329  }
330  }
331  }
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
Interfaces for reading/writing a mesh to/from a file.
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use...
Definition: mesh_base.h:1196
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly ecreated (or read) mesh for use.
Definition: mesh_base.C:759
void barrier() const
MeshBase & mesh
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
This class implements reading and writing meshes in the VTK format.
Definition: vtk_io.h:60
virtual dof_id_type n_elem() const =0
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

The documentation for this class was generated from the following file: