|
libMesh
|
Tools for Mesh generation.
More...
Namespaces | |
| namespace | Private |
Classes | |
| class | QueryElemSubdomainIDBase |
| Class for receiving the callback during extrusion generation and providing user-defined subdomains based on the old (existing) element id and the current layer. More... | |
Functions | |
| 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 \( nx \times ny \times nz \) (elements) cube. | |
| void | build_point (UnstructuredMesh &mesh, const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false) |
A specialized build_cube() for 0D meshes. | |
| 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. | |
| 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 | build_sphere (UnstructuredMesh &mesh, const Real radius=1, const unsigned int n_refinements=2, const ElemType type=INVALID_ELEM, const unsigned int n_smooth=2, const bool flat=true) |
Fills mesh with a mesh discretizing a ball (||x||<= radius) or sphere (||x|| = radius) domain. | |
| void | build_extrusion (UnstructuredMesh &mesh, const MeshBase &cross_section, const unsigned int nz, RealVectorValue extrusion_vector, QueryElemSubdomainIDBase *elem_subdomain=nullptr) |
| Meshes the tensor product of a 1D and a 1D-or-2D domain. | |
| void | build_delaunay_square (UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin, const Real xmax, const Real ymin, const Real ymax, const ElemType type, const std::vector< TriangleInterface::Hole * > *holes=nullptr) |
| Meshes a rectangular (2D) region (with or without holes) with a Delaunay triangulation. | |
| void | surface_octahedron (UnstructuredMesh &mesh, Real xmin, Real xmax, Real ymin, Real ymax, Real zmin, Real zmax, bool flip_tris=false) |
Meshes the surface of an octahedron with 8 Tri3 elements, with counter-clockwise (libMesh default) node ordering as viewed from the octahedron exterior if flip_tris is false or from the interior otherwise. | |
Tools for Mesh generation.
| void libMesh::MeshTools::Generation::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 \( nx \times ny \times nz \) (elements) cube.
Defaults to a unit cube (or line in 1D, square in 2D), but the dimensions can be specified through the optional arguments.
Boundary ids are set to be equal to the side indexing on a master hex
Definition at line 317 of file mesh_generation.C.
References libMesh::MeshBase::add_elem(), libMesh::BoundaryInfo::add_node(), libMesh::MeshBase::add_node(), libMesh::MeshBase::add_point(), libMesh::BoundaryInfo::add_side(), libMesh::MeshBase::all_complete_order(), libMesh::MeshBase::all_second_order(), libMesh::BoundaryInfo::boundary_ids(), libMesh::Elem::build(), libMesh::Elem::build_with_id(), libMesh::C0POLYGON, libMesh::C0POLYHEDRON, libMesh::MeshBase::clear(), libMesh::MeshBase::delete_elem(), libMesh::EDGE2, libMesh::EDGE3, libMesh::EDGE4, libMesh::Utility::enum_to_string(), libMesh::MeshBase::get_boundary_info(), libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::DofObject::id(), libMesh::index_range(), libMesh::INVALID_ELEM, libMesh::BoundaryInfo::invalid_id, libMesh::libmesh_assert(), libMesh::make_range(), mesh, libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::node_ptr(), libMesh::NODEELEM, libMesh::BoundaryInfo::nodeset_name(), libMesh::MeshBase::prepare_for_use(), libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM20, libMesh::PRISM21, libMesh::PRISM6, libMesh::PYRAMID13, libMesh::PYRAMID14, libMesh::PYRAMID18, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::QUADSHELL4, libMesh::QUADSHELL8, libMesh::QUADSHELL9, libMesh::Real, libMesh::MeshTools::Modification::redistribute(), libMesh::BoundaryInfo::remove(), libMesh::MeshBase::reserve_elem(), libMesh::MeshBase::reserve_nodes(), libMesh::DofObject::set_id(), libMesh::MeshBase::set_mesh_dimension(), libMesh::Elem::set_node(), libMesh::MeshBase::set_spatial_dimension(), libMesh::BoundaryInfo::sideset_name(), libMesh::TET10, libMesh::TET14, libMesh::TET4, libMesh::TRI3, libMesh::TRI6, libMesh::TRI7, and libMesh::TRISHELL3.
Referenced by add_cube_convex_hull_to_mesh(), AllSecondOrderTest::allCompleteOrderMixedFixing3D(), AllSecondOrderTest::allSecondOrderMixedFixing3D(), Biharmonic::Biharmonic(), build_line(), ExtraIntegersTest::build_mesh(), build_point(), build_square(), CopyNodesAndElementsTest::collectMeshes(), NodalNeighborsTest::do_test(), main(), main(), RationalMapTest< elem_type >::setUp(), FETestBase< order, family, elem_type, build_nx, CaseName >::setUp(), PerElemTest< elem_type >::setUp(), ParsedFEMFunctionTest::setUp(), ParallelGhostSyncTest::setUp(), setup(), SystemsTest::test3DProjectVectorFE(), AllRBBTest::test_box(), AllTriTest::test_helper(), DistortTest::test_helper_3D(), MeshFunctionTest::test_p_level(), VolumeTest::test_true_centroid_and_volume(), ExodusC0PolyhedronTest::test_write_cube_header(), MeshStitchTest::testAmbiguousRemappingStitch(), SystemsTest::testAssemblyWithDgFemContext(), SystemsTest::testBlockRestrictedVarNDofs(), MeshStitchTest::testBoundaryInfo(), SystemsTest::testBoundaryProjectCube(), MeshGenerationTest::testBuildCube(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), SystemsTest::testDofCouplingWithVarGroups(), DofMapTest::testDofOwner(), BoundaryInfoTest::testEdgeBoundaryConditions(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), SystemsTest::testFirstScalarNumber(), VolumeTest::testHex20PLevelTrueCentroid(), MeshTetTest::testHole(), InfFERadialTest::testInfQuants(), PointLocatorTest::testLocator(), MeshStitchTest::testMeshStitch(), MeshStitchTest::testMeshStitchElemsets(), PartitionerTest< PartitionerSubclass, MeshClass >::testPartition(), SystemsTest::testProjectCube(), SystemsTest::testProjectCubeWithMeshFunction(), SystemsTest::testProjectMatrix3D(), MeshStitchTest::testRemappingStitch(), BoundaryInfoTest::testSelectiveRenumber(), SystemsTest::testSetSystemParameterOverEquationSystem(), InfFERadialTest::testSides(), InfFERadialTest::testSingleOrder(), VolumeTest::testTwistedVolume(), MeshSmootherTest::testVariationalSmoother(), and WriteEdgesetData::testWriteImpl().
| void libMesh::MeshTools::Generation::build_delaunay_square | ( | UnstructuredMesh & | mesh, |
| const unsigned int | nx, | ||
| const unsigned int | ny, | ||
| const Real | xmin, | ||
| const Real | xmax, | ||
| const Real | ymin, | ||
| const Real | ymax, | ||
| const ElemType | type, | ||
| const std::vector< TriangleInterface::Hole * > * | holes = nullptr |
||
| ) |
Meshes a rectangular (2D) region (with or without holes) with a Delaunay triangulation.
This function internally calls the triangle library written by J.R. Shewchuk.
Definition at line 2881 of file mesh_generation.C.
References libMesh::MeshBase::add_point(), libMesh::BoundaryInfo::add_side(), libMesh::TriangulatorInterface::attach_hole_list(), libMesh::MeshBase::clear(), libMesh::TriangulatorInterface::desired_area(), libMesh::TriangulatorInterface::elem_type(), libMesh::MeshBase::get_boundary_info(), mesh, libMesh::MeshBase::n_nodes(), libMesh::TriangulatorInterface::PSLG, libMesh::Real, libMesh::MeshBase::set_mesh_dimension(), libMesh::TOLERANCE, libMesh::TriangleInterface::triangulate(), and libMesh::TriangulatorInterface::triangulation_type().
| void libMesh::MeshTools::Generation::build_extrusion | ( | UnstructuredMesh & | mesh, |
| const MeshBase & | cross_section, | ||
| const unsigned int | nz, | ||
| RealVectorValue | extrusion_vector, | ||
| QueryElemSubdomainIDBase * | elem_subdomain = nullptr |
||
| ) |
Meshes the tensor product of a 1D and a 1D-or-2D domain.
Definition at line 2508 of file mesh_generation.C.
References libMesh::MeshBase::add_elem(), libMesh::BoundaryInfo::add_node(), libMesh::MeshBase::add_node(), libMesh::BoundaryInfo::add_side(), libMesh::BoundaryInfo::boundary_ids(), libMesh::Elem::build(), libMesh::Node::build(), libMesh::ParallelObject::comm(), libMesh::MeshBase::delete_remote_elements(), libMesh::Elem::dim(), libMesh::EDGE2, libMesh::EDGE3, libMesh::MeshBase::get_boundary_info(), libMesh::BoundaryInfo::get_edgeset_name_map(), libMesh::BoundaryInfo::get_nodeset_name_map(), libMesh::BoundaryInfo::get_side_boundary_ids(), libMesh::BoundaryInfo::get_sideset_name_map(), libMesh::MeshTools::Generation::QueryElemSubdomainIDBase::get_subdomain_for_layer(), libMesh::HEX27, libMesh::HEX8, libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::Parallel::Communicator::max(), mesh, libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::node_ptr(), libMesh::MeshBase::parallel_max_unique_id(), libMesh::MeshBase::prepare_for_use(), libMesh::PRISM18, libMesh::PRISM21, libMesh::PRISM6, libMesh::QUAD4, libMesh::QUAD9, libMesh::MeshBase::query_node_ptr(), libMesh::remote_elem, libMesh::MeshBase::reserve_elem(), libMesh::MeshBase::reserve_nodes(), libMesh::SECOND, libMesh::BoundaryInfo::set_edgeset_name_map(), libMesh::BoundaryInfo::set_nodeset_name_map(), libMesh::BoundaryInfo::set_sideset_name_map(), top_id, libMesh::TRI3, libMesh::TRI6, and libMesh::TRI7.
Referenced by main(), AllRBBTest::test_cylinder(), and MeshExtruderTest::testExtruder().
| void libMesh::MeshTools::Generation::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.
Boundary ids are set to be equal to the side indexing on a master edge
Definition at line 1960 of file mesh_generation.C.
References build_cube(), and mesh.
Referenced by Biharmonic::Biharmonic(), BoundaryMesh0DTest::build_mesh(), NodalNeighborsTest::do_test(), main(), DualShapeTest::setUp(), SystemsTest::simpleSetup(), SystemsTest::test100KVariables(), MeshSpatialDimensionTest::test1D(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshGenerationTest::testBuildLine(), ConnectedComponentsTest::testEdge(), VolumeTest::testEdge3Volume(), MeshSubdomainIDTest::testMultiple(), BoundaryInfoTest::testNameCopying(), EquationSystemsTest::testPostInitAddElem(), SystemsTest::testProjectLine(), SystemsTest::testProjectMatrix1D(), EquationSystemsTest::testReinitWithNodeElem(), DistributedMeshTest::testRemoteElemError(), EquationSystemsTest::testSelectivePRefine(), and MeshSmootherTest::testVariationalSmoother().
| void libMesh::MeshTools::Generation::build_point | ( | UnstructuredMesh & | mesh, |
| const ElemType | type = INVALID_ELEM, |
||
| const bool | gauss_lobatto_grid = false |
||
| ) |
A specialized build_cube() for 0D meshes.
The resulting mesh is a single NodeElem suitable for ODE tests
Definition at line 1942 of file mesh_generation.C.
References build_cube(), and mesh.
Referenced by TimeSolverTestImplementation< TimeSolverType >::run_test_with_exact_soln(), EquationSystemsTest::testInit(), EquationSystemsTest::testPostInitAddRealSystem(), and EquationSystemsTest::testPostInitAddSystem().
| void libMesh::MeshTools::Generation::build_sphere | ( | UnstructuredMesh & | mesh, |
| const Real | radius = 1, |
||
| const unsigned int | n_refinements = 2, |
||
| const ElemType | type = INVALID_ELEM, |
||
| const unsigned int | n_smooth = 2, |
||
| const bool | flat = true |
||
| ) |
Fills mesh with a mesh discretizing a ball (||x||<= radius) or sphere (||x|| = radius) domain.
A coarse grid of product elements (edge, quad, or hex) is refined, n_refinements times, snapping boundary nodes to the sphere surface each time; interior nodes are then smoothed n_smooth times.
If the selected element type is 1D, our 1D ball is a line.
If type is 2D, then if flat is true (the default), a 2D ball (a filled circle) is meshed.
In 2D, if flat is false, a 2D sphere (the surface of a 3D ball) is meshed, using TRI3 elements in an icosahedron for the initial mesh.
Definition at line 2012 of file mesh_generation.C.
Referenced by main(), AllRBBTest::test_circle(), AllRBBTest::test_cylinder(), AllRBBTest::test_disk(), AllRBBTest::test_sphere(), MeshGenerationTest::testBuildSphere(), InfFERadialTest::testInfQuants_numericDeriv(), MeshTetTest::testSphereShell(), and MeshTriangulationTest::testTriangulatorRoundHole().
| void libMesh::MeshTools::Generation::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.
Boundary ids are set to be equal to the side indexing on a master quad
Definition at line 1981 of file mesh_generation.C.
References build_cube(), and mesh.
Referenced by AllSecondOrderTest::allCompleteOrder(), AllSecondOrderTest::allCompleteOrderDoNothing(), AllSecondOrderTest::allCompleteOrderMixed(), AllSecondOrderTest::allCompleteOrderMixedFixing(), AllSecondOrderTest::allCompleteOrderRange(), AllSecondOrderTest::allSecondOrder(), AllSecondOrderTest::allSecondOrderDoNothing(), AllSecondOrderTest::allSecondOrderMixed(), AllSecondOrderTest::allSecondOrderMixedFixing(), AllSecondOrderTest::allSecondOrderRange(), Biharmonic::Biharmonic(), MeshBaseTest::BrokenNeighborMesh(), BoundaryMeshTest::build_mesh(), NodalNeighborsTest::do_test(), main(), WriteVecAndScalar::setupTests(), MultiEvaluablePredTest::test(), MeshSpatialDimensionTest::test2D(), SystemsTest::test2DProjectVectorFE(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), DistortTest::test_helper_2D(), ProjectSolutionTest::test_partial_project_solution(), MeshFunctionTest::test_subdomain_id_sets(), AllTriTest::testAllTriC0Polygon(), DofMapTest::testArrayDofIndicesWithType(), DofMapTest::testBadElemFECombo(), EquationSystemsTest::testBadVarNames(), BoundaryInfoTest::testBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundarySides(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), BoundaryInfoTest::testBuildNodeListFromSideList(), BoundaryInfoTest::testBuildSideListFromNodeList(), MeshGenerationTest::testBuildSquare(), DofMapTest::testConstraintLoopDetection(), MeshAssignTest::testCopyConstruct(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), BoundaryMeshSubdomainTest::testDefaultSubdomain(), MeshDeletionsTest::testDeleteElem(), MeshInputTest::testExodusReadHeader(), MeshExtruderTest::testExtruder(), MixedOrderTest::testFindNeighbors(), BoundaryInfoTest::testInternalBoundary(), MeshSmootherTest::testLaplaceSmoother(), MappedSubdomainPartitionerTest::testMappedSubdomainPartitioner(), BoundaryInfoTest::testMesh(), MeshBaseTest::testMeshBaseVerifyHasCachedElemData(), MeshBaseTest::testMeshBaseVerifyRemovalPreparation(), MeshAssignTest::testMeshMoveAssign(), MeshInputTest::testNemesisReadImpl(), BoundaryMeshSubdomainTest::testPerBoundarySubdomain(), PointLocatorTest::testPlanar(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectScalarCoarsening(), SystemsTest::testProjectSquare(), VolumeTest::testQuad4TrueCentroid(), EquationSystemsTest::testRefineThenReinitPreserveFlags(), BoundaryInfoTest::testRenumber(), EquationSystemsTest::testRepartitionThenReinit(), MeshInputTest::testSingleElementImpl(), BoundaryMeshSubdomainTest::testSingleSubdomain(), CheckpointIOTest::testSplitter(), MixedOrderTest::testStitch(), MeshTriangulationTest::testTriangulatorMeshedHoles(), SimplexRefinementTest::testTriRefinement(), MeshSmootherTest::testVariationalSmoother(), MeshInputTest::testVTKPreserveElemIds(), MeshInputTest::testVTKPreserveSubdomainIds(), WriteElemsetData::testWriteImpl(), WriteNodesetData::testWriteImpl(), and WriteSidesetData::testWriteImpl().
| void libMesh::MeshTools::Generation::surface_octahedron | ( | UnstructuredMesh & | mesh, |
| Real | xmin, | ||
| Real | xmax, | ||
| Real | ymin, | ||
| Real | ymax, | ||
| Real | zmin, | ||
| Real | zmax, | ||
| bool | flip_tris = false |
||
| ) |
Meshes the surface of an octahedron with 8 Tri3 elements, with counter-clockwise (libMesh default) node ordering as viewed from the octahedron exterior if flip_tris is false or from the interior otherwise.
Definition at line 2994 of file mesh_generation.C.
References libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::Elem::build(), libMesh::MeshBase::get_boundary_info(), mesh, libMesh::MeshBase::node_ptr(), libMesh::MeshBase::prepare_for_use(), libMesh::Real, libMesh::Elem::set_node(), and libMesh::TRI3.
Referenced by SimplexRefinementTest::test3DTriRefinement().