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 | BoundingBox |
Backwards compatibility with forward declarations. 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... | |
void | find_boundary_nodes (const MeshBase &mesh, std::vector< bool > &on_boundary) |
std::unordered_set< dof_id_type > | find_boundary_nodes (const MeshBase &mesh) |
Returns a std::set containing Node IDs for all of the boundary nodes. 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... | |
BoundingBox | bounding_box (const MeshBase &mesh) |
libMesh::BoundingBox | create_bounding_box (const MeshBase &mesh) |
The same functionality as the deprecated MeshTools::bounding_box(). More... | |
Sphere | bounding_sphere (const MeshBase &mesh) |
libMesh::BoundingBox | create_nodal_bounding_box (const MeshBase &mesh) |
libMesh::BoundingBox | create_local_bounding_box (const MeshBase &mesh) |
BoundingBox | processor_bounding_box (const MeshBase &mesh, const processor_id_type pid) |
libMesh::BoundingBox | create_processor_bounding_box (const MeshBase &mesh, const processor_id_type pid) |
The same functionality as the deprecated MeshTools::processor_bounding_box(). More... | |
Sphere | processor_bounding_sphere (const MeshBase &mesh, const processor_id_type pid) |
BoundingBox | subdomain_bounding_box (const MeshBase &mesh, const subdomain_id_type sid) |
libMesh::BoundingBox | create_subdomain_bounding_box (const MeshBase &mesh, const subdomain_id_type sid) |
The same functionality as the deprecated MeshTools::subdomain_bounding_box(). More... | |
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) |
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... | |
unsigned int | max_level (const MeshBase &mesh) |
Find the maximum h-refinement level in a mesh. 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 | libmesh_assert_no_links_to_elem (const MeshBase &mesh, const Elem *bad_elem) |
A function for verifying that an element has been cut off from the rest of the mesh. More... | |
void | libmesh_assert_equal_n_systems (const MeshBase &mesh) |
A function for testing that all DofObjects within a mesh have the same n_systems count. 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_connected_nodes (const MeshBase &mesh) |
A function for verifying that all nodes are connected to at least one element. 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_contiguous_dof_ids (const MeshBase &mesh, unsigned int sysnum) |
A function for verifying that degree of freedom indexes are contiguous on each processors, as is required by libMesh numeric classes. 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 recieved 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_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... | |
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_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_flags (const MeshBase &mesh) |
A function for verifying that refinement flags on elements are consistent between processors. 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_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... | |
template<> | |
void | libmesh_assert_topology_consistent_procids< Elem > (const MeshBase &mesh) |
template<> | |
void | libmesh_assert_parallel_consistent_procids< Elem > (const MeshBase &mesh) |
template<> | |
void | libmesh_assert_topology_consistent_procids< Node > (const MeshBase &mesh) |
template<> | |
void | libmesh_assert_parallel_consistent_procids< Node > (const MeshBase &mesh) |
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.
MeshTools::BoundingBox libMesh::MeshTools::bounding_box | ( | const MeshBase & | mesh | ) |
Definition at line 376 of file mesh_tools.C.
References create_bounding_box(), and mesh.
Referenced by libMesh::TreeNode< N >::bounds_point(), libMesh::TreeNode< N >::create_bounding_box(), libMesh::TreeNode< N >::insert(), and libMesh::TreeNode< N >::set_bounding_box().
mesh
instead of a bounding box. Definition at line 441 of file mesh_tools.C.
References create_bounding_box(), mesh, std::norm(), and libMesh::Real.
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 293 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), 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 281 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), and mesh.
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 265 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), mesh, and libMesh::MeshBase::n_nodes().
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 248 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), mesh, libMesh::MeshBase::n_elem(), and libMesh::MeshBase::n_nodes().
Referenced by NodalNeighborsTest::do_test(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::GenericProjector(), libMesh::MeshTools::Subdivision::prepare_subdivision_mesh(), libMesh::VariationalMeshSmoother::readgr(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), and libMesh::Tree< N >::Tree().
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 2252 of file mesh_tools.C.
References libMesh::MeshBase::active_element_ptr_range(), libMesh::Node::choose_processor_id(), libMesh::ParallelObject::comm(), data, libMesh::libmesh_assert(), libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshBase::local_node_ptr_range(), mesh, n_elem(), new_proc_ids, libMesh::MeshBase::node_ptr_range(), libMesh::MeshBase::node_ref(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), libMesh::ParallelObject::processor_id(), libMesh::MeshBase::skip_noncritical_partitioning(), libMesh::Parallel::sync_dofobject_data_by_id(), libMesh::MeshBase::unpartitioned_elements_begin(), and libMesh::MeshBase::unpartitioned_elements_end().
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 | ) |
The same functionality as the deprecated MeshTools::bounding_box().
Definition at line 389 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), create_local_bounding_box(), libMesh::DofObject::invalid_processor_id, mesh, libMesh::Threads::parallel_reduce(), libMesh::MeshBase::pid_elements_begin(), and libMesh::MeshBase::pid_elements_end().
Referenced by libMesh::Partitioner::_find_global_index_by_pid_map(), bounding_box(), bounding_sphere(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::PointLocatorTree::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::MetisPartitioner::partition_range(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::TreeNode< N >::refine(), 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 454 of file mesh_tools.C.
References libMesh::MeshBase::local_elements_begin(), libMesh::MeshBase::local_elements_end(), mesh, and libMesh::Threads::parallel_reduce().
Referenced by create_bounding_box().
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 414 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::DofObject::invalid_processor_id, libMesh::MeshBase::local_nodes_begin(), libMesh::MeshBase::local_nodes_end(), mesh, libMesh::Threads::parallel_reduce(), libMesh::MeshBase::pid_nodes_begin(), and libMesh::MeshBase::pid_nodes_end().
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 | ||
) |
The same functionality as the deprecated MeshTools::processor_bounding_box().
Definition at line 480 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), mesh, libMesh::ParallelObject::n_processors(), libMesh::Threads::parallel_reduce(), libMesh::MeshBase::pid_elements_begin(), and libMesh::MeshBase::pid_elements_end().
Referenced by processor_bounding_box(), and processor_bounding_sphere().
libMesh::BoundingBox libMesh::MeshTools::create_subdomain_bounding_box | ( | const MeshBase & | mesh, |
const subdomain_id_type | sid | ||
) |
The same functionality as the deprecated MeshTools::subdomain_bounding_box().
Definition at line 532 of file mesh_tools.C.
References libMesh::MeshBase::active_local_subdomain_elements_begin(), libMesh::MeshBase::active_local_subdomain_elements_end(), libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), mesh, and libMesh::Threads::parallel_reduce().
Referenced by subdomain_bounding_box(), and subdomain_bounding_sphere().
Fills in a vector of all element types in the mesh.
Implemented in terms of element_iterators.
Definition at line 570 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), and mesh.
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 elemenents from 2 or more blockse
Definition at line 354 of file mesh_tools.C.
References libMesh::MeshBase::active_element_ptr_range(), and mesh.
Referenced by libMesh::LaplaceMeshSmoother::smooth().
std::unordered_set< dof_id_type > libMesh::MeshTools::find_boundary_nodes | ( | const MeshBase & | mesh | ) |
Returns a std::set containing Node IDs for all of the boundary nodes.
Definition at line 334 of file mesh_tools.C.
References libMesh::MeshBase::active_element_ptr_range(), and mesh.
void libMesh::MeshTools::find_boundary_nodes | ( | const MeshBase & | mesh, |
std::vector< bool > & | on_boundary | ||
) |
Calling this function on a 2D mesh will convert all the elements to triangles. \p QUAD4s will be converted to \p TRI3s, \p QUAD8s and \p QUAD9s will be converted to \p TRI6s. ‍/
void all_tri (MeshBase & mesh);
#ifdef LIBMESH_ENABLE_DEPRECATED /** Fills the vector "on_boundary" with flags that tell whether each node is on the domain boundary (true)) or not (false).
Definition at line 306 of file mesh_tools.C.
References libMesh::MeshBase::active_element_ptr_range(), libMesh::MeshBase::max_node_id(), and mesh.
Referenced by libMesh::MeshTools::Modification::distort(), DistortTest::perturb_and_check(), libMesh::VariationalMeshSmoother::readgr(), 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 1078 of file mesh_tools.C.
References libMesh::MeshBase::active_local_element_ptr_range(), 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().
Referenced by libMesh::VariationalMeshSmoother::smooth().
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 909 of file mesh_tools.C.
References libMesh::EDGE2, libMesh::EDGE3, libMesh::EDGE4, libMesh::Utility::enum_to_string(), libMesh::DofObject::id(), libMesh::invalid_uint, libMesh::libmesh_assert(), and n_nodes.
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 743 of file mesh_tools.C.
References libMesh::EDGE2, libMesh::EDGE3, libMesh::EDGE4, libMesh::Utility::enum_to_string(), libMesh::DofObject::id(), libMesh::invalid_uint, libMesh::libmesh_assert(), and n_nodes.
Referenced by NodalNeighborsTest::do_test(), libMesh::MeshTools::Subdivision::prepare_subdivision_mesh(), libMesh::VariationalMeshSmoother::readgr(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), and libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner().
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 694 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), and 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 1961 of file mesh_tools.C.
References libMesh::MeshBase::active_element_ptr_range(), and 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 1371 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), libMesh::libmesh_assert(), mesh, and libMesh::MeshBase::node_ptr_range().
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 1664 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), libMesh::MeshBase::max_elem_id(), libMesh::MeshBase::max_node_id(), mesh, 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 1694 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), libMesh::MeshBase::max_elem_id(), mesh, n_nodes(), libMesh::Elem::n_nodes(), libMesh::Elem::node_ptr(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::MeshBase::query_elem_ptr(), 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 processors, as is required by libMesh numeric classes.
Verify a particular system by specifying that system's number.
Definition at line 1593 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), libMesh::MeshBase::local_node_ptr_range(), mesh, libMesh::ParallelObject::n_processors(), libMesh::MeshBase::node_ptr_range(), and libMesh::ParallelObject::processor_id().
void libMesh::MeshTools::libmesh_assert_equal_n_systems | ( | const MeshBase & | mesh | ) |
A function for testing that all DofObjects within a mesh have the same n_systems count.
Definition at line 1168 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), libMesh::invalid_uint, mesh, and libMesh::MeshBase::node_ptr_range().
void libMesh::MeshTools::libmesh_assert_no_links_to_elem | ( | const MeshBase & | mesh, |
const Elem * | bad_elem | ||
) |
A function for verifying that an element has been cut off from the rest of the mesh.
Definition at line 1272 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), 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 1194 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), 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 recieved consistent DofObject::id(), using element topology to identify matching nodes.
Definition at line 1870 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), libMesh::MeshBase::max_elem_id(), mesh, n_nodes(), libMesh::Elem::n_nodes(), libMesh::ParallelObject::n_processors(), libMesh::Elem::node_ptr(), libMesh::DofObject::processor_id(), and libMesh::MeshBase::query_elem_ptr().
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 1770 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::element_ptr_range(), libMesh::libmesh_assert(), mesh, 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 1908 of file mesh_tools.C.
References libMesh::as_range(), libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), libMesh::MeshBase::local_elements_begin(), libMesh::MeshBase::local_elements_end(), mesh, libMesh::ParallelObject::n_processors(), libMesh::MeshBase::node_ptr_range(), libMesh::DofObject::processor_id(), and libMesh::MeshBase::query_node_ptr().
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 1726 of file mesh_tools.C.
References libMesh::Elem::child_ref_range(), libMesh::MeshBase::element_ptr_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 1819 of file mesh_tools.C.
References libMesh::as_range(), libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), libMesh::MeshBase::local_elements_begin(), libMesh::MeshBase::local_elements_end(), libMesh::MeshBase::local_node_ptr_range(), mesh, libMesh::ParallelObject::n_processors(), and libMesh::MeshBase::node_ptr_range().
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 1315 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), 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 1335 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), 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 1396 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::get_boundary_info(), libMesh::BoundaryInfo::invalid_id, libMesh::libmesh_assert(), 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(), and libMesh::MeshBase::query_elem_ptr().
Referenced by libMesh::DofMap::create_dof_constraints(), 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 1566 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), 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 1292 of file mesh_tools.C.
References libMesh::MeshBase::active_element_ptr_range(), 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 2061 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::element_ptr_range(), libMesh::DofObject::id(), libMesh::DofObject::invalid_id, libMesh::libmesh_assert(), 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(), and libMesh::remote_elem.
Referenced by libMesh::MeshRefinement::_smooth_flags(), libMesh::DistributedMesh::allgather(), libMesh::DistributedMesh::delete_remote_elements(), and libMesh::UnstructuredMesh::find_neighbors().
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 1218 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), 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 581 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 1978 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::element_ptr_range(), libMesh::libmesh_assert(), libMesh::MeshBase::max_elem_id(), mesh, 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 2026 of file mesh_tools.C.
References libMesh::MeshBase::element_ptr_range(), 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 1242 of file mesh_tools.C.
References libMesh::as_range(), libMesh::libmesh_assert(), libMesh::MeshBase::local_elements_begin(), libMesh::MeshBase::local_elements_end(), 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 1634 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::libmesh_assert(), libMesh::MeshBase::max_elem_id(), libMesh::MeshBase::max_node_id(), mesh, libMesh::MeshBase::query_elem_ptr(), libMesh::MeshBase::query_node_ptr(), and libMesh::DofObject::unique_id().
Referenced by libMesh::MeshBase::prepare_for_use().
Find the maximum h-refinement level in a mesh.
Referenced by libMesh::MeshRefinement::make_coarsening_compatible(), and libMesh::CheckpointIO::n_active_levels_in().
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 591 of file mesh_tools.C.
References libMesh::MeshBase::active_type_elements_begin(), libMesh::MeshBase::active_type_elements_end(), 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 626 of file mesh_tools.C.
References libMesh::as_range(), libMesh::ParallelObject::comm(), mesh, n_active_local_levels(), libMesh::MeshBase::unpartitioned_elements_begin(), and libMesh::MeshBase::unpartitioned_elements_end().
Referenced by libMesh::XdrIO::write_serialized_connectivity().
Implemented by looping over all the active local elements and finding the maximum level.
Definition at line 614 of file mesh_tools.C.
References libMesh::MeshBase::active_local_element_ptr_range(), and mesh.
Referenced by n_active_levels().
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 705 of file mesh_tools.C.
References distance(), and end.
Referenced by libMesh::MeshTools::Subdivision::add_boundary_ghosts(), add_cube_convex_hull_to_mesh(), correct_node_proc_ids(), NodalNeighborsTest::do_test(), libMesh::MeshBase::get_info(), main(), libMesh::SFCPartitioner::partition_range(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::XdrIO::read(), libMesh::XdrIO::read_header(), 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(), BoundaryInfoTest::testEdgeBoundaryConditions(), libMesh::XdrIO::write(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::UCDIO::write_nodal_data(), 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 582 of file mesh_tools.C.
References distance(), mesh, libMesh::MeshBase::type_elements_begin(), and libMesh::MeshBase::type_elements_end().
Implemented by looping over all the local elements and unpartitioned elements and finding the maximum level, then summing in parallel.
Definition at line 656 of file mesh_tools.C.
References libMesh::as_range(), libMesh::ParallelObject::comm(), mesh, n_local_levels(), paranoid_n_levels(), libMesh::MeshBase::unpartitioned_elements_begin(), and libMesh::MeshBase::unpartitioned_elements_end().
Referenced by libMesh::MeshCommunication::delete_remote_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::PetscDMWrapper::init_dm_data(), and libMesh::MeshTools::Modification::smooth().
Implemented by looping over all the local elements and finding the maximum level.
Definition at line 643 of file mesh_tools.C.
References libMesh::as_range(), libMesh::MeshBase::local_elements_begin(), libMesh::MeshBase::local_elements_end(), 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 713 of file mesh_tools.C.
References distance(), and end.
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 598 of file mesh_tools.C.
References libMesh::as_range(), mesh, libMesh::MeshBase::type_elements_begin(), and libMesh::MeshBase::type_elements_end().
Implemented by looping over all the local elements and finding the maximum p-level, then summing in parallel.
Definition at line 721 of file mesh_tools.C.
References libMesh::as_range(), libMesh::ParallelObject::comm(), libMesh::MeshBase::local_elements_begin(), libMesh::MeshBase::local_elements_end(), mesh, libMesh::MeshBase::unpartitioned_elements_begin(), and libMesh::MeshBase::unpartitioned_elements_end().
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 680 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::element_ptr_range(), and mesh.
Referenced by n_levels().
MeshTools::BoundingBox libMesh::MeshTools::processor_bounding_box | ( | const MeshBase & | mesh, |
const processor_id_type | pid | ||
) |
Definition at line 469 of file mesh_tools.C.
References create_processor_bounding_box(), and mesh.
Sphere libMesh::MeshTools::processor_bounding_sphere | ( | const MeshBase & | mesh, |
const processor_id_type | pid | ||
) |
Definition at line 505 of file mesh_tools.C.
References create_processor_bounding_box(), mesh, std::norm(), and libMesh::Real.
MeshTools::BoundingBox libMesh::MeshTools::subdomain_bounding_box | ( | const MeshBase & | mesh, |
const subdomain_id_type | sid | ||
) |
Definition at line 521 of file mesh_tools.C.
References create_subdomain_bounding_box(), and mesh.
Sphere libMesh::MeshTools::subdomain_bounding_sphere | ( | const MeshBase & | mesh, |
const subdomain_id_type | sid | ||
) |
Definition at line 556 of file mesh_tools.C.
References create_subdomain_bounding_box(), mesh, std::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 213 of file mesh_tools.C.
References libMesh::ParallelObject::comm(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::DofObject::invalid_processor_id, libMesh::MeshBase::is_serial(), mesh, libMesh::Threads::parallel_reduce(), libMesh::ParallelObject::processor_id(), and weight().
|
inline |
Definition at line 113 of file mesh_tools.h.
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 236 of file mesh_tools.C.
References mesh, libMesh::Threads::parallel_reduce(), libMesh::MeshBase::pid_elements_begin(), and libMesh::MeshBase::pid_elements_end().
Referenced by assemble_SchroedingerEquation(), assemble_wave(), libMesh::QGrundmann_Moller::gm_rule(), libMesh::QGrid::init_2D(), libMesh::QGrid::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::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), CoupledFEMFunctionsx::operator()(), CoupledFEMFunctionsy::operator()(), libMesh::MeshTools::Modification::smooth(), total_weight(), and weight().