libMesh
|
Utility functions for operations on a Mesh
object.
More...
Namespaces | |
Generation | |
Tools for Mesh generation. | |
Modification | |
Tools for Mesh modification. | |
Private | |
Subdivision | |
Utility functions for subdivision surface operations on a Mesh . | |
Classes | |
class | SidesToElemMap |
This class implements a generalization of the MeshTools::build_nodes_to_elem_map() function, but rather than being a standalone function taking a std::unordered_map argument, we define a class with APIs for both building the underlying map data structure and querying its contents. More... | |
Functions | |
dof_id_type | total_weight (const MeshBase &mesh) |
dof_id_type | weight (const MeshBase &mesh, const processor_id_type pid) |
dof_id_type | weight (const MeshBase &mesh) |
void | build_nodes_to_elem_map (const MeshBase &mesh, std::vector< std::vector< dof_id_type >> &nodes_to_elem_map) |
After calling this function the input vector nodes_to_elem_map will contain the node to element connectivity. More... | |
void | build_nodes_to_elem_map (const MeshBase &mesh, std::vector< std::vector< const Elem *>> &nodes_to_elem_map) |
The same, except element pointers are returned instead of indices. More... | |
void | build_nodes_to_elem_map (const MeshBase &mesh, std::unordered_map< dof_id_type, std::vector< dof_id_type >> &nodes_to_elem_map) |
After calling this function the input map nodes_to_elem_map will contain the node to element connectivity. More... | |
void | build_nodes_to_elem_map (const MeshBase &mesh, std::unordered_map< dof_id_type, std::vector< const Elem *>> &nodes_to_elem_map) |
The same, except element pointers are returned instead of indices. More... | |
std::unordered_set< dof_id_type > | find_boundary_nodes (const MeshBase &mesh) |
Calling this function on a 2D mesh will convert all the elements to triangles. More... | |
std::unordered_set< dof_id_type > | find_block_boundary_nodes (const MeshBase &mesh) |
Returns a std::set containing Node IDs for all of the block boundary nodes. More... | |
libMesh::BoundingBox | create_bounding_box (const MeshBase &mesh) |
Sphere | bounding_sphere (const MeshBase &mesh) |
libMesh::BoundingBox | create_nodal_bounding_box (const MeshBase &mesh) |
libMesh::BoundingBox | create_local_bounding_box (const MeshBase &mesh) |
libMesh::BoundingBox | create_processor_bounding_box (const MeshBase &mesh, const processor_id_type pid) |
Sphere | processor_bounding_sphere (const MeshBase &mesh, const processor_id_type pid) |
libMesh::BoundingBox | create_subdomain_bounding_box (const MeshBase &mesh, const subdomain_id_type sid) |
Sphere | subdomain_bounding_sphere (const MeshBase &mesh, const subdomain_id_type sid) |
void | elem_types (const MeshBase &mesh, std::vector< ElemType > &et) |
Fills in a vector of all element types in the mesh. More... | |
dof_id_type | n_elem_of_type (const MeshBase &mesh, const ElemType type) |
dof_id_type | n_active_elem_of_type (const MeshBase &mesh, const ElemType type) |
dof_id_type | n_non_subactive_elem_of_type_at_level (const MeshBase &mesh, const ElemType type, const unsigned int level) |
unsigned int | n_levels (const MeshBase &mesh) |
unsigned int | n_local_levels (const MeshBase &mesh) |
unsigned int | n_active_levels (const MeshBase &mesh) |
unsigned int | n_active_local_levels (const MeshBase &mesh) |
unsigned int | n_p_levels (const MeshBase &mesh) |
unsigned int | paranoid_n_levels (const MeshBase &mesh) |
dof_id_type | n_connected_components (const MeshBase &mesh, Real constraint_tol=0) |
void | get_not_subactive_node_ids (const MeshBase &mesh, std::set< dof_id_type > ¬_subactive_node_ids) |
Builds a set of node IDs for nodes which belong to non-subactive elements. More... | |
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). More... | |
dof_id_type | n_nodes (const MeshBase::const_node_iterator &begin, const MeshBase::const_node_iterator &end) |
Count up the number of nodes of a specific type (as defined by an iterator range). More... | |
Real | volume (const MeshBase &mesh, unsigned int dim=libMesh::invalid_uint) |
Find the total volume of a mesh (interpreting that as area for dim = 2, or total arc length for dim = 1, or number of NodeElem in the mesh for dim = 0). More... | |
void | find_nodal_neighbors (const MeshBase &mesh, const Node &n, const std::vector< std::vector< const Elem *>> &nodes_to_elem_map, std::vector< const Node *> &neighbors) |
Given a mesh and a node in the mesh, the vector will be filled with every node directly attached to the given one. More... | |
void | find_nodal_neighbors (const MeshBase &mesh, const Node &n, const std::unordered_map< dof_id_type, std::vector< const Elem *>> &nodes_to_elem_map, std::vector< const Node *> &neighbors) |
Given a mesh and a node in the mesh, the vector will be filled with every node directly attached to the given one. More... | |
void | find_hanging_nodes_and_parents (const MeshBase &mesh, std::map< dof_id_type, std::vector< dof_id_type >> &hanging_nodes) |
Given a mesh hanging_nodes will be filled with an associative array keyed off the global id of all the hanging nodes in the mesh. More... | |
void | correct_node_proc_ids (MeshBase &) |
Changes the processor ids on each node so be the same as the id of the lowest element touching that node. More... | |
void | clear_spline_nodes (MeshBase &) |
Remove spline node (for IsoGeometric Analysis meshes) elements and nodes and constraints from the mesh. More... | |
bool | valid_is_prepared (const MeshBase &mesh) |
A function for testing whether a mesh's cached is_prepared() setting is not a false positive. More... | |
template<> | |
void | libmesh_assert_topology_consistent_procids< Elem > (const MeshBase &mesh) |
template<> | |
void | libmesh_assert_topology_consistent_procids< Node > (const MeshBase &mesh) |
template<> | |
void | libmesh_assert_parallel_consistent_procids< Elem > (const MeshBase &mesh) |
template<> | |
void | libmesh_assert_parallel_consistent_procids< Node > (const MeshBase &mesh) |
void | libmesh_assert_equal_n_systems (const MeshBase &mesh) |
The following functions, only available in builds with NDEBUG undefined, are for asserting internal consistency that we hope should never be broken in opt. More... | |
void | libmesh_assert_old_dof_objects (const MeshBase &mesh) |
A function for testing that all non-recently-created DofObjects within a mesh have old_dof_object data. More... | |
void | libmesh_assert_valid_node_pointers (const MeshBase &mesh) |
A function for walking across the mesh to try and ferret out invalidated or misassigned pointers. More... | |
void | libmesh_assert_valid_remote_elems (const MeshBase &mesh) |
A function for verifying that active local elements' neighbors are never remote elements. More... | |
void | libmesh_assert_valid_elem_ids (const MeshBase &mesh) |
A function for verifying that ids and processor assignment of elements are correctly sorted (monotone increasing) More... | |
void | libmesh_assert_valid_amr_elem_ids (const MeshBase &mesh) |
A function for verifying that ids of elements are correctly sorted for AMR (parents have lower ids than children) More... | |
void | libmesh_assert_valid_amr_interior_parents (const MeshBase &mesh) |
A function for verifying that any interior_parent pointers on elements are consistent with AMR (parents' interior_parents are interior_parents' parents) More... | |
void | libmesh_assert_contiguous_dof_ids (const MeshBase &mesh, unsigned int sysnum) |
A function for verifying that degree of freedom indexes are contiguous on each processor, as is required by libMesh numeric classes. More... | |
template<typename DofObjectSubclass > | |
void | libmesh_assert_topology_consistent_procids (const MeshBase &mesh) |
A function for verifying that processor assignment is topologically consistent on nodes (each node part of an active element on its processor) or elements (each parent has the processor id of one of its children). More... | |
void | libmesh_assert_canonical_node_procids (const MeshBase &mesh) |
A function for verifying that processor assignment of nodes matches the heuristic specified in Node::choose_processor_id() More... | |
void | libmesh_assert_valid_refinement_tree (const MeshBase &mesh) |
A function for verifying that elements on this processor have valid descendants and consistent active flags. More... | |
void | libmesh_assert_no_links_to_elem (const MeshBase &mesh, const Elem *bad_elem) |
The following functions, only available in builds with DEBUG defined, typically have surprisingly slow asymptotic behavior, and so are unsuitable for use even with METHOD=devel. More... | |
void | libmesh_assert_equal_points (const MeshBase &mesh) |
A function for testing that node locations match across processors. More... | |
void | libmesh_assert_equal_connectivity (const MeshBase &mesh) |
A function for testing that element nodal connectivities match across processors. More... | |
void | libmesh_assert_connected_nodes (const MeshBase &mesh) |
A function for verifying that all nodes are connected to at least one element. More... | |
void | libmesh_assert_valid_constraint_rows (const MeshBase &mesh) |
A function for verifying that all mesh constraint rows express relations between nodes and elements that are semilocal (local or ghosted) to the current processor's portion of the mesh. More... | |
void | libmesh_assert_valid_boundary_ids (const MeshBase &mesh) |
A function for verifying that boundary condition ids match across processors. More... | |
void | libmesh_assert_valid_dof_ids (const MeshBase &mesh, unsigned int sysnum=libMesh::invalid_uint) |
A function for verifying that degree of freedom indexing matches across processors. More... | |
void | libmesh_assert_valid_unique_ids (const MeshBase &mesh) |
A function for verifying that unique ids match across processors. More... | |
void | libmesh_assert_consistent_distributed (const MeshBase &mesh) |
A function for verifying that distribution of dof objects is parallel consistent (every processor can see every node or element it owns) More... | |
void | libmesh_assert_consistent_distributed_nodes (const MeshBase &mesh) |
A function for verifying that distribution of nodes is parallel consistent (every processor can see every node it owns) even before node ids have been made consistent. More... | |
void | libmesh_assert_parallel_consistent_new_node_procids (const MeshBase &mesh) |
A function for verifying that processor assignment is parallel consistent (every processor agrees on the processor id of each node it can see) even on nodes which have not yet received consistent DofObject::id(), using element topology to identify matching nodes. More... | |
template<typename DofObjectSubclass > | |
void | libmesh_assert_parallel_consistent_procids (const MeshBase &mesh) |
A function for verifying that processor assignment is parallel consistent (every processor agrees on the processor id of each dof object it can see) More... | |
template<typename DofObjectSubclass > | |
void | libmesh_assert_valid_procids (const MeshBase &mesh) |
A function for verifying that processor assignment is both parallel and topologically consistent. More... | |
void | libmesh_assert_valid_refinement_flags (const MeshBase &mesh) |
A function for verifying that refinement flags on elements are consistent between processors. More... | |
void | libmesh_assert_valid_neighbors (const MeshBase &mesh, bool assert_valid_remote_elems=true) |
A function for verifying that neighbor connectivity is correct (each element is a neighbor of or descendant of a neighbor of its neighbors) and consistent (each neighbor link goes to either the same neighbor or to a RemoteElem on each processor) More... | |
Utility functions for operations on a Mesh
object.
Here is where useful functions for interfacing with a Mesh
should be defined. In general this namespace should be used to prevent the Mesh
class from becoming too cluttered.
mesh
instead of a bounding box. Definition at line 611 of file mesh_tools.C.
References create_bounding_box(), mesh, libMesh::TensorTools::norm(), and libMesh::Real.
void libMesh::MeshTools::build_nodes_to_elem_map | ( | const MeshBase & | mesh, |
std::vector< std::vector< dof_id_type >> & | nodes_to_elem_map | ||
) |
After calling this function the input vector nodes_to_elem_map
will contain the node to element connectivity.
That is to say nodes_to_elem_map
[i][j] is the global number of \( j^{th} \) element connected to node i
.
Definition at line 449 of file mesh_tools.C.
References libMesh::MeshBase::is_serial(), libMesh::MeshBase::max_node_id(), mesh, and libMesh::MeshBase::n_elem().
Referenced by libMesh::VariationalSmootherConstraint::constrain(), NodalNeighborsTest::do_test(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::GenericProjector(), libMesh::MeshTools::Subdivision::prepare_subdivision_mesh(), libMesh::C0Polyhedron::retriangulate(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), and libMesh::Tree< N >::Tree().
void libMesh::MeshTools::build_nodes_to_elem_map | ( | const MeshBase & | mesh, |
std::vector< std::vector< const Elem *>> & | nodes_to_elem_map | ||
) |
The same, except element pointers are returned instead of indices.
Definition at line 471 of file mesh_tools.C.
References libMesh::MeshBase::is_serial(), libMesh::MeshBase::max_node_id(), and mesh.
void libMesh::MeshTools::build_nodes_to_elem_map | ( | const MeshBase & | mesh, |
std::unordered_map< dof_id_type, std::vector< dof_id_type >> & | nodes_to_elem_map | ||
) |
After calling this function the input map nodes_to_elem_map
will contain the node to element connectivity.
That is to say nodes_to_elem_map
[i][j] is the global number of \( j^{th} \) element connected to node i
.
Definition at line 492 of file mesh_tools.C.
References mesh.
void libMesh::MeshTools::build_nodes_to_elem_map | ( | const MeshBase & | mesh, |
std::unordered_map< dof_id_type, std::vector< const Elem *>> & | nodes_to_elem_map | ||
) |
The same, except element pointers are returned instead of indices.
Definition at line 504 of file mesh_tools.C.
References mesh.
void libMesh::MeshTools::clear_spline_nodes | ( | MeshBase & | mesh | ) |
Remove spline node (for IsoGeometric Analysis meshes) elements and nodes and constraints from the mesh.
This should be done after the mesh is read but before the constraints are used by System initialization. The result is a mesh and solution space with lower required continuity and more unconstrained degrees of freedom, but with fewer total degrees of freedom and far fewer constraint equations.
Definition at line 1147 of file mesh_tools.C.
References libMesh::MeshBase::delete_elem(), libMesh::MeshBase::delete_node(), libMesh::MeshBase::get_constraint_rows(), libMesh::libmesh_assert(), libMesh::Elem::mapping_type(), mesh, libMesh::NODEELEM, libMesh::RATIONAL_BERNSTEIN_MAP, and libMesh::Elem::type().
Referenced by libMesh::DynaIO::clear_spline_nodes(), and libMesh::DynaIO::read_mesh().
void libMesh::MeshTools::correct_node_proc_ids | ( | MeshBase & | mesh | ) |
Changes the processor ids on each node so be the same as the id of the lowest element touching that node.
This corrects "orphaned" processor ids that may occur from element coarsening.
On a distributed mesh, this function must be called in parallel to sync everyone's corrected processor ids on ghost nodes.
Definition at line 2393 of file mesh_tools.C.
References libMesh::Node::choose_processor_id(), libMesh::ParallelObject::comm(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), libmesh_assert_parallel_consistent_procids< Node >(), mesh, n_elem(), new_proc_ids, libMesh::MeshBase::node_ref(), libMesh::ParallelObject::processor_id(), libMesh::MeshBase::skip_noncritical_partitioning(), and libMesh::Parallel::sync_dofobject_data_by_id().
Referenced by libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), and libMesh::MeshBase::partition().
libMesh::BoundingBox libMesh::MeshTools::create_bounding_box | ( | const MeshBase & | mesh | ) |
Definition at line 559 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), create_local_bounding_box(), libMesh::DofObject::invalid_processor_id, TIMPI::Communicator::max(), mesh, TIMPI::Communicator::min(), and libMesh::Threads::parallel_reduce().
Referenced by libMesh::Partitioner::_find_global_index_by_pid_map(), bounding_sphere(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::MeshBase::get_info(), libMesh::PointLocatorTree::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::MetisPartitioner::partition_range(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::TreeNode< N >::refine(), MeshGenerationTest::testBuildCube(), MeshGenerationTest::testBuildLine(), MeshGenerationTest::testBuildSquare(), libMesh::Tree< N >::Tree(), and libMesh::PostscriptIO::write().
libMesh::BoundingBox libMesh::MeshTools::create_local_bounding_box | ( | const MeshBase & | mesh | ) |
Unlike the other bounding box creation functions, this does not need to be run in parallel, because this is the only function we can guarantee can be resolved with only local information.
Definition at line 624 of file mesh_tools.C.
References mesh, and libMesh::Threads::parallel_reduce().
Referenced by create_bounding_box(), and libMesh::MeshBase::get_info().
libMesh::BoundingBox libMesh::MeshTools::create_nodal_bounding_box | ( | const MeshBase & | mesh | ) |
In the case of curved elements, this box might not bound the elements of the mesh.
Definition at line 584 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::DofObject::invalid_processor_id, TIMPI::Communicator::max(), mesh, TIMPI::Communicator::min(), and libMesh::Threads::parallel_reduce().
Referenced by libMesh::MeshCommunication::assign_global_indices(), and libMesh::MeshCommunication::check_for_duplicate_global_indices().
libMesh::BoundingBox libMesh::MeshTools::create_processor_bounding_box | ( | const MeshBase & | mesh, |
const processor_id_type | pid | ||
) |
Definition at line 638 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), TIMPI::Communicator::max(), mesh, TIMPI::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::Threads::parallel_reduce(), and TIMPI::Communicator::verify().
Referenced by processor_bounding_sphere().
libMesh::BoundingBox libMesh::MeshTools::create_subdomain_bounding_box | ( | const MeshBase & | mesh, |
const subdomain_id_type | sid | ||
) |
Definition at line 678 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), TIMPI::Communicator::max(), mesh, TIMPI::Communicator::min(), libMesh::Threads::parallel_reduce(), and TIMPI::Communicator::verify().
Referenced by subdomain_bounding_sphere().
Fills in a vector of all element types in the mesh.
Implemented in terms of element_iterators.
Definition at line 716 of file mesh_tools.C.
References mesh.
Referenced by libMesh::MeshBase::get_info().
std::unordered_set< dof_id_type > libMesh::MeshTools::find_block_boundary_nodes | ( | const MeshBase & | mesh | ) |
Returns a std::set containing Node IDs for all of the block boundary nodes.
A "block boundary node" is a node that is connected to elements from 2 or more blocks
Definition at line 537 of file mesh_tools.C.
References mesh.
Referenced by libMesh::LaplaceMeshSmoother::smooth().
std::unordered_set< dof_id_type > libMesh::MeshTools::find_boundary_nodes | ( | const MeshBase & | mesh | ) |
Calling this function on a 2D mesh will convert all the elements to triangles.
QUAD4s
will be converted to TRI3s
, QUAD8s
and QUAD9s
will be converted to TRI6s
. Returns a std::set containing Node IDs for all of the boundary nodes
Definition at line 517 of file mesh_tools.C.
References mesh.
Referenced by libMesh::VariationalSmootherConstraint::constrain(), libMesh::MeshTools::Modification::distort(), DistortTest::perturb_and_check(), libMesh::LaplaceMeshSmoother::smooth(), and libMesh::MeshTools::Modification::smooth().
void libMesh::MeshTools::find_hanging_nodes_and_parents | ( | const MeshBase & | mesh, |
std::map< dof_id_type, std::vector< dof_id_type >> & | hanging_nodes | ||
) |
Given a mesh hanging_nodes will be filled with an associative array keyed off the global id of all the hanging nodes in the mesh.
It will hold an array of the parents of the node (meaning the two nodes to either side of it that make up the side the hanging node is on.
Definition at line 1059 of file mesh_tools.C.
References libMesh::Elem::is_node_on_side(), libMesh::Elem::level(), mesh, libMesh::Elem::n_neighbors(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::node_id(), libMesh::Elem::parent(), libMesh::QUAD4, and libMesh::Elem::which_neighbor_am_i().
void libMesh::MeshTools::find_nodal_neighbors | ( | const MeshBase & | mesh, |
const Node & | n, | ||
const std::vector< std::vector< const Elem *>> & | nodes_to_elem_map, | ||
std::vector< const Node *> & | neighbors | ||
) |
Given a mesh and a node in the mesh, the vector will be filled with every node directly attached to the given one.
Definition at line 1036 of file mesh_tools.C.
References libMesh::DofObject::id().
Referenced by libMesh::VariationalSmootherConstraint::constrain(), NodalNeighborsTest::do_test(), libMesh::MeshTools::Subdivision::prepare_subdivision_mesh(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), and libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner().
void libMesh::MeshTools::find_nodal_neighbors | ( | const MeshBase & | mesh, |
const Node & | n, | ||
const std::unordered_map< dof_id_type, std::vector< const Elem *>> & | nodes_to_elem_map, | ||
std::vector< const Node *> & | neighbors | ||
) |
Given a mesh and a node in the mesh, the vector will be filled with every node directly attached to the given one.
Definition at line 1047 of file mesh_tools.C.
References libMesh::DofObject::id().
void libMesh::MeshTools::get_not_subactive_node_ids | ( | const MeshBase & | mesh, |
std::set< dof_id_type > & | not_subactive_node_ids | ||
) |
Builds a set of node IDs for nodes which belong to non-subactive elements.
Non-subactive elements are those which are either active or inactive. This is useful for determining which nodes should be written to a data file, and is used by the XDA mesh writing methods.
Definition at line 958 of file mesh_tools.C.
References mesh.
void libMesh::MeshTools::libmesh_assert_canonical_node_procids | ( | const MeshBase & | mesh | ) |
A function for verifying that processor assignment of nodes matches the heuristic specified in Node::choose_processor_id()
Definition at line 1534 of file mesh_tools.C.
References mesh.
void libMesh::MeshTools::libmesh_assert_connected_nodes | ( | const MeshBase & | mesh | ) |
A function for verifying that all nodes are connected to at least one element.
This will fail in the most general case. When DistributedMesh and NodeConstraints are enabled, we expect the possibility that a processor will be given remote nodes to satisfy node constraints without also being given the remote elements connected to those nodes.
Definition at line 1642 of file mesh_tools.C.
References libMesh::libmesh_assert(), and mesh.
void libMesh::MeshTools::libmesh_assert_consistent_distributed | ( | const MeshBase & | mesh | ) |
A function for verifying that distribution of dof objects is parallel consistent (every processor can see every node or element it owns)
Definition at line 1954 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), TIMPI::Communicator::max(), libMesh::MeshBase::max_elem_id(), libMesh::MeshBase::max_node_id(), mesh, TIMPI::Communicator::min(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::MeshBase::query_elem_ptr(), and libMesh::MeshBase::query_node_ptr().
void libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes | ( | const MeshBase & | mesh | ) |
A function for verifying that distribution of nodes is parallel consistent (every processor can see every node it owns) even before node ids have been made consistent.
Definition at line 1984 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), TIMPI::Communicator::max(), libMesh::MeshBase::max_elem_id(), mesh, TIMPI::Communicator::min(), n_nodes(), libMesh::Elem::n_nodes(), libMesh::Elem::node_ptr(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::MeshBase::query_elem_ptr(), TIMPI::Communicator::semiverify(), and libMesh::MeshBase::sub_point_locator().
void libMesh::MeshTools::libmesh_assert_contiguous_dof_ids | ( | const MeshBase & | mesh, |
unsigned int | sysnum | ||
) |
A function for verifying that degree of freedom indexes are contiguous on each processor, as is required by libMesh numeric classes.
Verify a particular system by specifying that system's number.
Definition at line 1397 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), libMesh::make_range(), mesh, libMesh::ParallelObject::n_processors(), and libMesh::ParallelObject::processor_id().
void libMesh::MeshTools::libmesh_assert_equal_connectivity | ( | const MeshBase & | mesh | ) |
A function for testing that element nodal connectivities match across processors.
Definition at line 1621 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), TIMPI::Communicator::max(), libMesh::MeshBase::max_elem_id(), mesh, libMesh::Elem::node_id(), libMesh::Elem::node_index_range(), libMesh::MeshBase::query_elem_ptr(), and TIMPI::Communicator::semiverify().
Referenced by libMesh::MeshCommunication::assign_global_indices(), and libMesh::SimplexRefiner::refine_via_edges().
void libMesh::MeshTools::libmesh_assert_equal_n_systems | ( | const MeshBase & | mesh | ) |
The following functions, only available in builds with NDEBUG undefined, are for asserting internal consistency that we hope should never be broken in opt.
A function for testing that all DofObjects within a mesh have the same n_systems count
Definition at line 1212 of file mesh_tools.C.
References libMesh::invalid_uint, and mesh.
void libMesh::MeshTools::libmesh_assert_equal_points | ( | const MeshBase & | mesh | ) |
A function for testing that node locations match across processors.
Definition at line 1605 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), TIMPI::Communicator::max(), libMesh::MeshBase::max_node_id(), mesh, libMesh::MeshBase::query_node_ptr(), and TIMPI::Communicator::semiverify().
Referenced by libMesh::MeshCommunication::assign_global_indices(), and libMesh::SimplexRefiner::refine_via_edges().
void libMesh::MeshTools::libmesh_assert_no_links_to_elem | ( | const MeshBase & | mesh, |
const Elem * | bad_elem | ||
) |
The following functions, only available in builds with DEBUG defined, typically have surprisingly slow asymptotic behavior, and so are unsuitable for use even with METHOD=devel.
A function for verifying that an element has been cut off from the rest of the mesh
Definition at line 1586 of file mesh_tools.C.
References libMesh::libmesh_assert(), and mesh.
void libMesh::MeshTools::libmesh_assert_old_dof_objects | ( | const MeshBase & | mesh | ) |
A function for testing that all non-recently-created DofObjects within a mesh have old_dof_object data.
This is not expected to be true at all points within a simulation code.
Definition at line 1238 of file mesh_tools.C.
References libMesh::Elem::INACTIVE, libMesh::Elem::JUST_REFINED, libMesh::libmesh_assert(), and mesh.
void libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids | ( | const MeshBase & | mesh | ) |
A function for verifying that processor assignment is parallel consistent (every processor agrees on the processor id of each node it can see) even on nodes which have not yet received consistent DofObject::id(), using element topology to identify matching nodes.
Definition at line 2065 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), TIMPI::Communicator::max(), libMesh::MeshBase::max_elem_id(), mesh, n_nodes(), libMesh::Elem::n_nodes(), libMesh::ParallelObject::n_processors(), libMesh::Elem::node_ptr(), libMesh::DofObject::processor_id(), libMesh::MeshBase::query_elem_ptr(), and TIMPI::Communicator::semiverify().
Referenced by libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent().
void libMesh::MeshTools::libmesh_assert_parallel_consistent_procids | ( | const MeshBase & | mesh | ) |
A function for verifying that processor assignment is parallel consistent (every processor agrees on the processor id of each dof object it can see)
void libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem > | ( | const MeshBase & | mesh | ) |
Definition at line 2017 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), TIMPI::Communicator::max(), mesh, TIMPI::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), and libMesh::MeshBase::query_elem_ptr().
void libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node > | ( | const MeshBase & | mesh | ) |
Definition at line 2103 of file mesh_tools.C.
References libMesh::as_range(), libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), TIMPI::Communicator::max(), mesh, libMesh::ParallelObject::n_processors(), libMesh::DofObject::processor_id(), libMesh::MeshBase::query_node_ptr(), and TIMPI::Communicator::semiverify().
Referenced by correct_node_proc_ids(), and libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent().
void libMesh::MeshTools::libmesh_assert_topology_consistent_procids | ( | const MeshBase & | mesh | ) |
A function for verifying that processor assignment is topologically consistent on nodes (each node part of an active element on its processor) or elements (each parent has the processor id of one of its children).
void libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Elem > | ( | const MeshBase & | mesh | ) |
Definition at line 1439 of file mesh_tools.C.
References libMesh::Elem::child_ref_range(), libMesh::Elem::has_children(), libMesh::libmesh_assert(), libMesh::libmesh_ignore(), mesh, libMesh::Elem::parent(), libMesh::DofObject::processor_id(), and libMesh::remote_elem.
void libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node > | ( | const MeshBase & | mesh | ) |
Definition at line 1483 of file mesh_tools.C.
References libMesh::as_range(), libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), TIMPI::Communicator::max(), mesh, and libMesh::ParallelObject::n_processors().
Referenced by libMesh::MeshCommunication::make_node_ids_parallel_consistent().
void libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids | ( | const MeshBase & | mesh | ) |
A function for verifying that ids of elements are correctly sorted for AMR (parents have lower ids than children)
Definition at line 1341 of file mesh_tools.C.
References libMesh::DofObject::id(), libMesh::libmesh_assert(), mesh, libMesh::Elem::parent(), and libMesh::DofObject::processor_id().
Referenced by libMesh::UnstructuredMesh::copy_nodes_and_elements().
void libMesh::MeshTools::libmesh_assert_valid_amr_interior_parents | ( | const MeshBase & | mesh | ) |
A function for verifying that any interior_parent pointers on elements are consistent with AMR (parents' interior_parents are interior_parents' parents)
Definition at line 1361 of file mesh_tools.C.
References libMesh::Elem::interior_parent(), libMesh::Elem::level(), libMesh::libmesh_assert(), mesh, libMesh::Elem::parent(), libMesh::remote_elem, and libMesh::Elem::top_parent().
Referenced by libMesh::UnstructuredMesh::find_neighbors().
void libMesh::MeshTools::libmesh_assert_valid_boundary_ids | ( | const MeshBase & | mesh | ) |
A function for verifying that boundary condition ids match across processors.
Definition at line 1708 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::get_boundary_info(), libMesh::BoundaryInfo::invalid_id, libMesh::libmesh_assert(), TIMPI::Communicator::max(), libMesh::MeshBase::max_elem_id(), mesh, libMesh::Elem::n_edges(), n_nodes(), libMesh::Elem::n_nodes(), libMesh::ParallelObject::n_processors(), libMesh::Elem::n_sides(), libMesh::Elem::node_ptr(), libMesh::MeshBase::query_elem_ptr(), and TIMPI::Communicator::semiverify().
Referenced by libMesh::DofMap::create_dof_constraints(), and libMesh::MeshBase::prepare_for_use().
void libMesh::MeshTools::libmesh_assert_valid_constraint_rows | ( | const MeshBase & | mesh | ) |
A function for verifying that all mesh constraint rows express relations between nodes and elements that are semilocal (local or ghosted) to the current processor's portion of the mesh.
Definition at line 1665 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::elem_ptr(), libMesh::MeshBase::get_constraint_rows(), libMesh::DofObject::id(), libMesh::libmesh_assert(), TIMPI::Communicator::max(), libMesh::MeshBase::max_node_id(), mesh, libMesh::MeshBase::node_ptr(), libMesh::MeshBase::query_node_ptr(), and TIMPI::Communicator::semiverify().
Referenced by libMesh::MeshCommunication::delete_remote_elements(), and libMesh::MeshBase::prepare_for_use().
void libMesh::MeshTools::libmesh_assert_valid_dof_ids | ( | const MeshBase & | mesh, |
unsigned int | sysnum = libMesh::invalid_uint |
||
) |
A function for verifying that degree of freedom indexing matches across processors.
Verify a particular system by specifying that system's number, or verify all systems at once by leaving sysnum
unspecified.
Definition at line 1878 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), TIMPI::Communicator::max(), libMesh::MeshBase::max_elem_id(), libMesh::MeshBase::max_node_id(), mesh, libMesh::ParallelObject::n_processors(), libMesh::MeshBase::query_elem_ptr(), and libMesh::MeshBase::query_node_ptr().
Referenced by libMesh::DofMap::distribute_dofs().
void libMesh::MeshTools::libmesh_assert_valid_elem_ids | ( | const MeshBase & | mesh | ) |
A function for verifying that ids and processor assignment of elements are correctly sorted (monotone increasing)
Definition at line 1318 of file mesh_tools.C.
References libMesh::libmesh_assert(), and mesh.
Referenced by libMesh::DistributedMesh::renumber_nodes_and_elements().
void libMesh::MeshTools::libmesh_assert_valid_neighbors | ( | const MeshBase & | mesh, |
bool | assert_valid_remote_elems = true |
||
) |
A function for verifying that neighbor connectivity is correct (each element is a neighbor of or descendant of a neighbor of its neighbors) and consistent (each neighbor link goes to either the same neighbor or to a RemoteElem on each processor)
If assert_valid_remote_elems is set to false, then no error will be thrown for neighbor links where a remote_elem should exist but a nullptr exists instead.
Definition at line 2205 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::DofObject::id(), libMesh::DofObject::invalid_id, libMesh::libmesh_assert(), TIMPI::Communicator::max(), libMesh::MeshBase::max_elem_id(), mesh, libMesh::Elem::n_neighbors(), libMesh::ParallelObject::n_processors(), libMesh::Elem::neighbor_ptr(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::MeshBase::query_elem_ptr(), libMesh::remote_elem, and TIMPI::Communicator::semiverify().
Referenced by libMesh::MeshRefinement::_smooth_flags(), libMesh::DistributedMesh::allgather(), libMesh::DistributedMesh::delete_remote_elements(), libMesh::UnstructuredMesh::find_neighbors(), and libMesh::UnstructuredMesh::stitching_helper().
void libMesh::MeshTools::libmesh_assert_valid_node_pointers | ( | const MeshBase & | mesh | ) |
A function for walking across the mesh to try and ferret out invalidated or misassigned pointers.
Definition at line 1262 of file mesh_tools.C.
References libMesh::libmesh_assert(), mesh, and libMesh::remote_elem.
void libMesh::MeshTools::libmesh_assert_valid_procids | ( | const MeshBase & | mesh | ) |
A function for verifying that processor assignment is both parallel and topologically consistent.
Definition at line 588 of file mesh_tools.h.
References mesh.
void libMesh::MeshTools::libmesh_assert_valid_refinement_flags | ( | const MeshBase & | mesh | ) |
A function for verifying that refinement flags on elements are consistent between processors.
Definition at line 2158 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), TIMPI::Communicator::max(), libMesh::MeshBase::max_elem_id(), mesh, TIMPI::Communicator::min(), and libMesh::ParallelObject::n_processors().
void libMesh::MeshTools::libmesh_assert_valid_refinement_tree | ( | const MeshBase & | mesh | ) |
A function for verifying that elements on this processor have valid descendants and consistent active flags.
Definition at line 1547 of file mesh_tools.C.
References libMesh::Elem::JUST_REFINED, libMesh::libmesh_assert(), mesh, and libMesh::remote_elem.
Referenced by libMesh::MeshCommunication::delete_remote_elements(), and libMesh::DistributedMesh::delete_remote_elements().
void libMesh::MeshTools::libmesh_assert_valid_remote_elems | ( | const MeshBase & | mesh | ) |
A function for verifying that active local elements' neighbors are never remote elements.
Definition at line 1287 of file mesh_tools.C.
References libMesh::as_range(), libMesh::libmesh_assert(), mesh, libMesh::Elem::parent(), and libMesh::remote_elem.
Referenced by libMesh::Partitioner::partition().
void libMesh::MeshTools::libmesh_assert_valid_unique_ids | ( | const MeshBase & | mesh | ) |
A function for verifying that unique ids match across processors.
FIXME: we ought to check for uniqueness too.
Definition at line 1906 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), TIMPI::Communicator::max(), libMesh::MeshBase::max_elem_id(), libMesh::MeshBase::max_node_id(), mesh, libMesh::MeshBase::query_elem_ptr(), and libMesh::MeshBase::query_node_ptr().
Referenced by libMesh::MeshBase::prepare_for_use(), and libMesh::SimplexRefiner::refine_via_edges().
dof_id_type libMesh::MeshTools::n_active_elem_of_type | ( | const MeshBase & | mesh, |
const ElemType | type | ||
) |
type
.Implemented in terms of active_type_element_iterators.
Definition at line 737 of file mesh_tools.C.
References distance(), and mesh.
Implemented by looping over all the active local elements and finding the maximum level, then taking the max in parallel.
Definition at line 772 of file mesh_tools.C.
References libMesh::as_range(), libMesh::ParallelObject::comm(), TIMPI::Communicator::max(), mesh, and n_active_local_levels().
Referenced by libMesh::XdrIO::write_serialized_connectivity().
Implemented by looping over all the active local elements and finding the maximum level.
Definition at line 760 of file mesh_tools.C.
References mesh.
Referenced by n_active_levels().
dof_id_type libMesh::MeshTools::n_connected_components | ( | const MeshBase & | mesh, |
Real | constraint_tol = 0 |
||
) |
To count sufficiently weak constraint row coefficients as a lack-of-connection, set a constraint_tol greater than 0.
Definition at line 840 of file mesh_tools.C.
References TIMPI::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::MeshBase::elem_ptr(), libMesh::MeshBase::get_constraint_rows(), libMesh::DofObject::id(), libMesh::MeshBase::is_serial_on_zero(), libMesh::libmesh_assert(), mesh, libMesh::Elem::node_ptr(), and libMesh::ParallelObject::processor_id().
Referenced by main(), and ConnectedComponentsTest::testEdge().
dof_id_type libMesh::MeshTools::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 at line 969 of file mesh_tools.C.
References distance().
Referenced by libMesh::MeshTools::Subdivision::add_boundary_ghosts(), add_cube_convex_hull_to_mesh(), correct_node_proc_ids(), NodalNeighborsTest::do_test(), libMesh::RBEIMEvaluation::get_interior_basis_function_sizes(), main(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::XdrIO::read(), libMesh::STLIO::read_binary(), libMesh::XdrIO::read_header(), libMesh::RBEIMEvaluation::read_in_interior_basis_functions(), libMesh::DynaIO::read_mesh(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::Partitioner::set_node_processor_ids(), libMesh::Partitioner::set_parent_processor_ids(), MeshInputTest::testAbaqusRead(), MeshDeletionsTest::testDeleteElem(), ConnectedComponentsTest::testEdge(), BoundaryInfoTest::testEdgeBoundaryConditions(), LibMeshNetgenTest::testPermutedHole(), libMesh::NetGenMeshInterface::triangulate(), libMesh::XdrIO::write(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::UCDIO::write_nodal_data(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_vector(), and libMesh::System::write_serialized_vectors().
dof_id_type libMesh::MeshTools::n_elem_of_type | ( | const MeshBase & | mesh, |
const ElemType | type | ||
) |
type
.Implemented in terms of type_element_iterators.
Definition at line 728 of file mesh_tools.C.
References distance(), and mesh.
Implemented by looping over all the local elements and unpartitioned elements and finding the maximum level, then summing in parallel.
Definition at line 802 of file mesh_tools.C.
References libMesh::as_range(), libMesh::ParallelObject::comm(), TIMPI::Communicator::max(), mesh, n_local_levels(), and paranoid_n_levels().
Referenced by libMesh::MeshCommunication::delete_remote_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::PetscDMWrapper::init_dm_data(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::MeshTools::Modification::orient_elements(), libMesh::MeshTools::Modification::permute_elements(), libMesh::Partitioner::set_node_processor_ids(), and libMesh::MeshTools::Modification::smooth().
Implemented by looping over all the local elements and finding the maximum level.
Definition at line 789 of file mesh_tools.C.
References libMesh::as_range(), and mesh.
Referenced by n_levels().
dof_id_type libMesh::MeshTools::n_nodes | ( | const MeshBase::const_node_iterator & | begin, |
const MeshBase::const_node_iterator & | end | ||
) |
Count up the number of nodes of a specific type (as defined by an iterator range).
Definition at line 977 of file mesh_tools.C.
References distance().
Referenced by libmesh_assert_consistent_distributed_nodes(), libmesh_assert_parallel_consistent_new_node_procids(), and libmesh_assert_valid_boundary_ids().
dof_id_type libMesh::MeshTools::n_non_subactive_elem_of_type_at_level | ( | const MeshBase & | mesh, |
const ElemType | type, | ||
const unsigned int | level | ||
) |
type
at the specified refinement level.Definition at line 744 of file mesh_tools.C.
References libMesh::as_range(), and mesh.
Implemented by looping over all the local elements and finding the maximum p-level, then summing in parallel.
Definition at line 1014 of file mesh_tools.C.
References libMesh::as_range(), libMesh::ParallelObject::comm(), TIMPI::Communicator::max(), and mesh.
Referenced by libMesh::XdrIO::write().
Implemented by looping over all elements and finding the maximum level, then summing in parallel. This is much slower than n_levels() but will return correct values even when the mesh is in an inconsistent parallel state.
Definition at line 826 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), TIMPI::Communicator::max(), and mesh.
Referenced by n_levels().
Sphere libMesh::MeshTools::processor_bounding_sphere | ( | const MeshBase & | mesh, |
const processor_id_type | pid | ||
) |
Definition at line 663 of file mesh_tools.C.
References create_processor_bounding_box(), mesh, libMesh::TensorTools::norm(), and libMesh::Real.
Sphere libMesh::MeshTools::subdomain_bounding_sphere | ( | const MeshBase & | mesh, |
const subdomain_id_type | sid | ||
) |
Definition at line 702 of file mesh_tools.C.
References create_subdomain_bounding_box(), mesh, libMesh::TensorTools::norm(), and libMesh::Real.
dof_id_type libMesh::MeshTools::total_weight | ( | const MeshBase & | mesh | ) |
This can be useful for partitioning hybrid meshes. A feasible load balancing scheme is to keep the weight per processor as uniform as possible.
Definition at line 414 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::DofObject::invalid_processor_id, libMesh::MeshBase::is_serial(), mesh, libMesh::Threads::parallel_reduce(), libMesh::ParallelObject::processor_id(), TIMPI::Communicator::sum(), and weight().
bool libMesh::MeshTools::valid_is_prepared | ( | const MeshBase & | mesh | ) |
A function for testing whether a mesh's cached is_prepared() setting is not a false positive.
If the mesh is marked as not prepared, or if preparing the already-partitioned mesh (without any repartitioning or renumbering) does not change it, then we return true. If the mesh believes it is prepared but prepare_for_use() would change it, we return false.
Definition at line 1182 of file mesh_tools.C.
References libMesh::MeshBase::clone(), libMesh::MeshBase::is_prepared(), and mesh.
Referenced by ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), ConstraintOperatorTest::testCoreform(), MeshBaseTest::testMeshBaseVerifyIsPrepared(), and libMesh::MeshTetInterface::volume_to_surface_mesh().
Real libMesh::MeshTools::volume | ( | const MeshBase & | mesh, |
unsigned int | dim = libMesh::invalid_uint |
||
) |
Find the total volume of a mesh (interpreting that as area for dim
= 2, or total arc length for dim
= 1, or number of NodeElem in the mesh for dim
= 0).
By default the dimension chosen will be the mesh_dimension(), which if not manually overridden will be the largest dimension of elements in the mesh.
Definition at line 985 of file mesh_tools.C.
References libMesh::as_range(), libMesh::ParallelObject::comm(), dim, libMesh::invalid_uint, mesh, libMesh::MeshBase::mesh_dimension(), libMesh::ParallelObject::processor_id(), libMesh::Real, and TIMPI::Communicator::sum().
Referenced by libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::MeshBase::get_info(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::SimplexRefiner::should_refine_elem(), MeshTetTest::testHole(), MeshTetTest::testTetInterfaceBase(), and MeshTetTest::testTetsToTets().
dof_id_type libMesh::MeshTools::weight | ( | const MeshBase & | mesh, |
const processor_id_type | pid | ||
) |
pid
of nodes per element.This can be useful for partitioning hybrid meshes. A feasible load balancing scheme is to keep the weight per processor as uniform as possible.
Definition at line 437 of file mesh_tools.C.
References mesh, and libMesh::Threads::parallel_reduce().
Referenced by libMesh::StaticCondensationDofMap::add_uncondensed_dof_plus_constraint_dofs(), assemble_SchroedingerEquation(), assemble_wave(), libMesh::QGrundmann_Moller::gm_rule(), libMesh::QGrid::init_2D(), libMesh::QNodal::init_2D(), libMesh::QGrid::init_3D(), libMesh::QNodal::init_3D(), libMesh::FE< Dim, LAGRANGE_VEC >::init_shape_functions(), libMesh::InfFE< Dim, T_radial, T_map >::init_shape_functions(), libMesh::FEXYZ< Dim >::init_shape_functions(), libMesh::InverseDistanceInterpolation< KDDim >::interpolate(), libMesh::VTKIO::nodes_to_vtk(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), CoupledFEMFunctionsx::operator()(), CoupledFEMFunctionsy::operator()(), libMesh::MeshTools::Modification::smooth(), total_weight(), and weight().
|
inline |