libMesh
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
libMesh::UnstructuredMesh Class Referenceabstract

The UnstructuredMesh class is derived from the MeshBase class. More...

#include <unstructured_mesh.h>

Inheritance diagram for libMesh::UnstructuredMesh:
[legend]

Public Types

typedef std::set< elemset_id_typeelemset_type
 Typedef for the "set" container used to store elemset ids. More...
 
typedef std::vector< GhostingFunctor * >::const_iterator GhostingFunctorIterator
 Iterator type for ghosting functor ranges. More...
 
typedef Predicates::multi_predicate Predicate
 We need an empty, generic class to act as a predicate for this and derived mesh classes. More...
 
typedef StoredRange< MeshBase::const_element_iterator, const Elem * > ConstElemRange
 
typedef std::vector< std::pair< std::pair< const Elem *, unsigned int >, Real > > constraint_rows_mapped_type
 
typedef std::map< const Node *, constraint_rows_mapped_typeconstraint_rows_type
 

Public Member Functions

 UnstructuredMesh (const Parallel::Communicator &comm_in, unsigned char dim=1)
 Constructor. More...
 
 UnstructuredMesh (const UnstructuredMesh &)=default
 UnstructuredMesh uses a defaulted copy constructor. More...
 
 UnstructuredMesh (const MeshBase &)
 UnstructuredMesh constructor from arbitrary (e.g. More...
 
 UnstructuredMesh (UnstructuredMesh &&)=delete
 Move-constructor deleted in MeshBase. More...
 
UnstructuredMeshoperator= (const UnstructuredMesh &)=delete
 Copy assignment is not allowed. More...
 
UnstructuredMeshoperator= (UnstructuredMesh &&other_mesh)=default
 Move assignment is allowed, by subclasses who handle post_dofobject_moves() More...
 
virtual MeshBaseassign (MeshBase &&other_mesh) override=0
 Shim to allow operator = (&&) to behave like a virtual function without having to be one. More...
 
virtual ~UnstructuredMesh ()
 Destructor. More...
 
virtual void read (const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false, bool skip_detect_interior_parents=false) override
 Reads the file specified by name. More...
 
virtual void write (const std::string &name) const override
 Write the file specified by name. More...
 
void write (const std::string &name, const std::vector< Number > &values, const std::vector< std::string > &variable_names) const
 Write to the file specified by name. More...
 
virtual void all_first_order () override
 Converts a mesh with higher-order elements into a mesh with linear elements. More...
 
virtual void all_second_order_range (const SimpleRange< element_iterator > &range, const bool full_ordered=true) override
 Converts a (conforming, non-refined) mesh with linear elements into a mesh with second-order elements. More...
 
virtual void all_complete_order_range (const SimpleRange< element_iterator > &range) override
 Converts a (conforming, non-refined) mesh with linear elements into a mesh with "complete" order elements, i.e. More...
 
void create_pid_mesh (UnstructuredMesh &pid_mesh, const processor_id_type pid) const
 Generates a new mesh containing all the elements which are assigned to processor pid. More...
 
void create_submesh (UnstructuredMesh &new_mesh, const const_element_iterator &it, const const_element_iterator &it_end) const
 Constructs a mesh called "new_mesh" from the current mesh by iterating over the elements between it and it_end and adding them to the new mesh. More...
 
std::size_t stitch_meshes (const MeshBase &other_mesh, boundary_id_type this_mesh_boundary, boundary_id_type other_mesh_boundary, Real tol=TOLERANCE, bool clear_stitched_boundary_ids=false, bool verbose=true, bool use_binary_search=true, bool enforce_all_nodes_match_on_boundaries=false, bool merge_boundary_nodes_all_or_nothing=false, bool remap_subdomain_ids=false, bool prepare_after_stitching=true)
 Stitch other_mesh to this mesh so that this mesh is the union of the two meshes. More...
 
std::size_t stitch_surfaces (boundary_id_type boundary_id_1, boundary_id_type boundary_id_2, Real tol=TOLERANCE, bool clear_stitched_boundary_ids=false, bool verbose=true, bool use_binary_search=true, bool enforce_all_nodes_match_on_boundaries=false, bool merge_boundary_nodes_all_or_nothing=false, bool prepare_after_stitching=true)
 Similar to stitch_meshes, except that we stitch two adjacent surfaces within this mesh. More...
 
virtual void copy_nodes_and_elements (const MeshBase &other_mesh, const bool skip_find_neighbors=false, dof_id_type element_id_offset=0, dof_id_type node_id_offset=0, unique_id_type unique_id_offset=0, std::unordered_map< subdomain_id_type, subdomain_id_type > *id_remapping=nullptr, const bool skip_preparation=false)
 Deep copy of nodes and elements from another mesh object (used by subclass copy constructors and by mesh merging operations) More...
 
virtual void move_nodes_and_elements (MeshBase &&other_mesh)=0
 Move node and elements from other_mesh to this mesh. More...
 
virtual void find_neighbors (const bool reset_remote_elements=false, const bool reset_current_list=true, const bool assert_valid=true) override
 Other functions from MeshBase requiring re-definition. More...
 
virtual bool contract () override
 Delete subactive (i.e. More...
 
bool operator== (const MeshBase &other_mesh) const
 This tests for exactly-equal data in all the senses that a mathematician would care about (element connectivity, nodal coordinates), but in the senses a programmer would care about it allows for non-equal equivalence in some ways (we accept different Elem/Node addresses in memory) but not others (we do not accept different subclass types, nor even different Elem/Node ids). More...
 
bool operator!= (const MeshBase &other_mesh) const
 
bool locally_equals (const MeshBase &other_mesh) const
 This behaves the same as operator==, but only for the local and ghosted aspects of the mesh; i.e. More...
 
virtual std::unique_ptr< MeshBaseclone () const =0
 Virtual "copy constructor". More...
 
virtual std::unique_ptr< Partitioner > & partitioner ()
 A partitioner to use at each partitioning. More...
 
const BoundaryInfoget_boundary_info () const
 The information about boundary ids on the mesh. More...
 
BoundaryInfoget_boundary_info ()
 Writable information about boundary ids on the mesh. More...
 
virtual void clear ()
 Deletes all the element and node data that is currently stored. More...
 
virtual void clear_elems ()=0
 Deletes all the element data that is currently stored. More...
 
bool is_prepared () const
 
Preparation preparation () const
 
void set_isnt_prepared ()
 Tells this we have done some operation where we should no longer consider ourself prepared. More...
 
void unset_is_prepared ()
 Tells this we have done some operation where we should no longer consider ourself prepared. More...
 
void unset_is_partitioned ()
 Tells this we have done some operation creating unpartitioned elements. More...
 
void unset_has_synched_id_counts ()
 Tells this we have done some operation (e.g. More...
 
void unset_has_neighbor_ptrs ()
 Tells this we have done some operation (e.g. More...
 
void unset_has_cached_elem_data ()
 Tells this we have done some operation (e.g. More...
 
void unset_has_interior_parent_ptrs ()
 Tells this we have done some operation (e.g. More...
 
void unset_has_removed_remote_elements ()
 Tells this we have done some operation (e.g. More...
 
void unset_has_removed_orphaned_nodes ()
 Tells this we have done some operation (e.g. More...
 
void unset_has_reinit_ghosting_functors ()
 Tells this we have done some operation (e.g. More...
 
void unset_has_boundary_id_sets ()
 Tells this we have done some operation which may have invalidated our cached boundary id sets. More...
 
virtual bool is_serial () const
 
virtual bool is_serial_on_zero () const
 
virtual void set_distributed ()
 Asserts that not all elements and nodes of the mesh necessarily exist on the current processor. More...
 
virtual bool is_replicated () const
 
virtual void allgather ()
 Gathers all elements and nodes of the mesh onto every processor. More...
 
virtual void gather_to_zero ()
 Gathers all elements and nodes of the mesh onto processor zero. More...
 
virtual void delete_remote_elements ()
 When supported, deletes all nonlocal elements of the mesh except for "ghosts" which touch a local element, and deletes all nodes which are not part of a local or ghost element. More...
 
void reinit_ghosting_functors ()
 Loops over ghosting functors and calls mesh_reinit() More...
 
unsigned int mesh_dimension () const
 
void set_mesh_dimension (unsigned char d)
 Resets the logical dimension of the mesh. More...
 
const std::set< unsigned char > & elem_dimensions () const
 
const std::set< Order > & elem_default_orders () const
 
Order supported_nodal_order () const
 
void set_elem_dimensions (std::set< unsigned char > elem_dims)
 Most of the time you should not need to call this, as the element dimensions will be set automatically by a call to cache_elem_data(), therefore only call this if you know what you're doing. More...
 
void add_elemset_code (dof_id_type code, MeshBase::elemset_type id_set)
 Tabulate a user-defined "code" for elements which belong to the element sets specified in id_set. More...
 
unsigned int n_elemsets () const
 Returns the number of unique elemset ids which have been added via add_elemset_code(), which is the size of the _all_elemset_ids set. More...
 
void get_elemsets (dof_id_type elemset_code, MeshBase::elemset_type &id_set_to_fill) const
 Look up the element sets for a given elemset code and vice-versa. More...
 
dof_id_type get_elemset_code (const MeshBase::elemset_type &id_set) const
 
std::vector< dof_id_typeget_elemset_codes () const
 Return a vector of all elemset codes defined on the mesh. More...
 
void change_elemset_code (dof_id_type old_code, dof_id_type new_code)
 Replace elemset code "old_code" with "new_code". More...
 
void change_elemset_id (elemset_id_type old_id, elemset_id_type new_id)
 Replace elemset id "old_id" with "new_id". More...
 
unsigned int spatial_dimension () const
 
void set_spatial_dimension (unsigned char d)
 Sets the "spatial dimension" of the Mesh. More...
 
virtual dof_id_type n_nodes () const =0
 
virtual dof_id_type parallel_n_nodes () const =0
 
dof_id_type n_nodes_on_proc (const processor_id_type proc) const
 
dof_id_type n_local_nodes () const
 
dof_id_type n_unpartitioned_nodes () const
 
virtual dof_id_type max_node_id () const =0
 
unique_id_type next_unique_id () const
 
virtual void set_next_unique_id (unique_id_type id)=0
 Sets the next available unique id to be used. More...
 
virtual void reserve_nodes (const dof_id_type nn)=0
 Reserves space for a known number of nodes. More...
 
virtual dof_id_type n_elem () const =0
 
virtual dof_id_type parallel_n_elem () const =0
 
virtual dof_id_type max_elem_id () const =0
 
virtual unique_id_type parallel_max_unique_id () const =0
 
virtual void reserve_elem (const dof_id_type ne)=0
 Reserves space for a known number of elements. More...
 
virtual void update_parallel_id_counts ()=0
 Updates parallel caches so that methods like n_elem() accurately reflect changes on other processors. More...
 
virtual dof_id_type n_active_elem () const =0
 
dof_id_type n_elem_on_proc (const processor_id_type proc) const
 
dof_id_type n_local_elem () const
 
dof_id_type n_unpartitioned_elem () const
 
dof_id_type n_active_elem_on_proc (const processor_id_type proc) const
 
dof_id_type n_active_local_elem () const
 
dof_id_type n_sub_elem () const
 
dof_id_type n_active_sub_elem () const
 Same as n_sub_elem(), but only counts active elements. More...
 
virtual const Pointpoint (const dof_id_type i) const =0
 
virtual const Nodenode_ref (const dof_id_type i) const
 
virtual Nodenode_ref (const dof_id_type i)
 
virtual const Nodenode_ptr (const dof_id_type i) const =0
 
virtual Nodenode_ptr (const dof_id_type i)=0
 
virtual const Nodequery_node_ptr (const dof_id_type i) const =0
 
virtual Nodequery_node_ptr (const dof_id_type i)=0
 
virtual const Elemelem_ref (const dof_id_type i) const
 
virtual Elemelem_ref (const dof_id_type i)
 
virtual const Elemelem_ptr (const dof_id_type i) const =0
 
virtual Elemelem_ptr (const dof_id_type i)=0
 
virtual const Elemquery_elem_ptr (const dof_id_type i) const =0
 
virtual Elemquery_elem_ptr (const dof_id_type i)=0
 
virtual Nodeadd_point (const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
 Add a new Node at Point p to the end of the vertex array, with processor_id procid. More...
 
virtual Nodeadd_node (Node *n)=0
 Add Node n to the end of the vertex array. More...
 
virtual Nodeadd_node (std::unique_ptr< Node > n)=0
 Version of add_node() taking a std::unique_ptr by value. More...
 
virtual void delete_node (Node *n)=0
 Removes the Node n from the mesh. More...
 
virtual void own_node (Node &)
 Takes ownership of node n on this partition of a distributed mesh, by setting n.processor_id() to this->processor_id(), as well as changing n.id() and moving it in the mesh's internal container to give it a new authoritative id. More...
 
virtual void renumber_node (dof_id_type old_id, dof_id_type new_id)=0
 Changes the id of node old_id, both by changing node(old_id)->id() and by moving node(old_id) in the mesh's internal container. More...
 
virtual Elemadd_elem (Elem *e)=0
 Add elem e to the end of the element array. More...
 
virtual Elemadd_elem (std::unique_ptr< Elem > e)=0
 Version of add_elem() taking a std::unique_ptr by value. More...
 
virtual Eleminsert_elem (Elem *e)=0
 Insert elem e to the element array, preserving its id and replacing/deleting any existing element with the same id. More...
 
virtual Eleminsert_elem (std::unique_ptr< Elem > e)=0
 Version of insert_elem() taking a std::unique_ptr by value. More...
 
virtual void delete_elem (Elem *e)=0
 Removes element e from the mesh. More...
 
virtual void renumber_elem (dof_id_type old_id, dof_id_type new_id)=0
 Changes the id of element old_id, both by changing elem(old_id)->id() and by moving elem(old_id) in the mesh's internal container. More...
 
ElemMappingType default_mapping_type () const
 Returns the default master space to physical space mapping basis functions to be used on newly added elements. More...
 
void set_default_mapping_type (const ElemMappingType type)
 Set the default master space to physical space mapping basis functions to be used on newly added elements. More...
 
unsigned char default_mapping_data () const
 Returns any default data value used by the master space to physical space mapping. More...
 
void set_default_mapping_data (const unsigned char data)
 Set the default master space to physical space mapping basis functions to be used on newly added elements. More...
 
void remove_orphaned_nodes ()
 Removes any orphaned nodes, nodes not connected to any elements. More...
 
virtual void renumber_nodes_and_elements ()=0
 After partitioning a mesh it is useful to renumber the nodes and elements so that they lie in contiguous blocks on the processors. More...
 
virtual void fix_broken_node_and_element_numbering ()=0
 There is no reason for a user to ever call this function. More...
 
unsigned int add_elem_integer (std::string name, bool allocate_data=true, dof_id_type default_value=DofObject::invalid_id)
 Register an integer datum (of type dof_id_type) to be added to each element in the mesh. More...
 
std::vector< unsigned intadd_elem_integers (const std::vector< std::string > &names, bool allocate_data=true, const std::vector< dof_id_type > *default_values=nullptr)
 Register integer data (of type dof_id_type) to be added to each element in the mesh, one string name for each new integer. More...
 
unsigned int get_elem_integer_index (std::string_view name) const
 
bool has_elem_integer (std::string_view name) const
 
const std::string & get_elem_integer_name (unsigned int i) const
 
unsigned int n_elem_integers () const
 
template<typename T >
unsigned int add_elem_datum (const std::string &name, bool allocate_data=true, const T *default_value=nullptr)
 Register a datum (of type T) to be added to each element in the mesh. More...
 
template<typename T >
std::vector< unsigned intadd_elem_data (const std::vector< std::string > &names, bool allocate_data=true, const std::vector< T > *default_values=nullptr)
 Register data (of type T) to be added to each element in the mesh. More...
 
unsigned int add_node_integer (std::string name, bool allocate_data=true, dof_id_type default_value=DofObject::invalid_id)
 Register an integer datum (of type dof_id_type) to be added to each node in the mesh. More...
 
std::vector< unsigned intadd_node_integers (const std::vector< std::string > &names, bool allocate_data=true, const std::vector< dof_id_type > *default_values=nullptr)
 Register integer data (of type dof_id_type) to be added to each node in the mesh. More...
 
unsigned int get_node_integer_index (std::string_view name) const
 
bool has_node_integer (std::string_view name) const
 
const std::string & get_node_integer_name (unsigned int i) const
 
unsigned int n_node_integers () const
 
template<typename T >
unsigned int add_node_datum (const std::string &name, bool allocate_data=true, const T *default_value=nullptr)
 Register a datum (of type T) to be added to each node in the mesh. More...
 
template<typename T >
std::vector< unsigned intadd_node_data (const std::vector< std::string > &name, bool allocate_data=true, const std::vector< T > *default_values=nullptr)
 Register data (of type T) to be added to each node in the mesh. More...
 
void prepare_for_use (const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
 Prepare a newly created (or read) mesh for use. More...
 
void prepare_for_use (const bool skip_renumber_nodes_and_elements)
 
void prepare_for_use ()
 
void complete_preparation ()
 
virtual void partition (const unsigned int n_parts)
 Call the default partitioner (currently metis_partition()). More...
 
void partition ()
 
virtual void redistribute ()
 Redistribute elements between processors. More...
 
virtual void update_post_partitioning ()
 Recalculate any cached data (or invalidate any caches that are computed on the fly) after elements and nodes have been repartitioned. More...
 
void allow_renumbering (bool allow)
 If false is passed in then this mesh will no longer be renumbered when being prepared for use. More...
 
bool allow_renumbering () const
 
void allow_find_neighbors (bool allow)
 If false is passed then this mesh will no longer work to find element neighbors when being prepared for use. More...
 
bool allow_find_neighbors () const
 
void allow_detect_interior_parents (bool allow)
 If false is passed then this mesh will no longer work to detect interior parents when being prepared for use. More...
 
bool allow_detect_interior_parents () const
 
void allow_remote_element_removal (bool allow)
 If false is passed in then this mesh will no longer have remote elements deleted when being prepared for use; i.e. More...
 
bool allow_remote_element_removal () const
 
void allow_node_and_elem_unique_id_overlap (bool allow)
 If true is passed, then this mesh will no longer require unique_ids to be unique across the set of all DofObjects. More...
 
bool allow_node_and_elem_unique_id_overlap () const
 
void skip_noncritical_partitioning (bool skip)
 If true is passed in then the elements on this mesh will no longer be (re)partitioned, and the nodes on this mesh will only be repartitioned if they are found "orphaned" via coarsening or other removal of the last element responsible for their node/element processor id consistency. More...
 
bool skip_noncritical_partitioning () const
 
void skip_partitioning (bool skip)
 If true is passed in then nothing on this mesh will be (re)partitioned. More...
 
bool skip_partitioning () const
 
void add_ghosting_functor (GhostingFunctor &ghosting_functor)
 Adds a functor which can specify ghosting requirements for use on distributed meshes. More...
 
void add_ghosting_functor (std::shared_ptr< GhostingFunctor > ghosting_functor)
 Adds a functor which can specify ghosting requirements for use on distributed meshes. More...
 
void remove_ghosting_functor (GhostingFunctor &ghosting_functor)
 Removes a functor which was previously added to the set of ghosting functors. More...
 
GhostingFunctorIterator ghosting_functors_begin () const
 Beginning of range of ghosting functors. More...
 
GhostingFunctorIterator ghosting_functors_end () const
 End of range of ghosting functors. More...
 
GhostingFunctordefault_ghosting ()
 Default ghosting functor. More...
 
void subdomain_ids (std::set< subdomain_id_type > &ids, const bool global=true) const
 Constructs a list of all subdomain identifiers in the local mesh if global == false, and in the global mesh if global == true (default). More...
 
subdomain_id_type n_subdomains () const
 
subdomain_id_type n_local_subdomains () const
 
unsigned int n_partitions () const
 
std::string get_info (const unsigned int verbosity=0, const bool global=true) const
 
void print_info (std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
 Prints relevant information about the mesh. More...
 
void all_second_order (const bool full_ordered=true)
 Calls the range-based version of this function with a range consisting of all elements in the mesh. More...
 
virtual void all_complete_order ()
 Calls the range-based version of this function with a range consisting of all elements in the mesh. More...
 
unsigned int recalculate_n_partitions ()
 In a few (very rare) cases, the user may have manually tagged the elements with specific processor IDs by hand, without using a partitioner. More...
 
std::unique_ptr< PointLocatorBasesub_point_locator () const
 
void set_point_locator_close_to_point_tol (Real val)
 Set value used by PointLocatorBase::close_to_point_tol(). More...
 
Real get_point_locator_close_to_point_tol () const
 
void clear_point_locator ()
 Releases the current PointLocator object. More...
 
void set_count_lower_dim_elems_in_point_locator (bool count_lower_dim_elems)
 In the point locator, do we count lower dimensional elements when we refine point locator regions? This is relevant in tree-based point locators, for example. More...
 
bool get_count_lower_dim_elems_in_point_locator () const
 Get the current value of _count_lower_dim_elems_in_point_locator. More...
 
virtual void libmesh_assert_valid_parallel_ids () const
 Verify id and processor_id consistency of our elements and nodes containers. More...
 
std::string & subdomain_name (subdomain_id_type id)
 
const std::string & subdomain_name (subdomain_id_type id) const
 
subdomain_id_type get_id_by_name (std::string_view name) const
 
 ABSTRACT_ELEM_ITERATORS (,) ABSTRACT_ELEM_ITERATORS(active_
 
 ABSTRACT_ELEM_ITERATORS (ancestor_,) ABSTRACT_ELEM_ITERATORS(subactive_
 
 ABSTRACT_ELEM_ITERATORS (local_,) ABSTRACT_ELEM_ITERATORS(unpartitioned_
 
 ABSTRACT_ELEM_ITERATORS (facelocal_,) ABSTRACT_ELEM_ITERATORS(level_
 
unsigned int level ABSTRACT_ELEM_ITERATORS (pid_, processor_id_type pid) ABSTRACT_ELEM_ITERATORS(type_
 
unsigned int level ElemType type ABSTRACT_ELEM_ITERATORS (active_subdomain_, subdomain_id_type sid) ABSTRACT_ELEM_ITERATORS(active_subdomain_set_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss ABSTRACT_ELEM_ITERATORS (not_active_,) ABSTRACT_ELEM_ITERATORS(not_ancestor_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss ABSTRACT_ELEM_ITERATORS (not_subactive_,) ABSTRACT_ELEM_ITERATORS(not_local_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss ABSTRACT_ELEM_ITERATORS (not_level_, unsigned int level) ABSTRACT_ELEM_ITERATORS(active_local_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss ABSTRACT_ELEM_ITERATORS (active_not_local_,) ABSTRACT_ELEM_ITERATORS(active_unpartitioned_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss ABSTRACT_ELEM_ITERATORS (active_type_, ElemType type) ABSTRACT_ELEM_ITERATORS(active_pid_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss processor_id_type pid ABSTRACT_ELEM_ITERATORS (local_level_, unsigned int level) ABSTRACT_ELEM_ITERATORS(local_not_level_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss processor_id_type pid unsigned int level ABSTRACT_ELEM_ITERATORS (active_local_subdomain_, subdomain_id_type sid) ABSTRACT_ELEM_ITERATORS(active_local_subdomain_set_
 
 ABSTRACT_ELEM_ITERATORS (semilocal_,) ABSTRACT_ELEM_ITERATORS(ghost_
 
 ABSTRACT_ELEM_ITERATORS (active_semilocal_,) ABSTRACT_ELEM_ITERATORS(evaluable_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss processor_id_type pid unsigned int level std::set< subdomain_id_type > virtual ss SimpleRange< element_iteratoractive_subdomain_elements_ptr_range (subdomain_id_type sid)=0
 
virtual SimpleRange< const_element_iteratoractive_subdomain_elements_ptr_range (subdomain_id_type sid) const =0
 
virtual SimpleRange< element_iteratoractive_local_subdomain_elements_ptr_range (subdomain_id_type sid)=0
 
virtual SimpleRange< const_element_iteratoractive_local_subdomain_elements_ptr_range (subdomain_id_type sid) const =0
 
virtual SimpleRange< element_iteratoractive_subdomain_set_elements_ptr_range (std::set< subdomain_id_type > ss)=0
 
virtual SimpleRange< const_element_iteratoractive_subdomain_set_elements_ptr_range (std::set< subdomain_id_type > ss) const =0
 
const ElemRangeelement_stored_range ()
 
const ConstElemRangeactive_local_element_stored_range () const
 
void clear_stored_ranges ()
 Clears stored ranges, to indicate that the mesh has changed and they should be regenerated when next needed. More...
 
std::map< subdomain_id_type, std::string > & set_subdomain_name_map ()
 
const std::map< subdomain_id_type, std::string > & get_subdomain_name_map () const
 
constraint_rows_typeget_constraint_rows ()
 Constraint rows accessors. More...
 
const constraint_rows_typeget_constraint_rows () const
 
dof_id_type n_constraint_rows () const
 
void copy_constraint_rows (const MeshBase &other_mesh)
 Copy the constraints from the other mesh to this mesh. More...
 
template<typename T >
void copy_constraint_rows (const SparseMatrix< T > &constraint_operator, bool precondition_constraint_operator=false)
 Copy the constraints from the given matrix to this mesh. More...
 
void print_constraint_rows (std::ostream &os=libMesh::out, bool print_nonlocal=false) const
 Prints (from processor 0) all mesh constraint rows. More...
 
std::string get_local_constraints (bool print_nonlocal=false) const
 Gets a string reporting all mesh constraint rows local to this processor. More...
 
void cache_elem_dims ()
 
void cache_elem_data ()
 
void sync_subdomain_name_map ()
 libMesh often expects all processors to know about names of all subdomain ids, but distributed mesh generators may only know about part of a mesh when creating names. More...
 
void detect_interior_parents ()
 Search the mesh for elements that have a neighboring element of dim+1 and set that element as the interior parent. More...
 
const MeshBaseinterior_mesh () const
 
MeshBaseinterior_mesh ()
 
void set_interior_mesh (MeshBase &int_mesh)
 Sets the interior mesh. More...
 
const std::set< subdomain_id_type > & get_mesh_subdomains () const
 
void add_disjoint_neighbor_boundary_pairs (const boundary_id_type b1, const boundary_id_type b2, const RealVectorValue &translation)
 Register a pair of boundaries as disjoint neighbor boundary pairs. More...
 
PeriodicBoundariesget_disjoint_neighbor_boundary_pairs ()
 
const PeriodicBoundariesget_disjoint_neighbor_boundary_pairs () const
 
void remove_disjoint_boundary_pair (const boundary_id_type b1, const boundary_id_type b2)
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Public Attributes

const DofMap &dof_map LIBMESH_COMMA unsigned int var_num
 
const DofMap &dof_map LIBMESH_COMMA unsigned int ElemElemRange
 

Protected Types

typedef variant_filter_iterator< MeshBase::Predicate, Elem * > elem_filter_iter
 The original iterator classes weren't properly const-safe; relying on their const-incorrectness is now deprecated. More...
 
typedef variant_filter_iterator< MeshBase::Predicate, Elem *const, Elem *const &, Elem *const *, const Elem *const, const Elem *const &, const Elem *const * > elem_filter_iter
 
typedef variant_filter_iterator< MeshBase::Predicate, Elem *const, Elem *const &, Elem *const * > const_elem_filter_iter
 
typedef variant_filter_iterator< MeshBase::Predicate, const Elem *const, const Elem *const &, const Elem *const * > const_elem_filter_iter
 
typedef variant_filter_iterator< MeshBase::Predicate, Node * > node_filter_iter
 
typedef variant_filter_iterator< MeshBase::Predicate, Node *const, Node *const &, Node *const *, const Node *const, const Node *const &, const Node *const * > node_filter_iter
 
typedef variant_filter_iterator< MeshBase::Predicate, Node *const, Node *const &, Node *const * > const_node_filter_iter
 
typedef variant_filter_iterator< MeshBase::Predicate, const Node *const, const Node *const &, const Node *const * > const_node_filter_iter
 

Protected Member Functions

void post_dofobject_moves (MeshBase &&other_mesh)
 Moves any superclass data (e.g. More...
 
void copy_cached_data (const MeshBase &other_mesh)
 Helper class to copy cached data, to synchronize with a possibly unprepared other_mesh. More...
 
virtual bool subclass_locally_equals (const MeshBase &other_mesh) const =0
 Shim to allow operator == (&) to behave like a virtual function without having to be one. More...
 
bool nodes_and_elements_equal (const MeshBase &other_mesh) const
 Tests for equality of all elements and nodes in the mesh. More...
 
unsigned intset_n_partitions ()
 
void size_elem_extra_integers ()
 Size extra-integer arrays of all elements in the mesh. More...
 
void size_node_extra_integers ()
 Size extra-integer arrays of all nodes in the mesh. More...
 
std::pair< std::vector< unsigned int >, std::vector< unsigned int > > merge_extra_integer_names (const MeshBase &other)
 Merge extra-integer arrays from an other mesh. More...
 

Protected Attributes

std::unique_ptr< PeriodicBoundaries_disjoint_neighbor_boundary_pairs
 The disjoint neighbor boundary id pairs. More...
 
std::unique_ptr< BoundaryInfoboundary_info
 This class holds the boundary information. More...
 
unsigned int _n_parts
 The number of partitions the mesh has. More...
 
ElemMappingType _default_mapping_type
 The default mapping type (typically Lagrange) between master and physical space to assign to newly added elements. More...
 
unsigned char _default_mapping_data
 The default mapping data (unused with Lagrange, used for nodal weight lookup index with rational bases) to assign to newly added elements. More...
 
Preparation _preparation
 Flags indicating in what ways this mesh has been prepared. More...
 
std::unique_ptr< ElemRange_element_stored_range
 A cached ElemRange for threaded mutation of all semilocal elements of this mesh. More...
 
std::unique_ptr< ConstElemRange_const_active_local_element_stored_range
 A cached ConstElemRange for threaded calculation on all local elements of this mesh. More...
 
std::unique_ptr< PointLocatorBase_point_locator
 A PointLocator class for this mesh. More...
 
bool _count_lower_dim_elems_in_point_locator
 Do we count lower dimensional elements in point locator refinement? This is relevant in tree-based point locators, for example. More...
 
std::unique_ptr< Partitioner_partitioner
 A partitioner to use at each prepare_for_use(). More...
 
unique_id_type _next_unique_id
 The next available unique id for assigning ids to DOF objects. More...
 
MeshBase_interior_mesh
 Defaulting to this, a pointer to the mesh used to generate boundary elements on this. More...
 
bool _skip_noncritical_partitioning
 If this is true then no partitioning should be done with the possible exception of orphaned nodes. More...
 
bool _skip_all_partitioning
 If this is true then no partitioning should be done. More...
 
bool _skip_renumber_nodes_and_elements
 If this is true then renumbering will be kept to a minimum. More...
 
bool _skip_find_neighbors
 If this is true then we will skip find_neighbors in prepare_for_use. More...
 
bool _skip_detect_interior_parents
 If this is true then we will skip detect_interior_parents in prepare_for_use. More...
 
bool _allow_remote_element_removal
 If this is false then even on DistributedMesh remote elements will not be deleted during mesh preparation. More...
 
bool _allow_node_and_elem_unique_id_overlap
 The Exodus reader (and potentially other readers in the future?) now supports setting Node and Elem unique_ids based on values from within the Exodus file itself, rather than generating them automatically in LibMesh. More...
 
std::map< subdomain_id_type, std::string > _block_id_to_name
 This structure maintains the mapping of named blocks for file formats that support named blocks. More...
 
std::set< unsigned char > _elem_dims
 We cache the dimension of the elements present in the mesh. More...
 
std::set< Order_elem_default_orders
 We cache the (default) order of the geometric elements present in the mesh. More...
 
Order _supported_nodal_order
 We cache the maximum nodal order supported by all the mesh's elements (the minimum supported_nodal_order() of any element) More...
 
std::set< subdomain_id_type_mesh_subdomains
 We cache the subdomain ids of the elements present in the mesh. More...
 
std::map< dof_id_type, const MeshBase::elemset_type * > _elemset_codes
 Map from "element set code" to list of set ids to which that element belongs (and vice-versa). More...
 
std::map< MeshBase::elemset_type, dof_id_type_elemset_codes_inverse_map
 
MeshBase::elemset_type _all_elemset_ids
 
unsigned char _spatial_dimension
 The "spatial dimension" of the Mesh. More...
 
std::vector< std::string > _elem_integer_names
 The array of names for integer data associated with each element in the mesh. More...
 
std::vector< dof_id_type_elem_integer_default_values
 The array of default initialization values for integer data associated with each element in the mesh. More...
 
std::vector< std::string > _node_integer_names
 The array of names for integer data associated with each node in the mesh. More...
 
std::vector< dof_id_type_node_integer_default_values
 The array of default initialization values for integer data associated with each node in the mesh. More...
 
std::unique_ptr< GhostingFunctor_default_ghosting
 The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior. More...
 
std::vector< GhostingFunctor * > _ghosting_functors
 The list of all GhostingFunctor objects to be used when distributing a DistributedMesh. More...
 
std::map< GhostingFunctor *, std::shared_ptr< GhostingFunctor > > _shared_functors
 Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form. More...
 
constraint_rows_type _constraint_rows
 
Real _point_locator_close_to_point_tol
 If nonzero, we will call PointLocatorBase::set_close_to_point_tol() on any PointLocators that we create. More...
 
const Parallel::Communicator_communicator
 

Private Member Functions

std::size_t stitching_helper (const MeshBase *other_mesh, boundary_id_type boundary_id_1, boundary_id_type boundary_id_2, Real tol, bool clear_stitched_boundary_ids, bool verbose, bool use_binary_search, bool enforce_all_nodes_match_on_boundaries, bool skip_find_neighbors, bool merge_boundary_nodes_all_or_nothing, bool remap_subdomain_ids, bool prepare_after_stitching)
 Helper function for stitch_meshes and stitch_surfaces that does the mesh stitching. More...
 

Detailed Description

The UnstructuredMesh class is derived from the MeshBase class.

The user will typically want to instantiate and use the Mesh class in her applications, which is currently a simple derived class of UnstructuredMesh. In order to use the adaptive mesh refinement capabilities of the library, first instantiate a MeshRefinement object with a reference to this class. Then call the appropriate refinement functions from that object. To interact with the boundary, instantiate a BoundaryMesh with a reference to this class, and then use that object's functionality.

Author
Roy Stogner
Date
2007 Base class for Replicated and Distributed meshes.

Definition at line 48 of file unstructured_mesh.h.

Member Typedef Documentation

◆ const_elem_filter_iter [1/2]

typedef variant_filter_iterator<MeshBase::Predicate, Elem * const, Elem * const &, Elem * const *> libMesh::MeshBase::const_elem_filter_iter
protectedinherited

Definition at line 2452 of file mesh_base.h.

◆ const_elem_filter_iter [2/2]

typedef variant_filter_iterator<MeshBase::Predicate, const Elem * const, const Elem * const &, const Elem * const *> libMesh::MeshBase::const_elem_filter_iter
protectedinherited

Definition at line 2472 of file mesh_base.h.

◆ const_node_filter_iter [1/2]

typedef variant_filter_iterator<MeshBase::Predicate, Node * const, Node * const &, Node * const *> libMesh::MeshBase::const_node_filter_iter
protectedinherited

Definition at line 2459 of file mesh_base.h.

◆ const_node_filter_iter [2/2]

typedef variant_filter_iterator<MeshBase::Predicate, const Node * const, const Node * const &, const Node * const *> libMesh::MeshBase::const_node_filter_iter
protectedinherited

Definition at line 2485 of file mesh_base.h.

◆ ConstElemRange

Definition at line 1865 of file mesh_base.h.

◆ constraint_rows_mapped_type

typedef std::vector<std::pair<std::pair<const Elem *, unsigned int>, Real> > libMesh::MeshBase::constraint_rows_mapped_type
inherited

Definition at line 1899 of file mesh_base.h.

◆ constraint_rows_type

Definition at line 1900 of file mesh_base.h.

◆ elem_filter_iter [1/2]

The original iterator classes weren't properly const-safe; relying on their const-incorrectness is now deprecated.

Definition at line 2447 of file mesh_base.h.

◆ elem_filter_iter [2/2]

typedef variant_filter_iterator<MeshBase::Predicate, Elem * const, Elem * const &, Elem * const *, const Elem * const, const Elem * const &, const Elem * const *> libMesh::MeshBase::elem_filter_iter
protectedinherited

Definition at line 2467 of file mesh_base.h.

◆ elemset_type

typedef std::set<elemset_id_type> libMesh::MeshBase::elemset_type
inherited

Typedef for the "set" container used to store elemset ids.

The main requirements are that the entries be sorted and unique, so std::set works for this, but there may be more efficient alternatives.

Definition at line 456 of file mesh_base.h.

◆ GhostingFunctorIterator

typedef std::vector<GhostingFunctor *>::const_iterator libMesh::MeshBase::GhostingFunctorIterator
inherited

Iterator type for ghosting functor ranges.

This has changed in the past and may change again; code should use auto or the type here.

Definition at line 1457 of file mesh_base.h.

◆ node_filter_iter [1/2]

Definition at line 2454 of file mesh_base.h.

◆ node_filter_iter [2/2]

typedef variant_filter_iterator<MeshBase::Predicate, Node * const, Node * const &, Node * const *, const Node * const, const Node * const &, const Node * const *> libMesh::MeshBase::node_filter_iter
protectedinherited

Definition at line 2480 of file mesh_base.h.

◆ Predicate

We need an empty, generic class to act as a predicate for this and derived mesh classes.

Definition at line 1575 of file mesh_base.h.

Constructor & Destructor Documentation

◆ UnstructuredMesh() [1/4]

libMesh::UnstructuredMesh::UnstructuredMesh ( const Parallel::Communicator comm_in,
unsigned char  dim = 1 
)
explicit

Constructor.

Takes dim, the dimension of the mesh. The mesh dimension can be changed (and may automatically be changed by mesh generation/loading) later.

Definition at line 628 of file unstructured_mesh.C.

References libMesh::initialized(), and libMesh::libmesh_assert().

629  :
630  MeshBase (comm_in,d)
631 {
633 }
libmesh_assert(ctx)
MeshBase(const Parallel::Communicator &comm_in, unsigned char dim=1)
Constructor.
Definition: mesh_base.C:64
bool initialized()
Checks that library initialization has been done.
Definition: libmesh.C:324

◆ UnstructuredMesh() [2/4]

libMesh::UnstructuredMesh::UnstructuredMesh ( const UnstructuredMesh )
default

UnstructuredMesh uses a defaulted copy constructor.

◆ UnstructuredMesh() [3/4]

libMesh::UnstructuredMesh::UnstructuredMesh ( const MeshBase other_mesh)

UnstructuredMesh constructor from arbitrary (e.g.

Cartesian someday?) meshes

Definition at line 637 of file unstructured_mesh.C.

References libMesh::initialized(), and libMesh::libmesh_assert().

637  :
638  MeshBase (other_mesh)
639 {
641 }
libmesh_assert(ctx)
MeshBase(const Parallel::Communicator &comm_in, unsigned char dim=1)
Constructor.
Definition: mesh_base.C:64
bool initialized()
Checks that library initialization has been done.
Definition: libmesh.C:324

◆ UnstructuredMesh() [4/4]

libMesh::UnstructuredMesh::UnstructuredMesh ( UnstructuredMesh &&  )
delete

Move-constructor deleted in MeshBase.

◆ ~UnstructuredMesh()

libMesh::UnstructuredMesh::~UnstructuredMesh ( )
virtual

Destructor.

Definition at line 944 of file unstructured_mesh.C.

References libMesh::closed().

945 {
946  // this->clear (); // Nothing to clear at this level
947 
948  libmesh_exceptionless_assert (!libMesh::closed());
949 }
bool closed()
Checks that the library has been closed.
Definition: libmesh.C:331

Member Function Documentation

◆ ABSTRACT_ELEM_ITERATORS() [1/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( )
inherited

◆ ABSTRACT_ELEM_ITERATORS() [2/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( ancestor_  )
inherited

◆ ABSTRACT_ELEM_ITERATORS() [3/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( local_  )
inherited

◆ ABSTRACT_ELEM_ITERATORS() [4/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( facelocal_  )
inherited

◆ ABSTRACT_ELEM_ITERATORS() [5/15]

unsigned int level libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( pid_  ,
processor_id_type  pid 
)
inherited

◆ ABSTRACT_ELEM_ITERATORS() [6/15]

unsigned int level ElemType type libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( active_subdomain_  ,
subdomain_id_type  sid 
)
inherited

◆ ABSTRACT_ELEM_ITERATORS() [7/15]

unsigned int level ElemType type std::set<subdomain_id_type> ss libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( not_active_  )
inherited

◆ ABSTRACT_ELEM_ITERATORS() [8/15]

unsigned int level ElemType type std::set<subdomain_id_type> ss libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( not_subactive_  )
inherited

◆ ABSTRACT_ELEM_ITERATORS() [9/15]

unsigned int level ElemType type std::set<subdomain_id_type> ss libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( not_level_  ,
unsigned int  level 
)
inherited

◆ ABSTRACT_ELEM_ITERATORS() [10/15]

unsigned int level ElemType type std::set<subdomain_id_type> ss libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( active_not_local_  )
inherited

◆ ABSTRACT_ELEM_ITERATORS() [11/15]

unsigned int level ElemType type std::set<subdomain_id_type> ss libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( active_type_  ,
ElemType  type 
)
inherited

◆ ABSTRACT_ELEM_ITERATORS() [12/15]

unsigned int level ElemType type std::set<subdomain_id_type> ss processor_id_type pid libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( local_level_  ,
unsigned int  level 
)
inherited

◆ ABSTRACT_ELEM_ITERATORS() [13/15]

unsigned int level ElemType type std::set<subdomain_id_type> ss processor_id_type pid unsigned int level libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( active_local_subdomain_  ,
subdomain_id_type  sid 
)
inherited

◆ ABSTRACT_ELEM_ITERATORS() [14/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( semilocal_  )
inherited

◆ ABSTRACT_ELEM_ITERATORS() [15/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( active_semilocal_  )
inherited

◆ active_local_element_stored_range()

const ConstElemRange & libMesh::MeshBase::active_local_element_stored_range ( ) const
inherited
Returns
A reference to a cached vector copy of a range of pointers to all active local elements, suitable for threading.

Iterating over only local elements is most useful for computing on the mesh, so we only have a non-const version for now.

Definition at line 1928 of file mesh_base.C.

References libMesh::MeshBase::_const_active_local_element_stored_range, libMesh::Threads::in_threads, and libMesh::libmesh_assert().

Referenced by libMesh::FEMSystem::assemble_qoi(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::FEMSystem::assembly(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::MeshTetInterface::check_hull_integrity(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshTools::n_active_local_levels(), libMesh::FEMSystem::postprocess(), and libMesh::MeshBase::subdomain_ids().

1929 {
1931  {
1932  // Range construction may not be safe within threads
1934 
1936  std::make_unique<ConstElemRange>(this->active_local_elements_begin(),
1937  this->active_local_elements_end());
1938  }
1939 
1941 }
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!Threadsin_thre...
Definition: threads.C:33
libmesh_assert(ctx)
std::unique_ptr< ConstElemRange > _const_active_local_element_stored_range
A cached ConstElemRange for threaded calculation on all local elements of this mesh.
Definition: mesh_base.h:2183

◆ active_local_subdomain_elements_ptr_range() [1/2]

virtual SimpleRange<element_iterator> libMesh::MeshBase::active_local_subdomain_elements_ptr_range ( subdomain_id_type  sid)
pure virtualinherited

◆ active_local_subdomain_elements_ptr_range() [2/2]

virtual SimpleRange<const_element_iterator> libMesh::MeshBase::active_local_subdomain_elements_ptr_range ( subdomain_id_type  sid) const
pure virtualinherited

◆ active_subdomain_elements_ptr_range() [1/2]

unsigned int level ElemType type std::set<subdomain_id_type> ss processor_id_type pid unsigned int level std::set<subdomain_id_type> virtual ss SimpleRange<element_iterator> libMesh::MeshBase::active_subdomain_elements_ptr_range ( subdomain_id_type  sid)
pure virtualinherited

◆ active_subdomain_elements_ptr_range() [2/2]

virtual SimpleRange<const_element_iterator> libMesh::MeshBase::active_subdomain_elements_ptr_range ( subdomain_id_type  sid) const
pure virtualinherited

◆ active_subdomain_set_elements_ptr_range() [1/2]

virtual SimpleRange<element_iterator> libMesh::MeshBase::active_subdomain_set_elements_ptr_range ( std::set< subdomain_id_type ss)
pure virtualinherited

◆ active_subdomain_set_elements_ptr_range() [2/2]

virtual SimpleRange<const_element_iterator> libMesh::MeshBase::active_subdomain_set_elements_ptr_range ( std::set< subdomain_id_type ss) const
pure virtualinherited

◆ add_disjoint_neighbor_boundary_pairs()

void libMesh::MeshBase::add_disjoint_neighbor_boundary_pairs ( const boundary_id_type  b1,
const boundary_id_type  b2,
const RealVectorValue translation 
)
inherited

Register a pair of boundaries as disjoint neighbor boundary pairs.

Definition at line 2232 of file mesh_base.C.

References libMesh::MeshBase::_disjoint_neighbor_boundary_pairs, libMesh::PeriodicBoundary::clone(), libMesh::PeriodicBoundaryBase::myboundary, and libMesh::PeriodicBoundaryBase::pairedboundary.

Referenced by DisjointNeighborTest::build_four_disjoint_elems(), DisjointNeighborTest::build_split_mesh_with_interface(), DisjointNeighborTest::build_two_disjoint_elems(), stitching_helper(), DisjointNeighborTest::testDisjointNeighborConflictError(), and DisjointNeighborTest::testStitchCrossMesh().

2235  {
2236  // Lazily allocate the container the first time it’s needed
2238  _disjoint_neighbor_boundary_pairs = std::make_unique<PeriodicBoundaries>();
2239 
2240  PeriodicBoundaries & db = *_disjoint_neighbor_boundary_pairs;
2241 
2242  // Create forward and inverse boundary mappings
2243  PeriodicBoundary forward(translation);
2244  PeriodicBoundary inverse(translation * -1.0);
2245 
2246  forward.myboundary = b1;
2247  forward.pairedboundary = b2;
2248  inverse.myboundary = b2;
2249  inverse.pairedboundary = b1;
2250 
2251  // Add both directions into the container
2252  db.emplace(b1, forward.clone());
2253  db.emplace(b2, inverse.clone());
2254  }
std::unique_ptr< PeriodicBoundaries > _disjoint_neighbor_boundary_pairs
The disjoint neighbor boundary id pairs.
Definition: mesh_base.h:2086

◆ add_elem() [1/2]

virtual Elem* libMesh::MeshBase::add_elem ( Elem e)
pure virtualinherited

Add elem e to the end of the element array.

To add an element locally, set e->processor_id() before adding it. To ensure a specific element id, call e->set_id() before adding it; only do this in parallel if you are manually keeping ids consistent.

Users should call MeshBase::complete_preparation() after elements are added to and/or deleted from the mesh.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::GMVIO::_read_one_cell(), libMesh::MeshTools::Subdivision::add_boundary_ghosts(), LinearElasticityWithContact::add_contact_edge_elements(), add_cube_convex_hull_to_mesh(), libMesh::MeshRefinement::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::MeshTools::Modification::all_tri(), AllSecondOrderTest::allCompleteOrderMixed(), AllSecondOrderTest::allCompleteOrderRange(), AllSecondOrderTest::allSecondOrderMixed(), AllSecondOrderTest::allSecondOrderRange(), libMesh::MeshTools::Generation::build_extrusion(), DisjointNeighborTest::build_four_disjoint_elems(), libMesh::InfElemBuilder::build_inf_elem(), DisjointNeighborTest::build_split_mesh_with_interface(), DisjointNeighborTest::build_two_disjoint_elems(), VolumeTest::buildC0Polyhedron(), libMesh::MeshBase::copy_constraint_rows(), copy_nodes_and_elements(), libMesh::TriangleWrapper::copy_tri_to_mesh(), create_submesh(), libMesh::TetGenIO::element_in(), libMesh::UNVIO::elements_in(), libMesh::MeshTools::Modification::flatten(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::TetGenMeshInterface::pointset_convexhull(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::AbaqusIO::read_elements(), libMesh::UCDIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::DynaIO::read_mesh(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::MeshTools::Generation::surface_octahedron(), AllTriTest::test_helper_c0polyhedron(), AllTriTest::testAllTriC0PolygonOctagon(), VolumeTest::testC0Polygon(), SystemsTest::testDofCouplingWithVarGroups(), MeshTriangulationTest::testEdge3Mesh(), MeshTriangulationTest::testEdgesMesh(), MeshTriangulationTest::testHalfDomain(), NodalNeighborsTest::testOrientation(), MeshTriangulationTest::testPoly2TriBad1DMultiBoundary(), MeshTriangulationTest::testPoly2TriBad2DMultiBoundary(), MeshTriangulationTest::testPoly2TriBadEdges(), EquationSystemsTest::testPostInitAddElem(), SystemsTest::testProjectMatrix3D(), InfFERadialTest::testRefinement(), EquationSystemsTest::testReinitWithNodeElem(), SystemsTest::testSetSystemParameterOverEquationSystem(), BoundaryInfoTest::testShellFaceConstraints(), MeshTetTest::testTetsToTets(), MeshSubdomainIDTest::testUnpartitioned(), libMesh::NetGenMeshInterface::triangulate(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::Poly2TriTriangulator::triangulate_current_points(), libMesh::TetGenMeshInterface::triangulate_pointset(), and libMesh::MeshTetInterface::volume_to_surface_mesh().

◆ add_elem() [2/2]

virtual Elem* libMesh::MeshBase::add_elem ( std::unique_ptr< Elem e)
pure virtualinherited

Version of add_elem() taking a std::unique_ptr by value.

The version taking a dumb pointer will eventually be deprecated in favor of this version. This API is intended to indicate that ownership of the Elem is transferred to the Mesh when this function is called, and it should play more nicely with the Elem::build() API which has always returned a std::unique_ptr.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

◆ add_elem_data()

template<typename T >
std::vector< unsigned int > libMesh::MeshBase::add_elem_data ( const std::vector< std::string > &  names,
bool  allocate_data = true,
const std::vector< T > *  default_values = nullptr 
)
inlineinherited

Register data (of type T) to be added to each element in the mesh.

If the mesh already has elements, data is allocated in each.

Newly allocated values for the new datum with name names[i] will be initialized to default_values[i], or to meaningless memcpy output if default_values is null.

Returns
The starting index number for the new data, or for the existing data if one by the same name has already been added.

If type T is larger than dof_id_type, each datum will end up spanning multiple index values, but will be queried with the starting index number.

No type checking is done with this function! If you add data of type T, don't try to access it with a call specifying type U.

Definition at line 2621 of file mesh_base.h.

References libMesh::MeshBase::_elem_integer_names, libMesh::index_range(), libMesh::libmesh_assert(), and libMesh::MeshBase::size_elem_extra_integers().

2624 {
2625  libmesh_assert(!default_values || default_values->size() == names.size());
2626 
2627  std::vector<unsigned int> returnval(names.size());
2628 
2629  const std::size_t old_size = _elem_integer_names.size();
2630 
2631  for (auto i : index_range(names))
2632  returnval[i] =
2633  this->add_elem_datum<T>(names[i], false,
2634  default_values ?
2635  (*default_values)[i] : nullptr);
2636 
2637  if (allocate_data && old_size != _elem_integer_names.size())
2638  this->size_elem_extra_integers();
2639 
2640  return returnval;
2641 }
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2338
libmesh_assert(ctx)
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153
void size_elem_extra_integers()
Size extra-integer arrays of all elements in the mesh.
Definition: mesh_base.C:2321

◆ add_elem_datum()

template<typename T >
unsigned int libMesh::MeshBase::add_elem_datum ( const std::string &  name,
bool  allocate_data = true,
const T *  default_value = nullptr 
)
inlineinherited

Register a datum (of type T) to be added to each element in the mesh.

If the mesh already has elements, data by default is allocated in each of them. This may be expensive to do repeatedly; use add_elem_data instead. Alternatively, the allocate_data option can be manually set to false, but if this is done then a manual call to size_elem_extra_integers() will need to be done before the new space is usable.

Newly allocated values for the new datum will be initialized to *default_value if default_value is not null, or to meaningless memcpy output otherwise.

Returns
The index numbers for the new data, and/or for existing data if data by some of the same names has already been added.

If type T is larger than dof_id_type, its data will end up spanning multiple index values, but will be queried with the starting index number.

No type checking is done with this function! If you add data of type T, don't try to access it with a call specifying type U.

Definition at line 2597 of file mesh_base.h.

References libMesh::MeshBase::_elem_integer_names, libMesh::MeshBase::add_elem_integer(), libMesh::DofObject::invalid_id, and libMesh::MeshBase::size_elem_extra_integers().

Referenced by ExtraIntegersTest::build_mesh().

2600 {
2601  const std::size_t old_size = _elem_integer_names.size();
2602 
2603  unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
2604  std::vector<dof_id_type> int_data(n_more_integers+1, DofObject::invalid_id);
2605  if (default_value)
2606  std::memcpy(int_data.data(), default_value, sizeof(T));
2607 
2608  unsigned int start_idx = this->add_elem_integer(name, false, int_data[0]);
2609  for (unsigned int i=0; i != n_more_integers; ++i)
2610  this->add_elem_integer(name+"__"+std::to_string(i), false, int_data[i+1]);
2611 
2612  if (allocate_data && old_size != _elem_integer_names.size())
2613  this->size_elem_extra_integers();
2614 
2615  return start_idx;
2616 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2338
unsigned int add_elem_integer(std::string name, bool allocate_data=true, dof_id_type default_value=DofObject::invalid_id)
Register an integer datum (of type dof_id_type) to be added to each element in the mesh...
Definition: mesh_base.C:623
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473
void size_elem_extra_integers()
Size extra-integer arrays of all elements in the mesh.
Definition: mesh_base.C:2321
uint8_t dof_id_type
Definition: id_types.h:67

◆ add_elem_integer()

unsigned int libMesh::MeshBase::add_elem_integer ( std::string  name,
bool  allocate_data = true,
dof_id_type  default_value = DofObject::invalid_id 
)
inherited

Register an integer datum (of type dof_id_type) to be added to each element in the mesh.

If the mesh already has elements, data by default is allocated in each of them. This may be expensive to do repeatedly; use add_elem_integers instead. Alternatively, the allocate_data option can be manually set to false, but if this is done then a manual call to size_elem_extra_integers() will need to be done before the new space is usable.

Newly allocated values for the new datum will be initialized to default_value

Returns
The index number for the new datum, or for the existing datum if one by the same name has already been added.

Definition at line 623 of file mesh_base.C.

References libMesh::MeshBase::_elem_integer_default_values, libMesh::MeshBase::_elem_integer_names, libMesh::index_range(), libMesh::Quality::name(), and libMesh::MeshBase::size_elem_extra_integers().

Referenced by libMesh::MeshBase::add_elem_datum(), libMesh::BoundaryInfo::add_elements(), ExtraIntegersTest::build_mesh(), ExtraIntegersTest::checkpoint_helper(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_header(), ExtraIntegersTest::test_helper(), MeshStitchTest::testMeshStitchElemsets(), and WriteElemsetData::testWriteImpl().

626 {
627  for (auto i : index_range(_elem_integer_names))
628  if (_elem_integer_names[i] == name)
629  {
630  libmesh_assert_less(i, _elem_integer_default_values.size());
631  _elem_integer_default_values[i] = default_value;
632  return i;
633  }
634 
635  libmesh_assert_equal_to(_elem_integer_names.size(),
637  _elem_integer_names.push_back(std::move(name));
638  _elem_integer_default_values.push_back(default_value);
639  if (allocate_data)
640  this->size_elem_extra_integers();
641  return _elem_integer_names.size()-1;
642 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2338
std::vector< dof_id_type > _elem_integer_default_values
The array of default initialization values for integer data associated with each element in the mesh...
Definition: mesh_base.h:2344
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153
void size_elem_extra_integers()
Size extra-integer arrays of all elements in the mesh.
Definition: mesh_base.C:2321

◆ add_elem_integers()

std::vector< unsigned int > libMesh::MeshBase::add_elem_integers ( const std::vector< std::string > &  names,
bool  allocate_data = true,
const std::vector< dof_id_type > *  default_values = nullptr 
)
inherited

Register integer data (of type dof_id_type) to be added to each element in the mesh, one string name for each new integer.

If the mesh already has elements, data by default is allocated in each of them.

Newly allocated values for the new datum with name names[i] will be initialized to default_values[i], or to DofObject::invalid_id if default_values is null.

Returns
The index numbers for the new data, and/or for existing data if data by some of the same names has already been added.

Definition at line 646 of file mesh_base.C.

References libMesh::MeshBase::_elem_integer_default_values, libMesh::MeshBase::_elem_integer_names, libMesh::index_range(), libMesh::DofObject::invalid_id, libMesh::libmesh_assert(), libMesh::Quality::name(), and libMesh::MeshBase::size_elem_extra_integers().

Referenced by libMesh::MeshBase::merge_extra_integer_names(), and libMesh::XdrIO::read_header().

649 {
650  libmesh_assert(!default_values || default_values->size() == names.size());
651  libmesh_assert_equal_to(_elem_integer_names.size(), _elem_integer_default_values.size());
652 
653  std::unordered_map<std::string, std::size_t> name_indices;
654  for (auto i : index_range(_elem_integer_names))
655  name_indices[_elem_integer_names[i]] = i;
656 
657  std::vector<unsigned int> returnval(names.size());
658 
659  bool added_an_integer = false;
660  for (auto i : index_range(names))
661  {
662  const std::string & name = names[i];
663  if (const auto it = name_indices.find(name);
664  it != name_indices.end())
665  {
666  returnval[i] = it->second;
667  _elem_integer_default_values[it->second] =
668  default_values ? (*default_values)[i] : DofObject::invalid_id;
669  }
670  else
671  {
672  returnval[i] = _elem_integer_names.size();
673  name_indices[name] = returnval[i];
674  _elem_integer_names.push_back(name);
676  (default_values ? (*default_values)[i] : DofObject::invalid_id);
677  added_an_integer = true;
678  }
679  }
680 
681  if (allocate_data && added_an_integer)
682  this->size_elem_extra_integers();
683 
684  return returnval;
685 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2338
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473
libmesh_assert(ctx)
std::vector< dof_id_type > _elem_integer_default_values
The array of default initialization values for integer data associated with each element in the mesh...
Definition: mesh_base.h:2344
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153
void size_elem_extra_integers()
Size extra-integer arrays of all elements in the mesh.
Definition: mesh_base.C:2321

◆ add_elemset_code()

void libMesh::MeshBase::add_elemset_code ( dof_id_type  code,
MeshBase::elemset_type  id_set 
)
inherited

Tabulate a user-defined "code" for elements which belong to the element sets specified in id_set.

For example, suppose that we have two elemsets A and B with the following Elem ids: Elemset A = {1, 3} Elemset B = {2, 3}

This implies the following mapping from elem id to elemset id: Elem 1 -> {A} Elem 2 -> {B} Elem 3 -> {A,B}

In this case, we would need to tabulate three different elemset codes, e.g.: 0 -> {A} 1 -> {B} 2 -> {A,B}

Also sets up the inverse mapping, so that if one knows all the element sets an Elem belongs to, one can look up the corresponding elemset code.

Definition at line 456 of file mesh_base.C.

References libMesh::MeshBase::_all_elemset_ids, libMesh::MeshBase::_elemset_codes, and libMesh::MeshBase::_elemset_codes_inverse_map.

Referenced by libMesh::MeshBase::change_elemset_code(), libMesh::ExodusII_IO::read(), libMesh::XdrIO::read_header(), stitching_helper(), MeshStitchTest::testMeshStitchElemsets(), and WriteElemsetData::testWriteImpl().

457 {
458  // Populate inverse map, stealing id_set's resources
459  auto [it1, inserted1] = _elemset_codes_inverse_map.emplace(std::move(id_set), code);
460 
461  // Reference to the newly inserted (or previously existing) id_set
462  const auto & inserted_id_set = it1->first;
463 
464  // Keep track of all elemset ids ever added for O(1) n_elemsets()
465  // performance. Only need to do this if we didn't know about this
466  // id_set before...
467  if (inserted1)
468  _all_elemset_ids.insert(inserted_id_set.begin(), inserted_id_set.end());
469 
470  // Take the address of the newly emplaced set to use in
471  // _elemset_codes, avoid duplicating std::set storage
472  auto [it2, inserted2] = _elemset_codes.emplace(code, &inserted_id_set);
473 
474  // Throw an error if this code already exists with a pointer to a
475  // different set of ids.
476  libmesh_error_msg_if(!inserted2 && it2->second != &inserted_id_set,
477  "The elemset code " << code << " already exists with a different id_set.");
478 }
std::map< dof_id_type, const MeshBase::elemset_type * > _elemset_codes
Map from "element set code" to list of set ids to which that element belongs (and vice-versa)...
Definition: mesh_base.h:2324
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2325
MeshBase::elemset_type _all_elemset_ids
Definition: mesh_base.h:2326

◆ add_ghosting_functor() [1/2]

void libMesh::MeshBase::add_ghosting_functor ( GhostingFunctor ghosting_functor)
inherited

Adds a functor which can specify ghosting requirements for use on distributed meshes.

Multiple ghosting functors can be added; any element which is required by any functor will be ghosted.

GhostingFunctor memory must be managed by the code which calls this function; the GhostingFunctor lifetime is expected to extend until either the functor is removed or the Mesh is destructed.

Definition at line 1071 of file mesh_base.C.

References libMesh::MeshBase::_ghosting_functors, and libMesh::libmesh_assert().

Referenced by libMesh::DofMap::add_algebraic_ghosting_functor(), libMesh::DofMap::add_coupling_functor(), libMesh::MeshBase::add_ghosting_functor(), main(), libMesh::MeshBase::MeshBase(), and EquationSystemsTest::testDisableDefaultGhosting().

1072 {
1073  // We used to implicitly support duplicate inserts to std::set
1074 #ifdef LIBMESH_ENABLE_DEPRECATED
1075  _ghosting_functors.erase
1076  (std::remove(_ghosting_functors.begin(),
1077  _ghosting_functors.end(),
1078  &ghosting_functor),
1079  _ghosting_functors.end());
1080 #endif
1081 
1082  // We shouldn't have two copies of the same functor
1083  libmesh_assert(std::find(_ghosting_functors.begin(),
1084  _ghosting_functors.end(),
1085  &ghosting_functor) ==
1086  _ghosting_functors.end());
1087 
1088  _ghosting_functors.push_back(&ghosting_functor);
1089 }
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2391
libmesh_assert(ctx)

◆ add_ghosting_functor() [2/2]

void libMesh::MeshBase::add_ghosting_functor ( std::shared_ptr< GhostingFunctor ghosting_functor)
inlineinherited

Adds a functor which can specify ghosting requirements for use on distributed meshes.

Multiple ghosting functors can be added; any element which is required by any functor will be ghosted.

GhostingFunctor memory when using this method is managed by the shared_ptr mechanism.

Definition at line 1442 of file mesh_base.h.

References libMesh::MeshBase::_shared_functors, and libMesh::MeshBase::add_ghosting_functor().

1443  { _shared_functors[ghosting_functor.get()] = ghosting_functor;
1444  this->add_ghosting_functor(*ghosting_functor); }
std::map< GhostingFunctor *, std::shared_ptr< GhostingFunctor > > _shared_functors
Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form...
Definition: mesh_base.h:2397
void add_ghosting_functor(GhostingFunctor &ghosting_functor)
Adds a functor which can specify ghosting requirements for use on distributed meshes.
Definition: mesh_base.C:1071

◆ add_node() [1/2]

virtual Node* libMesh::MeshBase::add_node ( Node n)
pure virtualinherited

◆ add_node() [2/2]

virtual Node* libMesh::MeshBase::add_node ( std::unique_ptr< Node n)
pure virtualinherited

Version of add_node() taking a std::unique_ptr by value.

The version taking a dumb pointer will eventually be deprecated in favor of this version. This API is intended to indicate that ownership of the Node is transferred to the Mesh when this function is called, and it should play more nicely with the Node::build() API which has always returned a std::unique_ptr.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

◆ add_node_data()

template<typename T >
std::vector< unsigned int > libMesh::MeshBase::add_node_data ( const std::vector< std::string > &  name,
bool  allocate_data = true,
const std::vector< T > *  default_values = nullptr 
)
inlineinherited

Register data (of type T) to be added to each node in the mesh.

If the mesh already has nodes, data by default is allocated in each.

Newly allocated values for the new datum with name names[i] will be initialized to default_values[i], or to meaningless memcpy output if default_values is null.

Returns
The starting index number for the new data, or for the existing data if one by the same name has already been added.

If type T is larger than dof_id_type, its data will end up spanning multiple index values, but will be queried with the starting index number.

No type checking is done with this function! If you add data of type T, don't try to access it with a call specifying type U.

Definition at line 2670 of file mesh_base.h.

References libMesh::MeshBase::_node_integer_names, libMesh::index_range(), libMesh::libmesh_assert(), and libMesh::MeshBase::size_node_extra_integers().

2673 {
2674  libmesh_assert(!default_values || default_values->size() == names.size());
2675 
2676  std::vector<unsigned int> returnval(names.size());
2677 
2678  const std::size_t old_size = _node_integer_names.size();
2679 
2680  for (auto i : index_range(names))
2681  returnval[i] =
2682  this->add_node_datum<T>(names[i], false,
2683  default_values ?
2684  (*default_values)[i] : nullptr);
2685 
2686  if (allocate_data && old_size != _node_integer_names.size())
2687  this->size_node_extra_integers();
2688 
2689  return returnval;
2690 }
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350
libmesh_assert(ctx)
void size_node_extra_integers()
Size extra-integer arrays of all nodes in the mesh.
Definition: mesh_base.C:2336
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153

◆ add_node_datum()

template<typename T >
unsigned int libMesh::MeshBase::add_node_datum ( const std::string &  name,
bool  allocate_data = true,
const T *  default_value = nullptr 
)
inlineinherited

Register a datum (of type T) to be added to each node in the mesh.

If the mesh already has nodes, data by default is allocated in each of them. This may be expensive to do repeatedly; use add_node_data instead. Alternatively, the allocate_data option can be manually set to false, but if this is done then a manual call to size_node_extra_integers() will need to be done before the new space is usable.

Newly allocated values for the new datum will be initialized to *default_value if default_value is not null, or to meaningless memcpy output otherwise.

Returns
The starting index number for the new datum, or for the existing datum if one by the same name has already been added.

If type T is larger than dof_id_type, its data will end up spanning multiple index values, but will be queried with the starting index number.

No type checking is done with this function! If you add data of type T, don't try to access it with a call specifying type U.

Definition at line 2646 of file mesh_base.h.

References libMesh::MeshBase::_node_integer_names, libMesh::MeshBase::add_node_integer(), libMesh::DofObject::invalid_id, and libMesh::MeshBase::size_node_extra_integers().

Referenced by libMesh::MeshTools::Modification::all_rbb(), ExtraIntegersTest::build_mesh(), libMesh::ExodusII_IO::read(), and libMesh::DynaIO::read_mesh().

2649 {
2650  const std::size_t old_size = _node_integer_names.size();
2651 
2652  unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
2653  std::vector<dof_id_type> int_data(n_more_integers+1, DofObject::invalid_id);
2654  if (default_value)
2655  std::memcpy(int_data.data(), default_value, sizeof(T));
2656 
2657  unsigned int start_idx = this->add_node_integer(name, false, int_data[0]);
2658  for (unsigned int i=0; i != n_more_integers; ++i)
2659  this->add_node_integer(name+"__"+std::to_string(i), false, int_data[i+1]);
2660 
2661  if (allocate_data && old_size != _node_integer_names.size())
2662  this->size_node_extra_integers();
2663 
2664  return start_idx;
2665 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473
void size_node_extra_integers()
Size extra-integer arrays of all nodes in the mesh.
Definition: mesh_base.C:2336
unsigned int add_node_integer(std::string name, bool allocate_data=true, dof_id_type default_value=DofObject::invalid_id)
Register an integer datum (of type dof_id_type) to be added to each node in the mesh.
Definition: mesh_base.C:712
uint8_t dof_id_type
Definition: id_types.h:67

◆ add_node_integer()

unsigned int libMesh::MeshBase::add_node_integer ( std::string  name,
bool  allocate_data = true,
dof_id_type  default_value = DofObject::invalid_id 
)
inherited

Register an integer datum (of type dof_id_type) to be added to each node in the mesh.

If the mesh already has nodes, data by default is allocated in each of them. This may be expensive to do repeatedly; use add_node_integers instead. Alternatively, the allocate_data option can be manually set to false, but if this is done then a manual call to size_node_extra_integers() will need to be done before the new space is usable.

Newly allocated values for the new datum will be initialized to default_value

Returns
The index number for the new datum, or for the existing datum if one by the same name has already been added.

Definition at line 712 of file mesh_base.C.

References libMesh::MeshBase::_node_integer_default_values, libMesh::MeshBase::_node_integer_names, libMesh::index_range(), libMesh::Quality::name(), and libMesh::MeshBase::size_node_extra_integers().

Referenced by libMesh::MeshBase::add_node_datum(), ExtraIntegersTest::build_mesh(), ExtraIntegersTest::checkpoint_helper(), libMesh::CheckpointIO::read_header(), and ExtraIntegersTest::test_helper().

715 {
716  for (auto i : index_range(_node_integer_names))
717  if (_node_integer_names[i] == name)
718  {
719  libmesh_assert_less(i, _node_integer_default_values.size());
720  _node_integer_default_values[i] = default_value;
721  return i;
722  }
723 
724  libmesh_assert_equal_to(_node_integer_names.size(),
726  _node_integer_names.push_back(std::move(name));
727  _node_integer_default_values.push_back(default_value);
728  if (allocate_data)
729  this->size_node_extra_integers();
730  return _node_integer_names.size()-1;
731 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350
void size_node_extra_integers()
Size extra-integer arrays of all nodes in the mesh.
Definition: mesh_base.C:2336
std::vector< dof_id_type > _node_integer_default_values
The array of default initialization values for integer data associated with each node in the mesh...
Definition: mesh_base.h:2356
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153

◆ add_node_integers()

std::vector< unsigned int > libMesh::MeshBase::add_node_integers ( const std::vector< std::string > &  names,
bool  allocate_data = true,
const std::vector< dof_id_type > *  default_values = nullptr 
)
inherited

Register integer data (of type dof_id_type) to be added to each node in the mesh.

If the mesh already has nodes, data by default is allocated in each.

Newly allocated values for the new datum with name names[i] will be initialized to default_values[i], or to DofObject::invalid_id if default_values is null.

Returns
The index numbers for the new data, and/or for existing data if data by some of the same names has already been added.

Definition at line 735 of file mesh_base.C.

References libMesh::MeshBase::_node_integer_default_values, libMesh::MeshBase::_node_integer_names, libMesh::index_range(), libMesh::DofObject::invalid_id, libMesh::libmesh_assert(), libMesh::Quality::name(), and libMesh::MeshBase::size_node_extra_integers().

Referenced by libMesh::MeshBase::merge_extra_integer_names(), and libMesh::XdrIO::read_header().

738 {
739  libmesh_assert(!default_values || default_values->size() == names.size());
740  libmesh_assert_equal_to(_node_integer_names.size(), _node_integer_default_values.size());
741 
742  std::unordered_map<std::string, std::size_t> name_indices;
743  for (auto i : index_range(_node_integer_names))
744  name_indices[_node_integer_names[i]] = i;
745 
746  std::vector<unsigned int> returnval(names.size());
747 
748  bool added_an_integer = false;
749  for (auto i : index_range(names))
750  {
751  const std::string & name = names[i];
752  if (const auto it = name_indices.find(name);
753  it != name_indices.end())
754  {
755  returnval[i] = it->second;
756  _node_integer_default_values[it->second] =
757  default_values ? (*default_values)[i] : DofObject::invalid_id;
758  }
759  else
760  {
761  returnval[i] = _node_integer_names.size();
762  name_indices[name] = returnval[i];
763  _node_integer_names.push_back(name);
765  (default_values ? (*default_values)[i] : DofObject::invalid_id);
766  added_an_integer = true;
767  }
768  }
769 
770  if (allocate_data && added_an_integer)
771  this->size_node_extra_integers();
772 
773  return returnval;
774 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473
libmesh_assert(ctx)
void size_node_extra_integers()
Size extra-integer arrays of all nodes in the mesh.
Definition: mesh_base.C:2336
std::vector< dof_id_type > _node_integer_default_values
The array of default initialization values for integer data associated with each node in the mesh...
Definition: mesh_base.h:2356
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153

◆ add_point()

virtual Node* libMesh::MeshBase::add_point ( const Point p,
const dof_id_type  id = DofObject::invalid_id,
const processor_id_type  proc_id = DofObject::invalid_processor_id 
)
pure virtualinherited

Add a new Node at Point p to the end of the vertex array, with processor_id procid.

Use DofObject::invalid_processor_id (default) to add a node to all processors, or this->processor_id() to add a node to the local processor only. If adding a node locally, passing an id other than DofObject::invalid_id will set that specific node id. Only do this in parallel if you are manually keeping ids consistent.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::MeshTools::Subdivision::add_boundary_ghosts(), add_cube_convex_hull_to_mesh(), libMesh::MeshRefinement::add_node(), libMesh::MeshTools::Modification::all_tri(), AllSecondOrderTest::allCompleteOrderMixed(), AllSecondOrderTest::allCompleteOrderRange(), AllSecondOrderTest::allSecondOrderMixed(), AllSecondOrderTest::allSecondOrderRange(), libMesh::MeshTools::Generation::build_delaunay_square(), DisjointNeighborTest::build_four_disjoint_elems(), libMesh::InfElemBuilder::build_inf_elem(), DisjointNeighborTest::build_split_mesh_with_interface(), DisjointNeighborTest::build_two_disjoint_elems(), libMesh::MeshBase::copy_constraint_rows(), copy_nodes_and_elements(), libMesh::TriangleWrapper::copy_tri_to_mesh(), create_submesh(), libMesh::TriangulatorInterface::insert_any_extra_boundary_points(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::TetGenIO::node_in(), libMesh::UNVIO::nodes_in(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::STLIO::read_ascii(), libMesh::STLIO::read_binary(), libMesh::UCDIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::DynaIO::read_mesh(), libMesh::AbaqusIO::read_nodes(), libMesh::CheckpointIO::read_nodes(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::MeshTools::Generation::surface_octahedron(), libMesh::BoundaryInfo::sync(), AllTriTest::test_helper_c0polyhedron(), AllTriTest::testAllTriC0PolygonOctagon(), VolumeTest::testC0Polygon(), VolumeTest::testC0PolyhedronCube(), VolumeTest::testC0PolyhedronHexagonalPrism(), SystemsTest::testDofCouplingWithVarGroups(), MeshTriangulationTest::testEdge3Mesh(), MeshTriangulationTest::testEdgesMesh(), MeshTriangulationTest::testHalfDomain(), NodalNeighborsTest::testOrientation(), MeshTriangulationTest::testPoly2TriBad1DMultiBoundary(), MeshTriangulationTest::testPoly2TriBad2DMultiBoundary(), MeshTriangulationTest::testPoly2TriBadEdges(), SystemsTest::testProjectMatrix3D(), InfFERadialTest::testRefinement(), SystemsTest::testSetSystemParameterOverEquationSystem(), BoundaryInfoTest::testShellFaceConstraints(), MeshTetTest::testTetsToTets(), MeshTriangulationTest::testTriangulator(), MeshTriangulationTest::testTriangulatorHoles(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), MeshTriangulationTest::testTriangulatorSegments(), MeshTriangulationTest::testTriangulatorTrapMesh(), MeshSubdomainIDTest::testUnpartitioned(), libMesh::NetGenMeshInterface::triangulate(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::Poly2TriTriangulator::triangulate_current_points(), and triangulate_domain().

◆ all_complete_order()

void libMesh::MeshBase::all_complete_order ( )
virtualinherited

Calls the range-based version of this function with a range consisting of all elements in the mesh.

Definition at line 1801 of file mesh_base.C.

References libMesh::MeshBase::all_complete_order_range().

Referenced by AllSecondOrderTest::allCompleteOrder(), libMesh::TriangulatorInterface::increase_triangle_order(), and main().

1802 {
1803  this->all_complete_order_range(this->element_ptr_range());
1804 }
virtual void all_complete_order_range(const SimpleRange< element_iterator > &range)=0
Converts a set of elements in this (conforming, non-refined) mesh into "complete" order elements...

◆ all_complete_order_range()

void libMesh::UnstructuredMesh::all_complete_order_range ( const SimpleRange< element_iterator > &  range)
overridevirtual

Converts a (conforming, non-refined) mesh with linear elements into a mesh with "complete" order elements, i.e.

elements which can store degrees of freedom on any vertex, edge, or face. For example, a mesh consisting of Tet4 or Tet10 will be converted to a mesh with Tet14 etc.

Implements libMesh::MeshBase.

Definition at line 1800 of file unstructured_mesh.C.

References libMesh::Elem::complete_order_equivalent_type(), libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_nodes(), and libMesh::MeshBase::reserve_nodes().

1801 {
1802  LOG_SCOPE("all_complete_order()", "Mesh");
1803 
1804  /*
1805  * The maximum number of new higher-order nodes we might be adding,
1806  * for use when picking unique unique_id values later. This variable
1807  * is not used unless unique ids are enabled.
1808  */
1809  unsigned int max_new_nodes_per_elem;
1810 
1811  /*
1812  * for speed-up of the \p add_point() method, we
1813  * can reserve memory. Guess the number of additional
1814  * nodes based on the element spatial dimensions and the
1815  * total number of nodes in the mesh as an upper bound.
1816  */
1817  switch (this->mesh_dimension())
1818  {
1819  case 1:
1820  /*
1821  * in 1D, there can only be order-increase from Edge2
1822  * to Edge3. Something like 1/2 of n_nodes() have
1823  * to be added
1824  */
1825  max_new_nodes_per_elem = 3 - 2;
1826  this->reserve_nodes(static_cast<unsigned int>
1827  (1.5*static_cast<double>(this->n_nodes())));
1828  break;
1829 
1830  case 2:
1831  /*
1832  * in 2D, we typically refine from Tri6 to Tri7 (1.1667 times
1833  * the nodes) but might refine from Quad4 to Quad9
1834  * (2.25 times the nodes)
1835  */
1836  max_new_nodes_per_elem = 9 - 4;
1837  this->reserve_nodes(static_cast<unsigned int>
1838  (2*static_cast<double>(this->n_nodes())));
1839  break;
1840 
1841 
1842  case 3:
1843  /*
1844  * in 3D, we typically refine from Tet10 to Tet14 (factor = 1.4)
1845  * but may go Hex8 to Hex27 (something > 3). Since in 3D there
1846  * _are_ already quite some nodes, and since we do not want to
1847  * overburden the memory by a too conservative guess, use a
1848  * moderate bound
1849  */
1850  max_new_nodes_per_elem = 27 - 8;
1851  this->reserve_nodes(static_cast<unsigned int>
1852  (2.5*static_cast<double>(this->n_nodes())));
1853  break;
1854 
1855  default:
1856  // Hm?
1857  libmesh_error_msg("Unknown mesh dimension " << this->mesh_dimension());
1858  }
1859 
1860  // All the real work is done in the helper function
1861  all_increased_order_range(*this, range, max_new_nodes_per_elem,
1862  [](ElemType t) {
1864  });
1865 }
ElemType
Defines an enum for geometric element types.
virtual void reserve_nodes(const dof_id_type nn)=0
Reserves space for a known number of nodes.
static ElemType complete_order_equivalent_type(const ElemType et)
Definition: elem.C:3352
unsigned int mesh_dimension() const
Definition: mesh_base.C:430
virtual dof_id_type n_nodes() const =0

◆ all_first_order()

void libMesh::UnstructuredMesh::all_first_order ( )
overridevirtual

Converts a mesh with higher-order elements into a mesh with linear elements.

For example, a mesh consisting of Tet10 will be converted to a mesh with Tet4 etc.

Prepare to identify (and then delete) a bunch of no-longer-used nodes.

If the second order element had any boundary conditions they should be transferred to the first-order element. The old boundary conditions will be removed from the BoundaryInfo data structure by insert_elem.

Implements libMesh::MeshBase.

Definition at line 1598 of file unstructured_mesh.C.

References libMesh::Elem::add_child(), libMesh::DofObject::add_extra_integers(), libMesh::Elem::build(), libMesh::Elem::child_ptr(), libMesh::BoundaryInfo::copy_boundary_ids(), libMesh::MeshBase::delete_node(), libMesh::Elem::first_order_equivalent_type(), libMesh::MeshBase::get_boundary_info(), libMesh::Elem::inherit_data_from(), libMesh::MeshBase::insert_elem(), libMesh::libmesh_assert(), libMesh::MeshBase::max_node_id(), libMesh::Elem::n_vertices(), libMesh::Elem::node_id(), libMesh::Elem::parent(), libMesh::MeshBase::prepare_for_use(), libMesh::BoundaryInfo::regenerate_id_sets(), libMesh::remote_elem, libMesh::Elem::replace_child(), libMesh::DofObject::set_extra_integer(), libMesh::DofObject::set_id(), libMesh::Elem::set_neighbor(), libMesh::Elem::set_node(), libMesh::Partitioner::set_node_processor_ids(), libMesh::Elem::set_p_level(), libMesh::Elem::set_p_refinement_flag(), libMesh::Elem::set_parent(), libMesh::Elem::set_refinement_flag(), and libMesh::DofObject::set_unique_id().

1599 {
1600  LOG_SCOPE("all_first_order()", "Mesh");
1601 
1605  std::vector<bool> node_touched_by_me(this->max_node_id(), false);
1606 
1607  // Loop over the high-ordered elements.
1608  // First make sure they _are_ indeed high-order, and then replace
1609  // them with an equivalent first-order element.
1610  for (auto & so_elem : element_ptr_range())
1611  {
1612  libmesh_assert(so_elem);
1613 
1614  /*
1615  * build the first-order equivalent, add to
1616  * the new_elements list.
1617  */
1618  auto lo_elem = Elem::build
1620  (so_elem->type()), so_elem->parent());
1621 
1622  const unsigned short n_sides = so_elem->n_sides();
1623 
1624  for (unsigned short s=0; s != n_sides; ++s)
1625  if (so_elem->neighbor_ptr(s) == remote_elem)
1626  lo_elem->set_neighbor(s, const_cast<RemoteElem *>(remote_elem));
1627 
1628 #ifdef LIBMESH_ENABLE_AMR
1629  /*
1630  * Reset the parent links of any child elements
1631  */
1632  if (so_elem->has_children())
1633  for (unsigned int c = 0, nc = so_elem->n_children(); c != nc; ++c)
1634  {
1635  Elem * child = so_elem->child_ptr(c);
1636  if (child != remote_elem)
1637  child->set_parent(lo_elem.get());
1638  lo_elem->add_child(child, c);
1639  }
1640 
1641  /*
1642  * Reset the child link of any parent element
1643  */
1644  if (so_elem->parent())
1645  {
1646  unsigned int c =
1647  so_elem->parent()->which_child_am_i(so_elem);
1648  lo_elem->parent()->replace_child(lo_elem.get(), c);
1649  }
1650 
1651  /*
1652  * Copy as much data to the new element as makes sense
1653  */
1654  lo_elem->set_p_level(so_elem->p_level());
1655  lo_elem->set_refinement_flag(so_elem->refinement_flag());
1656  lo_elem->set_p_refinement_flag(so_elem->p_refinement_flag());
1657 #endif
1658 
1659  libmesh_assert_equal_to (lo_elem->n_vertices(), so_elem->n_vertices());
1660 
1661  /*
1662  * By definition the vertices of the linear and
1663  * second order element are identically numbered.
1664  * transfer these.
1665  */
1666  for (unsigned int v=0, snv=so_elem->n_vertices(); v < snv; v++)
1667  {
1668  lo_elem->set_node(v, so_elem->node_ptr(v));
1669  node_touched_by_me[lo_elem->node_id(v)] = true;
1670  }
1671 
1672  /*
1673  * find_neighbors relies on remote_elem neighbor links being
1674  * properly maintained.
1675  */
1676  for (unsigned short s=0; s != n_sides; s++)
1677  {
1678  if (so_elem->neighbor_ptr(s) == remote_elem)
1679  lo_elem->set_neighbor(s, const_cast<RemoteElem*>(remote_elem));
1680  }
1681 
1689  (this->get_boundary_info(), so_elem, lo_elem.get());
1690 
1691  /*
1692  * The new first-order element is ready.
1693  * Inserting it into the mesh will replace and delete
1694  * the second-order element.
1695  */
1696  lo_elem->set_id(so_elem->id());
1697 #ifdef LIBMESH_ENABLE_UNIQUE_ID
1698  lo_elem->set_unique_id(so_elem->unique_id());
1699 #endif
1700 
1701  const unsigned int nei = so_elem->n_extra_integers();
1702  lo_elem->add_extra_integers(nei);
1703  for (unsigned int i=0; i != nei; ++i)
1704  lo_elem->set_extra_integer(i, so_elem->get_extra_integer(i));
1705 
1706  lo_elem->inherit_data_from(*so_elem);
1707 
1708  this->insert_elem(std::move(lo_elem));
1709  }
1710 
1711  // Deleting nodes does not invalidate iterators, so this is safe.
1712  for (const auto & node : this->node_ptr_range())
1713  if (!node_touched_by_me[node->id()])
1714  this->delete_node(node);
1715 
1716  // If crazy people applied boundary info to non-vertices and then
1717  // deleted those non-vertices, we should make sure their boundary id
1718  // caches are correct.
1720 
1721  // On hanging nodes that used to also be second order nodes, we
1722  // might now have an invalid nodal processor_id()
1724 
1725  // delete or renumber nodes if desired
1726  this->prepare_for_use();
1727 }
void set_parent(Elem *p)
Sets the pointer to the element&#39;s parent.
Definition: elem.h:3060
static void set_node_processor_ids(MeshBase &mesh)
This function is called after partitioning to set the processor IDs for the nodes.
Definition: partitioner.C:852
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:170
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
Definition: elem.C:442
libmesh_assert(ctx)
virtual void delete_node(Node *n)=0
Removes the Node n from the mesh.
void regenerate_id_sets()
Clears and regenerates the cached sets of ids.
void prepare_for_use()
Definition: mesh_base.C:860
virtual Elem * insert_elem(Elem *e)=0
Insert elem e to the element array, preserving its id and replacing/deleting any existing element wit...
void copy_boundary_ids(const BoundaryInfo &old_boundary_info, const Elem *const old_elem, const Elem *const new_elem)
virtual dof_id_type max_node_id() const =0
static ElemType first_order_equivalent_type(const ElemType et)
Definition: elem.C:3099
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:3177
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ all_second_order()

void libMesh::MeshBase::all_second_order ( const bool  full_ordered = true)
inherited

Calls the range-based version of this function with a range consisting of all elements in the mesh.

Definition at line 1796 of file mesh_base.C.

References libMesh::MeshBase::all_second_order_range().

Referenced by AllSecondOrderTest::allSecondOrder(), build_domain(), libMesh::TriangulatorInterface::increase_triangle_order(), main(), ExtraIntegersTest::test_helper(), and InfFERadialTest::testRefinement().

1797 {
1798  this->all_second_order_range(this->element_ptr_range(), full_ordered);
1799 }
virtual void all_second_order_range(const SimpleRange< element_iterator > &range, const bool full_ordered=true)=0
Converts a set of this Mesh&#39;s elements defined by range from FIRST order to SECOND order...

◆ all_second_order_range()

void libMesh::UnstructuredMesh::all_second_order_range ( const SimpleRange< element_iterator > &  range,
const bool  full_ordered = true 
)
overridevirtual

Converts a (conforming, non-refined) mesh with linear elements into a mesh with second-order elements.

For example, a mesh consisting of Tet4 will be converted to a mesh with Tet10 etc.

Note
For some elements like Hex8 there exist two higher order equivalents, Hex20 and Hex27. When full_ordered is true (default), then Hex27 is built. Otherwise, Hex20 is built. The same holds obviously for Quad4, Prism6, etc.

Implements libMesh::MeshBase.

Definition at line 1732 of file unstructured_mesh.C.

References libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::reserve_nodes(), and libMesh::Elem::second_order_equivalent_type().

1734 {
1735  LOG_SCOPE("all_second_order_range()", "Mesh");
1736 
1737  /*
1738  * The maximum number of new second order nodes we might be adding,
1739  * for use when picking unique unique_id values later. This variable
1740  * is not used unless unique ids are enabled.
1741  */
1742  unsigned int max_new_nodes_per_elem;
1743 
1744  /*
1745  * For speed-up of the \p add_point() method, we
1746  * can reserve memory. Guess the number of additional
1747  * nodes based on the element spatial dimensions and the
1748  * total number of nodes in the mesh as an upper bound.
1749  */
1750  switch (this->mesh_dimension())
1751  {
1752  case 1:
1753  /*
1754  * in 1D, there can only be order-increase from Edge2
1755  * to Edge3. Something like 1/2 of n_nodes() have
1756  * to be added
1757  */
1758  max_new_nodes_per_elem = 3 - 2;
1759  this->reserve_nodes(static_cast<unsigned int>
1760  (1.5*static_cast<double>(this->n_nodes())));
1761  break;
1762 
1763  case 2:
1764  /*
1765  * in 2D, either refine from Tri3 to Tri6 (double the nodes)
1766  * or from Quad4 to Quad8 (again, double) or Quad9 (2.25 that much)
1767  */
1768  max_new_nodes_per_elem = 9 - 4;
1769  this->reserve_nodes(static_cast<unsigned int>
1770  (2*static_cast<double>(this->n_nodes())));
1771  break;
1772 
1773 
1774  case 3:
1775  /*
1776  * in 3D, either refine from Tet4 to Tet10 (factor = 2.5) up to
1777  * Hex8 to Hex27 (something > 3). Since in 3D there _are_ already
1778  * quite some nodes, and since we do not want to overburden the memory by
1779  * a too conservative guess, use the lower bound
1780  */
1781  max_new_nodes_per_elem = 27 - 8;
1782  this->reserve_nodes(static_cast<unsigned int>
1783  (2.5*static_cast<double>(this->n_nodes())));
1784  break;
1785 
1786  default:
1787  // Hm?
1788  libmesh_error_msg("Unknown mesh dimension " << this->mesh_dimension());
1789  }
1790 
1791  // All the real work is done in the helper function
1792  all_increased_order_range(*this, range, max_new_nodes_per_elem,
1793  [full_ordered](ElemType t) {
1794  return Elem::second_order_equivalent_type(t, full_ordered);
1795  });
1796 }
ElemType
Defines an enum for geometric element types.
virtual void reserve_nodes(const dof_id_type nn)=0
Reserves space for a known number of nodes.
static ElemType second_order_equivalent_type(const ElemType et, const bool full_ordered=true)
Definition: elem.C:3168
unsigned int mesh_dimension() const
Definition: mesh_base.C:430
virtual dof_id_type n_nodes() const =0

◆ allgather()

virtual void libMesh::MeshBase::allgather ( )
inlinevirtualinherited

Gathers all elements and nodes of the mesh onto every processor.

Reimplemented in libMesh::DistributedMesh.

Definition at line 376 of file mesh_base.h.

Referenced by libMesh::EquationSystems::allgather(), libMesh::MeshSerializer::MeshSerializer(), and PartitionerTest< PartitionerSubclass, MeshClass >::testPartition().

376 {}

◆ allow_detect_interior_parents() [1/2]

void libMesh::MeshBase::allow_detect_interior_parents ( bool  allow)
inlineinherited

If false is passed then this mesh will no longer work to detect interior parents when being prepared for use.

Definition at line 1359 of file mesh_base.h.

References libMesh::MeshBase::_skip_detect_interior_parents.

Referenced by copy_nodes_and_elements(), libMesh::DistributedMesh::DistributedMesh(), and libMesh::ReplicatedMesh::ReplicatedMesh().

1359 { _skip_detect_interior_parents = !allow; }
bool _skip_detect_interior_parents
If this is true then we will skip detect_interior_parents in prepare_for_use.
Definition: mesh_base.h:2247

◆ allow_detect_interior_parents() [2/2]

bool libMesh::MeshBase::allow_detect_interior_parents ( ) const
inlineinherited

Definition at line 1360 of file mesh_base.h.

References libMesh::MeshBase::_skip_detect_interior_parents.

Referenced by copy_nodes_and_elements(), libMesh::DistributedMesh::DistributedMesh(), read(), and libMesh::ReplicatedMesh::ReplicatedMesh().

1360 { return !_skip_detect_interior_parents; }
bool _skip_detect_interior_parents
If this is true then we will skip detect_interior_parents in prepare_for_use.
Definition: mesh_base.h:2247

◆ allow_find_neighbors() [1/2]

void libMesh::MeshBase::allow_find_neighbors ( bool  allow)
inlineinherited

If false is passed then this mesh will no longer work to find element neighbors when being prepared for use.

Definition at line 1352 of file mesh_base.h.

References libMesh::MeshBase::_skip_find_neighbors.

Referenced by libMesh::DistributedMesh::DistributedMesh(), and libMesh::ReplicatedMesh::ReplicatedMesh().

1352 { _skip_find_neighbors = !allow; }
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
Definition: mesh_base.h:2242

◆ allow_find_neighbors() [2/2]

bool libMesh::MeshBase::allow_find_neighbors ( ) const
inlineinherited

Definition at line 1353 of file mesh_base.h.

References libMesh::MeshBase::_skip_find_neighbors.

Referenced by copy_nodes_and_elements(), libMesh::DistributedMesh::DistributedMesh(), libMesh::MeshBase::prepare_for_use(), read(), libMesh::ReplicatedMesh::ReplicatedMesh(), and stitching_helper().

1353 { return !_skip_find_neighbors; }
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
Definition: mesh_base.h:2242

◆ allow_node_and_elem_unique_id_overlap() [1/2]

void libMesh::MeshBase::allow_node_and_elem_unique_id_overlap ( bool  allow)
inlineinherited

If true is passed, then this mesh will no longer require unique_ids to be unique across the set of all DofObjects.

That is, although no two Elems (resp. Nodes) will share the same unique_id, a given Elem and Node might share the same unique_id.

Definition at line 1377 of file mesh_base.h.

References libMesh::MeshBase::_allow_node_and_elem_unique_id_overlap.

Referenced by libMesh::MeshTools::libmesh_assert_valid_unique_ids(), and libMesh::ExodusII_IO::read().

bool _allow_node_and_elem_unique_id_overlap
The Exodus reader (and potentially other readers in the future?) now supports setting Node and Elem u...
Definition: mesh_base.h:2268

◆ allow_node_and_elem_unique_id_overlap() [2/2]

bool libMesh::MeshBase::allow_node_and_elem_unique_id_overlap ( ) const
inlineinherited

Definition at line 1378 of file mesh_base.h.

References libMesh::MeshBase::_allow_node_and_elem_unique_id_overlap.

bool _allow_node_and_elem_unique_id_overlap
The Exodus reader (and potentially other readers in the future?) now supports setting Node and Elem u...
Definition: mesh_base.h:2268

◆ allow_remote_element_removal() [1/2]

void libMesh::MeshBase::allow_remote_element_removal ( bool  allow)
inlineinherited

If false is passed in then this mesh will no longer have remote elements deleted when being prepared for use; i.e.

even a DistributedMesh will remain (if it is already) serialized. This may adversely affect performance and memory use.

Definition at line 1368 of file mesh_base.h.

References libMesh::MeshBase::_allow_remote_element_removal.

Referenced by AllSecondOrderTest::allCompleteOrder(), AllSecondOrderTest::allCompleteOrderDoNothing(), AllSecondOrderTest::allSecondOrder(), AllSecondOrderTest::allSecondOrderDoNothing(), libMesh::DistributedMesh::DistributedMesh(), libMesh::MeshSerializer::MeshSerializer(), libMesh::ReplicatedMesh::ReplicatedMesh(), ConnectedComponentsTest::testEdge(), PeriodicBCTest::testPeriodicBC(), and libMesh::MeshSerializer::~MeshSerializer().

1368 { _allow_remote_element_removal = allow; }
bool _allow_remote_element_removal
If this is false then even on DistributedMesh remote elements will not be deleted during mesh prepara...
Definition: mesh_base.h:2255

◆ allow_remote_element_removal() [2/2]

bool libMesh::MeshBase::allow_remote_element_removal ( ) const
inlineinherited

Definition at line 1369 of file mesh_base.h.

References libMesh::MeshBase::_allow_remote_element_removal.

Referenced by copy_nodes_and_elements(), libMesh::DistributedMesh::DistributedMesh(), libMesh::ReplicatedMesh::ReplicatedMesh(), and stitching_helper().

bool _allow_remote_element_removal
If this is false then even on DistributedMesh remote elements will not be deleted during mesh prepara...
Definition: mesh_base.h:2255

◆ allow_renumbering() [1/2]

void libMesh::MeshBase::allow_renumbering ( bool  allow)
inlineinherited

If false is passed in then this mesh will no longer be renumbered when being prepared for use.

This may slightly adversely affect performance during subsequent element access, particularly when using a distributed mesh.

Important! When allow_renumbering(false) is set, ReplicatedMesh::n_elem() and ReplicatedMesh::n_nodes() will return wrong values whenever adaptive refinement is followed by adaptive coarsening. (Uniform refinement followed by uniform coarsening is OK.) This is due to the fact that n_elem() and n_nodes() are currently O(1) functions that just return the size of the respective underlying vectors, and this size is wrong when the numbering includes "gaps" from nodes and elements that have been deleted. We plan to implement a caching mechanism in the near future that will fix this incorrect behavior.

Definition at line 1345 of file mesh_base.h.

References libMesh::MeshBase::_skip_renumber_nodes_and_elements.

Referenced by AllSecondOrderTest::allSecondOrderMixedFixing(), DisjointNeighborTest::build_four_disjoint_elems(), DisjointNeighborTest::build_two_disjoint_elems(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::DistributedMesh::DistributedMesh(), main(), AllSecondOrderTest::MixedFixingImpl(), libMesh::NameBasedIO::read(), libMesh::GMVIO::read(), libMesh::ReplicatedMesh::ReplicatedMesh(), libMesh::C0Polyhedron::retriangulate(), WriteVecAndScalar::setupTests(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshGenerationTest::testBuildSphere(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), ConstraintOperatorTest::testCoreform(), DisjointNeighborTest::testDisjointNeighborConflictError(), MeshGenerationTest::tester(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), ExtraIntegersTest::testExtraIntegersExodusReading(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), EquationSystemsTest::testRefineThenReinitPreserveFlags(), EquationSystemsTest::testRepartitionThenReinit(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), DisjointNeighborTest::testStitchCrossMesh(), MeshSmootherTest::testVariationalPrism21MultipleSubdomains(), MeshInputTest::testVTKPreserveElemIds(), MeshInputTest::testVTKPreserveSubdomainIds(), WriteNodesetData::testWriteImpl(), WriteSidesetData::testWriteImpl(), and WriteElemsetData::testWriteImpl().

bool _skip_renumber_nodes_and_elements
If this is true then renumbering will be kept to a minimum.
Definition: mesh_base.h:2237

◆ allow_renumbering() [2/2]

bool libMesh::MeshBase::allow_renumbering ( ) const
inlineinherited

◆ assign()

virtual MeshBase& libMesh::UnstructuredMesh::assign ( MeshBase &&  other_mesh)
overridepure virtual

Shim to allow operator = (&&) to behave like a virtual function without having to be one.

Implements libMesh::MeshBase.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

◆ cache_elem_data()

void libMesh::MeshBase::cache_elem_data ( )
inherited

Definition at line 1959 of file mesh_base.C.

References libMesh::MeshBase::_elem_default_orders, libMesh::MeshBase::_elem_dims, libMesh::MeshBase::_mesh_subdomains, libMesh::MeshBase::_preparation, libMesh::MeshBase::_spatial_dimension, libMesh::MeshBase::_supported_nodal_order, libMesh::ParallelObject::comm(), libMesh::MeshBase::Preparation::has_cached_elem_data, libMesh::MeshBase::is_serial(), libMesh::MAXIMUM, libMesh::MeshBase::mesh_dimension(), TIMPI::Communicator::min(), and TIMPI::Communicator::set_union().

Referenced by libMesh::MeshBase::cache_elem_dims(), libMesh::MeshBase::complete_preparation(), main(), libMesh::MeshBase::set_elem_dimensions(), and MeshSmootherTest::testVariationalSmoother().

1960 {
1961  // This requires an inspection on every processor
1962  parallel_object_only();
1963 
1964  // Need to clear containers first in case all elements of a
1965  // particular dimension/order/subdomain have been deleted.
1966  _elem_dims.clear();
1967  _elem_default_orders.clear();
1968  _mesh_subdomains.clear();
1970 
1971  for (const auto & elem : this->active_element_ptr_range())
1972  {
1973  _elem_dims.insert(cast_int<unsigned char>(elem->dim()));
1974  _elem_default_orders.insert(elem->default_order());
1975  _mesh_subdomains.insert(elem->subdomain_id());
1977  static_cast<Order>
1978  (std::min(static_cast<int>(_supported_nodal_order),
1979  static_cast<int>(elem->supported_nodal_order())));
1980  }
1981 
1982  if (!this->is_serial())
1983  {
1984  // Some different dimension/order/subdomain elements may only live
1985  // on other processors
1986  this->comm().set_union(_elem_dims);
1988  this->comm().min(_supported_nodal_order);
1989  this->comm().set_union(_mesh_subdomains);
1990  }
1991 
1992  // If the largest element dimension found is larger than the current
1993  // _spatial_dimension, increase _spatial_dimension.
1994  unsigned int max_dim = this->mesh_dimension();
1995  if (max_dim > _spatial_dimension)
1996  _spatial_dimension = cast_int<unsigned char>(max_dim);
1997 
1998  // _spatial_dimension may need to increase from 1->2 or 2->3 if the
1999  // mesh is full of 1D elements but they are not x-aligned, or the
2000  // mesh is full of 2D elements but they are not in the x-y plane.
2001  // If the mesh is x-aligned or x-y planar, we will end up checking
2002  // every node's coordinates and not breaking out of the loop
2003  // early...
2004  if (_spatial_dimension < LIBMESH_DIM)
2005  {
2006  for (const auto & node : this->node_ptr_range())
2007  {
2008  // Note: the exact floating point comparison is intentional,
2009  // we don't want to get tripped up by tolerances.
2010  if ((*node)(0) != 0. && _spatial_dimension < 1)
2011  _spatial_dimension = 1;
2012 
2013  if ((*node)(1) != 0. && _spatial_dimension < 2)
2014  {
2015  _spatial_dimension = 2;
2016 #if LIBMESH_DIM == 2
2017  // If libmesh is compiled in 2D mode, this is the
2018  // largest spatial dimension possible so we can break
2019  // out.
2020  break;
2021 #endif
2022  }
2023 
2024 #if LIBMESH_DIM > 2
2025  if ((*node)(2) != 0.)
2026  {
2027  // Spatial dimension can't get any higher than this, so
2028  // we can break out.
2029  _spatial_dimension = 3;
2030  break;
2031  }
2032 #endif
2033  }
2034  }
2035 
2037 }
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
Definition: mesh_base.h:2300
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
const Parallel::Communicator & comm() const
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2332
virtual bool is_serial() const
Definition: mesh_base.h:347
void min(const T &r, T &o, Request &req) const
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:2289
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:2295
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:2282
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162
unsigned int mesh_dimension() const
Definition: mesh_base.C:430
void set_union(T &data, const unsigned int root_id) const

◆ cache_elem_dims()

void libMesh::MeshBase::cache_elem_dims ( )
inherited
Deprecated:
This method has ben replaced by cache_elem_data which caches data in addition to elem dimensions (e.g.

elem subdomain ids) Search the mesh and cache the different dimensions of the elements present in the mesh. This is done in prepare_for_use(), but can be done manually by other classes after major mesh modifications.

Definition at line 1951 of file mesh_base.C.

References libMesh::MeshBase::cache_elem_data().

1952 {
1953  libmesh_deprecated();
1954 
1955  this->cache_elem_data();
1956 }
void cache_elem_data()
Definition: mesh_base.C:1959

◆ change_elemset_code()

void libMesh::MeshBase::change_elemset_code ( dof_id_type  old_code,
dof_id_type  new_code 
)
inherited

Replace elemset code "old_code" with "new_code".

This function loops over all elements and changes the extra integer corresponding to the "elemset_code" label, and updates the _elemset_codes and _elemset_codes_inverse_map members. Does not change the elemset ids of any of the sets.

Definition at line 512 of file mesh_base.C.

References libMesh::MeshBase::_elemset_codes, libMesh::MeshBase::_elemset_codes_inverse_map, libMesh::MeshBase::add_elemset_code(), libMesh::MeshBase::element_stored_range(), libMesh::MeshBase::get_elem_integer_index(), libMesh::MeshBase::has_elem_integer(), and libMesh::Threads::parallel_for().

513 {
514  // Look up elemset ids for old_code
515  auto it = _elemset_codes.find(old_code);
516 
517  // If we don't have the old_code, then do nothing. Alternatively, we
518  // could throw an error since trying to change an elemset code you
519  // don't have could indicate there's a problem...
520  if (it == _elemset_codes.end())
521  return;
522 
523  // Make copy of the set of elemset ids. We are not changing these,
524  // only updating the elemset code it corresponds to.
525  elemset_type id_set_copy = *(it->second);
526 
527  // Look up the corresponding entry in the inverse map. Note: we want
528  // the iterator because we are going to remove it.
529  auto inverse_it = _elemset_codes_inverse_map.find(id_set_copy);
530  libmesh_error_msg_if(inverse_it == _elemset_codes_inverse_map.end(),
531  "Expected _elemset_codes_inverse_map entry for elemset code " << old_code);
532 
533  // Erase entry from inverse map
534  _elemset_codes_inverse_map.erase(inverse_it);
535 
536  // Erase entry from forward map
537  _elemset_codes.erase(it);
538 
539  // Add new code with original set of ids.
540  this->add_elemset_code(new_code, id_set_copy);
541 
542  // We can't update any actual elemset codes if there is no extra integer defined for it.
543  if (!this->has_elem_integer("elemset_code"))
544  return;
545 
546  // Get index of elemset_code extra integer
547  unsigned int elemset_index = this->get_elem_integer_index("elemset_code");
548 
549  // Loop over all elems and update code
551  (this->element_stored_range(),
552  [elemset_index, old_code, new_code](const ElemRange & range)
553  {
554  for (Elem * elem : range)
555  {
556  dof_id_type elemset_code =
557  elem->get_extra_integer(elemset_index);
558 
559  if (elemset_code == old_code)
560  elem->set_extra_integer(elemset_index, new_code);
561  }
562  });
563 }
void parallel_for(const Range &range, const Body &body, unsigned int n_threads=libMesh::n_threads())
Execute the provided function object in parallel on the specified range.
Definition: threads_none.h:73
std::map< dof_id_type, const MeshBase::elemset_type * > _elemset_codes
Map from "element set code" to list of set ids to which that element belongs (and vice-versa)...
Definition: mesh_base.h:2324
void add_elemset_code(dof_id_type code, MeshBase::elemset_type id_set)
Tabulate a user-defined "code" for elements which belong to the element sets specified in id_set...
Definition: mesh_base.C:456
bool has_elem_integer(std::string_view name) const
Definition: mesh_base.C:701
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2325
unsigned int get_elem_integer_index(std::string_view name) const
Definition: mesh_base.C:689
const ElemRange & element_stored_range()
Definition: mesh_base.C:1913
std::set< elemset_id_type > elemset_type
Typedef for the "set" container used to store elemset ids.
Definition: mesh_base.h:456
const DofMap &dof_map LIBMESH_COMMA unsigned int Elem * ElemRange
Definition: mesh_base.h:1816
uint8_t dof_id_type
Definition: id_types.h:67

◆ change_elemset_id()

void libMesh::MeshBase::change_elemset_id ( elemset_id_type  old_id,
elemset_id_type  new_id 
)
inherited

Replace elemset id "old_id" with "new_id".

Does not change any of the elemset codes, so does not need to loop over the elements themselves.

Definition at line 565 of file mesh_base.C.

References libMesh::MeshBase::_all_elemset_ids, libMesh::MeshBase::_elemset_codes, and libMesh::MeshBase::_elemset_codes_inverse_map.

566 {
567  // Early return if we don't have old_id
568  if (!_all_elemset_ids.count(old_id))
569  return;
570 
571  // Throw an error if the new_id is already used
572  libmesh_error_msg_if(_all_elemset_ids.count(new_id),
573  "Cannot change elemset id " << old_id <<
574  " to " << new_id << ", " << new_id << " already exists.");
575 
576  // We will build up a new version of the inverse map so we can iterate over
577  // the current one without invalidating anything.
578  std::map<MeshBase::elemset_type, dof_id_type> new_elemset_codes_inverse_map;
579  for (const auto & [id_set, elemset_code] : _elemset_codes_inverse_map)
580  {
581  auto id_set_copy = id_set;
582  if (id_set_copy.count(old_id))
583  {
584  // Remove old_id, insert new_id
585  id_set_copy.erase(old_id);
586  id_set_copy.insert(new_id);
587  }
588 
589  // Store in new version of map
590  new_elemset_codes_inverse_map.emplace(id_set_copy, elemset_code);
591  }
592 
593  // Swap existing map with newly-built one
594  _elemset_codes_inverse_map.swap(new_elemset_codes_inverse_map);
595 
596  // Reconstruct _elemset_codes map
597  _elemset_codes.clear();
598  for (const auto & [id_set, elemset_code] : _elemset_codes_inverse_map)
599  _elemset_codes.emplace(elemset_code, &id_set);
600 
601  // Update _all_elemset_ids
602  _all_elemset_ids.erase(old_id);
603  _all_elemset_ids.insert(new_id);
604 }
std::map< dof_id_type, const MeshBase::elemset_type * > _elemset_codes
Map from "element set code" to list of set ids to which that element belongs (and vice-versa)...
Definition: mesh_base.h:2324
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2325
MeshBase::elemset_type _all_elemset_ids
Definition: mesh_base.h:2326

◆ clear()

void libMesh::MeshBase::clear ( )
virtualinherited

Deletes all the element and node data that is currently stored.

elem and node extra_integer data is nevertheless retained here, for better compatibility between that feature and older code's use of MeshBase::clear()

Reimplemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Definition at line 1029 of file mesh_base.C.

References libMesh::MeshBase::_constraint_rows, libMesh::MeshBase::_elem_default_orders, libMesh::MeshBase::_elem_dims, libMesh::MeshBase::_elemset_codes, libMesh::MeshBase::_elemset_codes_inverse_map, libMesh::MeshBase::_n_parts, libMesh::MeshBase::_preparation, libMesh::MeshBase::_supported_nodal_order, libMesh::MeshBase::boundary_info, libMesh::MeshBase::clear_point_locator(), libMesh::MeshBase::clear_stored_ranges(), and libMesh::MAXIMUM.

Referenced by libMesh::MeshTools::Generation::build_delaunay_square(), DisjointNeighborTest::build_four_disjoint_elems(), DisjointNeighborTest::build_split_mesh_with_interface(), libMesh::ReplicatedMesh::clear(), libMesh::DistributedMesh::clear(), libMesh::TriangleWrapper::copy_tri_to_mesh(), create_submesh(), main(), libMesh::AbaqusIO::read(), libMesh::STLIO::read(), libMesh::GMVIO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::GmshIO::read_mesh(), libMesh::DynaIO::read_mesh(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::BoundaryInfo::sync(), MeshAssignTest::testMeshMoveAssign(), libMesh::NetGenMeshInterface::triangulate(), and libMesh::MeshBase::~MeshBase().

1030 {
1031  // Reset the number of partitions
1032  _n_parts = 1;
1033 
1034  // Reset the preparation flags
1035  _preparation = false;
1036 
1037  // Clear boundary information
1038  if (boundary_info)
1039  boundary_info->clear();
1040 
1041  // Clear cached element data
1042  _elem_dims.clear();
1043  _elem_default_orders.clear();
1045 
1046  _elemset_codes.clear();
1048 
1049  _constraint_rows.clear();
1050 
1051  // Clear our point locator.
1052  this->clear_point_locator();
1053  this->clear_stored_ranges();
1054 }
std::map< dof_id_type, const MeshBase::elemset_type * > _elemset_codes
Map from "element set code" to list of set ids to which that element belongs (and vice-versa)...
Definition: mesh_base.h:2324
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2409
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
Definition: mesh_base.h:2098
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2325
void clear_stored_ranges()
Clears stored ranges, to indicate that the mesh has changed and they should be regenerated when next ...
Definition: mesh_base.C:1943
unsigned int _n_parts
The number of partitions the mesh has.
Definition: mesh_base.h:2144
void clear_point_locator()
Releases the current PointLocator object.
Definition: mesh_base.C:1859
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:2289
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:2295
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:2282
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ clear_elems()

virtual void libMesh::MeshBase::clear_elems ( )
pure virtualinherited

Deletes all the element data that is currently stored.

No Node is removed from the mesh, however even NodeElem elements are deleted, so the remaining Nodes will be considered "unused" and cleared unless they are reconnected to new elements before the next preparation step.

This does not affect BoundaryInfo data; any boundary information associated elements should already be cleared.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::TriangulatorInterface::elems_to_segments(), and libMesh::Poly2TriTriangulator::triangulate_current_points().

◆ clear_point_locator()

void libMesh::MeshBase::clear_point_locator ( )
inherited

◆ clear_stored_ranges()

void libMesh::MeshBase::clear_stored_ranges ( )
inherited

Clears stored ranges, to indicate that the mesh has changed and they should be regenerated when next needed.

Definition at line 1943 of file mesh_base.C.

References libMesh::MeshBase::_const_active_local_element_stored_range, and libMesh::MeshBase::_element_stored_range.

Referenced by libMesh::ReplicatedMesh::add_elem(), libMesh::DistributedMesh::add_elem(), libMesh::MeshBase::clear(), libMesh::ReplicatedMesh::delete_elem(), libMesh::DistributedMesh::delete_elem(), libMesh::ReplicatedMesh::insert_elem(), libMesh::DistributedMesh::insert_elem(), libMesh::MeshBase::prepare_for_use(), libMesh::ReplicatedMesh::renumber_elem(), libMesh::DistributedMesh::renumber_elem(), and libMesh::MeshBase::unset_is_prepared().

1944 {
1945  _element_stored_range.reset(nullptr);
1947 }
std::unique_ptr< ElemRange > _element_stored_range
A cached ElemRange for threaded mutation of all semilocal elements of this mesh.
Definition: mesh_base.h:2172
std::unique_ptr< ConstElemRange > _const_active_local_element_stored_range
A cached ConstElemRange for threaded calculation on all local elements of this mesh.
Definition: mesh_base.h:2183

◆ clone()

virtual std::unique_ptr<MeshBase> libMesh::MeshBase::clone ( ) const
pure virtualinherited

◆ comm()

const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inlineinherited
Returns
A reference to the Parallel::Communicator object used by this mesh.

Definition at line 97 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_tao_equality_constraints(), libMesh::__libmesh_tao_equality_constraints_jacobian(), libMesh::__libmesh_tao_gradient(), libMesh::__libmesh_tao_hessian(), libMesh::__libmesh_tao_inequality_constraints(), libMesh::__libmesh_tao_inequality_constraints_jacobian(), libMesh::__libmesh_tao_objective(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult_add(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::DofMap::add_constraints_to_send_list(), add_cube_convex_hull_to_mesh(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::RBEIMEvaluation::add_interpolation_data(), libMesh::CondensedEigenSystem::add_matrices(), libMesh::EigenSystem::add_matrices(), libMesh::System::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::DofMap::add_variable(), libMesh::DofMap::add_variables(), libMesh::System::add_vector(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::AdvectionSystem::assemble_claw_rhs(), libMesh::FEMSystem::assemble_qoi(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::MeshCommunication::assign_global_indices(), libMesh::Partitioner::assign_partitioning(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::PetscDMWrapper::build_sf(), libMesh::MeshBase::cache_elem_data(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::MeshTetInterface::check_hull_integrity(), libMesh::MeshBase::complete_preparation(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::DofMap::computed_sparsity_already(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ContinuationSystem::ContinuationSystem(), libMesh::MeshBase::copy_constraint_rows(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::CondensedEigenSystem::copy_super_to_sub(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::MeshTools::create_subdomain_bounding_box(), libMesh::PetscMatrix< T >::create_submatrix_nosort(), create_wrapped_function(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::RBEIMEvaluation::distribute_bfs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::DTKSolutionTransfer::DTKSolutionTransfer(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::EpetraVector< T >::EpetraVector(), AssembleOptimization::equality_constraints(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::SmoothnessEstimator::estimate_smoothness(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::DofMap::gather_constraints(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::RBEIMEvaluation::get_eim_basis_function_node_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_side_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_value(), libMesh::System::get_info(), libMesh::MeshBase::get_info(), libMesh::DofMap::get_info(), libMesh::RBEIMEvaluation::get_interior_basis_functions_as_vecs(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::RBEIMConstruction::get_max_abs_value(), libMesh::RBEIMConstruction::get_node_max_abs_value(), libMesh::RBEIMEvaluation::get_parametrized_function_node_value(), libMesh::RBEIMEvaluation::get_parametrized_function_side_value(), libMesh::RBEIMEvaluation::get_parametrized_function_value(), libMesh::RBEIMConstruction::get_random_point(), libMesh::MeshTetInterface::improve_hull_integrity(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::StaticCondensation::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::AdvectionSystem::init_data(), libMesh::ClawSystem::init_data(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBEIMConstruction::inner_product(), integrate_function(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_equal_connectivity(), libMesh::MeshTools::libmesh_assert_equal_points(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_constraint_rows(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::libmesh_petsc_linesearch_shellfunc(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_recalculate_monitor(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_interface(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_precheck(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::LinearImplicitSystem::LinearImplicitSystem(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_node_bcids_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::FEMSystem::mesh_position_set(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::MeshTools::n_connected_components(), libMesh::DofMap::n_constrained_dofs(), libMesh::MeshBase::n_constraint_rows(), libMesh::DofMap::n_dofs(), libMesh::DofMap::n_dofs_per_processor(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), MixedOrderTest::n_neighbor_links(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::SparsityPattern::Build::n_nonzeros(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::RBEIMEvaluation::node_distribute_bfs(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::RBEIMConstruction::node_inner_product(), libMesh::PetscVector< libMesh::Number >::operator=(), libMesh::MeshBase::operator==(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::ReplicatedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_n_elem(), libMesh::DistributedMesh::parallel_n_nodes(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::MeshTools::paranoid_n_levels(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Partitioner::processor_pairs_to_interface_nodes(), libMesh::InterMeshProjection::project_system_vectors(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO::read_header(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEIMEvaluation::read_in_interior_basis_functions(), libMesh::RBEIMEvaluation::read_in_node_basis_functions(), libMesh::RBEIMEvaluation::read_in_side_basis_functions(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), MeshFunctionTest::read_variable_info_from_output_data(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::BoundaryInfo::remove_edge_id(), libMesh::BoundaryInfo::remove_node_id(), libMesh::BoundaryInfo::remove_shellface_id(), libMesh::BoundaryInfo::remove_side_id(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), scale_mesh_and_plot(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::send_and_insert_dof_values(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_linear(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::RBEIMEvaluation::side_distribute_bfs(), libMesh::RBEIMEvaluation::side_gather_bfs(), libMesh::RBEIMConstruction::side_inner_product(), libMesh::Partitioner::single_partition(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::VariationalMeshSmoother::smooth(), libMesh::ClawSystem::solve_conservation_law(), libMesh::split_mesh(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::MeshBase::sync_subdomain_name_map(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), libMesh::MeshRefinement::test_unflagged(), DofMapTest::testBadElemFECombo(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), VolumeTest::testC0PolygonMethods(), VolumeTest::testC0PolyhedronMethods(), ConstraintOperatorTest::testCoreform(), ConnectedComponentsTest::testEdge(), MeshInputTest::testExodusIGASidesets(), MeshTriangulationTest::testFoundCenters(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), PointLocatorTest::testPlanar(), MeshTriangulationTest::testPoly2TriRefinementBase(), SystemsTest::testProjectCubeWithMeshFunction(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testSelectiveRenumber(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), MeshSmootherTest::testVariationalSmoother(), libMesh::MeshTools::total_weight(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::Poly2TriTriangulator::triangulate(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), update_current_local_solution(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::VTKIO::write_nodal_data(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), libMesh::RBEvaluation::write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::TransientRBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::RBEIMEvaluationSerialization::write_to_file(), and libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file().

98  { return _communicator; }
const Parallel::Communicator & _communicator

◆ complete_preparation()

void libMesh::MeshBase::complete_preparation ( )
inherited

Definition at line 874 of file mesh_base.C.

References libMesh::MeshBase::_allow_remote_element_removal, libMesh::MeshBase::_preparation, libMesh::MeshBase::_skip_detect_interior_parents, libMesh::MeshBase::_skip_find_neighbors, libMesh::MeshBase::_skip_renumber_nodes_and_elements, libMesh::MeshBase::cache_elem_data(), libMesh::ParallelObject::comm(), libMesh::MeshBase::delete_remote_elements(), libMesh::MeshBase::detect_interior_parents(), libMesh::MeshBase::find_neighbors(), libMesh::MeshBase::get_boundary_info(), libMesh::MeshBase::Preparation::has_boundary_id_sets, libMesh::MeshBase::Preparation::has_cached_elem_data, libMesh::MeshBase::Preparation::has_interior_parent_ptrs, libMesh::MeshBase::Preparation::has_neighbor_ptrs, libMesh::MeshBase::Preparation::has_reinit_ghosting_functors, libMesh::MeshBase::Preparation::has_removed_orphaned_nodes, libMesh::MeshBase::Preparation::has_removed_remote_elements, libMesh::MeshBase::Preparation::has_synched_id_counts, libMesh::MeshBase::Preparation::is_partitioned, libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_constraint_rows(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::MeshBase::n_unpartitioned_elem(), libMesh::MeshBase::n_unpartitioned_nodes(), libMesh::MeshBase::partition(), libMesh::BoundaryInfo::regenerate_id_sets(), libMesh::MeshBase::reinit_ghosting_functors(), libMesh::MeshBase::remove_orphaned_nodes(), libMesh::MeshBase::renumber_nodes_and_elements(), libMesh::MeshBase::skip_partitioning(), and libMesh::MeshBase::update_parallel_id_counts().

Referenced by libMesh::MeshBase::prepare_for_use(), MeshBaseTest::testMeshBaseVerifyHasCachedElemData(), MeshBaseTest::testMeshBaseVerifyHasNeighborPtrs(), and MeshBaseTest::testMeshBaseVerifyRemovalPreparation().

875 {
876  LOG_SCOPE("complete_preparation()", "MeshBase");
877 
878  parallel_object_only();
879 
880  libmesh_assert(this->comm().verify(this->is_serial()));
881 
882  // If we don't go into this method with valid constraint rows, we're
883  // only going to be able to make that worse.
884 #ifdef DEBUG
886 #endif
887 
888  // A distributed mesh may have processors with no elements (or
889  // processors with no elements of higher dimension, if we ever
890  // support mixed-dimension meshes), but we want consistent
891  // mesh_dimension anyways.
892  //
893  // cache_elem_data() should get the elem_dimensions() and
894  // mesh_dimension() correct later, and we don't need it earlier.
895 
896 
897  // Renumber the nodes and elements so that they in contiguous
898  // blocks. By default, _skip_renumber_nodes_and_elements is false.
899  //
900  // Instances where you if prepare_for_use() should not renumber the nodes
901  // and elements include reading in e.g. an xda/r or gmv file. In
902  // this case, the ordering of the nodes may depend on an accompanying
903  // solution, and the node ordering cannot be changed.
904 
905 
906  // Mesh modification operations might not leave us with consistent
907  // id counts, or might leave us with orphaned nodes we're no longer
908  // using, but our partitioner might need that consistency and/or
909  // might be confused by orphaned nodes.
911  {
915  }
916  else
917  {
919  this->remove_orphaned_nodes();
922  }
923 
924  // Let all the elements find their neighbors
926  this->find_neighbors();
927 
928  // The user may have set boundary conditions. We require that the
929  // boundary conditions were set consistently. Because we examine
930  // neighbors when evaluating non-raw boundary condition IDs, this
931  // assert is only valid when our neighbor links are in place.
932 #ifdef DEBUG
934 #endif
935 
936  // Search the mesh for all the dimensions of the elements
937  // and cache them.
939  this->cache_elem_data();
940 
941  // Search the mesh for elements that have a neighboring element
942  // of dim+1 and set that element as the interior parent
944  {
946  this->detect_interior_parents();
947  else
948  {
949  // We must set the flag that says "interior parent pointers have been set up"
950  // even though we skip detect_interior_parents().
952  }
953  }
954 
955  // Fix up node unique ids in case mesh generation code didn't take
956  // exceptional care to do so.
957  // MeshCommunication().make_node_unique_ids_parallel_consistent(*this);
958 
959  // We're going to still require that mesh generation code gets
960  // element unique ids consistent.
961 #if defined(DEBUG) && defined(LIBMESH_ENABLE_UNIQUE_ID)
963 #endif
964 
965  // Allow our GhostingFunctor objects to reinit if necessary.
966  // Do this before partitioning and redistributing, and before
967  // deleting remote elements.
969  this->reinit_ghosting_functors();
970 
971  // Partition the mesh unless *all* partitioning is to be skipped.
972  // If only noncritical partitioning is to be skipped, the
973  // partition() call will still check for orphaned nodes.
975  this->partition();
976  else if (!this->n_unpartitioned_elem() &&
977  !this->n_unpartitioned_nodes())
979 
980  // If we're using DistributedMesh, we'll probably want it
981  // parallelized.
982  if (this->_allow_remote_element_removal &&
984  this->delete_remote_elements();
985  else
987 
988  // Much of our boundary info may have been for now-remote parts of the mesh,
989  // in which case we don't want to keep local copies of data meant to be
990  // local. On the other hand we may have deleted, or the user may have added in
991  // a distributed fashion, boundary data that is meant to be global. So we
992  // handle both of those scenarios here
995 
998 
999  // The mesh is now prepared for use, with the possible exception of
1000  // partitioning that was supposed to be skipped, and it should know
1001  // it.
1002 #ifndef NDEBUG
1003  Preparation completed_preparation = _preparation;
1004  if (skip_partitioning())
1005  completed_preparation.is_partitioned = true;
1006  libmesh_assert(completed_preparation);
1007 #endif
1008 
1009 #ifdef DEBUG
1011 #ifdef LIBMESH_ENABLE_UNIQUE_ID
1013 #endif
1014 #endif
1015 }
bool _skip_renumber_nodes_and_elements
If this is true then renumbering will be kept to a minimum.
Definition: mesh_base.h:2237
dof_id_type n_unpartitioned_nodes() const
Definition: mesh_base.h:587
void remove_orphaned_nodes()
Removes any orphaned nodes, nodes not connected to any elements.
Definition: mesh_base.C:801
void detect_interior_parents()
Search the mesh for elements that have a neighboring element of dim+1 and set that element as the int...
Definition: mesh_base.C:2049
virtual void find_neighbors(const bool reset_remote_elements=false, const bool reset_current_list=true, const bool assert_valid=true)=0
Locate element face (edge in 2D) neighbors.
void libmesh_assert_valid_constraint_rows(const MeshBase &mesh)
A function for verifying that all mesh constraint rows express relations between nodes and elements t...
Definition: mesh_tools.C:1745
const Parallel::Communicator & comm() const
bool _allow_remote_element_removal
If this is false then even on DistributedMesh remote elements will not be deleted during mesh prepara...
Definition: mesh_base.h:2255
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:170
dof_id_type n_unpartitioned_elem() const
Definition: mesh_base.h:693
virtual bool is_serial() const
Definition: mesh_base.h:347
virtual void update_parallel_id_counts()=0
Updates parallel caches so that methods like n_elem() accurately reflect changes on other processors...
void cache_elem_data()
Definition: mesh_base.C:1959
libmesh_assert(ctx)
void libmesh_assert_valid_boundary_ids(const MeshBase &mesh)
A function for verifying that boundary condition ids match across processors.
Definition: mesh_tools.C:1788
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
Definition: mesh_base.h:2242
void regenerate_id_sets()
Clears and regenerates the cached sets of ids.
bool skip_partitioning() const
Definition: mesh_base.h:1421
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162
bool _skip_detect_interior_parents
If this is true then we will skip detect_interior_parents in prepare_for_use.
Definition: mesh_base.h:2247
virtual void delete_remote_elements()
When supported, deletes all nonlocal elements of the mesh except for "ghosts" which touch a local ele...
Definition: mesh_base.h:389
void reinit_ghosting_functors()
Loops over ghosting functors and calls mesh_reinit()
Definition: mesh_base.C:1018
void libmesh_assert_valid_unique_ids(const MeshBase &mesh)
A function for verifying that unique ids match across processors.
Definition: mesh_tools.C:1986
virtual void renumber_nodes_and_elements()=0
After partitioning a mesh it is useful to renumber the nodes and elements so that they lie in contigu...

◆ contract()

bool libMesh::UnstructuredMesh::contract ( )
overridevirtual

Delete subactive (i.e.

children of coarsened) elements. This removes all elements descended from currently active elements in the mesh.

Implements libMesh::MeshBase.

Definition at line 1535 of file unstructured_mesh.C.

References libMesh::as_range(), libMesh::MeshBase::clear_point_locator(), libMesh::MeshBase::delete_elem(), libMesh::MeshBase::ghosting_functors_begin(), libMesh::MeshBase::ghosting_functors_end(), libMesh::libmesh_assert(), and libMesh::MeshBase::renumber_nodes_and_elements().

1536 {
1537  LOG_SCOPE ("contract()", "Mesh");
1538 
1539  // Flag indicating if this call actually changes the mesh
1540  bool mesh_changed = false;
1541 
1542 #ifdef DEBUG
1543  for (const auto & elem : this->element_ptr_range())
1544  libmesh_assert(elem->active() || elem->subactive() || elem->ancestor());
1545 #endif
1546 
1547  // Loop over the elements.
1548  for (auto & elem : this->element_ptr_range())
1549  {
1550  // Delete all the subactive ones
1551  if (elem->subactive())
1552  {
1553  // No level-0 element should be subactive.
1554  // Note that we CAN'T test elem->level(), as that
1555  // touches elem->parent()->dim(), and elem->parent()
1556  // might have already been deleted!
1557  libmesh_assert(elem->parent());
1558 
1559  // Delete the element
1560  // This just sets a pointer to nullptr, and doesn't
1561  // invalidate any iterators
1562  this->delete_elem(elem);
1563 
1564  // the mesh has certainly changed
1565  mesh_changed = true;
1566  }
1567  else
1568  {
1569  // Compress all the active ones
1570  if (elem->active())
1571  elem->contract();
1572  else
1573  libmesh_assert (elem->ancestor());
1574  }
1575  }
1576 
1577  // Strip any newly-created nullptr voids out of the element array
1579 
1580  // FIXME: Need to understand why deleting subactive children
1581  // invalidates the point locator. For now we will clear it explicitly
1582  this->clear_point_locator();
1583 
1584  // Allow our GhostingFunctor objects to reinit if necessary.
1585  for (auto & gf : as_range(this->ghosting_functors_begin(),
1586  this->ghosting_functors_end()))
1587  {
1588  libmesh_assert(gf);
1589  gf->mesh_reinit();
1590  }
1591 
1592  return mesh_changed;
1593 }
GhostingFunctorIterator ghosting_functors_begin() const
Beginning of range of ghosting functors.
Definition: mesh_base.h:1462
GhostingFunctorIterator ghosting_functors_end() const
End of range of ghosting functors.
Definition: mesh_base.h:1468
virtual void delete_elem(Elem *e)=0
Removes element e from the mesh.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
Definition: simple_range.h:57
void clear_point_locator()
Releases the current PointLocator object.
Definition: mesh_base.C:1859
libmesh_assert(ctx)
virtual void renumber_nodes_and_elements()=0
After partitioning a mesh it is useful to renumber the nodes and elements so that they lie in contigu...

◆ copy_cached_data()

void libMesh::MeshBase::copy_cached_data ( const MeshBase other_mesh)
protectedinherited

Helper class to copy cached data, to synchronize with a possibly unprepared other_mesh.

Definition at line 2391 of file mesh_base.C.

References libMesh::MeshBase::_elem_default_orders, libMesh::MeshBase::_elem_dims, libMesh::MeshBase::_mesh_subdomains, libMesh::MeshBase::_spatial_dimension, and libMesh::MeshBase::_supported_nodal_order.

2392 {
2393  this->_spatial_dimension = other_mesh._spatial_dimension;
2394  this->_elem_dims = other_mesh._elem_dims;
2395  this->_elem_default_orders = other_mesh._elem_default_orders;
2396  this->_supported_nodal_order = other_mesh._supported_nodal_order;
2397  this->_mesh_subdomains = other_mesh._mesh_subdomains;
2398 }
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
Definition: mesh_base.h:2300
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2332
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:2289
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:2295
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:2282

◆ copy_constraint_rows() [1/2]

void libMesh::MeshBase::copy_constraint_rows ( const MeshBase other_mesh)
inherited

Copy the constraints from the other mesh to this mesh.

Definition at line 2450 of file mesh_base.C.

References libMesh::MeshBase::_constraint_rows, libMesh::MeshBase::elem_ptr(), libMesh::MeshBase::get_constraint_rows(), and libMesh::MeshBase::node_ptr().

Referenced by libMesh::DistributedMesh::DistributedMesh(), libMesh::ReplicatedMesh::ReplicatedMesh(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), ConstraintOperatorTest::testCoreform(), and ConnectedComponentsTest::testEdge().

2451 {
2452  LOG_SCOPE("copy_constraint_rows(mesh)", "MeshBase");
2453 
2454  _constraint_rows.clear();
2455 
2456  const auto & other_constraint_rows = other_mesh.get_constraint_rows();
2457  for (const auto & [other_node, other_node_constraints] : other_constraint_rows)
2458  {
2459  const Node * const our_node = this->node_ptr(other_node->id());
2460  constraint_rows_mapped_type our_node_constraints;
2461  for (const auto & [other_inner_key_pair, constraint_value] : other_node_constraints)
2462  {
2463  const auto & [other_elem, local_node_id] = other_inner_key_pair;
2464  const Elem * const our_elem = this->elem_ptr(other_elem->id());
2465  our_node_constraints.emplace_back(std::make_pair(our_elem, local_node_id), constraint_value);
2466  }
2467  _constraint_rows[our_node] = std::move(our_node_constraints);
2468  }
2469 }
std::vector< std::pair< std::pair< const Elem *, unsigned int >, Real > > constraint_rows_mapped_type
Definition: mesh_base.h:1899
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2409
virtual const Elem * elem_ptr(const dof_id_type i) const =0
virtual const Node * node_ptr(const dof_id_type i) const =0

◆ copy_constraint_rows() [2/2]

template<typename T >
void libMesh::MeshBase::copy_constraint_rows ( const SparseMatrix< T > &  constraint_operator,
bool  precondition_constraint_operator = false 
)
inherited

Copy the constraints from the given matrix to this mesh.

The constraint_operator should be an mxn matrix, where m == this->n_nodes() and the operator indexing matches the current node indexing. This may require users to disable mesh renumbering in between loading a mesh file and loading a constraint matrix which matches it.

If any "constraint" rows in the matrix are unit vectors, the node corresponding to that row index will be left unconstrained, and will be used to constrain any other nodes which have a non-zero in the column index of that unit vector.

For each matrix column index which does not correspond to an existing node, a new NodeElem will be added to the mesh on which to store the new unconstrained degree(s) of freedom.

If precondition_constraint_operator is true, then the values of those new unconstrained degrees of freedom may be scaled to improve the conditioning of typical PDE matrices integrated on constrained mesh elements.

T for the constraint_operator in this function should be Real or Number ... and the data should be Real - we just allow complex T for the sake of subclasses which have to be configured and compiled with only one runtime option.

Definition at line 2474 of file mesh_base.C.

References libMesh::MeshBase::_constraint_rows, libMesh::MeshBase::_elem_default_orders, libMesh::MeshBase::_elem_dims, libMesh::MeshBase::_mesh_subdomains, libMesh::MeshBase::_supported_nodal_order, libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), TIMPI::Communicator::allgather(), libMesh::Elem::build(), libMesh::ParallelObject::comm(), libMesh::Elem::default_order(), libMesh::MeshBase::elem_ptr(), libMesh::SparseMatrix< T >::get_row(), libMesh::DofObject::id(), libMesh::index_range(), libMesh::libmesh_assert(), libMesh::libmesh_real(), libMesh::SparseMatrix< T >::m(), libMesh::make_range(), libMesh::SparseMatrix< T >::n(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::node_ptr(), libMesh::MeshBase::node_ref(), libMesh::NODEELEM, libMesh::DofObject::processor_id(), libMesh::Real, libMesh::SparseMatrix< T >::row_start(), libMesh::SparseMatrix< T >::row_stop(), TIMPI::Communicator::set_union(), libMesh::MeshBase::subdomain_ids(), libMesh::Elem::supported_nodal_order(), and libMesh::TOLERANCE.

2476 {
2477  LOG_SCOPE("copy_constraint_rows(mat)", "MeshBase");
2478 
2479  this->_constraint_rows.clear();
2480 
2481  // We're not going to support doing this distributed yet; it'd be
2482  // pointless unless we temporarily had a linear partitioning to
2483  // better match the constraint operator.
2484  MeshSerializer serialize(*this);
2485 
2486  // Our current mesh should already reflect the desired assembly space
2487  libmesh_error_msg_if(this->n_nodes() != constraint_operator.m(),
2488  "Constraint operator matrix with " <<
2489  constraint_operator.m() <<
2490  "rows does not match this mesh with " <<
2491  this->n_nodes() << " nodes");
2492 
2493  // First, find what new unconstrained DoFs we need to add. We can't
2494  // iterate over columns in a SparseMatrix, so we'll iterate over
2495  // rows and keep track of columns.
2496 
2497  // If we have nodes that will work unconstrained, keep track of
2498  // their node ids and corresponding column indices.
2499  // existing_unconstrained_nodes[column_id] = node_id
2500  std::map<dof_id_type, dof_id_type> existing_unconstrained_columns;
2501  std::set<dof_id_type> existing_unconstrained_nodes;
2502 
2503  // In case we need new nodes, keep track of their columns.
2504  // columns[j][k] will be the kth row index and value of column j
2505  typedef
2506  std::unordered_map<dof_id_type,
2507  std::vector<std::pair<dof_id_type, Real>>>
2508  columns_type;
2509  columns_type columns(constraint_operator.n());
2510 
2511  // If we need to precondition the constraint operator (e.g. it's an
2512  // unpreconditioned extraction operator for a Flex IGA matrix),
2513  // we'll want to keep track of the sum of each column, because we'll
2514  // be dividing each column by that sum (Jacobi preconditioning on
2515  // the right, which then leads to symmetric preconditioning on a
2516  // physics Jacobian).
2517  std::unordered_map<dof_id_type, Real> column_sums;
2518 
2519  // Work in parallel, though we'll have to sync shortly
2520  for (auto i : make_range(constraint_operator.row_start(),
2521  constraint_operator.row_stop()))
2522  {
2523  std::vector<numeric_index_type> indices;
2524  std::vector<T> values;
2525 
2526  constraint_operator.get_row(i, indices, values);
2527  libmesh_assert_equal_to(indices.size(), values.size());
2528 
2529  if (indices.size() == 1 &&
2530  values[0] == T(1))
2531  {
2532  // If we have multiple simple Ui=Uj constraints, let the
2533  // first one be our "unconstrained" node and let the others
2534  // be constrained to it.
2535  if (existing_unconstrained_columns.find(indices[0]) !=
2536  existing_unconstrained_columns.end())
2537  {
2538  const auto j = indices[0];
2539  columns[j].emplace_back(i, 1);
2540  }
2541  else
2542  {
2543  existing_unconstrained_nodes.insert(i);
2544  existing_unconstrained_columns.emplace(indices[0],i);
2545  }
2546  }
2547  else
2548  for (auto jj : index_range(indices))
2549  {
2550  const auto j = indices[jj];
2551  const Real coef = libmesh_real(values[jj]);
2552  libmesh_assert_equal_to(coef, values[jj]);
2553  columns[j].emplace_back(i, coef);
2554  }
2555  }
2556 
2557  // Merge data from different processors' slabs of the matrix
2558  this->comm().set_union(existing_unconstrained_nodes);
2559  this->comm().set_union(existing_unconstrained_columns);
2560 
2561  std::vector<columns_type> all_columns;
2562  this->comm().allgather(columns, all_columns);
2563 
2564  columns.clear();
2565  for (auto p : index_range(all_columns))
2566  for (auto & [j, subcol] : all_columns[p])
2567  for (auto [i, v] : subcol)
2568  columns[j].emplace_back(i,v);
2569 
2570  // Keep track of elements on which unconstrained nodes exist, and
2571  // their local node indices.
2572  // node_to_elem_ptrs[node] = [elem_id, local_node_num]
2573  std::unordered_map<const Node *, std::pair<dof_id_type, unsigned int>> node_to_elem_ptrs;
2574 
2575  // Find elements attached to any existing nodes that will stay
2576  // unconstrained. We'll also build a subdomain set here so we don't
2577  // have to assert that the mesh is already prepared before we pick a
2578  // new subdomain for any NodeElems we need to add.
2579  std::set<subdomain_id_type> subdomain_ids;
2580  for (const Elem * elem : this->element_ptr_range())
2581  {
2582  subdomain_ids.insert(elem->subdomain_id());
2583  for (auto n : make_range(elem->n_nodes()))
2584  {
2585  const Node * node = elem->node_ptr(n);
2586  if (existing_unconstrained_nodes.count(node->id()))
2587  node_to_elem_ptrs.emplace(node, std::make_pair(elem->id(), n));
2588  }
2589  }
2590 
2591  const subdomain_id_type new_sbd_id = *subdomain_ids.rbegin() + 1;
2592 
2593  for (auto j : make_range(constraint_operator.n()))
2594  {
2595  // If we already have a good node for this then we're done
2596  if (existing_unconstrained_columns.count(j))
2597  continue;
2598 
2599  // Get a half-decent spot to place a new NodeElem for
2600  // unconstrained DoF(s) here. Getting a *fully*-decent spot
2601  // would require finding a Moore-Penrose pseudoinverse, and I'm
2602  // not going to do that, but scaling a transpose will at least
2603  // get us a little uniqueness to make visualization reasonable.
2604  Point newpt;
2605  Real total_scaling = 0;
2606  unsigned int total_entries = 0;
2607 
2608  // We'll get a decent initial pid choice here too, if only to
2609  // aid in later repartitioning.
2610  std::map<processor_id_type, int> pids;
2611 
2612  auto & column = columns[j];
2613  for (auto [i, r] : column)
2614  {
2615  Node & constrained_node = this->node_ref(i);
2616  const Point constrained_pt = constrained_node;
2617  newpt += r*constrained_pt;
2618  total_scaling += r;
2619  ++total_entries;
2620  ++pids[constrained_node.processor_id()];
2621  }
2622 
2623  if (precondition_constraint_operator)
2624  column_sums[j] = total_scaling;
2625 
2626  libmesh_error_msg_if
2627  (!total_entries,
2628  "Empty column " << j <<
2629  " found in constraint operator matrix");
2630 
2631  // If we have *cancellation* here then we can end up dividing by
2632  // zero; try just evenly scaling across all constrained node
2633  // points instead.
2634  if (total_scaling > TOLERANCE)
2635  newpt /= total_scaling;
2636  else
2637  newpt /= total_entries;
2638 
2639  Node *n = this->add_point(newpt);
2640  std::unique_ptr<Elem> elem = Elem::build(NODEELEM);
2641  elem->set_node(0, n);
2642  elem->subdomain_id() = new_sbd_id;
2643 
2644  Elem * added_elem = this->add_elem(std::move(elem));
2645  this->_elem_dims.insert(0);
2646  this->_elem_default_orders.insert(added_elem->default_order());
2647  this->_supported_nodal_order =
2648  static_cast<Order>
2649  (std::min(static_cast<int>(this->_supported_nodal_order),
2650  static_cast<int>(added_elem->supported_nodal_order())));
2651  this->_mesh_subdomains.insert(new_sbd_id);
2652  node_to_elem_ptrs.emplace(n, std::make_pair(added_elem->id(), 0));
2653  existing_unconstrained_columns.emplace(j,n->id());
2654 
2655  // Repartition the new objects *after* adding them, so a
2656  // DistributedMesh doesn't get confused and think you're not
2657  // adding them on all processors at once.
2658  int n_pids = 0;
2659  for (auto [pid, count] : pids)
2660  if (count >= n_pids)
2661  {
2662  n_pids = count;
2663  added_elem->processor_id() = pid;
2664  n->processor_id() = pid;
2665  }
2666  }
2667 
2668  // Calculate constraint rows in an indexed form that's easy for us
2669  // to allgather
2670  std::unordered_map<dof_id_type,
2671  std::vector<std::pair<std::pair<dof_id_type, unsigned int>,Real>>>
2672  indexed_constraint_rows;
2673 
2674  for (auto i : make_range(constraint_operator.row_start(),
2675  constraint_operator.row_stop()))
2676  {
2677  if (existing_unconstrained_nodes.count(i))
2678  continue;
2679 
2680  std::vector<numeric_index_type> indices;
2681  std::vector<T> values;
2682 
2683  constraint_operator.get_row(i, indices, values);
2684 
2685  std::vector<std::pair<std::pair<dof_id_type, unsigned int>, Real>> constraint_row;
2686 
2687  for (auto jj : index_range(indices))
2688  {
2689  const dof_id_type node_id =
2690  existing_unconstrained_columns[indices[jj]];
2691 
2692  Node & constraining_node = this->node_ref(node_id);
2693 
2694  libmesh_assert(node_to_elem_ptrs.count(&constraining_node));
2695 
2696  auto p = node_to_elem_ptrs[&constraining_node];
2697 
2698  Real coef = libmesh_real(values[jj]);
2699  libmesh_assert_equal_to(coef, values[jj]);
2700 
2701  // If we're preconditioning and we created a nodeelem then
2702  // we can scale the meaning of that nodeelem's value to give
2703  // us a better-conditioned matrix after the constraints are
2704  // applied.
2705  if (precondition_constraint_operator)
2706  if (auto sum_it = column_sums.find(indices[jj]);
2707  sum_it != column_sums.end())
2708  {
2709  const Real scaling = sum_it->second;
2710 
2711  if (scaling > TOLERANCE)
2712  coef /= scaling;
2713  }
2714 
2715  constraint_row.emplace_back(std::make_pair(p, coef));
2716  }
2717 
2718  indexed_constraint_rows.emplace(i, std::move(constraint_row));
2719  }
2720 
2721  this->comm().set_union(indexed_constraint_rows);
2722 
2723  // Add constraint rows as mesh constraint rows
2724  for (auto & [node_id, indexed_row] : indexed_constraint_rows)
2725  {
2726  Node * constrained_node = this->node_ptr(node_id);
2727 
2728  constraint_rows_mapped_type constraint_row;
2729 
2730  for (auto [p, coef] : indexed_row)
2731  {
2732  const Elem * elem = this->elem_ptr(p.first);
2733  constraint_row.emplace_back
2734  (std::make_pair(std::make_pair(elem, p.second), coef));
2735  }
2736 
2737  this->_constraint_rows.emplace(constrained_node,
2738  std::move(constraint_row));
2739  }
2740 }
T libmesh_real(T a)
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
Definition: mesh_base.h:2300
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
static constexpr Real TOLERANCE
std::vector< std::pair< std::pair< const Elem *, unsigned int >, Real > > constraint_rows_mapped_type
Definition: mesh_base.h:1899
TestClass subdomain_id_type
Based on the 4-byte comment warning above, this probably doesn&#39;t work with exodusII at all...
Definition: id_types.h:43
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2409
const Parallel::Communicator & comm() const
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
Add a new Node at Point p to the end of the vertex array, with processor_id procid.
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
Definition: elem.C:442
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:2289
void subdomain_ids(std::set< subdomain_id_type > &ids, const bool global=true) const
Constructs a list of all subdomain identifiers in the local mesh if global == false, and in the global mesh if global == true (default).
Definition: mesh_base.C:1119
libmesh_assert(ctx)
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:2295
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:2282
virtual const Elem * elem_ptr(const dof_id_type i) const =0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176
virtual const Node & node_ref(const dof_id_type i) const
Definition: mesh_base.h:735
virtual const Node * node_ptr(const dof_id_type i) const =0
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67
void set_union(T &data, const unsigned int root_id) const

◆ copy_nodes_and_elements()

void libMesh::UnstructuredMesh::copy_nodes_and_elements ( const MeshBase other_mesh,
const bool  skip_find_neighbors = false,
dof_id_type  element_id_offset = 0,
dof_id_type  node_id_offset = 0,
unique_id_type  unique_id_offset = 0,
std::unordered_map< subdomain_id_type, subdomain_id_type > *  id_remapping = nullptr,
const bool  skip_preparation = false 
)
virtual

Deep copy of nodes and elements from another mesh object (used by subclass copy constructors and by mesh merging operations)

This will not copy most "high level" data in the mesh; that is done separately by constructors. An exception is that, if the other_mesh has element or node extra_integer data, any names for that data which do not already exist on this mesh are added so that all such data can be copied.

If an id_remapping map is provided, then element subdomain ids in other_mesh will be converted using it before adding them to this mesh.

For backwards compatibility, this does some limited mesh preparation after the copy: everything except for renumbering, remote element removal, and partitioning. To skip just the step of that preparation which finds new neighbor_ptr links between elements, set skip_find_neighbors. To skip all of that preparation, set skip_preparation. If preparation is skipped, it is the users responsibility to set the flags indicating what preparation may still be necessary before using the mesh later.

Definition at line 645 of file unstructured_mesh.C.

References libMesh::MeshBase::_elem_integer_names, libMesh::MeshBase::_interior_mesh, libMesh::MeshBase::_node_integer_names, libMesh::Elem::add_child(), libMesh::MeshBase::add_elem(), libMesh::DofObject::add_extra_integers(), libMesh::MeshBase::add_point(), libMesh::MeshBase::allow_detect_interior_parents(), libMesh::MeshBase::allow_find_neighbors(), libMesh::MeshBase::allow_remote_element_removal(), libMesh::MeshBase::allow_renumbering(), libMesh::Elem::disconnected_clone(), libMesh::MeshBase::elem_ptr(), libMesh::MeshBase::element_stored_range(), libMesh::DofObject::id(), libMesh::MeshBase::interior_mesh(), libMesh::MeshBase::is_prepared(), libMesh::libmesh_assert(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids(), libMesh::MeshBase::merge_extra_integer_names(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::n_partitions(), libMesh::ParallelObject::n_processors(), libMesh::Elem::neighbor_ptr(), libMesh::Threads::parallel_for(), libMesh::MeshBase::parallel_max_unique_id(), libMesh::Elem::parent(), libMesh::MeshBase::prepare_for_use(), libMesh::remote_elem, libMesh::MeshBase::reserve_elem(), libMesh::MeshBase::reserve_nodes(), libMesh::MeshBase::set_interior_mesh(), libMesh::Elem::set_neighbor(), libMesh::MeshBase::set_next_unique_id(), libMesh::MeshBase::skip_partitioning(), and libMesh::MeshBase::unset_is_prepared().

Referenced by libMesh::DistributedMesh::DistributedMesh(), libMesh::ReplicatedMesh::ReplicatedMesh(), and stitching_helper().

657 {
658  LOG_SCOPE("copy_nodes_and_elements()", "UnstructuredMesh");
659 
660  // If we're asked to skip all preparation, we should be skipping
661  // find_neighbors specifically.
662  libmesh_assert(!skip_preparation || skip_find_neighbors);
663 
664  std::pair<std::vector<unsigned int>, std::vector<unsigned int>>
665  extra_int_maps = this->merge_extra_integer_names(other_mesh);
666 
667  const unsigned int n_old_node_ints = extra_int_maps.second.size(),
668  n_new_node_ints = _node_integer_names.size(),
669  n_old_elem_ints = extra_int_maps.first.size(),
670  n_new_elem_ints = _elem_integer_names.size();
671 
672  // If we are partitioned into fewer parts than the incoming mesh has
673  // processors to handle, then we need to "wrap" the other Mesh's
674  // processor ids to fit within our range. This can happen, for
675  // example, while stitching meshes with small numbers of elements in
676  // parallel...
677  bool wrap_proc_ids = (this->n_processors() <
678  other_mesh.n_partitions());
679 
680  // We're assuming the other mesh has proper element number ordering,
681  // so that we add parents before their children, and that the other
682  // mesh is consistently partitioned. We're not assuming that node
683  // proc ids are topologically consistent, so we don't just
684  // libmesh_assert_valid_procids.
685 #ifdef DEBUG
688 #endif
689 
690  //Copy in Nodes
691  {
692  //Preallocate Memory if necessary
693  this->reserve_nodes(other_mesh.n_nodes());
694 
695  for (const auto & oldn : other_mesh.node_ptr_range())
696  {
697  processor_id_type added_pid = cast_int<processor_id_type>
698  (wrap_proc_ids ? oldn->processor_id() % this->n_processors() : oldn->processor_id());
699 
700  // Add new nodes in old node Point locations
701  Node * newn =
702  this->add_point(*oldn,
703  oldn->id() + node_id_offset,
704  added_pid);
705 
706  newn->add_extra_integers(n_new_node_ints);
707  for (unsigned int i = 0; i != n_old_node_ints; ++i)
708  newn->set_extra_integer(extra_int_maps.second[i],
709  oldn->get_extra_integer(i));
710 
711 #ifdef LIBMESH_ENABLE_UNIQUE_ID
712  newn->set_unique_id(oldn->unique_id() + unique_id_offset);
713 #endif
714  }
715  }
716 
717  //Copy in Elements
718  {
719  //Preallocate Memory if necessary
720  this->reserve_elem(other_mesh.n_elem());
721 
722  // Declare a map linking old and new elements, needed to copy the neighbor lists
723  typedef std::unordered_map<const Elem *, Elem *> map_type;
724  map_type old_elems_to_new_elems, ip_map;
725 
726  // Loop over the elements
727  for (const auto & old : other_mesh.element_ptr_range())
728  {
729  // Build a new element
730  Elem * newparent = old->parent() ?
731  this->elem_ptr(old->parent()->id() + element_id_offset) :
732  nullptr;
733  auto el = old->disconnected_clone();
734  el->set_parent(newparent);
735 
736  subdomain_id_type sbd_id = old->subdomain_id();
737  if (id_remapping)
738  {
739  auto remapping_it = id_remapping->find(sbd_id);
740  if (remapping_it != id_remapping->end())
741  sbd_id = remapping_it->second;
742  }
743  el->subdomain_id() = sbd_id;
744 
745  // Hold off on trying to set the interior parent because we may actually
746  // add lower dimensional elements before their interior parents
747  if (old->interior_parent())
748  ip_map[old] = el.get();
749 
750 #ifdef LIBMESH_ENABLE_AMR
751  if (old->has_children())
752  for (unsigned int c = 0, nc = old->n_children(); c != nc; ++c)
753  if (old->child_ptr(c) == remote_elem)
754  el->add_child(const_cast<RemoteElem *>(remote_elem), c);
755 
756  //Create the parent's child pointers if necessary
757  if (newparent)
758  {
759  unsigned int oldc = old->parent()->which_child_am_i(old);
760  newparent->add_child(el.get(), oldc);
761  }
762 
763  // Copy the refinement flags
764  el->set_refinement_flag(old->refinement_flag());
765 
766  // Use hack_p_level since we may not have sibling elements
767  // added yet
768  el->hack_p_level(old->p_level());
769 
770  el->set_p_refinement_flag(old->p_refinement_flag());
771 #endif // #ifdef LIBMESH_ENABLE_AMR
772 
773  //Assign all the nodes
774  for (auto i : el->node_index_range())
775  el->set_node(i,
776  this->node_ptr(old->node_id(i) + node_id_offset));
777 
778  // And start it off with the same processor id (mod _n_parts).
779  el->processor_id() = cast_int<processor_id_type>
780  (wrap_proc_ids ? old->processor_id() % this->n_processors() : old->processor_id());
781 
782  // Give it the same element and unique ids
783  el->set_id(old->id() + element_id_offset);
784 
785  el->add_extra_integers(n_new_elem_ints);
786  for (unsigned int i = 0; i != n_old_elem_ints; ++i)
787  el->set_extra_integer(extra_int_maps.first[i],
788  old->get_extra_integer(i));
789 
790 #ifdef LIBMESH_ENABLE_UNIQUE_ID
791  el->set_unique_id(old->unique_id() + unique_id_offset);
792 #endif
793 
794  //Hold onto it
795  if (!skip_find_neighbors)
796  {
797  for (auto s : old->side_index_range())
798  if (old->neighbor_ptr(s) == remote_elem)
799  el->set_neighbor(s, const_cast<RemoteElem *>(remote_elem));
800  this->add_elem(std::move(el));
801  }
802  else
803  {
804  Elem * new_el = this->add_elem(std::move(el));
805  old_elems_to_new_elems[old] = new_el;
806  }
807  }
808 
809  // If the other_mesh had some interior parents, we may need to
810  // copy those pointers (if they're to elements in a third mesh),
811  // or create new equivalent pointers (if they're to elements we
812  // just copied), or scream and die (if the other mesh had interior
813  // parents from a third mesh but we already have interior parents
814  // that aren't to that same third mesh.
815  if (!ip_map.empty())
816  {
817  std::atomic<bool> existing_interior_parents{false};
818 
820  (this->element_stored_range(),
821  [&existing_interior_parents](const ElemRange & range)
822  {
823  for (Elem * elem : range)
824  if (elem->interior_parent())
825  {
826  existing_interior_parents = true;
827  break;
828  }
829  });
830 
831  MeshBase * other_interior_mesh =
832  const_cast<MeshBase *>(&other_mesh.interior_mesh());
833 
834  // If we don't already have interior parents, then we can just
835  // use whatever interior_mesh we need for the incoming
836  // elements.
837  if (!existing_interior_parents)
838  {
839  if (other_interior_mesh == &other_mesh)
840  this->set_interior_mesh(*this);
841  else
842  this->set_interior_mesh(*other_interior_mesh);
843  }
844 
845  if (other_interior_mesh == &other_mesh &&
846  _interior_mesh == this)
847  for (auto & elem_pair : ip_map)
848  elem_pair.second->set_interior_parent(
849  this->elem_ptr(elem_pair.first->interior_parent()->id() + element_id_offset));
850  else if (other_interior_mesh == _interior_mesh)
851  for (auto & elem_pair : ip_map)
852  {
853  Elem * ip = const_cast<Elem *>(elem_pair.first->interior_parent());
854  libmesh_assert(ip == remote_elem ||
855  ip == other_interior_mesh->elem_ptr(ip->id()));
856  elem_pair.second->set_interior_parent(ip);
857  }
858  else
859  libmesh_error_msg("Cannot copy boundary elements between meshes with different interior meshes");
860  }
861 
862  // Loop (again) over the elements to fill in the neighbors
863  if (skip_find_neighbors)
864  {
865  old_elems_to_new_elems[remote_elem] = const_cast<RemoteElem*>(remote_elem);
866 
867  for (const auto & old_elem : other_mesh.element_ptr_range())
868  {
869  Elem * new_elem = old_elems_to_new_elems[old_elem];
870  for (auto s : old_elem->side_index_range())
871  {
872  const Elem * old_neighbor = old_elem->neighbor_ptr(s);
873  Elem * new_neighbor = old_elems_to_new_elems[old_neighbor];
874  new_elem->set_neighbor(s, new_neighbor);
875  }
876  }
877  }
878  }
879 
880 #ifdef LIBMESH_ENABLE_UNIQUE_ID
881  // We set the unique ids of nodes after adding them to the mesh such that our value of
882  // _next_unique_id may be wrong. So we amend that here
883  this->set_next_unique_id(other_mesh.parallel_max_unique_id() + unique_id_offset + 1);
884 #endif
885 
886  // Finally, partially prepare the new Mesh for use, if that isn't
887  // being skipped.
888  // Even the default behavior here is for backwards compatibility,
889  // and we don't want to prepare everything.
890 
891  if (!skip_preparation)
892  {
893  // Keep the same numbering and partitioning and distribution
894  // status for now, but save our original policies to restore
895  // later.
896  const bool allowed_renumbering = this->allow_renumbering();
897  const bool allowed_find_neighbors = this->allow_find_neighbors();
898  const bool allowed_elem_removal = this->allow_remote_element_removal();
899  const bool allowed_detect_detect_interior_parents = this->allow_detect_interior_parents();
900  this->allow_renumbering(false);
901  this->allow_remote_element_removal(false);
902  this->allow_find_neighbors(!skip_find_neighbors);
904 
905  // We should generally be able to skip *all* partitioning here
906  // because we're only adding one already-consistent mesh to
907  // another.
908  const bool skipped_partitioning = this->skip_partitioning();
909  this->skip_partitioning(true);
910 
911  const bool was_prepared = this->is_prepared();
912  this->prepare_for_use();
913 
914  //But in the long term, don't change our policies.
915  this->allow_find_neighbors(allowed_find_neighbors);
916  this->allow_renumbering(allowed_renumbering);
917  this->allow_remote_element_removal(allowed_elem_removal);
918  this->skip_partitioning(skipped_partitioning);
919  this->allow_detect_interior_parents(allowed_detect_detect_interior_parents);
920 
921  // That prepare_for_use() call marked us as prepared, but we
922  // specifically avoided some important preparation, so we might not
923  // actually be prepared now.
924  if (skip_find_neighbors ||
925  !was_prepared || !other_mesh.is_prepared())
926  this->unset_is_prepared();
927  }
928 
929  // In general we've just invalidated just about everything, and we'd
930  // like to unset_is_prepared(), but specific use cases might know a
931  // priori that they're still partitioned well, or that they've
932  // copied in a disjoint mesh component and don't need new neighbor
933  // pointers, or that they're not adding anything that would change
934  // cached subdomain/element/boundary sets, etc., so we'll rely on
935  // users of the "advanced" skip_preparation option to also set what
936  // preparation they still need.
937 
938  // else
939  // this->unset_is_prepared();
940 }
void parallel_for(const Range &range, const Body &body, unsigned int n_threads=libMesh::n_threads())
Execute the provided function object in parallel on the specified range.
Definition: threads_none.h:73
virtual void reserve_nodes(const dof_id_type nn)=0
Reserves space for a known number of nodes.
const Elem * parent() const
Definition: elem.h:3044
bool is_prepared() const
Definition: mesh_base.C:1057
In parallel meshes where a ghost element has neighbors which do not exist on the local processor...
Definition: remote_elem.h:59
A Node is like a Point, but with more information.
Definition: node.h:52
const MeshBase & interior_mesh() const
Definition: mesh_base.h:2008
virtual unique_id_type parallel_max_unique_id() const =0
void set_interior_mesh(MeshBase &int_mesh)
Sets the interior mesh.
Definition: mesh_base.h:2018
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2338
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
Definition: mesh_base.h:2219
bool allow_detect_interior_parents() const
Definition: mesh_base.h:1360
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
void add_child(Elem *elem)
Adds a child pointer to the array of children of this element.
Definition: elem.C:2053
The StoredRange class defines a contiguous, divisible set of objects.
Definition: stored_range.h:54
virtual void set_next_unique_id(unique_id_type id)=0
Sets the next available unique id to be used.
void allow_detect_interior_parents(bool allow)
If false is passed then this mesh will no longer work to detect interior parents when being prepared ...
Definition: mesh_base.h:1359
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
Add a new Node at Point p to the end of the vertex array, with processor_id procid.
This is the MeshBase class.
Definition: mesh_base.h:80
uint8_t processor_id_type
processor_id_type n_processors() const
dof_id_type id() const
Definition: dof_object.h:819
const ElemRange & element_stored_range()
Definition: mesh_base.C:1913
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
bool allow_find_neighbors() const
Definition: mesh_base.h:1353
libmesh_assert(ctx)
std::pair< std::vector< unsigned int >, std::vector< unsigned int > > merge_extra_integer_names(const MeshBase &other)
Merge extra-integer arrays from an other mesh.
Definition: mesh_base.C:2345
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 th...
Definition: mesh_tools.C:1421
virtual std::unique_ptr< Elem > disconnected_clone() const
Definition: elem.C:410
bool allow_remote_element_removal() const
Definition: mesh_base.h:1369
void set_neighbor(const unsigned int i, Elem *n)
Assigns n as the neighbor.
Definition: elem.h:2632
void prepare_for_use()
Definition: mesh_base.C:860
void libmesh_assert_parallel_consistent_procids< Node >(const MeshBase &mesh)
Definition: mesh_tools.C:2218
bool skip_partitioning() const
Definition: mesh_base.h:1421
unsigned int n_partitions() const
Definition: mesh_base.h:1516
virtual const Elem * elem_ptr(const dof_id_type i) const =0
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:2612
void set_unique_id(unique_id_type new_id)
Sets the unique_id for this DofObject.
Definition: dof_object.h:848
void add_extra_integers(const unsigned int n_integers)
Assigns a set of extra integers to this DofObject.
Definition: dof_object.C:482
bool allow_renumbering() const
Definition: mesh_base.h:1346
virtual dof_id_type n_elem() const =0
processor_id_type processor_id() const
virtual void reserve_elem(const dof_id_type ne)=0
Reserves space for a known number of elements.
void unset_is_prepared()
Tells this we have done some operation where we should no longer consider ourself prepared...
Definition: mesh_base.C:1063
void set_extra_integer(const unsigned int index, const dof_id_type value)
Sets the value on this object of the extra integer associated with index, which should have been obta...
Definition: dof_object.h:1062
virtual dof_id_type n_nodes() const =0
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ create_pid_mesh()

void libMesh::UnstructuredMesh::create_pid_mesh ( UnstructuredMesh pid_mesh,
const processor_id_type  pid 
) const

Generates a new mesh containing all the elements which are assigned to processor pid.

This mesh is written to the pid_mesh reference which you must create and pass to the function.

Definition at line 1423 of file unstructured_mesh.C.

References create_submesh(), libMesh::ParallelObject::n_processors(), and libMesh::out.

1425 {
1426 
1427  // Issue a warning if the number the number of processors
1428  // currently available is less that that requested for
1429  // partitioning. This is not necessarily an error since
1430  // you may run on one processor and still partition the
1431  // mesh into several partitions.
1432 #ifdef DEBUG
1433  if (this->n_processors() < pid)
1434  {
1435  libMesh::out << "WARNING: You are creating a "
1436  << "mesh for a processor id (="
1437  << pid
1438  << ") greater than "
1439  << "the number of processors available for "
1440  << "the calculation. (="
1441  << this->n_processors()
1442  << ")."
1443  << std::endl;
1444  }
1445 #endif
1446 
1447  this->create_submesh (pid_mesh,
1448  this->active_pid_elements_begin(pid),
1449  this->active_pid_elements_end(pid));
1450 }
processor_id_type n_processors() const
OStreamProxy out
void create_submesh(UnstructuredMesh &new_mesh, const const_element_iterator &it, const const_element_iterator &it_end) const
Constructs a mesh called "new_mesh" from the current mesh by iterating over the elements between it a...

◆ create_submesh()

void libMesh::UnstructuredMesh::create_submesh ( UnstructuredMesh new_mesh,
const const_element_iterator it,
const const_element_iterator it_end 
) const

Constructs a mesh called "new_mesh" from the current mesh by iterating over the elements between it and it_end and adding them to the new mesh.

Definition at line 1458 of file unstructured_mesh.C.

References libMesh::MeshBase::_node_integer_names, libMesh::MeshBase::add_elem(), libMesh::DofObject::add_extra_integers(), libMesh::MeshBase::add_point(), libMesh::BoundaryInfo::add_side(), libMesh::as_range(), libMesh::BoundaryInfo::boundary_ids(), libMesh::MeshBase::clear(), libMesh::MeshBase::delete_remote_elements(), libMesh::MeshBase::get_boundary_info(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::MeshBase::merge_extra_integer_names(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::node_ptr(), libMesh::MeshBase::prepare_for_use(), libMesh::MeshBase::query_node_ptr(), libMesh::DofObject::set_extra_integer(), libMesh::Elem::set_node(), and libMesh::DofObject::set_unique_id().

Referenced by create_pid_mesh().

1461 {
1462  // Just in case the subdomain_mesh already has some information
1463  // in it, get rid of it.
1464  new_mesh.clear();
1465 
1466  // If we're not serial, our submesh isn't either.
1467  // There are no remote elements to delete on an empty mesh, but
1468  // calling the method to do so marks the mesh as parallel.
1469  if (!this->is_serial())
1470  new_mesh.delete_remote_elements();
1471 
1472  // Fail if (*this == new_mesh), we cannot create a submesh inside ourself!
1473  // This may happen if the user accidentally passes the original mesh into
1474  // this function! We will check this by making sure we did not just
1475  // clear ourself.
1476  libmesh_assert_not_equal_to (this->n_nodes(), 0);
1477  libmesh_assert_not_equal_to (this->n_elem(), 0);
1478 
1479  // Container to catch boundary IDs handed back by BoundaryInfo
1480  std::vector<boundary_id_type> bc_ids;
1481 
1482  // Put any extra integers on the new mesh too
1483  new_mesh.merge_extra_integer_names(*this);
1484  const unsigned int n_node_ints = _node_integer_names.size();
1485 
1486  for (const auto & old_elem : as_range(it, it_end))
1487  {
1488  // Add an equivalent element type to the new_mesh.
1489  // disconnected_clone() copies ids, extra element integers, etc.
1490  auto uelem = old_elem->disconnected_clone();
1491  Elem * new_elem = new_mesh.add_elem(std::move(uelem));
1492  libmesh_assert(new_elem);
1493 
1494  // Loop over the nodes on this element.
1495  for (auto n : old_elem->node_index_range())
1496  {
1497  const dof_id_type this_node_id = old_elem->node_id(n);
1498 
1499  // Add this node to the new mesh if it's not there already
1500  if (!new_mesh.query_node_ptr(this_node_id))
1501  {
1502  Node * newn =
1503  new_mesh.add_point (old_elem->point(n),
1504  this_node_id,
1505  old_elem->node_ptr(n)->processor_id());
1506 
1507  newn->add_extra_integers(n_node_ints);
1508  for (unsigned int i = 0; i != n_node_ints; ++i)
1509  newn->set_extra_integer(i, old_elem->node_ptr(n)->get_extra_integer(i));
1510 
1511 #ifdef LIBMESH_ENABLE_UNIQUE_ID
1512  newn->set_unique_id(old_elem->node_ptr(n)->unique_id());
1513 #endif
1514  }
1515 
1516  // Define this element's connectivity on the new mesh
1517  new_elem->set_node(n, new_mesh.node_ptr(this_node_id));
1518  }
1519 
1520  // Maybe add boundary conditions for this element
1521  for (auto s : old_elem->side_index_range())
1522  {
1523  this->get_boundary_info().boundary_ids(old_elem, s, bc_ids);
1524  new_mesh.get_boundary_info().add_side (new_elem, s, bc_ids);
1525  }
1526  } // end loop over elements
1527 
1528  // Prepare the new_mesh for use
1529  new_mesh.prepare_for_use();
1530 }
virtual Node *& set_node(const unsigned int i)
Definition: elem.h:2564
A Node is like a Point, but with more information.
Definition: node.h:52
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly created (or read) mesh for use.
Definition: mesh_base.C:824
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:170
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
Add a new Node at Point p to the end of the vertex array, with processor_id procid.
virtual bool is_serial() const
Definition: mesh_base.h:347
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
Definition: simple_range.h:57
virtual const Node * query_node_ptr(const dof_id_type i) const =0
libmesh_assert(ctx)
std::pair< std::vector< unsigned int >, std::vector< unsigned int > > merge_extra_integer_names(const MeshBase &other)
Merge extra-integer arrays from an other mesh.
Definition: mesh_base.C:2345
virtual void clear()
Deletes all the element and node data that is currently stored.
Definition: mesh_base.C:1029
void set_unique_id(unique_id_type new_id)
Sets the unique_id for this DofObject.
Definition: dof_object.h:848
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
Add side side of element number elem with boundary id id to the boundary information data structure...
void add_extra_integers(const unsigned int n_integers)
Assigns a set of extra integers to this DofObject.
Definition: dof_object.C:482
virtual void delete_remote_elements()
When supported, deletes all nonlocal elements of the mesh except for "ghosts" which touch a local ele...
Definition: mesh_base.h:389
virtual dof_id_type n_elem() const =0
virtual const Node * node_ptr(const dof_id_type i) const =0
void set_extra_integer(const unsigned int index, const dof_id_type value)
Sets the value on this object of the extra integer associated with index, which should have been obta...
Definition: dof_object.h:1062
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

◆ default_ghosting()

GhostingFunctor& libMesh::MeshBase::default_ghosting ( )
inlineinherited

Default ghosting functor.

Definition at line 1474 of file mesh_base.h.

References libMesh::MeshBase::_default_ghosting.

1474 { return *_default_ghosting; }
std::unique_ptr< GhostingFunctor > _default_ghosting
The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior...
Definition: mesh_base.h:2382

◆ default_mapping_data()

unsigned char libMesh::MeshBase::default_mapping_data ( ) const
inlineinherited

Returns any default data value used by the master space to physical space mapping.

Definition at line 949 of file mesh_base.h.

References libMesh::MeshBase::_default_mapping_data.

Referenced by libMesh::ReplicatedMesh::add_elem(), libMesh::DistributedMesh::add_elem(), MeshInputTest::helperTestingDynaQuad(), libMesh::ReplicatedMesh::insert_elem(), libMesh::DistributedMesh::insert_elem(), libMesh::VTKIO::nodes_to_vtk(), AllRBBTest::test_box(), and MeshInputTest::testDynaReadPatch().

950  {
951  return _default_mapping_data;
952  }
unsigned char _default_mapping_data
The default mapping data (unused with Lagrange, used for nodal weight lookup index with rational base...
Definition: mesh_base.h:2157

◆ default_mapping_type()

ElemMappingType libMesh::MeshBase::default_mapping_type ( ) const
inlineinherited

Returns the default master space to physical space mapping basis functions to be used on newly added elements.

Definition at line 931 of file mesh_base.h.

References libMesh::MeshBase::_default_mapping_type.

Referenced by libMesh::ReplicatedMesh::add_elem(), libMesh::DistributedMesh::add_elem(), libMesh::VTKIO::cells_to_vtk(), MeshInputTest::helperTestingDynaQuad(), libMesh::ReplicatedMesh::insert_elem(), libMesh::DistributedMesh::insert_elem(), libMesh::VTKIO::nodes_to_vtk(), libMesh::VTKIO::read(), MeshInputTest::testDynaFileMappings(), MeshInputTest::testDynaReadPatch(), and MeshInputTest::testExodusFileMappings().

932  {
933  return _default_mapping_type;
934  }
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
Definition: mesh_base.h:2150

◆ delete_elem()

virtual void libMesh::MeshBase::delete_elem ( Elem e)
pure virtualinherited

◆ delete_node()

virtual void libMesh::MeshBase::delete_node ( Node n)
pure virtualinherited

◆ delete_remote_elements()

virtual void libMesh::MeshBase::delete_remote_elements ( )
inlinevirtualinherited

When supported, deletes all nonlocal elements of the mesh except for "ghosts" which touch a local element, and deletes all nodes which are not part of a local or ghost element.

Reimplemented in libMesh::DistributedMesh.

Definition at line 389 of file mesh_base.h.

References libMesh::MeshBase::_preparation, and libMesh::MeshBase::Preparation::has_removed_remote_elements.

Referenced by libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshBase::complete_preparation(), create_submesh(), libMesh::Nemesis_IO::read(), libMesh::BoundaryInfo::sync(), and libMesh::MeshSerializer::~MeshSerializer().

389  {
391  }
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ detect_interior_parents()

void libMesh::MeshBase::detect_interior_parents ( )
inherited

Search the mesh for elements that have a neighboring element of dim+1 and set that element as the interior parent.

Definition at line 2049 of file mesh_base.C.

References libMesh::MeshBase::_preparation, libMesh::Elem::dim(), libMesh::MeshBase::elem_dimensions(), libMesh::MeshBase::elem_ptr(), libMesh::MeshBase::elem_ref(), libMesh::MeshBase::Preparation::has_cached_elem_data, libMesh::MeshBase::Preparation::has_interior_parent_ptrs, libMesh::MeshBase::interior_mesh(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::MeshBase::max_elem_id(), and libMesh::MeshTools::Subdivision::next.

Referenced by libMesh::MeshBase::complete_preparation().

2050 {
2051  LOG_SCOPE("detect_interior_parents()", "MeshBase");
2052 
2053  // This requires an inspection on every processor
2054  parallel_object_only();
2055 
2056  // This requires up-to-date mesh dimensions in cache
2058 
2059  // Early return if the mesh is empty or has elements of a single spatial dimension.
2060  if (this->elem_dimensions().size() <= 1)
2061  {
2063  return;
2064  }
2065 
2066  // Convenient elem_dimensions iterators
2067  const auto dim_start = this->elem_dimensions().begin();
2068  const auto dim_end = this->elem_dimensions().end();
2069 
2070  // In this function we find only +1 dimensional interior parents,
2071  // (so, for a given element el, the interior parent p must satisfy p.dim() == el.dim() + 1).
2072  // Therefore, we can avoid checking the existence of interior parents
2073  // for all those elements el such there there is no p with p.dim() == el.dim() + 1.
2074  // We store whether to skip any given dimension in the construction of interior parents
2075  // inside the vector in dimensions_to_skip_for_interior_parents.
2076  std::vector<bool> skip_dimension_for_interior_parents(/*count=*/LIBMESH_DIM+1, /*value=*/false);
2077  skip_dimension_for_interior_parents.back() = true;
2078 
2079  // Moreover, in the following, we will build a node-to-elem map.
2080  // It is among the elems of this map that we will look for interior parents.
2081  // Therefore, we can skip all elems p such that there is no el with el.dim() == p.dim() - 1.
2082  // We store whether to skip any given dimension in the construction of the node-to-elem map
2083  // in the vector skip_dimensions_for_node_to_el_map.
2084  std::vector<bool> skip_dimensions_for_node_to_el_map(/*count=*/LIBMESH_DIM+1, /*value=*/false);
2085  skip_dimensions_for_node_to_el_map[*dim_start] = true;
2086 
2087  // We also create a flag to know if all dimensions should be skipped,
2088  // and if we should therefore return early.
2089  bool skip_all_dimensions = true;
2090 
2091  // Fill dimensions_to_skip_for_interior_parents and dimensions_to_skip_for_node_to_el_map.
2092  for (auto [it, next] = std::make_tuple(dim_start, std::next(dim_start));
2093  next != dim_end; ++it, ++next)
2094  {
2095  if (*it + 1 != *next) // if sequential dimensions differ by exactly 1
2096  {
2097  skip_dimension_for_interior_parents[*it] = true;
2098  skip_dimensions_for_node_to_el_map[*next] = true;
2099  }
2100  else if (!skip_dimension_for_interior_parents[*it])
2101  skip_all_dimensions = false;
2102  }
2103 
2104  // There is nothing to do if all dimensions should be
2105  // skipped. Before returning, we must also set the flag that says
2106  // "interior parent pointers have been set up" even though we
2107  // determined there was no work to be done.
2108  if (skip_all_dimensions)
2109  {
2111  return;
2112  }
2113 
2114  // Do we have interior parent pointers going to a different mesh?
2115  // If so then we'll still check to make sure that's the only place
2116  // they go, so we can libmesh_not_implemented() if not.
2117  const bool separate_interior_mesh = (&(this->interior_mesh()) != this);
2118 
2119  // This map will be used to set interior parents
2120  std::unordered_map<dof_id_type, std::vector<dof_id_type>> node_to_elem;
2121 
2122  for (const auto & elem : this->element_ptr_range())
2123  {
2124  // Ignore element if it cannot be interior parent of any other elem.
2125  if (skip_dimensions_for_node_to_el_map[elem->dim()])
2126  continue;
2127 
2128  // Populating the node_to_elem map, same as MeshTools::build_nodes_to_elem_map
2129  for (auto n : make_range(elem->n_vertices()))
2130  {
2131  libmesh_assert_less (elem->id(), this->max_elem_id());
2132 
2133  node_to_elem[elem->node_id(n)].push_back(elem->id());
2134  }
2135  }
2136 
2137  // Automatically set interior parents
2138  for (const auto & element : this->element_ptr_range())
2139  {
2140  // Ignore elements with dimensions to skip
2141  // or elements that already have an interior parent.
2142  if (skip_dimension_for_interior_parents[element->dim()] || element->interior_parent())
2143  continue;
2144 
2145  // Start by generating sets of dim+1 dimensional elements that
2146  // touch each vertex of the current element. If we encounter a
2147  // vertex not connected to _any_ dim+1 dimensional elements,
2148  // then we can exit the loop without checking the remaining
2149  // vertices since an interior parent (if it exists) will be
2150  // connected to all vertices of the current element.
2151  std::vector<std::set<dof_id_type>> neighbors( element->n_vertices() );
2152 
2153  bool found_interior_parents = true;
2154 
2155  for (auto n : make_range(element->n_vertices()))
2156  {
2157  auto it = node_to_elem.find(element->node_id(n));
2158 
2159  // Check at first that this node is not isolated.
2160  if (it == node_to_elem.end())
2161  {
2162  found_interior_parents = false;
2163  break; // out of n-loop
2164  }
2165 
2166  for (const auto & vertex_neighbor_id : it->second)
2167  if (this->elem_ref(vertex_neighbor_id).dim() == element->dim()+1)
2168  neighbors[n].insert(vertex_neighbor_id);
2169 
2170  if (neighbors[n].empty())
2171  {
2172  // We have found an empty set for one vertex, no reason
2173  // to continue.
2174  found_interior_parents = false;
2175  break; // out of n-loop
2176  }
2177  }
2178 
2179  // If we have generated a non-empty set of elements for each
2180  // vertex, we will now look for a vertex_neighbor_id that
2181  // appears in _all_ of those sets. If found, this is our interior
2182  // parent id. If multiple such common ids are found, we will
2183  // take the lowest such id to be the interior parent id.
2184  if (found_interior_parents)
2185  {
2186  std::set<dof_id_type> & neighbors_0 = neighbors[0];
2187  for (const auto & interior_parent_id : neighbors_0)
2188  {
2189  found_interior_parents = false;
2190  for (auto n : make_range(1u, element->n_vertices()))
2191  {
2192  if (neighbors[n].count(interior_parent_id))
2193  {
2194  found_interior_parents = true;
2195  }
2196  else
2197  {
2198  found_interior_parents = false;
2199  break;
2200  }
2201  }
2202 
2203  if (found_interior_parents)
2204  {
2205  element->set_interior_parent(this->elem_ptr(interior_parent_id));
2206  break;
2207  }
2208  }
2209 
2210  // Do we have a mixed dimensional mesh that contains some of
2211  // its own interior parents, but we already expect to have
2212  // interior parents on a different mesh? That's going to
2213  // take some work to support if anyone needs it.
2214  if (separate_interior_mesh)
2215  libmesh_not_implemented_msg
2216  ("interior_parent() values in multiple meshes are unsupported.");
2217  }
2218  }
2219 
2220  // This flag doesn't necessarily mean any Elems actually have
2221  // interior parent pointers, just that we did all the work to
2222  // determine whether or not they do.
2224 }
const MeshBase & interior_mesh() const
Definition: mesh_base.h:2008
virtual dof_id_type max_elem_id() const =0
libmesh_assert(ctx)
const std::set< unsigned char > & elem_dimensions() const
Definition: mesh_base.h:420
virtual const Elem * elem_ptr(const dof_id_type i) const =0
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162
static const unsigned int next[3]
A lookup table for the increment modulo 3 operation, for iterating through the three nodes per elemen...
virtual unsigned short dim() const =0
virtual const Elem & elem_ref(const dof_id_type i) const
Definition: mesh_base.h:778
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176

◆ elem_default_orders()

const std::set<Order>& libMesh::MeshBase::elem_default_orders ( ) const
inlineinherited
Returns
A const reference to a std::set of element default orders present in the mesh.

Definition at line 427 of file mesh_base.h.

References libMesh::MeshBase::_elem_default_orders.

Referenced by MeshSmootherTest::testVariationalSmoother().

428  { return _elem_default_orders; }
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:2289

◆ elem_dimensions()

const std::set<unsigned char>& libMesh::MeshBase::elem_dimensions ( ) const
inlineinherited
Returns
A const reference to a std::set of element dimensions present in the mesh.

Definition at line 420 of file mesh_base.h.

References libMesh::MeshBase::_elem_dims.

Referenced by libMesh::System::calculate_norm(), libMesh::MeshBase::detect_interior_parents(), libMesh::TreeNode< N >::insert(), and libMesh::VariationalMeshSmoother::setup().

421  { return _elem_dims; }
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:2282

◆ elem_ptr() [1/2]

virtual const Elem* libMesh::MeshBase::elem_ptr ( const dof_id_type  i) const
pure virtualinherited
Returns
A pointer to the \( i^{th} \) element, which should be present in this processor's subset of the mesh data structure.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by NonManifoldTestPartitioner::_do_partition(), libMesh::MeshTools::Subdivision::add_boundary_ghosts(), libMesh::BoundaryInfo::add_edge(), libMesh::BoundaryInfo::add_elements(), libMesh::BoundaryInfo::add_shellface(), libMesh::BoundaryInfo::add_side(), AllSecondOrderTest::allCompleteOrderMixed(), AllSecondOrderTest::allCompleteOrderRange(), AllSecondOrderTest::allSecondOrderMixed(), AllSecondOrderTest::allSecondOrderRange(), DisjointNeighborTest::build_four_disjoint_elems(), libMesh::MeshBase::copy_constraint_rows(), copy_nodes_and_elements(), libMesh::MeshBase::detect_interior_parents(), libMesh::DTKAdapter::DTKAdapter(), libMesh::MeshBase::elem_ref(), libMesh::DTKEvaluator::evaluate(), find_neighbors(), libMesh::ExodusII_IO_Helper::get_sideset_data_indices(), libMesh::UNVIO::groups_in(), libMesh::MeshTetInterface::improve_hull_integrity(), libMesh::ErrorVector::is_active_elem(), libMesh::MeshTools::libmesh_assert_valid_constraint_rows(), LinearElasticityWithContact::move_mesh(), libMesh::MeshTools::n_connected_components(), AugmentSparsityOnNodes::operator()(), libMesh::BoundaryInfo::operator=(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::query_ghosting_functors(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::ExodusII_IO_Helper::read_edge_blocks(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::ExodusII_IO_Helper::read_sideset_data(), stitching_helper(), VolumeTest::testHex20PLevelTrueCentroid(), InfFERadialTest::testInfQuants(), InfFERadialTest::testInfQuants_numericDeriv(), InfFERadialTest::testRefinement(), EquationSystemsTest::testRefineThenReinitPreserveFlags(), InfFERadialTest::testSides(), InfFERadialTest::testSingleOrder(), VolumeTest::testTwistedVolume(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_sideset_data(), and libMesh::ExodusII_IO_Helper::write_sidesets().

◆ elem_ptr() [2/2]

virtual Elem* libMesh::MeshBase::elem_ptr ( const dof_id_type  i)
pure virtualinherited
Returns
A writable pointer to the \( i^{th} \) element, which should be present in this processor's subset of the mesh data structure.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

◆ elem_ref() [1/2]

virtual const Elem& libMesh::MeshBase::elem_ref ( const dof_id_type  i) const
inlinevirtualinherited
Returns
A reference to the \( i^{th} \) element, which should be present in this processor's subset of the mesh data structure.

Definition at line 778 of file mesh_base.h.

References libMesh::MeshBase::elem_ptr().

Referenced by libMesh::SyncRefinementFlags::act_on_data(), libMesh::SyncSubdomainIds::act_on_data(), libMesh::SyncElementIntegers::act_on_data(), libMesh::AbaqusIO::assign_sideset_ids(), libMesh::AbaqusIO::assign_subdomain_ids(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::MeshBase::detect_interior_parents(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::SyncRefinementFlags::gather_data(), libMesh::SyncSubdomainIds::gather_data(), libMesh::SyncElementIntegers::gather_data(), libMesh::MeshTetInterface::improve_hull_integrity(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), MeshPerElemTest< elem_type >::meshes_equal_enough(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::RBParametrizedFunction::preevaluate_parametrized_function_on_mesh(), libMesh::RBParametrizedFunction::preevaluate_parametrized_function_on_mesh_sides(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_remote_elem(), SystemsTest::testDofCouplingWithVarGroups(), MeshExtruderTest::testExtruder(), SystemsTest::testSetSystemParameterOverEquationSystem(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::FroIO::write(), libMesh::Nemesis_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::GmshIO::write_mesh(), and libMesh::ExodusII_IO_Helper::write_sidesets().

779  {
780  return *this->elem_ptr(i);
781  }
virtual const Elem * elem_ptr(const dof_id_type i) const =0

◆ elem_ref() [2/2]

virtual Elem& libMesh::MeshBase::elem_ref ( const dof_id_type  i)
inlinevirtualinherited
Returns
A writable reference to the \( i^{th} \) element, which should be present in this processor's subset of the mesh data structure.

Definition at line 788 of file mesh_base.h.

References libMesh::MeshBase::elem_ptr().

789  {
790  return *this->elem_ptr(i);
791  }
virtual const Elem * elem_ptr(const dof_id_type i) const =0

◆ element_stored_range()

const ElemRange & libMesh::MeshBase::element_stored_range ( )
inherited
Returns
A reference to a cached vector copy of a range of pointers to all semilocal elements, suitable for threading.

Iterating over all semilocal elements is most useful for modifying the mesh, so we only have a non-const version for now.

Definition at line 1913 of file mesh_base.C.

References libMesh::MeshBase::_element_stored_range, libMesh::Threads::in_threads, and libMesh::libmesh_assert().

Referenced by libMesh::EquationSystems::_add_system_to_nodes_and_elems(), libMesh::EquationSystems::allgather(), libMesh::MeshBase::change_elemset_code(), libMesh::MeshTools::Modification::change_subdomain_id(), libMesh::MeshRefinement::coarsen_elements(), copy_nodes_and_elements(), find_neighbors(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::DofMap::reinit(), libMesh::EquationSystems::reinit_mesh(), libMesh::EquationSystems::reinit_solutions(), and libMesh::MeshBase::size_elem_extra_integers().

1914 {
1915  if (!_element_stored_range)
1916  {
1917  // Range construction may not be safe within threads
1919 
1921  std::make_unique<ElemRange>(this->elements_begin(),
1922  this->elements_end());
1923  }
1924 
1925  return *_element_stored_range;
1926 }
std::unique_ptr< ElemRange > _element_stored_range
A cached ElemRange for threaded mutation of all semilocal elements of this mesh.
Definition: mesh_base.h:2172
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!Threadsin_thre...
Definition: threads.C:33
libmesh_assert(ctx)

◆ find_neighbors()

void libMesh::UnstructuredMesh::find_neighbors ( const bool  reset_remote_elements = false,
const bool  reset_current_list = true,
const bool  assert_valid = true 
)
overridevirtual

Other functions from MeshBase requiring re-definition.

Here we look at all of the child elements which don't already have valid neighbors.

If a child element has a nullptr neighbor it is either because it is on the boundary or because its neighbor is at a different level. In the latter case we must get the neighbor from the parent.

If a child element has a remote_elem neighbor on a boundary it shares with its parent, that info may have become out-dated through coarsening of the neighbor's parent. In this case, if the parent's neighbor is active then the child should share it.

Furthermore, that neighbor better be active, otherwise we missed a child somewhere.

We also need to look through children ordered by increasing refinement level in order to add new interior_parent() links in boundary elements which have just been generated by refinement, and fix links in boundary elements whose previous interior_parent() has just been coarsened away.

Implements libMesh::MeshBase.

Definition at line 955 of file unstructured_mesh.C.

References libMesh::MeshBase::_preparation, libMesh::Elem::active(), libMesh::Elem::ancestor(), libMesh::as_range(), libMesh::Elem::child_ptr(), libMesh::Elem::child_ref_range(), libMesh::MeshBase::elem_ptr(), libMesh::MeshBase::element_stored_range(), libMesh::err, libMesh::MeshBase::get_boundary_info(), libMesh::MeshBase::get_disjoint_neighbor_boundary_pairs(), libMesh::BoundaryInfo::has_boundary_id(), libMesh::Elem::has_children(), libMesh::MeshBase::Preparation::has_neighbor_ptrs, libMesh::Elem::hmin(), libMesh::DofObject::id(), libMesh::Elem::interior_parent(), libMesh::Elem::is_ancestor_of(), libMesh::Elem::is_child_on_side(), libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::MeshTools::libmesh_assert_valid_amr_interior_parents(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::libmesh_ignore(), libMesh::Elem::n_children(), libMesh::MeshTools::n_levels(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::neighbor_ptr_range(), libMesh::Threads::parallel_for(), libMesh::Elem::parent(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::Real, libMesh::remote_elem, libMesh::Elem::set_interior_parent(), libMesh::Elem::set_neighbor(), libMesh::Elem::side_ptr(), libMesh::MeshBase::sub_point_locator(), libMesh::Elem::subactive(), libMesh::TOLERANCE, libMesh::Elem::vertex_average(), libMesh::Elem::which_child_am_i(), and libMesh::NameBasedIO::write().

Referenced by libMesh::TriangleWrapper::copy_tri_to_mesh(), libMesh::MeshTetInterface::improve_hull_integrity(), libMesh::Poly2TriTriangulator::insert_refinement_points(), stitching_helper(), and libMesh::TriangleInterface::triangulate().

958 {
959  // We might actually want to run this on an empty mesh
960  // (e.g. the boundary mesh for a nonexistent bcid!)
961  // libmesh_assert_not_equal_to (this->n_nodes(), 0);
962  // libmesh_assert_not_equal_to (this->n_elem(), 0);
963 
964  // This function must be run on all processors at once
965  parallel_object_only();
966 
967  LOG_SCOPE("find_neighbors()", "Mesh");
968 
969  //TODO:[BSK] This should be removed later?!
970  if (reset_current_list)
972  (this->element_stored_range(),
973  [reset_remote_elements](const ElemRange & range)
974  {
975  for (Elem * e : range)
976  for (auto s : e->side_index_range())
977  if (e->neighbor_ptr(s) != remote_elem || reset_remote_elements)
978  e->set_neighbor(s, nullptr);
979  });
980 
981  // Find neighboring elements by first finding elements
982  // with identical side keys and then check to see if they
983  // are neighbors
984  {
985  // data structures -- Use the hash_multimap if available
986  typedef dof_id_type key_type;
987  typedef std::pair<Elem *, unsigned char> val_type;
988  typedef std::unordered_multimap<key_type, val_type> map_type;
989 
990  // A map from side keys to corresponding elements & side numbers
991  map_type side_to_elem_map;
992 
993  // Pull objects out of the loop to reduce heap operations
994  std::unique_ptr<Elem> my_side, their_side;
995 
996  for (const auto & element : this->element_ptr_range())
997  {
998  for (auto ms : element->side_index_range())
999  {
1000  next_side:
1001  // If we haven't yet found a neighbor on this side, try.
1002  // Even if we think our neighbor is remote, that
1003  // information may be out of date.
1004  if (element->neighbor_ptr(ms) == nullptr ||
1005  element->neighbor_ptr(ms) == remote_elem)
1006  {
1007  // Get the key for the side of this element. Use the
1008  // low_order_key so we can find neighbors in
1009  // mixed-order meshes if necessary.
1010  const dof_id_type key = element->low_order_key(ms);
1011 
1012  // Look for elements that have an identical side key
1013  auto bounds = side_to_elem_map.equal_range(key);
1014 
1015  // May be multiple keys, check all the possible
1016  // elements which _might_ be neighbors.
1017  if (bounds.first != bounds.second)
1018  {
1019  // Get the side for this element
1020  element->side_ptr(my_side, ms);
1021 
1022  // Look at all the entries with an equivalent key
1023  while (bounds.first != bounds.second)
1024  {
1025  // Get the potential element
1026  Elem * neighbor = bounds.first->second.first;
1027 
1028  // Get the side for the neighboring element
1029  const unsigned int ns = bounds.first->second.second;
1030  neighbor->side_ptr(their_side, ns);
1031  //libmesh_assert(my_side.get());
1032  //libmesh_assert(their_side.get());
1033 
1034  // If found a match with my side
1035  //
1036  // In 1D, since parents and children have an
1037  // equal side (i.e. a node) we need to check
1038  // for matching level() to avoid setting our
1039  // neighbor pointer to any of our neighbor's
1040  // descendants.
1041  if ((*my_side == *their_side) &&
1042  (element->level() == neighbor->level()))
1043  {
1044  // So share a side. Is this a mixed pair
1045  // of subactive and active/ancestor
1046  // elements?
1047  // If not, then we're neighbors.
1048  // If so, then the subactive's neighbor is
1049 
1050  if (element->subactive() ==
1051  neighbor->subactive())
1052  {
1053  // an element is only subactive if it has
1054  // been coarsened but not deleted
1055  element->set_neighbor (ms,neighbor);
1056  neighbor->set_neighbor(ns,element);
1057  }
1058  else if (element->subactive())
1059  {
1060  element->set_neighbor(ms,neighbor);
1061  }
1062  else if (neighbor->subactive())
1063  {
1064  neighbor->set_neighbor(ns,element);
1065  }
1066  side_to_elem_map.erase (bounds.first);
1067 
1068  // get out of this nested crap
1069  goto next_side;
1070  }
1071 
1072  ++bounds.first;
1073  }
1074  }
1075 
1076  // didn't find a match...
1077  // Build the map entry for this element
1078  side_to_elem_map.emplace
1079  (key, std::make_pair(element, cast_int<unsigned char>(ms)));
1080  }
1081  }
1082  }
1083  }
1084 
1085 #ifdef LIBMESH_ENABLE_PERIODIC
1086  // Get the disjoint neighbor boundary pairs object (from periodic BCs)
1087  auto * db = this->get_disjoint_neighbor_boundary_pairs();
1088 
1089  if (db)
1090  {
1091  // Obtain a point locator
1092  std::unique_ptr<PointLocatorBase> point_locator = this->sub_point_locator();
1093 
1094  for (const auto & element : this->element_ptr_range())
1095  {
1096  for (auto ms : element->side_index_range())
1097  {
1098  // Skip if this side already has a valid neighbor (including remote neighbors)
1099  if (element->neighbor_ptr(ms) != nullptr &&
1100  element->neighbor_ptr(ms) != remote_elem)
1101  continue;
1102 
1103  for (const auto & [id, boundary_ptr] : *db)
1104  {
1105  if (!this->get_boundary_info().has_boundary_id(element, ms, id))
1106  continue;
1107 
1108  unsigned int neigh_side;
1109  const Elem * neigh =
1110  db->neighbor(id, *point_locator, element, ms, &neigh_side);
1111 
1112  if (neigh && neigh != remote_elem && neigh != element)
1113  {
1114  auto neigh_changeable = this->elem_ptr(neigh->id());
1115  element->set_neighbor(ms, neigh_changeable);
1116  neigh_changeable->set_neighbor(neigh_side, element);
1117  }
1118  }
1119  }
1120  }
1121  }
1122 #endif // LIBMESH_ENABLE_PERIODIC
1123 
1124 #ifdef LIBMESH_ENABLE_AMR
1125 
1153  const unsigned int n_levels = MeshTools::n_levels(*this);
1154  for (unsigned int level = 1; level < n_levels; ++level)
1155  {
1156  for (auto & current_elem : as_range(level_elements_begin(level),
1157  level_elements_end(level)))
1158  {
1159  libmesh_assert(current_elem);
1160  Elem * parent = current_elem->parent();
1161  libmesh_assert(parent);
1162  const unsigned int my_child_num = parent->which_child_am_i(current_elem);
1163 
1164  for (auto s : current_elem->side_index_range())
1165  {
1166  if (current_elem->neighbor_ptr(s) == nullptr ||
1167  (current_elem->neighbor_ptr(s) == remote_elem &&
1168  parent->is_child_on_side(my_child_num, s)))
1169  {
1170  Elem * neigh = parent->neighbor_ptr(s);
1171 
1172  // If neigh was refined and had non-subactive children
1173  // made remote earlier, then our current elem should
1174  // actually have one of those remote children as a
1175  // neighbor
1176  if (neigh &&
1177  (neigh->ancestor() ||
1178  // If neigh has subactive children which should have
1179  // matched as neighbors of the current element but
1180  // did not, then those likewise must be remote
1181  // children.
1182  (current_elem->subactive() && neigh->has_children() &&
1183  (neigh->level()+1) == current_elem->level())))
1184  {
1185 #ifdef DEBUG
1186  // Let's make sure that "had children made remote"
1187  // situation is actually the case
1188  libmesh_assert(neigh->has_children());
1189  bool neigh_has_remote_children = false;
1190  for (auto & child : neigh->child_ref_range())
1191  if (&child == remote_elem)
1192  neigh_has_remote_children = true;
1193  libmesh_assert(neigh_has_remote_children);
1194 
1195  // And let's double-check that we don't have
1196  // a remote_elem neighboring an active local element
1197  if (current_elem->active())
1198  libmesh_assert_not_equal_to (current_elem->processor_id(),
1199  this->processor_id());
1200 #endif // DEBUG
1201  neigh = const_cast<RemoteElem *>(remote_elem);
1202  }
1203  // If neigh and current_elem are more than one level
1204  // apart, figuring out whether we have a remote
1205  // neighbor here becomes much harder.
1206  else if (neigh && (current_elem->subactive() &&
1207  neigh->has_children()))
1208  {
1209  // Find the deepest descendant of neigh which
1210  // we could consider for a neighbor. If we run
1211  // out of neigh children, then that's our
1212  // neighbor. If we find a potential neighbor
1213  // with remote_children and we don't find any
1214  // potential neighbors among its non-remote
1215  // children, then our neighbor must be remote.
1216  while (neigh != remote_elem &&
1217  neigh->has_children())
1218  {
1219  bool found_neigh = false;
1220  for (unsigned int c = 0, nc = neigh->n_children();
1221  !found_neigh && c != nc; ++c)
1222  {
1223  Elem * child = neigh->child_ptr(c);
1224  if (child == remote_elem)
1225  continue;
1226  for (auto ncn : child->neighbor_ptr_range())
1227  {
1228  if (ncn != remote_elem &&
1229  ncn->is_ancestor_of(current_elem))
1230  {
1231  neigh = ncn;
1232  found_neigh = true;
1233  break;
1234  }
1235  }
1236  }
1237  if (!found_neigh)
1238  neigh = const_cast<RemoteElem *>(remote_elem);
1239  }
1240  }
1241  current_elem->set_neighbor(s, neigh);
1242 #ifdef DEBUG
1243  if (neigh != nullptr && neigh != remote_elem)
1244  // We ignore subactive elements here because
1245  // we don't care about neighbors of subactive element.
1246  if ((!neigh->active()) && (!current_elem->subactive()))
1247  {
1248  libMesh::err << "On processor " << this->processor_id()
1249  << std::endl;
1250  libMesh::err << "Bad element ID = " << current_elem->id()
1251  << ", Side " << s << ", Bad neighbor ID = " << neigh->id() << std::endl;
1252  libMesh::err << "Bad element proc_ID = " << current_elem->processor_id()
1253  << ", Bad neighbor proc_ID = " << neigh->processor_id() << std::endl;
1254  libMesh::err << "Bad element size = " << current_elem->hmin()
1255  << ", Bad neighbor size = " << neigh->hmin() << std::endl;
1256  libMesh::err << "Bad element center = " << current_elem->vertex_average()
1257  << ", Bad neighbor center = " << neigh->vertex_average() << std::endl;
1258  libMesh::err << "ERROR: "
1259  << (current_elem->active()?"Active":"Ancestor")
1260  << " Element at level "
1261  << current_elem->level() << std::endl;
1262  libMesh::err << "with "
1263  << (parent->active()?"active":
1264  (parent->subactive()?"subactive":"ancestor"))
1265  << " parent share "
1266  << (neigh->subactive()?"subactive":"ancestor")
1267  << " neighbor at level " << neigh->level()
1268  << std::endl;
1269  NameBasedIO(*this).write ("bad_mesh.gmv");
1270  libmesh_error_msg("Problematic mesh written to bad_mesh.gmv.");
1271  }
1272 #endif // DEBUG
1273  }
1274  }
1275 
1276  // We can skip to the next element if we're full-dimension
1277  // and therefore don't have any interior parents
1278  if (current_elem->dim() >= LIBMESH_DIM)
1279  continue;
1280 
1281  // We have no interior parents unless we can find one later
1282  current_elem->set_interior_parent(nullptr);
1283 
1284  Elem * pip = parent->interior_parent();
1285 
1286  if (!pip)
1287  continue;
1288 
1289  // If there's no interior_parent children, whether due to a
1290  // remote element or a non-conformity, then there's no
1291  // children to search.
1292  if (pip == remote_elem || pip->active())
1293  {
1294  current_elem->set_interior_parent(pip);
1295  continue;
1296  }
1297 
1298  // For node comparisons we'll need a sensible tolerance
1299  Real node_tolerance = current_elem->hmin() * TOLERANCE;
1300 
1301  // Otherwise our interior_parent should be a child of our
1302  // parent's interior_parent.
1303  for (auto & child : pip->child_ref_range())
1304  {
1305  // If we have a remote_elem, that might be our
1306  // interior_parent. We'll set it provisionally now and
1307  // keep trying to find something better.
1308  if (&child == remote_elem)
1309  {
1310  current_elem->set_interior_parent
1311  (const_cast<RemoteElem *>(remote_elem));
1312  continue;
1313  }
1314 
1315  bool child_contains_our_nodes = true;
1316  for (auto & n : current_elem->node_ref_range())
1317  {
1318  bool child_contains_this_node = false;
1319  for (auto & cn : child.node_ref_range())
1320  if (cn.absolute_fuzzy_equals
1321  (n, node_tolerance))
1322  {
1323  child_contains_this_node = true;
1324  break;
1325  }
1326  if (!child_contains_this_node)
1327  {
1328  child_contains_our_nodes = false;
1329  break;
1330  }
1331  }
1332  if (child_contains_our_nodes)
1333  {
1334  current_elem->set_interior_parent(&child);
1335  break;
1336  }
1337  }
1338 
1339  // We should have found *some* interior_parent at this
1340  // point, whether semilocal or remote.
1341  libmesh_assert(current_elem->interior_parent());
1342  }
1343  }
1344 #endif // AMR
1345 
1346 #ifdef DEBUG
1347  if (assert_valid)
1348  {
1350  !reset_remote_elements);
1352  }
1353 #else
1354  libmesh_ignore(assert_valid);
1355 #endif
1356 
1357  this->_preparation.has_neighbor_ptrs = true;
1358 }
OStreamProxy err
void parallel_for(const Range &range, const Body &body, unsigned int n_threads=libMesh::n_threads())
Execute the provided function object in parallel on the specified range.
Definition: threads_none.h:73
This class supports simple reads and writes in any libMesh-supported format, by dispatching to one of...
Definition: namebased_io.h:44
const Elem * parent() const
Definition: elem.h:3044
In parallel meshes where a ghost element has neighbors which do not exist on the local processor...
Definition: remote_elem.h:59
bool is_ancestor_of(const Elem *descendant) const
Definition: elem.h:3023
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 (paren...
Definition: mesh_tools.C:1441
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
std::unique_ptr< PointLocatorBase > sub_point_locator() const
Definition: mesh_base.C:1826
const Elem * interior_parent() const
Definition: elem.C:1160
static constexpr Real TOLERANCE
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const =0
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
virtual unsigned int n_children() const =0
The StoredRange class defines a contiguous, divisible set of objects.
Definition: stored_range.h:54
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:170
void set_interior_parent(Elem *p)
Sets the pointer to the element&#39;s interior_parent.
Definition: elem.C:1222
SimpleRange< ChildRefIter > child_ref_range()
Returns a range with all children of a parent element, usable in range-based for loops.
Definition: elem.h:2352
bool ancestor() const
Definition: elem.C:2019
void libmesh_ignore(const Args &...)
dof_id_type id() const
Definition: dof_object.h:819
virtual Real hmin() const
Definition: elem.C:683
const ElemRange & element_stored_range()
Definition: mesh_base.C:1913
PeriodicBoundaries * get_disjoint_neighbor_boundary_pairs()
Definition: mesh_base.C:2256
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
Definition: simple_range.h:57
unsigned int n_levels(const MeshBase &mesh)
Definition: mesh_tools.C:826
virtual void write(const std::string &mesh_file) override
This method implements writing a mesh to a specified file.
Definition: namebased_io.C:306
libmesh_assert(ctx)
void set_neighbor(const unsigned int i, Elem *n)
Assigns n as the neighbor.
Definition: elem.h:2632
unsigned int which_child_am_i(const Elem *e) const
Definition: elem.h:3206
SimpleRange< NodeRefIter > node_ref_range()
Returns a range with all nodes of an element, usable in range-based for loops.
Definition: elem.h:2679
virtual const Elem * elem_ptr(const dof_id_type i) const =0
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:2612
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162
unsigned int level() const
Definition: elem.h:3088
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual std::unique_ptr< Elem > side_ptr(unsigned int i)=0
bool subactive() const
Definition: elem.h:2973
SimpleRange< NeighborPtrIter > neighbor_ptr_range()
Returns a range with all neighbors of an element, usable in range-based for loops.
Definition: elem.h:3517
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 desc...
Definition: mesh_tools.C:2320
processor_id_type processor_id() const
bool active() const
Definition: elem.h:2955
processor_id_type processor_id() const
Definition: dof_object.h:881
bool has_children() const
Definition: elem.h:2993
Point vertex_average() const
Definition: elem.C:669
const Elem * child_ptr(unsigned int i) const
Definition: elem.h:3177
uint8_t dof_id_type
Definition: id_types.h:67
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ fix_broken_node_and_element_numbering()

virtual void libMesh::MeshBase::fix_broken_node_and_element_numbering ( )
pure virtualinherited

There is no reason for a user to ever call this function.

This function restores a previously broken element/node numbering such that mesh.node_ref(n).id() == n.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::EquationSystems::read(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), and libMesh::RBEvaluation::write_out_vectors().

◆ gather_to_zero()

virtual void libMesh::MeshBase::gather_to_zero ( )
inlinevirtualinherited

Gathers all elements and nodes of the mesh onto processor zero.

Reimplemented in libMesh::DistributedMesh.

Definition at line 382 of file mesh_base.h.

Referenced by libMesh::MeshSerializer::MeshSerializer().

382 {}

◆ get_boundary_info() [1/2]

const BoundaryInfo& libMesh::MeshBase::get_boundary_info ( ) const
inlineinherited

The information about boundary ids on the mesh.

Definition at line 170 of file mesh_base.h.

References libMesh::MeshBase::boundary_info.

Referenced by libMesh::MeshRefinement::_coarsen_elements(), libMesh::MeshTools::Subdivision::add_boundary_ghosts(), all_first_order(), libMesh::MeshTools::Subdivision::all_subdivision(), libMesh::MeshTools::Modification::all_tri(), LinearElasticity::assemble(), assemble_elasticity(), assemble_poisson(), assemble_shell(), assemble_temperature_jump(), libMesh::AbaqusIO::assign_boundary_node_ids(), libMesh::AbaqusIO::assign_sideset_ids(), AssemblyA0::boundary_assembly(), AssemblyA1::boundary_assembly(), AssemblyF0::boundary_assembly(), AssemblyF1::boundary_assembly(), AssemblyA2::boundary_assembly(), AssemblyF2::boundary_assembly(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::MeshTools::Generation::build_extrusion(), DisjointNeighborTest::build_four_disjoint_elems(), DisjointNeighborTest::build_split_mesh_with_interface(), DisjointNeighborTest::build_two_disjoint_elems(), libMesh::MeshTools::Modification::change_boundary_id(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::MeshBase::complete_preparation(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::TriangleWrapper::copy_tri_to_mesh(), create_submesh(), libMesh::MeshTetInterface::delete_2D_hull_elements(), libMesh::ReplicatedMesh::delete_elem(), libMesh::DistributedMesh::delete_elem(), libMesh::ReplicatedMesh::delete_node(), libMesh::DistributedMesh::delete_node(), libMesh::DistributedMesh::delete_remote_elements(), libMesh::DistributedMesh::DistributedMesh(), find_neighbors(), libMesh::MeshTools::Modification::flatten(), libMesh::MeshBase::get_info(), libMesh::UNVIO::groups_in(), libMesh::MeshTetInterface::improve_hull_integrity(), libMesh::HDGProblem::init(), libMesh::ExodusII_IO_Helper::initialize(), LinearElasticityWithContact::initialize_contact_load_paths(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::HDGProblem::jacobian(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), main(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), libMesh::MeshTools::Modification::orient_elements(), libMesh::TetGenMeshInterface::pointset_convexhull(), libMesh::Nemesis_IO::prepare_to_write_nodal_data(), libMesh::AbaqusIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_bcs(), libMesh::ExodusII_IO_Helper::read_edge_blocks(), libMesh::CheckpointIO::read_header(), libMesh::GmshIO::read_mesh(), libMesh::CheckpointIO::read_nodesets(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::SimplexRefiner::refine_via_edges(), MeshStitchTest::renameAndShift(), libMesh::ReplicatedMesh::renumber_nodes_and_elements(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::ReplicatedMesh::ReplicatedMesh(), libMesh::HDGProblem::residual(), SolidSystem::side_time_derivative(), libMesh::PetscDiffSolver::solve(), stitching_helper(), libMesh::MeshTools::Generation::surface_octahedron(), libMesh::BoundaryInfo::sync(), AllTriTest::test_helper_2D(), AllTriTest::test_helper_3D(), AllTriTest::test_helper_c0polyhedron(), AllTriTest::testAllTriC0Polygon(), AllTriTest::testAllTriC0PolygonOctagon(), MeshTetTest::testBcids(), BoundaryInfoTest::testBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundarySides(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), SystemsTest::testBoundaryProjectCube(), BoundaryInfoTest::testBuildNodeListFromSideList(), BoundaryInfoTest::testBuildSideListFromNodeList(), VolumeTest::testC0PolygonMethods(), DisjointNeighborTest::testDisjointNeighborConflictError(), BoundaryInfoTest::testEdgeBoundaryConditions(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testGmshBCIDOverlap(), BoundaryInfoTest::testInternalBoundary(), MeshInputTest::testLowOrderEdgeBlocks(), BoundaryInfoTest::testMesh(), BoundaryInfoTest::testNameCopying(), PeriodicBCTest::testPeriodicBC(), MeshTriangulationTest::testPoly2TriHolesInteriorRefinedBase(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testSelectiveRenumber(), BoundaryInfoTest::testShellFaceConstraints(), DisjointNeighborTest::testStitchCrossMesh(), MeshTetTest::testTrisToTets(), MeshSmootherTest::testVariationalSmoother(), WriteNodesetData::testWriteImpl(), WriteEdgesetData::testWriteImpl(), WriteSidesetData::testWriteImpl(), libMesh::NetGenMeshInterface::triangulate(), libMesh::Poly2TriTriangulator::triangulate_current_points(), libMesh::MeshTetInterface::volume_to_surface_mesh(), libMesh::FroIO::write(), libMesh::Nemesis_IO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::ExodusII_IO::write(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::GmshIO::write_mesh(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_nodesets(), and libMesh::ExodusII_IO_Helper::write_sidesets().

170 { return *boundary_info; }
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
Definition: mesh_base.h:2098

◆ get_boundary_info() [2/2]

BoundaryInfo& libMesh::MeshBase::get_boundary_info ( )
inlineinherited

Writable information about boundary ids on the mesh.

Definition at line 175 of file mesh_base.h.

References libMesh::MeshBase::boundary_info.

175 { return *boundary_info; }
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
Definition: mesh_base.h:2098

◆ get_constraint_rows() [1/2]

constraint_rows_type& libMesh::MeshBase::get_constraint_rows ( )
inlineinherited

◆ get_constraint_rows() [2/2]

const constraint_rows_type& libMesh::MeshBase::get_constraint_rows ( ) const
inlineinherited

Definition at line 1908 of file mesh_base.h.

References libMesh::MeshBase::_constraint_rows.

1909  { return _constraint_rows; }
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2409

◆ get_count_lower_dim_elems_in_point_locator()

bool libMesh::MeshBase::get_count_lower_dim_elems_in_point_locator ( ) const
inherited

Get the current value of _count_lower_dim_elems_in_point_locator.

Definition at line 1873 of file mesh_base.C.

References libMesh::MeshBase::_count_lower_dim_elems_in_point_locator.

Referenced by libMesh::TreeNode< N >::insert().

1874 {
1876 }
bool _count_lower_dim_elems_in_point_locator
Do we count lower dimensional elements in point locator refinement? This is relevant in tree-based po...
Definition: mesh_base.h:2198

◆ get_disjoint_neighbor_boundary_pairs() [1/2]

PeriodicBoundaries * libMesh::MeshBase::get_disjoint_neighbor_boundary_pairs ( )
inherited

◆ get_disjoint_neighbor_boundary_pairs() [2/2]

const PeriodicBoundaries * libMesh::MeshBase::get_disjoint_neighbor_boundary_pairs ( ) const
inherited

Definition at line 2261 of file mesh_base.C.

References libMesh::MeshBase::_disjoint_neighbor_boundary_pairs.

2262  {
2263  return _disjoint_neighbor_boundary_pairs.get();
2264  }
std::unique_ptr< PeriodicBoundaries > _disjoint_neighbor_boundary_pairs
The disjoint neighbor boundary id pairs.
Definition: mesh_base.h:2086

◆ get_elem_integer_index()

unsigned int libMesh::MeshBase::get_elem_integer_index ( std::string_view  name) const
inherited

Definition at line 689 of file mesh_base.C.

References libMesh::MeshBase::_elem_integer_names, libMesh::index_range(), libMesh::invalid_uint, and libMesh::Quality::name().

Referenced by libMesh::MeshBase::change_elemset_code(), WriteElemsetData::checkElemsetCodes(), ExtraIntegersTest::testExtraIntegersExodusReading(), and libMesh::ExodusII_IO_Helper::write_elemsets().

690 {
691  for (auto i : index_range(_elem_integer_names))
692  if (_elem_integer_names[i] == name)
693  return i;
694 
695  libmesh_error_msg("Unknown elem integer " << name);
696  return libMesh::invalid_uint;
697 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:303
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2338
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153

◆ get_elem_integer_name()

const std::string& libMesh::MeshBase::get_elem_integer_name ( unsigned int  i) const
inlineinherited

Definition at line 1069 of file mesh_base.h.

References libMesh::MeshBase::_elem_integer_names.

Referenced by libMesh::XdrIO::write(), and libMesh::CheckpointIO::write().

1070  { return _elem_integer_names[i]; }
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2338

◆ get_elemset_code()

dof_id_type libMesh::MeshBase::get_elemset_code ( const MeshBase::elemset_type id_set) const
inherited

Definition at line 497 of file mesh_base.C.

References libMesh::MeshBase::_elemset_codes_inverse_map, and libMesh::DofObject::invalid_id.

Referenced by WriteElemsetData::checkElemsetCodes(), and libMesh::ExodusII_IO::read().

498 {
499  auto it = _elemset_codes_inverse_map.find(id_set);
500  return (it == _elemset_codes_inverse_map.end()) ? DofObject::invalid_id : it->second;
501 }
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2325
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:473

◆ get_elemset_codes()

std::vector< dof_id_type > libMesh::MeshBase::get_elemset_codes ( ) const
inherited

Return a vector of all elemset codes defined on the mesh.

We get this by looping over the _elemset_codes map.

Definition at line 503 of file mesh_base.C.

References libMesh::MeshBase::_elemset_codes.

Referenced by stitching_helper(), and libMesh::XdrIO::write().

504 {
505  std::vector<dof_id_type> ret;
506  ret.reserve(_elemset_codes.size());
507  for (const auto & pr : _elemset_codes)
508  ret.push_back(pr.first);
509  return ret;
510 }
std::map< dof_id_type, const MeshBase::elemset_type * > _elemset_codes
Map from "element set code" to list of set ids to which that element belongs (and vice-versa)...
Definition: mesh_base.h:2324

◆ get_elemsets()

void libMesh::MeshBase::get_elemsets ( dof_id_type  elemset_code,
MeshBase::elemset_type id_set_to_fill 
) const
inherited

Look up the element sets for a given elemset code and vice-versa.

The elemset must have been previously stored by calling add_elemset_code(). If no such code/set is found, returns the empty set or DofObject::invalid_id, respectively.

Definition at line 487 of file mesh_base.C.

References libMesh::MeshBase::_elemset_codes.

Referenced by stitching_helper(), WriteElemsetData::testWriteImpl(), libMesh::XdrIO::write(), and libMesh::ExodusII_IO_Helper::write_elemsets().

488 {
489  // If we don't recognize this elemset_code, hand back an empty set
490  id_set_to_fill.clear();
491 
492  if (const auto it = _elemset_codes.find(elemset_code);
493  it != _elemset_codes.end())
494  id_set_to_fill.insert(it->second->begin(), it->second->end());
495 }
std::map< dof_id_type, const MeshBase::elemset_type * > _elemset_codes
Map from "element set code" to list of set ids to which that element belongs (and vice-versa)...
Definition: mesh_base.h:2324

◆ get_id_by_name()

subdomain_id_type libMesh::MeshBase::get_id_by_name ( std::string_view  name) const
inherited
Returns
The id of the named subdomain if it exists, Elem::invalid_subdomain_id otherwise.

Definition at line 1900 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name, libMesh::Elem::invalid_subdomain_id, and libMesh::Quality::name().

1901 {
1902  // Linear search over the map values.
1903  for (const auto & [sbd_id, sbd_name] : _block_id_to_name)
1904  if (sbd_name == name)
1905  return sbd_id;
1906 
1907  // If we made it here without returning, we don't have a subdomain
1908  // with the requested name, so return Elem::invalid_subdomain_id.
1910 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
static constexpr subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
Definition: elem.h:246
std::map< subdomain_id_type, std::string > _block_id_to_name
This structure maintains the mapping of named blocks for file formats that support named blocks...
Definition: mesh_base.h:2275

◆ get_info()

std::string libMesh::MeshBase::get_info ( const unsigned int  verbosity = 0,
const bool  global = true 
) const
inherited
Returns
A string containing relevant information about the mesh.

verbosity sets the verbosity, with 0 being the least and 2 being the greatest. 0 - Dimensions, number of nodes, number of elems, number of subdomains, number of partitions, prepared status. 1 - Adds the mesh bounding box, mesh element types, specific nodesets/edgesets/sidesets with element types, number of nodes/edges/sides. 2 - Adds volume information and bounding boxes to boundary information.

The global parameter pertains primarily to verbosity levels 1 and above. When global == true, information is only output on rank 0 and the information is reduced. When global == false, information is output on all ranks that pertains only to that local partition.

Definition at line 1268 of file mesh_base.C.

References libMesh::MeshBase::_elem_default_orders, libMesh::MeshBase::_elem_dims, libMesh::MeshBase::_elemset_codes, libMesh::Elem::build_edge_ptr(), libMesh::ParallelObject::comm(), libMesh::MeshTools::create_bounding_box(), libMesh::MeshTools::create_local_bounding_box(), libMesh::MeshTools::elem_types(), libMesh::Utility::enum_to_string(), libMesh::MeshBase::get_boundary_info(), libMesh::BoundaryInfo::get_edge_boundary_ids(), libMesh::BoundaryInfo::get_edgeset_name_map(), libMesh::BoundaryInfo::get_node_boundary_ids(), libMesh::BoundaryInfo::get_nodeset_name_map(), libMesh::BoundaryInfo::get_side_boundary_ids(), libMesh::BoundaryInfo::get_sideset_name_map(), libMesh::MeshBase::get_subdomain_name_map(), libMesh::DofObject::id(), libMesh::DofObject::invalid_processor_id, libMesh::MeshBase::is_prepared(), libMesh::MeshBase::is_replicated(), libMesh::libmesh_assert(), libMesh::Elem::loose_bounding_box(), TIMPI::Communicator::max(), TIMPI::Communicator::min(), libMesh::MeshBase::n_active_elem(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_elemsets(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::MeshBase::n_local_subdomains(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::n_partitions(), libMesh::ParallelObject::n_processors(), libMesh::MeshBase::n_subdomains(), libMesh::n_threads(), libMesh::Quality::name(), libMesh::Elem::node_ref_range(), libMesh::ParallelObject::processor_id(), libMesh::Real, TIMPI::Communicator::set_union(), libMesh::MeshBase::spatial_dimension(), TIMPI::Communicator::sum(), libMesh::MeshBase::supported_nodal_order(), libMesh::Elem::type(), libMesh::BoundingBox::union_with(), libMesh::MeshTools::volume(), and libMesh::Elem::volume().

Referenced by libMesh::MeshBase::print_info().

1269 {
1270  std::ostringstream oss;
1271 
1272  oss << " Mesh Information:" << '\n';
1273 
1274  if (!_elem_dims.empty())
1275  {
1276  oss << " elem_dimensions()={";
1277  std::copy(_elem_dims.begin(),
1278  --_elem_dims.end(), // --end() is valid if the set is non-empty
1279  std::ostream_iterator<unsigned int>(oss, ", "));
1280  oss << cast_int<unsigned int>(*_elem_dims.rbegin());
1281  oss << "}\n";
1282  }
1283 
1284  if (!_elem_default_orders.empty())
1285  {
1286  oss << " elem_default_orders()={";
1287  std::transform(_elem_default_orders.begin(),
1288  --_elem_default_orders.end(),
1289  std::ostream_iterator<std::string>(oss, ", "),
1290  [](Order o)
1291  { return Utility::enum_to_string<Order>(o); });
1292  oss << Utility::enum_to_string<Order>(*_elem_default_orders.rbegin());
1293  oss << "}\n";
1294  }
1295 
1296  oss << " supported_nodal_order()=" << this->supported_nodal_order() << '\n'
1297  << " spatial_dimension()=" << this->spatial_dimension() << '\n'
1298  << " n_nodes()=" << this->n_nodes() << '\n'
1299  << " n_local_nodes()=" << this->n_local_nodes() << '\n'
1300  << " n_elem()=" << this->n_elem() << '\n'
1301  << " n_local_elem()=" << this->n_local_elem() << '\n';
1302 #ifdef LIBMESH_ENABLE_AMR
1303  oss << " n_active_elem()=" << this->n_active_elem() << '\n';
1304 #endif
1305  if (global)
1306  oss << " n_subdomains()=" << static_cast<std::size_t>(this->n_subdomains()) << '\n';
1307  else
1308  oss << " n_local_subdomains()= " << static_cast<std::size_t>(this->n_local_subdomains()) << '\n';
1309  oss << " n_elemsets()=" << static_cast<std::size_t>(this->n_elemsets()) << '\n';
1310  if (!_elemset_codes.empty())
1311  oss << " n_elemset_codes=" << _elemset_codes.size() << '\n';
1312  oss << " n_partitions()=" << static_cast<std::size_t>(this->n_partitions()) << '\n'
1313  << " n_processors()=" << static_cast<std::size_t>(this->n_processors()) << '\n'
1314  << " n_threads()=" << static_cast<std::size_t>(libMesh::n_threads()) << '\n'
1315  << " processor_id()=" << static_cast<std::size_t>(this->processor_id()) << '\n'
1316  << " is_prepared()=" << (this->is_prepared() ? "true" : "false") << '\n'
1317  << " is_replicated()=" << (this->is_replicated() ? "true" : "false") << '\n';
1318 
1319  if (verbosity > 0)
1320  {
1321  if (global)
1322  {
1323  libmesh_parallel_only(this->comm());
1324  if (this->processor_id() != 0)
1325  oss << "\n Detailed global get_info() (verbosity > 0) is reduced and output to only rank 0.";
1326  }
1327 
1328  // Helper for printing element types
1329  const auto elem_type_helper = [](const std::set<int> & elem_types) {
1330  std::stringstream ss;
1331  for (auto it = elem_types.begin(); it != elem_types.end();)
1332  {
1333  ss << Utility::enum_to_string((ElemType)*it);
1334  if (++it != elem_types.end())
1335  ss << ", ";
1336  }
1337  return ss.str();
1338  };
1339 
1340  // Helper for whether or not the given DofObject is to be included. If we're doing
1341  // a global reduction, we also count unpartitioned objects on rank 0.
1342  const auto include_object = [this, &global](const DofObject & dof_object) {
1343  return this->processor_id() == dof_object.processor_id() ||
1344  (global &&
1345  this->processor_id() == 0 &&
1346  dof_object.processor_id() == DofObject::invalid_processor_id);
1347  };
1348 
1349  Real volume = 0;
1350 
1351  // Add bounding box information
1352  const auto bbox = global ? MeshTools::create_bounding_box(*this) : MeshTools::create_local_bounding_box(*this);
1353  if (!global || this->processor_id() == 0)
1354  oss << "\n " << (global ? "" : "Local ") << "Mesh Bounding Box:\n"
1355  << " Minimum: " << bbox.min() << "\n"
1356  << " Maximum: " << bbox.max() << "\n"
1357  << " Delta: " << (bbox.max() - bbox.min()) << "\n";
1358 
1359  // Obtain the global or local element types
1360  std::set<int> elem_types;
1361  for (const Elem * elem : this->active_local_element_ptr_range())
1362  elem_types.insert(elem->type());
1363  if (global)
1364  {
1365  // Pick up unpartitioned elems on rank 0
1366  if (this->processor_id() == 0)
1367  for (const Elem * elem : this->active_unpartitioned_element_ptr_range())
1368  elem_types.insert(elem->type());
1369 
1370  this->comm().set_union(elem_types);
1371  }
1372 
1373  // Add element types
1374  if (!global || this->processor_id() == 0)
1375  oss << "\n " << (global ? "" : "Local ") << "Mesh Element Type(s):\n "
1376  << elem_type_helper(elem_types) << "\n";
1377 
1378  // Reduce the nodeset ids
1379  auto nodeset_ids = this->get_boundary_info().get_node_boundary_ids();
1380  if (global)
1381  this->comm().set_union(nodeset_ids);
1382 
1383  // Accumulate local information for each nodeset
1384  struct NodesetInfo
1385  {
1386  std::size_t num_nodes = 0;
1387  BoundingBox bbox;
1388  };
1389  std::map<boundary_id_type, NodesetInfo> nodeset_info_map;
1390  for (const auto & [node, id] : this->get_boundary_info().get_nodeset_map())
1391  {
1392  if (!include_object(*node))
1393  continue;
1394 
1395  NodesetInfo & info = nodeset_info_map[id];
1396 
1397  ++info.num_nodes;
1398 
1399  if (verbosity > 1)
1400  info.bbox.union_with(*node);
1401  }
1402 
1403  // Add nodeset info
1404  if (!global || this->processor_id() == 0)
1405  {
1406  oss << "\n " << (global ? "" : "Local ") << "Mesh Nodesets:\n";
1407  if (nodeset_ids.empty())
1408  oss << " None\n";
1409  }
1410 
1411  const auto & nodeset_name_map = this->get_boundary_info().get_nodeset_name_map();
1412  for (const auto id : nodeset_ids)
1413  {
1414  NodesetInfo & info = nodeset_info_map[id];
1415 
1416  // Reduce the local information for this nodeset if required
1417  if (global)
1418  {
1419  this->comm().sum(info.num_nodes);
1420  if (verbosity > 1)
1421  {
1422  this->comm().min(info.bbox.min());
1423  this->comm().max(info.bbox.max());
1424  }
1425  }
1426 
1427  const bool has_name = nodeset_name_map.count(id) && nodeset_name_map.at(id).size();
1428  const std::string name = has_name ? nodeset_name_map.at(id) : "";
1429  if (global)
1430  libmesh_assert(this->comm().verify(name));
1431 
1432  if (global ? this->processor_id() == 0 : info.num_nodes > 0)
1433  {
1434  oss << " Nodeset " << id;
1435  if (has_name)
1436  oss << " (" << name << ")";
1437  oss << ", " << info.num_nodes << " " << (global ? "" : "local ") << "nodes\n";
1438 
1439  if (verbosity > 1)
1440  {
1441  oss << " " << (global ? "Bounding" : "Local bounding") << " box minimum: "
1442  << info.bbox.min() << "\n"
1443  << " " << (global ? "Bounding" : "Local bounding") << " box maximum: "
1444  << info.bbox.max() << "\n"
1445  << " " << (global ? "Bounding" : "Local bounding") << " box delta: "
1446  << (info.bbox.max() - info.bbox.min()) << "\n";
1447  }
1448  }
1449  }
1450 
1451  // Reduce the sideset ids
1452  auto sideset_ids = this->get_boundary_info().get_side_boundary_ids();
1453  if (global)
1454  this->comm().set_union(sideset_ids);
1455 
1456  // Accumulate local information for each sideset
1457  struct SidesetInfo
1458  {
1459  std::size_t num_sides = 0;
1460  Real volume = 0;
1461  std::set<int> side_elem_types;
1462  std::set<int> elem_types;
1463  std::set<dof_id_type> elem_ids;
1464  std::set<dof_id_type> node_ids;
1465  BoundingBox bbox;
1466  };
1467  ElemSideBuilder side_builder;
1468  std::map<boundary_id_type, SidesetInfo> sideset_info_map;
1469  for (const auto & pair : this->get_boundary_info().get_sideset_map())
1470  {
1471  const Elem * elem = pair.first;
1472  if (!include_object(*elem))
1473  continue;
1474 
1475  const auto id = pair.second.second;
1476  SidesetInfo & info = sideset_info_map[id];
1477 
1478  const auto s = pair.second.first;
1479  const Elem & side = side_builder(*elem, s);
1480 
1481  ++info.num_sides;
1482  info.side_elem_types.insert(side.type());
1483  info.elem_types.insert(elem->type());
1484  info.elem_ids.insert(elem->id());
1485 
1486  for (const Node & node : side.node_ref_range())
1487  if (include_object(node))
1488  info.node_ids.insert(node.id());
1489 
1490  if (verbosity > 1)
1491  {
1492  info.volume += side.volume();
1493  info.bbox.union_with(side.loose_bounding_box());
1494  }
1495  }
1496 
1497  // Add sideset info
1498  if (!global || this->processor_id() == 0)
1499  {
1500  oss << "\n " << (global ? "" : "Local ") << "Mesh Sidesets:\n";
1501  if (sideset_ids.empty())
1502  oss << " None\n";
1503  }
1504  const auto & sideset_name_map = this->get_boundary_info().get_sideset_name_map();
1505  for (const auto id : sideset_ids)
1506  {
1507  SidesetInfo & info = sideset_info_map[id];
1508 
1509  auto num_elems = info.elem_ids.size();
1510  auto num_nodes = info.node_ids.size();
1511 
1512  // Reduce the local information for this sideset if required
1513  if (global)
1514  {
1515  this->comm().sum(info.num_sides);
1516  this->comm().set_union(info.side_elem_types, 0);
1517  this->comm().sum(num_elems);
1518  this->comm().set_union(info.elem_types, 0);
1519  this->comm().sum(num_nodes);
1520  if (verbosity > 1)
1521  {
1522  this->comm().sum(info.volume);
1523  this->comm().min(info.bbox.min());
1524  this->comm().max(info.bbox.max());
1525  }
1526  }
1527 
1528  const bool has_name = sideset_name_map.count(id) && sideset_name_map.at(id).size();
1529  const std::string name = has_name ? sideset_name_map.at(id) : "";
1530  if (global)
1531  libmesh_assert(this->comm().verify(name));
1532 
1533  if (global ? this->processor_id() == 0 : info.num_sides > 0)
1534  {
1535  oss << " Sideset " << id;
1536  if (has_name)
1537  oss << " (" << name << ")";
1538  oss << ", " << info.num_sides << " sides (" << elem_type_helper(info.side_elem_types) << ")"
1539  << ", " << num_elems << " " << (global ? "" : "local ") << "elems (" << elem_type_helper(info.elem_types) << ")"
1540  << ", " << num_nodes << " " << (global ? "" : "local ") << "nodes\n";
1541 
1542  if (verbosity > 1)
1543  {
1544  oss << " " << (global ? "Side" : "Local side") << " volume: " << info.volume << "\n"
1545  << " " << (global ? "Bounding" : "Local bounding") << " box minimum: "
1546  << info.bbox.min() << "\n"
1547  << " " << (global ? "Bounding" : "Local bounding") << " box maximum: "
1548  << info.bbox.max() << "\n"
1549  << " " << (global ? "Bounding" : "Local bounding") << " box delta: "
1550  << (info.bbox.max() - info.bbox.min()) << "\n";
1551  }
1552  }
1553  }
1554 
1555  // Reduce the edgeset ids
1556  auto edgeset_ids = this->get_boundary_info().get_edge_boundary_ids();
1557  if (global)
1558  this->comm().set_union(edgeset_ids);
1559 
1560  // Accumulate local information for each edgeset
1561  struct EdgesetInfo
1562  {
1563  std::size_t num_edges = 0;
1564  std::set<int> edge_elem_types;
1565  BoundingBox bbox;
1566  };
1567  std::map<boundary_id_type, EdgesetInfo> edgeset_info_map;
1568  std::unique_ptr<const Elem> edge;
1569 
1570  for (const auto & pair : this->get_boundary_info().get_edgeset_map())
1571  {
1572  const Elem * elem = pair.first;
1573  if (!include_object(*elem))
1574  continue;
1575 
1576  const auto id = pair.second.second;
1577  EdgesetInfo & info = edgeset_info_map[id];
1578 
1579  elem->build_edge_ptr(edge, pair.second.first);
1580 
1581  ++info.num_edges;
1582  info.edge_elem_types.insert(edge->type());
1583 
1584  if (verbosity > 1)
1585  info.bbox.union_with(edge->loose_bounding_box());
1586  }
1587 
1588  // Add edgeset info
1589  if (!global || this->processor_id() == 0)
1590  {
1591  oss << "\n " << (global ? "" : "Local ") << "Mesh Edgesets:\n";
1592  if (edgeset_ids.empty())
1593  oss << " None\n";
1594  }
1595 
1596  const auto & edgeset_name_map = this->get_boundary_info().get_edgeset_name_map();
1597  for (const auto id : edgeset_ids)
1598  {
1599  EdgesetInfo & info = edgeset_info_map[id];
1600 
1601  // Reduce the local information for this edgeset if required
1602  if (global)
1603  {
1604  this->comm().sum(info.num_edges);
1605  this->comm().set_union(info.edge_elem_types, 0);
1606  if (verbosity > 1)
1607  {
1608  this->comm().min(info.bbox.min());
1609  this->comm().min(info.bbox.max());
1610  }
1611  }
1612 
1613  const bool has_name = edgeset_name_map.count(id) && edgeset_name_map.at(id).size();
1614  const std::string name = has_name ? edgeset_name_map.at(id) : "";
1615  if (global)
1616  libmesh_assert(this->comm().verify(name));
1617 
1618  if (global ? this->processor_id() == 0 : info.num_edges > 0)
1619  {
1620  oss << " Edgeset " << id;
1621  if (has_name)
1622  oss << " (" << name << ")";
1623  oss << ", " << info.num_edges << " " << (global ? "" : "local ") << "edges ("
1624  << elem_type_helper(info.edge_elem_types) << ")\n";
1625 
1626  if (verbosity > 1)
1627  {
1628  oss << " " << (global ? "Bounding" : "Local bounding") << " box minimum: "
1629  << info.bbox.min() << "\n"
1630  << " " << (global ? "Bounding" : "Local bounding") << " box maximum: "
1631  << info.bbox.max() << "\n"
1632  << " " << (global ? "Bounding" : "Local bounding") << " box delta: "
1633  << (info.bbox.max() - info.bbox.min()) << "\n";
1634  }
1635  }
1636  }
1637 
1638  // Reduce the block IDs and block names
1639  std::set<subdomain_id_type> subdomains;
1640  for (const Elem * elem : this->active_element_ptr_range())
1641  if (include_object(*elem))
1642  subdomains.insert(elem->subdomain_id());
1643  if (global)
1644  this->comm().set_union(subdomains);
1645 
1646  // Accumulate local information for each subdomain
1647  struct SubdomainInfo
1648  {
1649  std::size_t num_elems = 0;
1650  Real volume = 0;
1651  std::set<int> elem_types;
1652  std::set<dof_id_type> active_node_ids;
1653 #ifdef LIBMESH_ENABLE_AMR
1654  std::size_t num_active_elems = 0;
1655 #endif
1656  BoundingBox bbox;
1657  };
1658  std::map<subdomain_id_type, SubdomainInfo> subdomain_info_map;
1659  for (const Elem * elem : this->element_ptr_range())
1660  if (include_object(*elem))
1661  {
1662  SubdomainInfo & info = subdomain_info_map[elem->subdomain_id()];
1663 
1664  ++info.num_elems;
1665  info.elem_types.insert(elem->type());
1666 
1667 #ifdef LIBMESH_ENABLE_AMR
1668  if (elem->active())
1669  ++info.num_active_elems;
1670 #endif
1671 
1672  for (const Node & node : elem->node_ref_range())
1673  if (include_object(node) && node.active())
1674  info.active_node_ids.insert(node.id());
1675 
1676  if (verbosity > 1 && elem->active())
1677  {
1678  info.volume += elem->volume();
1679  info.bbox.union_with(elem->loose_bounding_box());
1680  }
1681  }
1682 
1683  // Add subdomain info
1684  oss << "\n " << (global ? "" : "Local ") << "Mesh Subdomains:\n";
1685  const auto & subdomain_name_map = this->get_subdomain_name_map();
1686  for (const auto id : subdomains)
1687  {
1688  SubdomainInfo & info = subdomain_info_map[id];
1689 
1690  auto num_active_nodes = info.active_node_ids.size();
1691 
1692  // Reduce the information for this subdomain if needed
1693  if (global)
1694  {
1695  this->comm().sum(info.num_elems);
1696 #ifdef LIBMESH_ENABLE_AMR
1697  this->comm().sum(info.num_active_elems);
1698 #endif
1699  this->comm().sum(num_active_nodes);
1700  this->comm().set_union(info.elem_types, 0);
1701  if (verbosity > 1)
1702  {
1703  this->comm().min(info.bbox.min());
1704  this->comm().max(info.bbox.max());
1705  this->comm().sum(info.volume);
1706  }
1707  }
1708  if (verbosity > 1)
1709  volume += info.volume;
1710 
1711  const bool has_name = subdomain_name_map.count(id);
1712  const std::string name = has_name ? subdomain_name_map.at(id) : "";
1713  if (global)
1714  libmesh_assert(this->comm().verify(name));
1715 
1716  if (!global || this->processor_id() == 0)
1717  {
1718  oss << " Subdomain " << id;
1719  if (has_name)
1720  oss << " (" << name << ")";
1721  oss << ": " << info.num_elems << " " << (global ? "" : "local ") << "elems "
1722  << "(" << elem_type_helper(info.elem_types);
1723 #ifdef LIBMESH_ENABLE_AMR
1724  oss << ", " << info.num_active_elems << " active";
1725 #endif
1726  oss << "), " << num_active_nodes << " " << (global ? "" : "local ") << "active nodes\n";
1727  if (verbosity > 1)
1728  {
1729  oss << " " << (global ? "Volume" : "Local volume") << ": " << info.volume << "\n";
1730  oss << " " << (global ? "Bounding" : "Local bounding") << " box minimum: "
1731  << info.bbox.min() << "\n"
1732  << " " << (global ? "Bounding" : "Local bounding") << " box maximum: "
1733  << info.bbox.max() << "\n"
1734  << " " << (global ? "Bounding" : "Local bounding") << " box delta: "
1735  << (info.bbox.max() - info.bbox.min()) << "\n";
1736  }
1737  }
1738  }
1739 
1740  oss << " " << (global ? "Global" : "Local") << " mesh volume = " << volume << "\n";
1741 
1742  }
1743 
1744  return oss.str();
1745 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
ElemType
Defines an enum for geometric element types.
void elem_types(const MeshBase &mesh, std::vector< ElemType > &et)
Fills in a vector of all element types in the mesh.
Definition: mesh_tools.C:723
const std::set< boundary_id_type > & get_side_boundary_ids() const
bool is_prepared() const
Definition: mesh_base.C:1057
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:484
virtual dof_id_type n_active_elem() const =0
unsigned int n_threads()
Definition: libmesh_base.h:109
MPI_Info info
libMesh::BoundingBox create_bounding_box(const MeshBase &mesh)
Definition: mesh_tools.C:566
subdomain_id_type n_local_subdomains() const
Definition: mesh_base.C:1197
std::map< dof_id_type, const MeshBase::elemset_type * > _elemset_codes
Map from "element set code" to list of set ids to which that element belongs (and vice-versa)...
Definition: mesh_base.h:2324
void sum(T &r) const
const std::map< boundary_id_type, std::string > & get_sideset_name_map() const
dof_id_type n_local_nodes() const
Definition: mesh_base.h:581
const Parallel::Communicator & comm() const
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:170
dof_id_type n_local_elem() const
Definition: mesh_base.h:687
libMesh::BoundingBox create_local_bounding_box(const MeshBase &mesh)
Definition: mesh_tools.C:631
const std::set< boundary_id_type > & get_node_boundary_ids() const
Order supported_nodal_order() const
Definition: mesh_base.h:435
processor_id_type n_processors() const
const std::map< boundary_id_type, std::string > & get_nodeset_name_map() const
void min(const T &r, T &o, Request &req) const
const std::map< subdomain_id_type, std::string > & get_subdomain_name_map() const
Definition: mesh_base.h:1896
const Point & min() const
Definition: bounding_box.h:77
const std::map< boundary_id_type, std::string > & get_edgeset_name_map() const
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:2289
libmesh_assert(ctx)
unsigned int n_elemsets() const
Returns the number of unique elemset ids which have been added via add_elemset_code(), which is the size of the _all_elemset_ids set.
Definition: mesh_base.C:482
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:2282
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 =...
Definition: mesh_tools.C:1020
std::string enum_to_string(const T e)
unsigned int n_partitions() const
Definition: mesh_base.h:1516
subdomain_id_type n_subdomains() const
Definition: mesh_base.C:1183
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void max(const T &r, T &o, Request &req) const
unsigned int spatial_dimension() const
Definition: mesh_base.C:606
const std::set< boundary_id_type > & get_edge_boundary_ids() const
virtual bool is_replicated() const
Definition: mesh_base.h:369
virtual dof_id_type n_elem() const =0
processor_id_type processor_id() const
virtual dof_id_type n_nodes() const =0
void set_union(T &data, const unsigned int root_id) const

◆ get_local_constraints()

std::string libMesh::MeshBase::get_local_constraints ( bool  print_nonlocal = false) const
inherited

Gets a string reporting all mesh constraint rows local to this processor.

If print_nonlocal is true, then nonlocal constraints which are locally known are included.

Definition at line 2771 of file mesh_base.C.

References libMesh::MeshBase::_constraint_rows, and libMesh::ParallelObject::processor_id().

Referenced by libMesh::MeshBase::print_constraint_rows().

2772 {
2773  std::ostringstream os;
2774 
2775  if (print_nonlocal)
2776  os << "All ";
2777  else
2778  os << "Local ";
2779 
2780  os << "Mesh Constraint Rows:"
2781  << std::endl;
2782 
2783  for (const auto & [node, row] : _constraint_rows)
2784  {
2785  const bool local = (node->processor_id() == this->processor_id());
2786 
2787  // Skip non-local dofs if requested
2788  if (!print_nonlocal && !local)
2789  continue;
2790 
2791  os << "Constraints for " << (local ? "Local" : "Ghost") << " Node " << node->id()
2792  << ": \t";
2793 
2794  for (const auto & [elem_and_node, coef] : row)
2795  os << " ((" << elem_and_node.first->id() << ',' << elem_and_node.second << "), " << coef << ")\t";
2796 
2797  os << std::endl;
2798  }
2799 
2800  return os.str();
2801 }
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2409
processor_id_type processor_id() const

◆ get_mesh_subdomains()

const std::set<subdomain_id_type>& libMesh::MeshBase::get_mesh_subdomains ( ) const
inlineinherited
Returns
The cached mesh subdomains. As long as the mesh is prepared, this should contain all the subdomain ids across processors. Relies on the mesh being prepared

Definition at line 2025 of file mesh_base.h.

References libMesh::MeshBase::_mesh_subdomains, libMesh::MeshBase::is_prepared(), and libMesh::libmesh_assert().

2026  { libmesh_assert(this->is_prepared()); return _mesh_subdomains; }
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
Definition: mesh_base.h:2300
bool is_prepared() const
Definition: mesh_base.C:1057
libmesh_assert(ctx)

◆ get_node_integer_index()

unsigned int libMesh::MeshBase::get_node_integer_index ( std::string_view  name) const
inherited

Definition at line 778 of file mesh_base.C.

References libMesh::MeshBase::_node_integer_names, libMesh::index_range(), libMesh::invalid_uint, and libMesh::Quality::name().

779 {
780  for (auto i : index_range(_node_integer_names))
781  if (_node_integer_names[i] == name)
782  return i;
783 
784  libmesh_error_msg("Unknown node integer " << name);
785  return libMesh::invalid_uint;
786 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:303
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153

◆ get_node_integer_name()

const std::string& libMesh::MeshBase::get_node_integer_name ( unsigned int  i) const
inlineinherited

Definition at line 1191 of file mesh_base.h.

References libMesh::MeshBase::_node_integer_names.

Referenced by libMesh::XdrIO::write(), and libMesh::CheckpointIO::write().

1192  { return _node_integer_names[i]; }
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350

◆ get_point_locator_close_to_point_tol()

Real libMesh::MeshBase::get_point_locator_close_to_point_tol ( ) const
inherited

Definition at line 2314 of file mesh_base.C.

References libMesh::MeshBase::_point_locator_close_to_point_tol.

2315 {
2317 }
Real _point_locator_close_to_point_tol
If nonzero, we will call PointLocatorBase::set_close_to_point_tol() on any PointLocators that we crea...
Definition: mesh_base.h:2415

◆ get_subdomain_name_map()

const std::map<subdomain_id_type, std::string>& libMesh::MeshBase::get_subdomain_name_map ( ) const
inlineinherited

Definition at line 1896 of file mesh_base.h.

References libMesh::MeshBase::_block_id_to_name.

Referenced by libMesh::DistributedMesh::DistributedMesh(), libMesh::MeshBase::get_info(), libMesh::ReplicatedMesh::ReplicatedMesh(), stitching_helper(), MeshInputTest::testGmshBCIDOverlap(), libMesh::XdrIO::write_serialized_subdomain_names(), and libMesh::CheckpointIO::write_subdomain_names().

1897  { return _block_id_to_name; }
std::map< subdomain_id_type, std::string > _block_id_to_name
This structure maintains the mapping of named blocks for file formats that support named blocks...
Definition: mesh_base.h:2275

◆ ghosting_functors_begin()

GhostingFunctorIterator libMesh::MeshBase::ghosting_functors_begin ( ) const
inlineinherited

Beginning of range of ghosting functors.

Definition at line 1462 of file mesh_base.h.

References libMesh::MeshBase::_ghosting_functors.

Referenced by contract(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::query_ghosting_functors(), libMesh::MeshBase::redistribute(), and EquationSystemsTest::testDisableDefaultGhosting().

1463  { return _ghosting_functors.begin(); }
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2391

◆ ghosting_functors_end()

GhostingFunctorIterator libMesh::MeshBase::ghosting_functors_end ( ) const
inlineinherited

End of range of ghosting functors.

Definition at line 1468 of file mesh_base.h.

References libMesh::MeshBase::_ghosting_functors.

Referenced by contract(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::query_ghosting_functors(), libMesh::MeshBase::redistribute(), and EquationSystemsTest::testDisableDefaultGhosting().

1469  { return _ghosting_functors.end(); }
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2391

◆ has_elem_integer()

bool libMesh::MeshBase::has_elem_integer ( std::string_view  name) const
inherited

Definition at line 701 of file mesh_base.C.

References libMesh::MeshBase::_elem_integer_names, and libMesh::Quality::name().

Referenced by libMesh::MeshBase::change_elemset_code(), WriteElemsetData::checkElemsetCodes(), ExtraIntegersTest::checkpoint_helper(), libMesh::ExodusII_IO_Helper::initialize(), ExtraIntegersTest::testExtraIntegersExodusReading(), and libMesh::ExodusII_IO_Helper::write_elemsets().

702 {
703  for (auto & entry : _elem_integer_names)
704  if (entry == name)
705  return true;
706 
707  return false;
708 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2338

◆ has_node_integer()

bool libMesh::MeshBase::has_node_integer ( std::string_view  name) const
inherited

Definition at line 790 of file mesh_base.C.

References libMesh::MeshBase::_node_integer_names, and libMesh::Quality::name().

Referenced by ExtraIntegersTest::checkpoint_helper().

791 {
792  for (auto & entry : _node_integer_names)
793  if (entry == name)
794  return true;
795 
796  return false;
797 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350

◆ insert_elem() [1/2]

virtual Elem* libMesh::MeshBase::insert_elem ( Elem e)
pure virtualinherited

Insert elem e to the element array, preserving its id and replacing/deleting any existing element with the same id.

Users should call MeshBase::complete_preparation() after elements are added to and/or deleted from the mesh.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by all_first_order(), and libMesh::MeshTools::Subdivision::all_subdivision().

◆ insert_elem() [2/2]

virtual Elem* libMesh::MeshBase::insert_elem ( std::unique_ptr< Elem e)
pure virtualinherited

Version of insert_elem() taking a std::unique_ptr by value.

The version taking a dumb pointer will eventually be deprecated in favor of this version. This API is intended to indicate that ownership of the Elem is transferred to the Mesh when this function is called, and it should play more nicely with the Elem::build() API which has always returned a std::unique_ptr.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

◆ interior_mesh() [1/2]

const MeshBase& libMesh::MeshBase::interior_mesh ( ) const
inlineinherited
Returns
A mesh that may own interior parents of elements in this mesh. In most cases this mesh includes its own interior parents, but in cases where a separate "interior" mesh was used to create this mesh as a distinct lower-dimensional boundary (or boundary subset) mesh, the original mesh will be returned here.

Definition at line 2008 of file mesh_base.h.

References libMesh::MeshBase::_interior_mesh.

Referenced by libMesh::BoundaryInfo::add_elements(), copy_nodes_and_elements(), and libMesh::MeshBase::detect_interior_parents().

2008 { return *_interior_mesh; }
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
Definition: mesh_base.h:2219

◆ interior_mesh() [2/2]

MeshBase& libMesh::MeshBase::interior_mesh ( )
inlineinherited
Returns
A writeable reference to the interior mesh.

Definition at line 2013 of file mesh_base.h.

References libMesh::MeshBase::_interior_mesh.

2013 { return *_interior_mesh; }
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
Definition: mesh_base.h:2219

◆ is_prepared()

bool libMesh::MeshBase::is_prepared ( ) const
inherited

◆ is_replicated()

virtual bool libMesh::MeshBase::is_replicated ( ) const
inlinevirtualinherited

◆ is_serial()

virtual bool libMesh::MeshBase::is_serial ( ) const
inlinevirtualinherited
Returns
true if all elements and nodes of the mesh exist on the current processor, false otherwise

Reimplemented in libMesh::DistributedMesh.

Definition at line 347 of file mesh_base.h.

Referenced by libMesh::MeshRefinement::_coarsen_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::BoundaryInfo::add_elements(), libMesh::MeshTools::Modification::all_tri(), libMesh::EquationSystems::allgather(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::MeshTools::build_nodes_to_elem_map(), libMesh::MeshBase::cache_elem_data(), libMesh::MeshBase::complete_preparation(), libMesh::DofMap::create_dof_constraints(), create_submesh(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::LocationMap< T >::init(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshSerializer::MeshSerializer(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::MeshBase::partition(), libMesh::Nemesis_IO::read(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::BoundaryInfo::regenerate_id_sets(), libMesh::ReplicatedMesh::ReplicatedMesh(), scale_mesh_and_plot(), libMesh::DofMap::scatter_constraints(), libMesh::Partitioner::set_node_processor_ids(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::BoundaryInfo::sync(), libMesh::BoundaryInfo::synchronize_global_id_set(), MeshInputTest::testExodusIGASidesets(), PointLocatorTest::testLocator(), MeshInputTest::testLowOrderEdgeBlocks(), BoundaryInfoTest::testMesh(), PointLocatorTest::testPlanar(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testSelectiveRenumber(), MeshInputTest::testTetgenIO(), WriteNodesetData::testWriteImpl(), WriteSidesetData::testWriteImpl(), libMesh::MeshTools::total_weight(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::STLIO::write(), libMesh::CheckpointIO::write(), and libMesh::XdrIO::write_parallel().

348  { return true; }

◆ is_serial_on_zero()

virtual bool libMesh::MeshBase::is_serial_on_zero ( ) const
inlinevirtualinherited
Returns
true if all elements and nodes of the mesh exist on the processor 0, false otherwise

Reimplemented in libMesh::DistributedMesh.

Definition at line 354 of file mesh_base.h.

Referenced by libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), and libMesh::MeshTools::n_connected_components().

355  { return true; }

◆ libmesh_assert_valid_parallel_ids()

virtual void libMesh::MeshBase::libmesh_assert_valid_parallel_ids ( ) const
inlinevirtualinherited

Verify id and processor_id consistency of our elements and nodes containers.

Calls libmesh_assert() on each possible failure. Currently only implemented on DistributedMesh; a serial data structure is much harder to get out of sync.

Reimplemented in libMesh::DistributedMesh.

Definition at line 1688 of file mesh_base.h.

Referenced by libMesh::MeshRefinement::_refine_elements(), libMesh::InfElemBuilder::build_inf_elem(), and libMesh::MeshRefinement::refine_and_coarsen_elements().

1688 {}

◆ locally_equals()

bool libMesh::MeshBase::locally_equals ( const MeshBase other_mesh) const
inherited

This behaves the same as operator==, but only for the local and ghosted aspects of the mesh; i.e.

operator== is true iff local equality is true on every rank.

Definition at line 281 of file mesh_base.C.

References libMesh::MeshBase::_all_elemset_ids, libMesh::MeshBase::_allow_node_and_elem_unique_id_overlap, libMesh::MeshBase::_allow_remote_element_removal, libMesh::MeshBase::_block_id_to_name, libMesh::MeshBase::_constraint_rows, libMesh::MeshBase::_count_lower_dim_elems_in_point_locator, libMesh::MeshBase::_default_ghosting, libMesh::MeshBase::_default_mapping_data, libMesh::MeshBase::_default_mapping_type, libMesh::MeshBase::_disjoint_neighbor_boundary_pairs, libMesh::MeshBase::_elem_default_orders, libMesh::MeshBase::_elem_dims, libMesh::MeshBase::_elem_integer_default_values, libMesh::MeshBase::_elem_integer_names, libMesh::MeshBase::_elemset_codes, libMesh::MeshBase::_ghosting_functors, libMesh::MeshBase::_interior_mesh, libMesh::MeshBase::_mesh_subdomains, libMesh::MeshBase::_n_parts, libMesh::MeshBase::_node_integer_default_values, libMesh::MeshBase::_node_integer_names, libMesh::MeshBase::_partitioner, libMesh::MeshBase::_point_locator_close_to_point_tol, libMesh::MeshBase::_preparation, libMesh::MeshBase::_skip_all_partitioning, libMesh::MeshBase::_skip_detect_interior_parents, libMesh::MeshBase::_skip_find_neighbors, libMesh::MeshBase::_skip_noncritical_partitioning, libMesh::MeshBase::_skip_renumber_nodes_and_elements, libMesh::MeshBase::_spatial_dimension, libMesh::MeshBase::_supported_nodal_order, libMesh::MeshBase::boundary_info, libMesh::MeshBase::get_constraint_rows(), libMesh::index_range(), libMesh::libmesh_assert(), libMesh::MeshBase::query_node_ptr(), and libMesh::MeshBase::subclass_locally_equals().

Referenced by libMesh::MeshBase::operator==().

282 {
283  // Check whether (almost) everything in the base is equal
284  //
285  // We don't check _next_unique_id here, because it's expected to
286  // change in a DistributedMesh prepare_for_use(); it's conceptually
287  // "mutable".
288  //
289  // We use separate if statements instead of logical operators here,
290  // to make it easy to see the failing condition when using a
291  // debugger to figure out why a MeshTools::valid_is_prepared(mesh)
292  // is failing.
293  if (_n_parts != other_mesh._n_parts)
294  return false;
295  if (_default_mapping_type != other_mesh._default_mapping_type)
296  return false;
297  if (_default_mapping_data != other_mesh._default_mapping_data)
298  return false;
299  if (_preparation != other_mesh._preparation)
300  return false;
302  other_mesh._count_lower_dim_elems_in_point_locator)
303  return false;
304 
305  // We should either both have our own interior parents or both not;
306  // but if we both don't then we can't really assert anything else
307  // because pointing at the same interior mesh is fair but so is
308  // pointing at two different copies of "the same" interior mesh.
309  if ((_interior_mesh == this) !=
310  (other_mesh._interior_mesh == &other_mesh))
311  return false;
312 
313  if (_skip_noncritical_partitioning != other_mesh._skip_noncritical_partitioning)
314  return false;
315  if (_skip_all_partitioning != other_mesh._skip_all_partitioning)
316  return false;
317  if (_skip_renumber_nodes_and_elements != other_mesh._skip_renumber_nodes_and_elements)
318  return false;
319  if (_skip_find_neighbors != other_mesh._skip_find_neighbors)
320  return false;
321  if (_skip_detect_interior_parents != other_mesh._skip_detect_interior_parents)
322  return false;
323  if (_allow_remote_element_removal != other_mesh._allow_remote_element_removal)
324  return false;
325  if (_allow_node_and_elem_unique_id_overlap != other_mesh._allow_node_and_elem_unique_id_overlap)
326  return false;
327  if (_spatial_dimension != other_mesh._spatial_dimension)
328  return false;
329  if (_point_locator_close_to_point_tol != other_mesh._point_locator_close_to_point_tol)
330  return false;
331  if (_block_id_to_name != other_mesh._block_id_to_name)
332  return false;
333  if (_elem_dims != other_mesh._elem_dims)
334  return false;
335  if (_elem_default_orders != other_mesh._elem_default_orders)
336  return false;
337  if (_supported_nodal_order != other_mesh._supported_nodal_order)
338  return false;
339  if (_mesh_subdomains != other_mesh._mesh_subdomains)
340  return false;
341  if (_all_elemset_ids != other_mesh._all_elemset_ids)
342  return false;
343  if (_elem_integer_names != other_mesh._elem_integer_names)
344  return false;
345  if (_elem_integer_default_values != other_mesh._elem_integer_default_values)
346  return false;
347  if (_node_integer_names != other_mesh._node_integer_names)
348  return false;
349  if (_node_integer_default_values != other_mesh._node_integer_default_values)
350  return false;
351  if (static_cast<bool>(_default_ghosting) != static_cast<bool>(other_mesh._default_ghosting))
352  return false;
353  if (static_cast<bool>(_partitioner) != static_cast<bool>(other_mesh._partitioner))
354  return false;
355  if (*boundary_info != *other_mesh.boundary_info)
356  return false;
357 
358  // First check whether the "existence" of the two pointers differs (one present, one absent)
359  if (static_cast<bool>(_disjoint_neighbor_boundary_pairs) !=
360  static_cast<bool>(other_mesh._disjoint_neighbor_boundary_pairs))
361  return false;
362  // If both exist, compare the contents (Weak Test: just compare sizes like `_ghosting_functors`)
364  (_disjoint_neighbor_boundary_pairs->size() != other_mesh._disjoint_neighbor_boundary_pairs->size()))
365  return false;
366 
367  const constraint_rows_type & other_rows =
368  other_mesh.get_constraint_rows();
369  for (const auto & [node, row] : this->_constraint_rows)
370  {
371  const dof_id_type node_id = node->id();
372  const Node * other_node = other_mesh.query_node_ptr(node_id);
373  if (!other_node)
374  return false;
375 
376  auto it = other_rows.find(other_node);
377  if (it == other_rows.end())
378  return false;
379 
380  const auto & other_row = it->second;
381  if (row.size() != other_row.size())
382  return false;
383 
384  for (auto i : index_range(row))
385  {
386  const auto & [elem_pair, coef] = row[i];
387  const auto & [other_elem_pair, other_coef] = other_row[i];
388  libmesh_assert(elem_pair.first);
389  libmesh_assert(other_elem_pair.first);
390  if (elem_pair.first->id() !=
391  other_elem_pair.first->id() ||
392  elem_pair.second !=
393  other_elem_pair.second ||
394  coef != other_coef)
395  return false;
396  }
397  }
398 
399  for (const auto & [elemset_code, elemset_ptr] : this->_elemset_codes)
400  if (const auto it = other_mesh._elemset_codes.find(elemset_code);
401  it == other_mesh._elemset_codes.end() || *elemset_ptr != *it->second)
402  return false;
403 
404  // FIXME: we have no good way to compare ghosting functors, since
405  // they're in a vector of pointers, and we have no way *at all*
406  // to compare ghosting functors, since they don't have operator==
407  // defined and we encourage users to subclass them. We can check if
408  // we have the same number, is all.
409  if (_ghosting_functors.size() !=
410  other_mesh._ghosting_functors.size())
411  return false;
412 
413  // Same deal for partitioners. We tested that we both have one or
414  // both don't, but are they equivalent? Let's guess "yes".
415 
416  // Now let the subclasses decide whether everything else is equal
417  return this->subclass_locally_equals(other_mesh);
418 }
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
Definition: mesh_base.h:2300
virtual bool subclass_locally_equals(const MeshBase &other_mesh) const =0
Shim to allow operator == (&) to behave like a virtual function without having to be one...
bool _allow_node_and_elem_unique_id_overlap
The Exodus reader (and potentially other readers in the future?) now supports setting Node and Elem u...
Definition: mesh_base.h:2268
bool _skip_renumber_nodes_and_elements
If this is true then renumbering will be kept to a minimum.
Definition: mesh_base.h:2237
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2338
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
Definition: mesh_base.h:2219
std::map< dof_id_type, const MeshBase::elemset_type * > _elemset_codes
Map from "element set code" to list of set ids to which that element belongs (and vice-versa)...
Definition: mesh_base.h:2324
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2391
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2409
bool _skip_noncritical_partitioning
If this is true then no partitioning should be done with the possible exception of orphaned nodes...
Definition: mesh_base.h:2225
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2332
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
Definition: mesh_base.h:2098
bool _allow_remote_element_removal
If this is false then even on DistributedMesh remote elements will not be deleted during mesh prepara...
Definition: mesh_base.h:2255
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350
MeshBase::elemset_type _all_elemset_ids
Definition: mesh_base.h:2326
unsigned int _n_parts
The number of partitions the mesh has.
Definition: mesh_base.h:2144
unsigned char _default_mapping_data
The default mapping data (unused with Lagrange, used for nodal weight lookup index with rational base...
Definition: mesh_base.h:2157
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
Definition: mesh_base.h:2150
std::unique_ptr< Partitioner > _partitioner
A partitioner to use at each prepare_for_use().
Definition: mesh_base.h:2206
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:2289
libmesh_assert(ctx)
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
Definition: mesh_base.h:2242
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:2295
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:2282
std::unique_ptr< PeriodicBoundaries > _disjoint_neighbor_boundary_pairs
The disjoint neighbor boundary id pairs.
Definition: mesh_base.h:2086
std::vector< dof_id_type > _node_integer_default_values
The array of default initialization values for integer data associated with each node in the mesh...
Definition: mesh_base.h:2356
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162
std::vector< dof_id_type > _elem_integer_default_values
The array of default initialization values for integer data associated with each element in the mesh...
Definition: mesh_base.h:2344
bool _skip_detect_interior_parents
If this is true then we will skip detect_interior_parents in prepare_for_use.
Definition: mesh_base.h:2247
std::map< const Node *, constraint_rows_mapped_type > constraint_rows_type
Definition: mesh_base.h:1900
std::unique_ptr< GhostingFunctor > _default_ghosting
The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior...
Definition: mesh_base.h:2382
bool _skip_all_partitioning
If this is true then no partitioning should be done.
Definition: mesh_base.h:2230
Real _point_locator_close_to_point_tol
If nonzero, we will call PointLocatorBase::set_close_to_point_tol() on any PointLocators that we crea...
Definition: mesh_base.h:2415
bool _count_lower_dim_elems_in_point_locator
Do we count lower dimensional elements in point locator refinement? This is relevant in tree-based po...
Definition: mesh_base.h:2198
std::map< subdomain_id_type, std::string > _block_id_to_name
This structure maintains the mapping of named blocks for file formats that support named blocks...
Definition: mesh_base.h:2275
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153
uint8_t dof_id_type
Definition: id_types.h:67

◆ max_elem_id()

virtual dof_id_type libMesh::MeshBase::max_elem_id ( ) const
pure virtualinherited
Returns
A number one greater than the maximum element id in the mesh. A more apt name for this method would be end_elem_id

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::BoundaryInfo::add_elements(), libMesh::MeshTools::Modification::all_tri(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), CopyNodesAndElementsTest::collectMeshes(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::MeshBase::detect_interior_parents(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_equal_connectivity(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), main(), AllSecondOrderTest::MixedFixingImpl(), libMesh::MeshTools::Modification::permute_elements(), libMesh::Partitioner::set_parent_processor_ids(), stitching_helper(), AllRBBTest::test_box(), EquationSystemsTest::testPostInitAddElem(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testVTKPreserveElemIds(), libMesh::MeshTetInterface::volume_to_surface_mesh(), libMesh::ExodusII_IO_Helper::write_elements(), and libMesh::GmshIO::write_mesh().

◆ max_node_id()

virtual dof_id_type libMesh::MeshBase::max_node_id ( ) const
pure virtualinherited

◆ merge_extra_integer_names()

std::pair< std::vector< unsigned int >, std::vector< unsigned int > > libMesh::MeshBase::merge_extra_integer_names ( const MeshBase other)
protectedinherited

Merge extra-integer arrays from an other mesh.

Returns two mappings from index values in other to (possibly newly created) index values with the same string name in this mesh, the first for element integers and the second for node integers.

Definition at line 2345 of file mesh_base.C.

References libMesh::MeshBase::_elem_integer_default_values, libMesh::MeshBase::_elem_integer_names, libMesh::MeshBase::_node_integer_default_values, libMesh::MeshBase::_node_integer_names, libMesh::MeshBase::add_elem_integers(), and libMesh::MeshBase::add_node_integers().

Referenced by copy_nodes_and_elements(), and create_submesh().

2346 {
2347  std::pair<std::vector<unsigned int>, std::vector<unsigned int>> returnval;
2348  returnval.first = this->add_elem_integers(other._elem_integer_names, true, &other._elem_integer_default_values);
2349  returnval.second = this->add_node_integers(other._node_integer_names, true, &other._node_integer_default_values);
2350  return returnval;
2351 }
std::vector< unsigned int > add_elem_integers(const std::vector< std::string > &names, bool allocate_data=true, const std::vector< dof_id_type > *default_values=nullptr)
Register integer data (of type dof_id_type) to be added to each element in the mesh, one string name for each new integer.
Definition: mesh_base.C:646
std::vector< unsigned int > add_node_integers(const std::vector< std::string > &names, bool allocate_data=true, const std::vector< dof_id_type > *default_values=nullptr)
Register integer data (of type dof_id_type) to be added to each node in the mesh. ...
Definition: mesh_base.C:735

◆ mesh_dimension()

unsigned int libMesh::MeshBase::mesh_dimension ( ) const
inherited
Returns
The logical dimension of the mesh; i.e. the manifold dimension of the elements in the mesh. When we have multi-dimensional meshes (e.g. hexes and quads in the same mesh) then this will return the largest such dimension.

Definition at line 430 of file mesh_base.C.

References libMesh::MeshBase::_elem_dims.

Referenced by libMesh::HPCoarsenTest::add_projection(), all_complete_order_range(), all_second_order_range(), libMesh::MeshTools::Modification::all_tri(), alternative_fe_assembly(), assemble(), LinearElasticity::assemble(), assemble_1D(), AssembleOptimization::assemble_A_and_F(), assemble_biharmonic(), assemble_cd(), assemble_divgrad(), assemble_elasticity(), assemble_ellipticdg(), assemble_func(), assemble_graddiv(), assemble_helmholtz(), assemble_laplace(), assemble_mass(), assemble_matrices(), assemble_poisson(), assemble_SchroedingerEquation(), assemble_shell(), assemble_stokes(), assemble_temperature_jump(), assemble_wave(), libMesh::MeshBase::cache_elem_data(), compute_enriched_soln(), compute_jacobian(), compute_residual(), compute_stresses(), LinearElasticityWithContact::compute_stresses(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::VariationalSmootherConstraint::constrain_node_to_line(), libMesh::VariationalSmootherConstraint::constrain_node_to_plane(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshTools::Modification::distort(), SolidSystem::element_time_derivative(), HeatSystem::element_time_derivative(), fe_assembly(), libMesh::VariationalSmootherConstraint::fix_node(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), form_functionA(), form_functionB(), form_matrixA(), libMesh::ReplicatedMesh::get_boundary_points(), libMesh::LaplaceMeshSmoother::init(), SolidSystem::init_data(), libMesh::ExodusII_IO_Helper::initialize(), integrate_function(), LaplaceYoung::jacobian(), LargeDeformationElasticity::jacobian(), main(), libMesh::GMVIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::System::read_header(), libMesh::UCDIO::read_implementation(), libMesh::XdrIO::read_serialized_connectivity(), LaplaceYoung::residual(), LargeDeformationElasticity::residual(), LinearElasticityWithContact::residual_and_jacobian(), SolidSystem::save_initial_mesh(), libMesh::PetscPreconditioner< T >::set_hypre_ads_data(), libMesh::PetscPreconditioner< T >::set_hypre_ams_data(), libMesh::PetscPreconditioner< T >::set_petsc_aux_data(), setup(), libMesh::MeshTools::Modification::smooth(), MeshSpatialDimensionTest::test1D(), MeshSpatialDimensionTest::test2D(), InfFERadialTest::testInfQuants(), InfFERadialTest::testInfQuants_numericDeriv(), InfFERadialTest::testSides(), InfFERadialTest::testSingleOrder(), MeshSmootherTest::testVariationalSmootherRegression(), libMesh::BoundaryVolumeSolutionTransfer::transfer(), libMesh::DTKSolutionTransfer::transfer(), libMesh::MeshTools::volume(), libMesh::PostscriptIO::write(), libMesh::CheckpointIO::write(), libMesh::TecplotIO::write_binary(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::UCDIO::write_implementation(), libMesh::UCDIO::write_nodal_data(), libMesh::EnsightIO::write_scalar_ascii(), libMesh::GnuPlotIO::write_solution(), and libMesh::EnsightIO::write_vector_ascii().

431 {
432  if (!_elem_dims.empty())
433  return cast_int<unsigned int>(*_elem_dims.rbegin());
434  return 0;
435 }
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:2282

◆ move_nodes_and_elements()

virtual void libMesh::UnstructuredMesh::move_nodes_and_elements ( MeshBase &&  other_mesh)
pure virtual

Move node and elements from other_mesh to this mesh.

Implemented in libMesh::ReplicatedMesh.

◆ n_active_elem()

virtual dof_id_type libMesh::MeshBase::n_active_elem ( ) const
pure virtualinherited

◆ n_active_elem_on_proc()

dof_id_type libMesh::MeshBase::n_active_elem_on_proc ( const processor_id_type  proc) const
inherited
Returns
The number of active elements on processor proc.

Definition at line 1235 of file mesh_base.C.

References distance(), and libMesh::ParallelObject::n_processors().

Referenced by libMesh::MeshBase::n_active_local_elem().

1236 {
1237  libmesh_assert_less (proc_id, this->n_processors());
1238  return static_cast<dof_id_type>(std::distance (this->active_pid_elements_begin(proc_id),
1239  this->active_pid_elements_end (proc_id)));
1240 }
Real distance(const Point &p)
processor_id_type n_processors() const
uint8_t dof_id_type
Definition: id_types.h:67

◆ n_active_local_elem()

dof_id_type libMesh::MeshBase::n_active_local_elem ( ) const
inlineinherited

◆ n_active_sub_elem()

dof_id_type libMesh::MeshBase::n_active_sub_elem ( ) const
inherited

Same as n_sub_elem(), but only counts active elements.

Definition at line 1256 of file mesh_base.C.

Referenced by libMesh::TecplotIO::write_ascii(), libMesh::GMVIO::write_ascii_old_impl(), and libMesh::TecplotIO::write_binary().

1257 {
1258  dof_id_type ne=0;
1259 
1260  for (const auto & elem : this->active_element_ptr_range())
1261  ne += elem->n_sub_elem();
1262 
1263  return ne;
1264 }
uint8_t dof_id_type
Definition: id_types.h:67

◆ n_constraint_rows()

dof_id_type libMesh::MeshBase::n_constraint_rows ( ) const
inherited

Definition at line 2431 of file mesh_base.C.

References libMesh::MeshBase::_constraint_rows, libMesh::ParallelObject::comm(), libMesh::DofObject::invalid_processor_id, libMesh::ParallelObject::processor_id(), and TIMPI::Communicator::sum().

Referenced by libMesh::MeshCommunication::delete_remote_elements().

2432 {
2433  dof_id_type n_local_rows=0, n_unpartitioned_rows=0;
2434  for (const auto & [node, node_constraints] : _constraint_rows)
2435  {
2436  // Unpartitioned nodes
2437  if (node->processor_id() == DofObject::invalid_processor_id)
2438  n_unpartitioned_rows++;
2439  else if (node->processor_id() == this->processor_id())
2440  n_local_rows++;
2441  }
2442 
2443  this->comm().sum(n_local_rows);
2444 
2445  return n_unpartitioned_rows + n_local_rows;
2446 }
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:484
void sum(T &r) const
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2409
const Parallel::Communicator & comm() const
processor_id_type processor_id() const
uint8_t dof_id_type
Definition: id_types.h:67

◆ n_elem()

virtual dof_id_type libMesh::MeshBase::n_elem ( ) const
pure virtualinherited
Returns
The number of elements in the mesh.

The standard n_elem() function may return a cached value on distributed meshes, and so can be called by any processor at any time.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::MeshTools::Subdivision::add_boundary_ghosts(), libMesh::MeshTools::Modification::all_tri(), AllSecondOrderTest::allCompleteOrderDoNothing(), AllSecondOrderTest::allCompleteOrderMixed(), AllSecondOrderTest::allCompleteOrderRange(), AllSecondOrderTest::allSecondOrderDoNothing(), AllSecondOrderTest::allSecondOrderMixed(), AllSecondOrderTest::allSecondOrderRange(), libMesh::MeshCommunication::assign_global_indices(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::MeshTools::build_nodes_to_elem_map(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::MeshTetInterface::check_hull_integrity(), copy_nodes_and_elements(), libMesh::DofMap::create_dof_constraints(), create_submesh(), libMesh::MeshTools::Modification::distort(), libMesh::TriangulatorInterface::elems_to_segments(), libMesh::MeshBase::get_info(), main(), AllSecondOrderTest::MixedFixingImpl(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read_serialized_nodes(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::MeshTools::Modification::redistribute(), ConstraintOperatorTest::test1DCoarseningNewNodes(), AllRBBTest::test_box(), AllRBBTest::test_cylinder(), AllRBBTest::test_disk(), AllTriTest::test_helper_2D(), AllTriTest::test_helper_3D(), AllTriTest::test_helper_c0polyhedron(), MeshInputTest::testAbaqusRead(), AllTriTest::testAllTriC0Polygon(), AllTriTest::testAllTriC0PolygonOctagon(), MeshGenerationTest::testBuildCube(), MeshGenerationTest::testBuildLine(), MeshGenerationTest::testBuildSquare(), MeshDeletionsTest::testDeleteElem(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshTriangulationTest::testEdge3ToTri6Base(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testGoodGmsh(), MeshInputTest::testGoodSTL(), MeshInputTest::testGoodSTLBinary(), InfFERadialTest::testInfQuants(), InfFERadialTest::testInfQuants_numericDeriv(), MeshAssignTest::testMeshMoveAssign(), MeshInputTest::testNemesisReadImpl(), MeshTriangulationTest::testPoly2TriRefinementBase(), EquationSystemsTest::testSelectivePRefine(), InfFERadialTest::testSides(), InfFERadialTest::testSingleOrder(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTetTest::testTetInterfaceBase(), MeshTriangulationTest::testTriangulatorBase(), MeshTriangulationTest::testTriangulatorHoles(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), MeshInputTest::testVTKPreserveElemIds(), MeshInputTest::testVTKPreserveSubdomainIds(), libMesh::NetGenMeshInterface::triangulate(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::FroIO::write(), libMesh::TetGenIO::write(), libMesh::XdrIO::write(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::UCDIO::write_implementation(), libMesh::UCDIO::write_nodal_data(), libMesh::XdrIO::write_serialized_connectivity(), and libMesh::System::write_serialized_vectors().

◆ n_elem_integers()

unsigned int libMesh::MeshBase::n_elem_integers ( ) const
inlineinherited

Definition at line 1080 of file mesh_base.h.

References libMesh::MeshBase::_elem_integer_names.

Referenced by libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::write(), and libMesh::CheckpointIO::write().

1080 { return _elem_integer_names.size(); }
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2338

◆ n_elem_on_proc()

dof_id_type libMesh::MeshBase::n_elem_on_proc ( const processor_id_type  proc) const
inherited
Returns
The number of elements on processor proc.

Definition at line 1222 of file mesh_base.C.

References distance(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), and libMesh::ParallelObject::n_processors().

Referenced by libMesh::MeshBase::n_local_elem(), and libMesh::MeshBase::n_unpartitioned_elem().

1223 {
1224  // We're either counting a processor's elements or unpartitioned
1225  // elements
1226  libmesh_assert (proc_id < this->n_processors() ||
1227  proc_id == DofObject::invalid_processor_id);
1228 
1229  return static_cast<dof_id_type>(std::distance (this->pid_elements_begin(proc_id),
1230  this->pid_elements_end (proc_id)));
1231 }
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:484
Real distance(const Point &p)
processor_id_type n_processors() const
libmesh_assert(ctx)
uint8_t dof_id_type
Definition: id_types.h:67

◆ n_elemsets()

unsigned int libMesh::MeshBase::n_elemsets ( ) const
inherited

Returns the number of unique elemset ids which have been added via add_elemset_code(), which is the size of the _all_elemset_ids set.

Definition at line 482 of file mesh_base.C.

References libMesh::MeshBase::_all_elemset_ids.

Referenced by libMesh::MeshBase::get_info(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO::read(), and libMesh::ExodusII_IO_Helper::write_elemsets().

483 {
484  return _all_elemset_ids.size();
485 }
MeshBase::elemset_type _all_elemset_ids
Definition: mesh_base.h:2326

◆ n_local_elem()

dof_id_type libMesh::MeshBase::n_local_elem ( ) const
inlineinherited
Returns
The number of elements on the local processor.

Definition at line 687 of file mesh_base.h.

References libMesh::MeshBase::n_elem_on_proc(), and libMesh::ParallelObject::processor_id().

Referenced by libMesh::DTKAdapter::DTKAdapter(), libMesh::MeshBase::get_info(), libMesh::DistributedMesh::parallel_n_elem(), and DofMapTest::testBadElemFECombo().

688  { return this->n_elem_on_proc (this->processor_id()); }
dof_id_type n_elem_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:1222
processor_id_type processor_id() const

◆ n_local_nodes()

dof_id_type libMesh::MeshBase::n_local_nodes ( ) const
inlineinherited
Returns
The number of nodes on the local processor.

Definition at line 581 of file mesh_base.h.

References libMesh::MeshBase::n_nodes_on_proc(), and libMesh::ParallelObject::processor_id().

Referenced by libMesh::MeshBase::get_info(), libMesh::VTKIO::nodes_to_vtk(), and libMesh::DistributedMesh::parallel_n_nodes().

582  { return this->n_nodes_on_proc (this->processor_id()); }
dof_id_type n_nodes_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:1209
processor_id_type processor_id() const

◆ n_local_subdomains()

subdomain_id_type libMesh::MeshBase::n_local_subdomains ( ) const
inherited
Returns
The number of subdomains in the local mesh. Subdomains correspond to separate subsets of the mesh which could correspond e.g. to different materials in a solid mechanics application, or regions where different physical processes are important. The subdomain mapping is independent from the parallel decomposition.

Definition at line 1197 of file mesh_base.C.

References libMesh::MeshBase::subdomain_ids().

Referenced by libMesh::MeshBase::get_info().

1198 {
1199  std::set<subdomain_id_type> ids;
1200 
1201  this->subdomain_ids (ids, /* global = */ false);
1202 
1203  return cast_int<subdomain_id_type>(ids.size());
1204 }
void subdomain_ids(std::set< subdomain_id_type > &ids, const bool global=true) const
Constructs a list of all subdomain identifiers in the local mesh if global == false, and in the global mesh if global == true (default).
Definition: mesh_base.C:1119

◆ n_node_integers()

unsigned int libMesh::MeshBase::n_node_integers ( ) const
inlineinherited

Definition at line 1202 of file mesh_base.h.

References libMesh::MeshBase::_node_integer_names.

Referenced by libMesh::CheckpointIO::read_nodes(), libMesh::XdrIO::write(), and libMesh::CheckpointIO::write().

1202 { return _node_integer_names.size(); }
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350

◆ n_nodes()

virtual dof_id_type libMesh::MeshBase::n_nodes ( ) const
pure virtualinherited
Returns
The number of nodes in the mesh.

This function and others must be defined in derived classes since the MeshBase class has no specific storage for nodes or elements. The standard n_nodes() function may return a cached value on distributed meshes, and so can be called by any processor at any time.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by all_complete_order_range(), all_second_order_range(), AllSecondOrderTest::allCompleteOrderDoNothing(), AllSecondOrderTest::allCompleteOrderMixed(), AllSecondOrderTest::allCompleteOrderRange(), AllSecondOrderTest::allSecondOrderDoNothing(), AllSecondOrderTest::allSecondOrderMixed(), AllSecondOrderTest::allSecondOrderRange(), libMesh::MeshCommunication::assign_global_indices(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshBase::copy_constraint_rows(), copy_nodes_and_elements(), create_submesh(), libMesh::MeshTools::Modification::distort(), fill_dirichlet_bc(), libMesh::TetGenMeshInterface::fill_pointlist(), libMesh::MeshBase::get_info(), libMesh::VTKIO::get_local_node_values(), libMesh::TreeNode< N >::insert(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), main(), AllSecondOrderTest::MixedFixingImpl(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::UCDIO::read_implementation(), libMesh::XdrIO::read_serialized_nodes(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::MeshTools::Modification::redistribute(), libMesh::MeshTools::Modification::smooth(), ConstraintOperatorTest::test1DCoarseningNewNodes(), MeshInputTest::testAbaqusRead(), SystemsTest::testBoundaryProjectCube(), MeshGenerationTest::testBuildCube(), MeshGenerationTest::testBuildLine(), MeshGenerationTest::testBuildSquare(), SystemsTest::testDofCouplingWithVarGroups(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), ConnectedComponentsTest::testEdge(), VolumeTest::testEdge3Volume(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testGoodSTLBinary(), MeshInputTest::testNemesisReadImpl(), MeshInputTest::testTetgenIO(), MeshTetTest::testTetInterfaceBase(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorRoundHole(), MeshSmootherTest::testVariationalSmootherRegression(), MeshInputTest::testVTKPreserveElemIds(), MeshInputTest::testVTKPreserveSubdomainIds(), libMesh::DirectSolutionTransfer::transfer(), libMesh::TreeNode< N >::transform_nodes_to_elements(), libMesh::TriangleInterface::triangulate(), libMesh::NetGenMeshInterface::triangulate(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::Poly2TriTriangulator::triangulate_current_points(), libMesh::FroIO::write(), libMesh::TetGenIO::write(), libMesh::MEDITIO::write_ascii(), libMesh::TecplotIO::write_ascii(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::TecplotIO::write_binary(), libMesh::GMVIO::write_binary(), libMesh::UCDIO::write_header(), libMesh::GmshIO::write_mesh(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::GmshIO::write_post(), libMesh::System::write_serialized_vectors(), and libMesh::UCDIO::write_soln().

◆ n_nodes_on_proc()

dof_id_type libMesh::MeshBase::n_nodes_on_proc ( const processor_id_type  proc) const
inherited
Returns
The number of nodes on processor proc.

Definition at line 1209 of file mesh_base.C.

References distance(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), and libMesh::ParallelObject::n_processors().

Referenced by libMesh::MeshBase::n_local_nodes(), and libMesh::MeshBase::n_unpartitioned_nodes().

1210 {
1211  // We're either counting a processor's nodes or unpartitioned
1212  // nodes
1213  libmesh_assert (proc_id < this->n_processors() ||
1214  proc_id == DofObject::invalid_processor_id);
1215 
1216  return static_cast<dof_id_type>(std::distance (this->pid_nodes_begin(proc_id),
1217  this->pid_nodes_end (proc_id)));
1218 }
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:484
Real distance(const Point &p)
processor_id_type n_processors() const
libmesh_assert(ctx)
uint8_t dof_id_type
Definition: id_types.h:67

◆ n_partitions()

unsigned int libMesh::MeshBase::n_partitions ( ) const
inlineinherited
Returns
The number of partitions which have been defined via a call to either mesh.partition() or by building a Partitioner object and calling partition.
Note
The partitioner object is responsible for setting this value.

Definition at line 1516 of file mesh_base.h.

References libMesh::MeshBase::_n_parts.

Referenced by libMesh::Partitioner::assign_partitioning(), copy_nodes_and_elements(), libMesh::MeshBase::get_info(), libMesh::BoundaryInfo::sync(), CheckpointIOTest::testSplitter(), libMesh::NameBasedIO::write(), libMesh::GMVIO::write_ascii_new_impl(), and libMesh::GMVIO::write_ascii_old_impl().

1517  { return _n_parts; }
unsigned int _n_parts
The number of partitions the mesh has.
Definition: mesh_base.h:2144

◆ n_processors()

processor_id_type libMesh::ParallelObject::n_processors ( ) const
inlineinherited
Returns
The number of processors in the group.

Definition at line 103 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, libMesh::libmesh_assert(), and TIMPI::Communicator::size().

Referenced by libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::DofMap::add_constraints_to_send_list(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::System::add_vector(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::Partitioner::build_graph(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), copy_nodes_and_elements(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::MeshBase::get_info(), libMesh::StaticCondensation::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::NumericVector< Number >::is_effectively_ghosted(), libMesh::NumericVector< Number >::is_effectively_serial(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::DofMap::n_dofs_per_processor(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::prepare_send_list(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), OverlappingFunctorTest::run_partitioner_test(), libMesh::DofMap::scatter_constraints(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), WriteVecAndScalar::setupTests(), libMesh::RBEIMEvaluation::side_gather_bfs(), DistributedMeshTest::testRemoteElemError(), CheckpointIOTest::testSplitter(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

104  {
105  processor_id_type returnval =
106  cast_int<processor_id_type>(_communicator.size());
107  libmesh_assert(returnval); // We never have an empty comm
108  return returnval;
109  }
const Parallel::Communicator & _communicator
processor_id_type size() const
uint8_t processor_id_type
libmesh_assert(ctx)

◆ n_sub_elem()

dof_id_type libMesh::MeshBase::n_sub_elem ( ) const
inherited
Returns
The number of elements that will be written out in certain I/O formats.

For example, a 9-noded quadrilateral will be broken into 4 linear sub-elements for plotting purposes. Thus, for a mesh of 2 QUAD9 elements n_tecplot_elem() will return 8. Implemented in terms of element_iterators.

Definition at line 1244 of file mesh_base.C.

1245 {
1246  dof_id_type ne=0;
1247 
1248  for (const auto & elem : this->element_ptr_range())
1249  ne += elem->n_sub_elem();
1250 
1251  return ne;
1252 }
uint8_t dof_id_type
Definition: id_types.h:67

◆ n_subdomains()

subdomain_id_type libMesh::MeshBase::n_subdomains ( ) const
inherited
Returns
The number of subdomains in the global mesh. Subdomains correspond to separate subsets of the mesh which could correspond e.g. to different materials in a solid mechanics application, or regions where different physical processes are important. The subdomain mapping is independent from the parallel decomposition.

Definition at line 1183 of file mesh_base.C.

References libMesh::MeshBase::subdomain_ids().

Referenced by libMesh::MeshBase::get_info(), MeshSubdomainIDTest::testUnpartitioned(), libMesh::XdrIO::write(), and libMesh::NameBasedIO::write_nodal_data().

1184 {
1185  // This requires an inspection on every processor
1186  parallel_object_only();
1187 
1188  std::set<subdomain_id_type> ids;
1189 
1190  this->subdomain_ids (ids);
1191 
1192  return cast_int<subdomain_id_type>(ids.size());
1193 }
void subdomain_ids(std::set< subdomain_id_type > &ids, const bool global=true) const
Constructs a list of all subdomain identifiers in the local mesh if global == false, and in the global mesh if global == true (default).
Definition: mesh_base.C:1119

◆ n_unpartitioned_elem()

dof_id_type libMesh::MeshBase::n_unpartitioned_elem ( ) const
inlineinherited
Returns
The number of elements owned by no processor.

Definition at line 693 of file mesh_base.h.

References libMesh::DofObject::invalid_processor_id, and libMesh::MeshBase::n_elem_on_proc().

Referenced by libMesh::MeshBase::complete_preparation(), libMesh::DistributedMesh::parallel_n_elem(), and libMesh::MeshBase::partition().

static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:484
dof_id_type n_elem_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:1222

◆ n_unpartitioned_nodes()

dof_id_type libMesh::MeshBase::n_unpartitioned_nodes ( ) const
inlineinherited
Returns
The number of nodes owned by no processor.

Definition at line 587 of file mesh_base.h.

References libMesh::DofObject::invalid_processor_id, and libMesh::MeshBase::n_nodes_on_proc().

Referenced by libMesh::MeshBase::complete_preparation(), and libMesh::DistributedMesh::parallel_n_nodes().

static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:484
dof_id_type n_nodes_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:1209

◆ next_unique_id()

unique_id_type libMesh::MeshBase::next_unique_id ( ) const
inlineinherited
Returns
The next unique id to be used.

Definition at line 600 of file mesh_base.h.

References libMesh::MeshBase::_next_unique_id.

Referenced by libMesh::ExodusII_IO_Helper::set_dof_object_unique_id(), and libMesh::ExodusII_IO_Helper::write_elements().

600 { return _next_unique_id; }
unique_id_type _next_unique_id
The next available unique id for assigning ids to DOF objects.
Definition: mesh_base.h:2212

◆ node_ptr() [1/2]

virtual const Node* libMesh::MeshBase::node_ptr ( const dof_id_type  i) const
pure virtualinherited
Returns
A pointer to the \( i^{th} \) node, which should be present in this processor's subset of the mesh data structure.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::GMVIO::_read_one_cell(), add_cube_convex_hull_to_mesh(), libMesh::MeshRefinement::add_node(), AllSecondOrderTest::allCompleteOrderMixed(), AllSecondOrderTest::allCompleteOrderRange(), libMesh::DofMap::allgather_recursive_constraints(), AllSecondOrderTest::allSecondOrderMixed(), AllSecondOrderTest::allSecondOrderRange(), libMesh::AbaqusIO::assign_boundary_node_ids(), libMesh::TetGenMeshInterface::assign_nodes_to_elem(), libMesh::MeshTools::Generation::build_extrusion(), DisjointNeighborTest::build_four_disjoint_elems(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), DisjointNeighborTest::build_split_mesh_with_interface(), DisjointNeighborTest::build_two_disjoint_elems(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::MeshBase::copy_constraint_rows(), libMesh::TriangleWrapper::copy_tri_to_mesh(), create_submesh(), libMesh::TetGenIO::element_in(), libMesh::TriangulatorInterface::elems_to_segments(), libMesh::TriangulatorInterface::insert_any_extra_boundary_points(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::MeshTools::libmesh_assert_valid_constraint_rows(), main(), libMesh::MeshBase::node_ref(), libMesh::BoundaryInfo::operator=(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::ExodusII_IO_Helper::read_edge_blocks(), libMesh::AbaqusIO::read_elements(), libMesh::UCDIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::DofMap::scatter_constraints(), stitching_helper(), libMesh::MeshTools::Generation::surface_octahedron(), libMesh::BoundaryInfo::sync(), AllTriTest::test_helper_c0polyhedron(), VolumeTest::testC0PolygonMethods(), VolumeTest::testC0PolyhedronCube(), VolumeTest::testC0PolyhedronHexagonalPrism(), MeshInputTest::testExodusSetNodeUniqueIdsFromMaps_implementation(), NodalNeighborsTest::testOrientation(), EquationSystemsTest::testPostInitAddElem(), SystemsTest::testProjectMatrix3D(), InfFERadialTest::testRefinement(), EquationSystemsTest::testReinitWithNodeElem(), BoundaryInfoTest::testShellFaceConstraints(), MeshTetTest::testTetsToTets(), MeshSubdomainIDTest::testUnpartitioned(), libMesh::NetGenMeshInterface::triangulate(), and libMesh::CheckpointIO::write_nodesets().

◆ node_ptr() [2/2]

virtual Node* libMesh::MeshBase::node_ptr ( const dof_id_type  i)
pure virtualinherited
Returns
A writable pointer to the \( i^{th} \) node, which should be present in this processor's subset of the mesh data structure.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

◆ node_ref() [1/2]

virtual const Node& libMesh::MeshBase::node_ref ( const dof_id_type  i) const
inlinevirtualinherited
Returns
A constant reference (for reading only) to the \( i^{th} \) node, which should be present in this processor's subset of the mesh data structure.

Definition at line 735 of file mesh_base.h.

References libMesh::MeshBase::node_ptr().

Referenced by libMesh::SyncNodalPositions::act_on_data(), LinearElasticityWithContact::add_contact_edge_elements(), assemble_matrix_and_rhs(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::MeshBase::copy_constraint_rows(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::DTKAdapter::DTKAdapter(), fill_dirichlet_bc(), main(), libMesh::ReplicatedMesh::point(), libMesh::DistributedMesh::point(), libMesh::ExodusII_IO::read(), libMesh::XdrIO::read_serialized_nodes(), libMesh::DistributedMesh::renumber_nodes_and_elements(), LinearElasticityWithContact::residual_and_jacobian(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_linear(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), libMesh::Partitioner::set_node_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::VariationalMeshSmoother::smooth(), libMesh::MeshTools::Modification::smooth(), stitching_helper(), MeshTriangulationTest::testPoly2TriHolesInterpRefined(), MeshSmootherTest::testVariationalSmoother(), MeshSmootherTest::testVariationalSmootherRegression(), libMesh::DTKAdapter::update_variable_values(), and libMesh::GmshIO::write_mesh().

736  {
737  return *this->node_ptr(i);
738  }
virtual const Node * node_ptr(const dof_id_type i) const =0

◆ node_ref() [2/2]

virtual Node& libMesh::MeshBase::node_ref ( const dof_id_type  i)
inlinevirtualinherited
Returns
A reference to the \( i^{th} \) node, which should be present in this processor's subset of the mesh data structure.

Definition at line 744 of file mesh_base.h.

References libMesh::MeshBase::node_ptr().

745  {
746  return *this->node_ptr(i);
747  }
virtual const Node * node_ptr(const dof_id_type i) const =0

◆ nodes_and_elements_equal()

bool libMesh::MeshBase::nodes_and_elements_equal ( const MeshBase other_mesh) const
protectedinherited

Tests for equality of all elements and nodes in the mesh.

Helper function for subclass_equals() in unstructured mesh subclasses.

Definition at line 2401 of file mesh_base.C.

References libMesh::MeshBase::query_elem_ptr(), and libMesh::MeshBase::query_node_ptr().

2402 {
2403  for (const auto & other_node : other_mesh.node_ptr_range())
2404  {
2405  const Node * node = this->query_node_ptr(other_node->id());
2406  if (!node)
2407  return false;
2408  if (*other_node != *node)
2409  return false;
2410  }
2411  for (const auto & node : this->node_ptr_range())
2412  if (!other_mesh.query_node_ptr(node->id()))
2413  return false;
2414 
2415  for (const auto & other_elem : other_mesh.element_ptr_range())
2416  {
2417  const Elem * elem = this->query_elem_ptr(other_elem->id());
2418  if (!elem)
2419  return false;
2420  if (!other_elem->topologically_equal(*elem))
2421  return false;
2422  }
2423  for (const auto & elem : this->element_ptr_range())
2424  if (!other_mesh.query_elem_ptr(elem->id()))
2425  return false;
2426 
2427  return true;
2428 }
virtual const Node * query_node_ptr(const dof_id_type i) const =0
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0

◆ operator!=()

bool libMesh::MeshBase::operator!= ( const MeshBase other_mesh) const
inlineinherited

Definition at line 138 of file mesh_base.h.

139  {
140  return !(*this == other_mesh);
141  }

◆ operator=() [1/2]

UnstructuredMesh& libMesh::UnstructuredMesh::operator= ( const UnstructuredMesh )
delete

Copy assignment is not allowed.

Referenced by libMesh::ReplicatedMesh::operator=().

◆ operator=() [2/2]

UnstructuredMesh& libMesh::UnstructuredMesh::operator= ( UnstructuredMesh &&  other_mesh)
default

Move assignment is allowed, by subclasses who handle post_dofobject_moves()

◆ operator==()

bool libMesh::MeshBase::operator== ( const MeshBase other_mesh) const
inherited

This tests for exactly-equal data in all the senses that a mathematician would care about (element connectivity, nodal coordinates), but in the senses a programmer would care about it allows for non-equal equivalence in some ways (we accept different Elem/Node addresses in memory) but not others (we do not accept different subclass types, nor even different Elem/Node ids).

Though this method is non-virtual, its implementation calls the virtual function subclass_locally_equals() to test for equality of subclass-specific data as well.

Definition at line 271 of file mesh_base.C.

References libMesh::ParallelObject::comm(), libMesh::MeshBase::locally_equals(), and TIMPI::Communicator::min().

272 {
273  LOG_SCOPE("operator==()", "MeshBase");
274 
275  bool is_equal = this->locally_equals(other_mesh);
276  this->comm().min(is_equal);
277  return is_equal;
278 }
const Parallel::Communicator & comm() const
void min(const T &r, T &o, Request &req) const
bool locally_equals(const MeshBase &other_mesh) const
This behaves the same as operator==, but only for the local and ghosted aspects of the mesh; i...
Definition: mesh_base.C:281

◆ own_node()

virtual void libMesh::MeshBase::own_node ( Node )
inlinevirtualinherited

Takes ownership of node n on this partition of a distributed mesh, by setting n.processor_id() to this->processor_id(), as well as changing n.id() and moving it in the mesh's internal container to give it a new authoritative id.

Reimplemented in libMesh::DistributedMesh.

Definition at line 859 of file mesh_base.h.

859 {}

◆ parallel_max_unique_id()

virtual unique_id_type libMesh::MeshBase::parallel_max_unique_id ( ) const
pure virtualinherited

◆ parallel_n_elem()

virtual dof_id_type libMesh::MeshBase::parallel_n_elem ( ) const
pure virtualinherited
Returns
The number of elements in the mesh.

The parallel_n_elem() function computes a parallel-synchronized value on distributed meshes, and so must be called in parallel only.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::Nemesis_IO_Helper::initialize(), and libMesh::Nemesis_IO::read().

◆ parallel_n_nodes()

virtual dof_id_type libMesh::MeshBase::parallel_n_nodes ( ) const
pure virtualinherited
Returns
The number of nodes in the mesh.

This function and others must be overridden in derived classes since the MeshBase class has no specific storage for nodes or elements. The parallel_n_nodes() function computes a parallel-synchronized value on distributed meshes, and so must be called in parallel only.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::Nemesis_IO_Helper::initialize(), libMesh::Nemesis_IO::read(), DisjointNeighborTest::testPreserveDisjointNeighborPairsAfterStitch(), and DisjointNeighborTest::testStitchingDiscontinuousBoundaries().

◆ partition() [1/2]

void libMesh::MeshBase::partition ( const unsigned int  n_parts)
virtualinherited

Call the default partitioner (currently metis_partition()).

Definition at line 1762 of file mesh_base.C.

References libMesh::MeshBase::_preparation, libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshBase::Preparation::is_partitioned, libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::MeshBase::n_unpartitioned_elem(), libMesh::MeshBase::partitioner(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshBase::skip_noncritical_partitioning(), and libMesh::MeshBase::update_post_partitioning().

Referenced by main(), libMesh::split_mesh(), ExtraIntegersTest::test_helper(), MappedSubdomainPartitionerTest::testMappedSubdomainPartitioner(), EquationSystemsTest::testRepartitionThenReinit(), and CheckpointIOTest::testSplitter().

1763 {
1764  // If we get here and we have unpartitioned elements, we need that
1765  // fixed.
1766  if (this->n_unpartitioned_elem() > 0)
1767  {
1768  libmesh_assert (partitioner().get());
1769  libmesh_assert (this->is_serial());
1770  partitioner()->partition (*this, n_parts);
1771  }
1772  // A nullptr partitioner or a skip_partitioning(true) call or a
1773  // skip_noncritical_partitioning(true) call means don't repartition;
1774  // skip_noncritical_partitioning() checks all these.
1775  else if (!skip_noncritical_partitioning())
1776  {
1777  partitioner()->partition (*this, n_parts);
1778  }
1779  else
1780  {
1781  // Adaptive coarsening may have "orphaned" nodes on processors
1782  // whose elements no longer share them. We need to check for
1783  // and possibly fix that.
1785 
1786  // Make sure locally cached partition count is correct
1787  this->recalculate_n_partitions();
1788 
1789  // Make sure any other locally cached data is correct
1790  this->update_post_partitioning();
1791  }
1792 
1794 }
virtual void update_post_partitioning()
Recalculate any cached data (or invalidate any caches that are computed on the fly) after elements an...
Definition: mesh_base.C:1173
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 n...
Definition: mesh_tools.C:2508
bool skip_noncritical_partitioning() const
Definition: mesh_base.h:1404
virtual std::unique_ptr< Partitioner > & partitioner()
A partitioner to use at each partitioning.
Definition: mesh_base.h:165
dof_id_type n_unpartitioned_elem() const
Definition: mesh_base.h:693
virtual bool is_serial() const
Definition: mesh_base.h:347
libmesh_assert(ctx)
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162
unsigned int recalculate_n_partitions()
In a few (very rare) cases, the user may have manually tagged the elements with specific processor ID...
Definition: mesh_base.C:1806

◆ partition() [2/2]

void libMesh::MeshBase::partition ( )
inlineinherited

Definition at line 1310 of file mesh_base.h.

References libMesh::ParallelObject::n_processors().

Referenced by libMesh::MeshBase::complete_preparation().

1311  { this->partition(this->n_processors()); }
processor_id_type n_processors() const

◆ partitioner()

virtual std::unique_ptr<Partitioner>& libMesh::MeshBase::partitioner ( )
inlinevirtualinherited

A partitioner to use at each partitioning.

Definition at line 165 of file mesh_base.h.

References libMesh::MeshBase::_partitioner.

Referenced by main(), libMesh::MeshBase::partition(), libMesh::BoundaryInfo::sync(), MultiEvaluablePredTest::test(), MeshDeletionsTest::testDeleteElem(), and MappedSubdomainPartitionerTest::testMappedSubdomainPartitioner().

165 { return _partitioner; }
std::unique_ptr< Partitioner > _partitioner
A partitioner to use at each prepare_for_use().
Definition: mesh_base.h:2206

◆ point()

virtual const Point& libMesh::MeshBase::point ( const dof_id_type  i) const
pure virtualinherited

◆ post_dofobject_moves()

void libMesh::MeshBase::post_dofobject_moves ( MeshBase &&  other_mesh)
protectedinherited

Moves any superclass data (e.g.

GhostingFunctors that might rely on element and nodal data (which is managed by subclasses!) being already moved first.

Must be manually called in dofobject-managing subclass move operators.

Definition at line 2356 of file mesh_base.C.

References libMesh::MeshBase::_constraint_rows, libMesh::MeshBase::_default_ghosting, libMesh::MeshBase::_ghosting_functors, libMesh::MeshBase::_partitioner, and libMesh::MeshBase::_shared_functors.

Referenced by libMesh::ReplicatedMesh::operator=().

2357 {
2358  // Now that all the DofObject moving is done, we can move the GhostingFunctor objects
2359  // which include the _default_ghosting,_ghosting_functors and _shared_functors. We also need
2360  // to set the mesh object associated with these functors to the assignee mesh.
2361 
2362  // _default_ghosting
2363  _default_ghosting = std::move(other_mesh._default_ghosting);
2364  _default_ghosting->set_mesh(this);
2365 
2366  // _ghosting_functors
2367  _ghosting_functors = std::move(other_mesh._ghosting_functors);
2368 
2369  for (const auto gf : _ghosting_functors )
2370  {
2371  gf->set_mesh(this);
2372  }
2373 
2374  // _shared_functors
2375  _shared_functors = std::move(other_mesh._shared_functors);
2376 
2377  for (const auto & sf : _shared_functors )
2378  {
2379  (sf.second)->set_mesh(this);
2380  }
2381 
2382  // _constraint_rows
2383  _constraint_rows = std::move(other_mesh._constraint_rows);
2384 
2385  if (other_mesh.partitioner())
2386  _partitioner = std::move(other_mesh.partitioner());
2387 }
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2391
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2409
std::unique_ptr< Partitioner > _partitioner
A partitioner to use at each prepare_for_use().
Definition: mesh_base.h:2206
std::map< GhostingFunctor *, std::shared_ptr< GhostingFunctor > > _shared_functors
Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form...
Definition: mesh_base.h:2397
std::unique_ptr< GhostingFunctor > _default_ghosting
The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior...
Definition: mesh_base.h:2382

◆ preparation()

Preparation libMesh::MeshBase::preparation ( ) const
inlineinherited

Definition at line 213 of file mesh_base.h.

References libMesh::MeshBase::_preparation.

Referenced by libMesh::DistributedMesh::DistributedMesh(), and libMesh::ReplicatedMesh::ReplicatedMesh().

214  { return _preparation; }
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ prepare_for_use() [1/3]

void libMesh::MeshBase::prepare_for_use ( const bool  skip_renumber_nodes_and_elements,
const bool  skip_find_neighbors 
)
inherited

Prepare a newly created (or read) mesh for use.

This involves several steps: 1.) renumbering (if enabled) 2.) removing any orphaned nodes 3.) updating parallel id counts 4.) finding neighbor links 5.) caching summarized element data 6.) finding interior parent links 7.) clearing any old point locator 8.) calling reinit() on ghosting functors 9.) repartitioning (if enabled) 10.) removing any remote elements (if enabled) 11.) regenerating summarized boundary id sets

For backwards compatibility, prepare_for_use() performs all those steps, regardless of the official preparation() state of the mesh. In codes which have maintained a valid preparation() state via methods such as unset_has_synched_id_counts(), calling complete_preparation() will result in a fully-prepared mesh at less cost.

The argument to skip renumbering is now deprecated - to prevent a mesh from being renumbered, set allow_renumbering(false). The argument to skip finding neighbors is also deprecated. To prevent find_neighbors, set allow_find_neighbors(false)

If this is a distributed mesh, local copies of remote elements will be deleted here - to keep those elements replicated during preparation, set allow_remote_element_removal(false).

Definition at line 824 of file mesh_base.C.

References libMesh::MeshBase::allow_find_neighbors(), libMesh::MeshBase::allow_renumbering(), and libMesh::MeshBase::prepare_for_use().

Referenced by LinearElasticityWithContact::add_contact_edge_elements(), libMesh::MeshTools::Subdivision::all_subdivision(), libMesh::MeshTools::Modification::all_tri(), libMesh::MeshTools::Generation::build_extrusion(), DisjointNeighborTest::build_four_disjoint_elems(), libMesh::InfElemBuilder::build_inf_elem(), DisjointNeighborTest::build_split_mesh_with_interface(), DisjointNeighborTest::build_two_disjoint_elems(), VolumeTest::buildC0Polyhedron(), libMesh::MeshRefinement::coarsen_elements(), create_submesh(), libMesh::MeshTools::Modification::flatten(), main(), libMesh::MeshTools::Subdivision::prepare_subdivision_mesh(), libMesh::GMVIO::read(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::SimplexRefiner::refine_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::C0Polyhedron::retriangulate(), libMesh::MeshTools::Generation::surface_octahedron(), libMesh::BoundaryInfo::sync(), MeshSpatialDimensionTest::test1D(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshSpatialDimensionTest::test2D(), AllTriTest::test_helper_c0polyhedron(), XdrIOTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), XdrIOTest< elem_type >::test_write(), MeshInputTest::testAbaqusRead(), AllTriTest::testAllTriC0PolygonOctagon(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundarySides(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), ConstraintOperatorTest::testCoreform(), MeshDeletionsTest::testDeleteElem(), DisjointNeighborTest::testDisjointNeighborConflictError(), SystemsTest::testDofCouplingWithVarGroups(), MeshInputTest::testDynaFileMappings(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), ConnectedComponentsTest::testEdge(), MeshTriangulationTest::testEdge3Mesh(), MeshTriangulationTest::testEdgesMesh(), MeshInputTest::testExodusFileMappings(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), BoundaryInfoTest::testInternalBoundary(), MeshInputTest::testLowOrderEdgeBlocks(), MeshInputTest::testNemesisReadImpl(), NodalNeighborsTest::testOrientation(), PeriodicBCTest::testPeriodicBC(), MeshTriangulationTest::testPoly2TriBad1DMultiBoundary(), MeshTriangulationTest::testPoly2TriBad2DMultiBoundary(), MeshTriangulationTest::testPoly2TriBadEdges(), EquationSystemsTest::testPostInitAddElem(), SystemsTest::testProjectMatrix3D(), InfFERadialTest::testRefinement(), EquationSystemsTest::testReinitWithNodeElem(), SystemsTest::testSetSystemParameterOverEquationSystem(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), DisjointNeighborTest::testStitchCrossMesh(), MeshInputTest::testTetgenIO(), MeshTetTest::testTetsToTets(), MeshTetTest::testTrisToTetsError(), MeshInputTest::testVTKPreserveElemIds(), MeshInputTest::testVTKPreserveSubdomainIds(), tetrahedralize_domain(), libMesh::TriangleInterface::triangulate(), libMesh::NetGenMeshInterface::triangulate(), libMesh::Poly2TriTriangulator::triangulate(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::MeshRefinement::uniformly_refine(), and libMesh::MeshTetInterface::volume_to_surface_mesh().

825 {
826  libmesh_deprecated();
827 
828  // We only respect the users wish if they tell us to skip renumbering. If they tell us not to
829  // skip renumbering but someone previously called allow_renumbering(false), then the latter takes
830  // precedence
831  if (skip_renumber_nodes_and_elements)
832  this->allow_renumbering(false);
833 
834  // We always accept the user's value for skip_find_neighbors, in contrast to skip_renumber
835  const bool old_allow_find_neighbors = this->allow_find_neighbors();
836  this->allow_find_neighbors(!skip_find_neighbors);
837 
838  this->prepare_for_use();
839 
840  this->allow_find_neighbors(old_allow_find_neighbors);
841 }
bool allow_find_neighbors() const
Definition: mesh_base.h:1353
void prepare_for_use()
Definition: mesh_base.C:860
bool allow_renumbering() const
Definition: mesh_base.h:1346

◆ prepare_for_use() [2/3]

void libMesh::MeshBase::prepare_for_use ( const bool  skip_renumber_nodes_and_elements)
inherited

Definition at line 843 of file mesh_base.C.

References libMesh::MeshBase::allow_renumbering(), and libMesh::MeshBase::prepare_for_use().

844 {
845  libmesh_deprecated();
846 
847  // We only respect the users wish if they tell us to skip renumbering. If they tell us not to
848  // skip renumbering but someone previously called allow_renumbering(false), then the latter takes
849  // precedence
850  if (skip_renumber_nodes_and_elements)
851  this->allow_renumbering(false);
852 
853  this->prepare_for_use();
854 }
void prepare_for_use()
Definition: mesh_base.C:860
bool allow_renumbering() const
Definition: mesh_base.h:1346

◆ prepare_for_use() [3/3]

void libMesh::MeshBase::prepare_for_use ( )
inherited

Definition at line 860 of file mesh_base.C.

References libMesh::MeshBase::_allow_remote_element_removal, libMesh::MeshBase::_preparation, libMesh::MeshBase::_skip_find_neighbors, libMesh::MeshBase::clear_point_locator(), libMesh::MeshBase::clear_stored_ranges(), libMesh::MeshBase::complete_preparation(), libMesh::MeshBase::Preparation::has_neighbor_ptrs, and libMesh::MeshBase::Preparation::has_removed_remote_elements.

Referenced by all_first_order(), copy_nodes_and_elements(), libMesh::MeshBase::prepare_for_use(), read(), and stitching_helper().

861 {
862  // Mark everything as unprepared, except for those things we've been
863  // told we don't need to prepare, for backwards compatibility
864  this->clear_point_locator();
865  this->clear_stored_ranges();
866  _preparation = false;
869 
870  this->complete_preparation();
871 }
bool _allow_remote_element_removal
If this is false then even on DistributedMesh remote elements will not be deleted during mesh prepara...
Definition: mesh_base.h:2255
void clear_stored_ranges()
Clears stored ranges, to indicate that the mesh has changed and they should be regenerated when next ...
Definition: mesh_base.C:1943
void clear_point_locator()
Releases the current PointLocator object.
Definition: mesh_base.C:1859
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
Definition: mesh_base.h:2242
void complete_preparation()
Definition: mesh_base.C:874
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ print_constraint_rows()

void libMesh::MeshBase::print_constraint_rows ( std::ostream &  os = libMesh::out,
bool  print_nonlocal = false 
) const
inherited

Prints (from processor 0) all mesh constraint rows.

If print_nonlocal is true, then each constraint is printed once for each processor that knows about it, which may be useful for DistributedMesh debugging.

Definition at line 2743 of file mesh_base.C.

References libMesh::ParallelObject::comm(), libMesh::MeshBase::get_local_constraints(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), TIMPI::Communicator::receive(), and TIMPI::Communicator::send().

2745 {
2746  parallel_object_only();
2747 
2748  std::string local_constraints =
2749  this->get_local_constraints(print_nonlocal);
2750 
2751  if (this->processor_id())
2752  {
2753  this->comm().send(0, local_constraints);
2754  }
2755  else
2756  {
2757  os << "Processor 0:\n";
2758  os << local_constraints;
2759 
2760  for (auto p : IntRange<processor_id_type>(1, this->n_processors()))
2761  {
2762  this->comm().receive(p, local_constraints);
2763  os << "Processor " << p << ":\n";
2764  os << local_constraints;
2765  }
2766  }
2767 }
const Parallel::Communicator & comm() const
processor_id_type n_processors() const
Status receive(const unsigned int dest_processor_id, T &buf, const MessageTag &tag=any_tag) const
std::string get_local_constraints(bool print_nonlocal=false) const
Gets a string reporting all mesh constraint rows local to this processor.
Definition: mesh_base.C:2771
void send(const unsigned int dest_processor_id, const T &buf, const MessageTag &tag=no_tag) const
processor_id_type processor_id() const

◆ print_info()

void libMesh::MeshBase::print_info ( std::ostream &  os = libMesh::out,
const unsigned int  verbosity = 0,
const bool  global = true 
) const
inherited

Prints relevant information about the mesh.

Take note of the docstring for get_info() for more information pretaining to the verbosity and global parameters.

Definition at line 1748 of file mesh_base.C.

References libMesh::MeshBase::get_info().

Referenced by assemble_and_solve(), libMesh::InfElemBuilder::build_inf_elem(), main(), libMesh::operator<<(), and setup().

1749 {
1750  os << this->get_info(verbosity, global)
1751  << std::endl;
1752 }
std::string get_info(const unsigned int verbosity=0, const bool global=true) const
Definition: mesh_base.C:1268

◆ processor_id()

processor_id_type libMesh::ParallelObject::processor_id ( ) const
inlineinherited
Returns
The rank of this processor in the group.

Definition at line 114 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and TIMPI::Communicator::rank().

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshFunction::check_found_elem(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMapBase::end_dof(), libMesh::DofMapBase::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), find_neighbors(), libMesh::DofMapBase::first_dof(), libMesh::DofMapBase::first_old_dof(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::MeshBase::get_info(), libMesh::DofMap::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::RBEIMEvaluation::get_interior_basis_functions_as_vecs(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::DofMap::get_local_constraints(), libMesh::MeshBase::get_local_constraints(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::LaplaceMeshSmoother::init(), libMesh::SystemSubsetBySubdomain::init(), HeatSystem::init_data(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::DofMap::is_evaluable(), libMesh::SparsityPattern::Build::join(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DofMap::local_variable_indices(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::MeshTools::n_connected_components(), libMesh::MeshBase::n_constraint_rows(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMapBase::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::DistributedMesh::own_node(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::ExodusII_IO::read_header(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::DynaIO::read_mesh(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::RBEIMEvaluation::side_gather_bfs(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), ExodusTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), MeshInputTest::testAbaqusRead(), MeshInputTest::testBadGmsh(), BoundaryInfoTest::testBoundaryIDs(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaFileMappings(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusFileMappings(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), MeshInputTest::testGmshBCIDOverlap(), MeshInputTest::testGoodGmsh(), MeshInputTest::testGoodSTL(), MeshInputTest::testGoodSTLBinary(), BoundaryInfoTest::testInternalBoundary(), MeshInputTest::testLowOrderEdgeBlocks(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), WriteVecAndScalar::testSolution(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshSmootherTest::testVariationalSmoother(), libMesh::MeshTools::total_weight(), libMesh::NetGenMeshInterface::triangulate(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elemset_data(), libMesh::ExodusII_IO_Helper::write_elemsets(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodal_data(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodeset_data(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), write_output_solvedata(), libMesh::System::write_parallel_data(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

115  { return cast_int<processor_id_type>(_communicator.rank()); }
processor_id_type rank() const
const Parallel::Communicator & _communicator

◆ query_elem_ptr() [1/2]

virtual const Elem* libMesh::MeshBase::query_elem_ptr ( const dof_id_type  i) const
pure virtualinherited
Returns
A pointer to the \( i^{th} \) element, or nullptr if no such element exists in this processor's mesh data structure.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by MeshBaseTest::BrokenNeighborMesh(), libMesh::Nemesis_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_equal_connectivity(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), main(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshBase::nodes_and_elements_equal(), libMesh::BoundaryInfo::operator==(), libMesh::MeshTools::Modification::permute_elements(), libMesh::VTKIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_serialized_bcs_helper(), ParsedFEMFunctionTest::setUp(), DofMapTest::testArrayDofIndicesWithType(), BoundaryInfoTest::testBoundaryIDs(), VolumeTest::testC0PolygonMethods(), VolumeTest::testC0PolyhedronMethods(), MeshDeletionsTest::testDeleteElem(), VolumeTest::testEdge3Volume(), ExtraIntegersTest::testExtraIntegersExodusReading(), MeshBaseTest::testMeshBaseVerifyHasCachedElemData(), EquationSystemsTest::testRefineThenReinitPreserveFlags(), EquationSystemsTest::testSelectivePRefine(), BoundaryInfoTest::testSelectiveRenumber(), BoundaryInfoTest::testShellFaceConstraints(), DisjointNeighborTest::testTempJump(), and MeshInputTest::testTetgenIO().

◆ query_elem_ptr() [2/2]

virtual Elem* libMesh::MeshBase::query_elem_ptr ( const dof_id_type  i)
pure virtualinherited
Returns
A writable pointer to the \( i^{th} \) element, or nullptr if no such element exists in this processor's mesh data structure.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

◆ query_node_ptr() [1/2]

virtual const Node* libMesh::MeshBase::query_node_ptr ( const dof_id_type  i) const
pure virtualinherited

◆ query_node_ptr() [2/2]

virtual Node* libMesh::MeshBase::query_node_ptr ( const dof_id_type  i)
pure virtualinherited
Returns
A writable pointer to the \( i^{th} \) node, or nullptr if no such node exists in this processor's mesh data structure.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

◆ read()

void libMesh::UnstructuredMesh::read ( const std::string &  name,
void *  mesh_data = nullptr,
bool  skip_renumber_nodes_and_elements = false,
bool  skip_find_neighbors = false,
bool  skip_detect_interior_parents = false 
)
overridevirtual

Reads the file specified by name.

Attempts to figure out the proper method by the file extension. This is now the only way to read a mesh. The UnstructuredMesh then initializes its data structures and is ready for use.

The skip_renumber_nodes_and_elements argument is now deprecated - to disallow renumbering, set MeshBase::allow_renumbering(false).

Set skip_find_neighbors=true to skip the find-neighbors operation during prepare_for_use. This operation isn't always necessary and it can be time-consuming, which is why we provide an option to skip it.

Implements libMesh::MeshBase.

Definition at line 1362 of file unstructured_mesh.C.

References libMesh::MeshBase::allow_detect_interior_parents(), libMesh::MeshBase::allow_find_neighbors(), libMesh::MeshBase::allow_renumbering(), libMesh::Utility::ends_with(), libMesh::Quality::name(), libMesh::MeshBase::prepare_for_use(), and libMesh::NameBasedIO::read().

Referenced by ExtraIntegersTest::checkpoint_helper(), main(), ExtraIntegersTest::test_helper(), MeshStitchTest::testNodeElemStitch(), SlitMeshRefinedSystemTest::testRestart(), and WriteElemsetData::testWriteImpl().

1367 {
1368  // Set the skip_renumber_nodes_and_elements flag on all processors
1369  // if necessary.
1370  // This ensures that renumber_nodes_and_elements is *not* called
1371  // during prepare_for_use() for certain types of mesh files.
1372  // This is required in cases where there is an associated solution
1373  // file which expects a certain ordering of the nodes.
1374  if (Utility::ends_with(name, ".gmv"))
1375  this->allow_renumbering(false);
1376 
1377  NameBasedIO(*this).read(name);
1378 
1379  if (skip_renumber_nodes_and_elements)
1380  {
1381  // Use MeshBase::allow_renumbering() yourself instead.
1382  libmesh_deprecated();
1383  this->allow_renumbering(false);
1384  }
1385 
1386  // Done reading the mesh. Now prepare it for use.
1387  const bool old_allow_find_neighbors = this->allow_find_neighbors();
1388  const bool old_allow_detect_interior_parents = this->allow_detect_interior_parents();
1389 
1390  this->allow_find_neighbors(!skip_find_neighbors);
1391  this->allow_detect_interior_parents(!skip_detect_interior_parents);
1392 
1393  this->prepare_for_use();
1394 
1395  this->allow_find_neighbors(old_allow_find_neighbors);
1396  this->allow_detect_interior_parents(old_allow_detect_interior_parents);
1397 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
This class supports simple reads and writes in any libMesh-supported format, by dispatching to one of...
Definition: namebased_io.h:44
virtual void read(const std::string &mesh_file) override
This method implements reading a mesh from a specified file.
Definition: namebased_io.C:69
bool ends_with(std::string_view superstring, std::string_view suffix)
Look for a substring at the very end of a string.
Definition: utility.C:213
bool allow_detect_interior_parents() const
Definition: mesh_base.h:1360
bool allow_find_neighbors() const
Definition: mesh_base.h:1353
void prepare_for_use()
Definition: mesh_base.C:860
bool allow_renumbering() const
Definition: mesh_base.h:1346

◆ recalculate_n_partitions()

unsigned int libMesh::MeshBase::recalculate_n_partitions ( )
inherited

In a few (very rare) cases, the user may have manually tagged the elements with specific processor IDs by hand, without using a partitioner.

In this case, the Mesh will not know that the total number of partitions, _n_parts, has changed, unless you call this function. This is an O(N active elements) calculation. The return value is the number of partitions, and _n_parts is also set by this function.

Definition at line 1806 of file mesh_base.C.

References libMesh::MeshBase::_n_parts, libMesh::ParallelObject::comm(), and TIMPI::Communicator::max().

Referenced by libMesh::MeshBase::partition(), and libMesh::CheckpointIO::read().

1807 {
1808  // This requires an inspection on every processor
1809  parallel_object_only();
1810 
1811  unsigned int max_proc_id=0;
1812 
1813  for (const auto & elem : this->active_local_element_ptr_range())
1814  max_proc_id = std::max(max_proc_id, static_cast<unsigned int>(elem->processor_id()));
1815 
1816  // The number of partitions is one more than the max processor ID.
1817  _n_parts = max_proc_id+1;
1818 
1819  this->comm().max(_n_parts);
1820 
1821  return _n_parts;
1822 }
const Parallel::Communicator & comm() const
unsigned int _n_parts
The number of partitions the mesh has.
Definition: mesh_base.h:2144
void max(const T &r, T &o, Request &req) const

◆ redistribute()

void libMesh::MeshBase::redistribute ( )
virtualinherited

Redistribute elements between processors.

This gets called automatically by the Partitioner, and merely notifies any GhostingFunctors of redistribution in the case of a ReplicatedMesh or serialized DistributedMesh

Reimplemented in libMesh::DistributedMesh.

Definition at line 1161 of file mesh_base.C.

References libMesh::as_range(), libMesh::MeshBase::ghosting_functors_begin(), and libMesh::MeshBase::ghosting_functors_end().

Referenced by libMesh::Partitioner::partition(), libMesh::DistributedMesh::redistribute(), and libMesh::Partitioner::single_partition().

1162 {
1163  // We now have all elements and nodes redistributed; our ghosting
1164  // functors should be ready to redistribute and/or recompute any
1165  // cached data they use too.
1166  for (auto & gf : as_range(this->ghosting_functors_begin(),
1167  this->ghosting_functors_end()))
1168  gf->redistribute();
1169 }
GhostingFunctorIterator ghosting_functors_begin() const
Beginning of range of ghosting functors.
Definition: mesh_base.h:1462
GhostingFunctorIterator ghosting_functors_end() const
End of range of ghosting functors.
Definition: mesh_base.h:1468
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
Definition: simple_range.h:57

◆ reinit_ghosting_functors()

void libMesh::MeshBase::reinit_ghosting_functors ( )
inherited

Loops over ghosting functors and calls mesh_reinit()

Definition at line 1018 of file mesh_base.C.

References libMesh::MeshBase::_ghosting_functors, libMesh::MeshBase::_preparation, libMesh::MeshBase::Preparation::has_reinit_ghosting_functors, and libMesh::libmesh_assert().

Referenced by libMesh::MeshBase::complete_preparation().

1019 {
1020  for (auto & gf : _ghosting_functors)
1021  {
1022  libmesh_assert(gf);
1023  gf->mesh_reinit();
1024  }
1025 
1027 }
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2391
libmesh_assert(ctx)
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ remove_disjoint_boundary_pair()

void libMesh::MeshBase::remove_disjoint_boundary_pair ( const boundary_id_type  b1,
const boundary_id_type  b2 
)
inherited

Definition at line 2266 of file mesh_base.C.

References libMesh::MeshBase::_disjoint_neighbor_boundary_pairs.

Referenced by stitching_helper().

2268  {
2269  // Nothing to remove if not allocated or empty
2271  return;
2272 
2273  auto & pairs = *_disjoint_neighbor_boundary_pairs;
2274 
2275  // Helper to check and erase both directions
2276  auto erase_if_match = [](boundary_id_type key,
2277  boundary_id_type pair,
2278  PeriodicBoundaries & pb_map)
2279  {
2280  auto it = pb_map.find(key);
2281  if (it != pb_map.end())
2282  {
2283  const auto & pb = *(it->second);
2284  // Check both directions
2285  if ((pb.myboundary == key && pb.pairedboundary == pair) ||
2286  (pb.pairedboundary == key && pb.myboundary == pair))
2287  pb_map.erase(it);
2288  }
2289  };
2290 
2291  erase_if_match(b1, b2, pairs);
2292  erase_if_match(b2, b1, pairs);
2293  }
int8_t boundary_id_type
Definition: id_types.h:51
std::unique_ptr< PeriodicBoundaries > _disjoint_neighbor_boundary_pairs
The disjoint neighbor boundary id pairs.
Definition: mesh_base.h:2086

◆ remove_ghosting_functor()

void libMesh::MeshBase::remove_ghosting_functor ( GhostingFunctor ghosting_functor)
inherited

Removes a functor which was previously added to the set of ghosting functors.

Definition at line 1093 of file mesh_base.C.

References libMesh::MeshBase::_ghosting_functors, libMesh::MeshBase::_shared_functors, and libMesh::libmesh_assert().

Referenced by libMesh::DofMap::clear(), libMesh::DofMap::remove_algebraic_ghosting_functor(), libMesh::DofMap::remove_coupling_functor(), EquationSystemsTest::testDisableDefaultGhosting(), and libMesh::DofMap::~DofMap().

1094 {
1095  auto raw_it = std::find(_ghosting_functors.begin(),
1096  _ghosting_functors.end(), &ghosting_functor);
1097 
1098  // The DofMap has a "to_mesh" parameter that tells it to avoid
1099  // registering a new functor with the mesh, but it doesn't keep
1100  // track of which functors weren't added, so we'll support "remove a
1101  // functor that isn't there" just like we did with set::erase
1102  // before.
1103  if (raw_it != _ghosting_functors.end())
1104  _ghosting_functors.erase(raw_it);
1105 
1106  // We shouldn't have had two copies of the same functor
1107  libmesh_assert(std::find(_ghosting_functors.begin(),
1108  _ghosting_functors.end(),
1109  &ghosting_functor) ==
1110  _ghosting_functors.end());
1111 
1112  if (const auto it = _shared_functors.find(&ghosting_functor);
1113  it != _shared_functors.end())
1114  _shared_functors.erase(it);
1115 }
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2391
libmesh_assert(ctx)
std::map< GhostingFunctor *, std::shared_ptr< GhostingFunctor > > _shared_functors
Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form...
Definition: mesh_base.h:2397

◆ remove_orphaned_nodes()

void libMesh::MeshBase::remove_orphaned_nodes ( )
inherited

Removes any orphaned nodes, nodes not connected to any elements.

Typically done automatically in a preparation step

Definition at line 801 of file mesh_base.C.

References libMesh::MeshBase::_preparation, libMesh::MeshBase::delete_node(), and libMesh::MeshBase::Preparation::has_removed_orphaned_nodes.

Referenced by libMesh::MeshBase::complete_preparation().

802 {
803  LOG_SCOPE("remove_orphaned_nodes()", "MeshBase");
804 
805  // Will hold the set of nodes that are currently connected to elements
806  std::unordered_set<Node *> connected_nodes;
807 
808  // Loop over the elements. Find which nodes are connected to at
809  // least one of them.
810  for (const auto & element : this->element_ptr_range())
811  for (auto & n : element->node_ref_range())
812  connected_nodes.insert(&n);
813 
814  for (const auto & node : this->node_ptr_range())
815  if (!connected_nodes.count(node))
816  this->delete_node(node);
817 
819 }
virtual void delete_node(Node *n)=0
Removes the Node n from the mesh.
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ renumber_elem()

virtual void libMesh::MeshBase::renumber_elem ( dof_id_type  old_id,
dof_id_type  new_id 
)
pure virtualinherited

Changes the id of element old_id, both by changing elem(old_id)->id() and by moving elem(old_id) in the mesh's internal container.

No element with the id new_id should already exist.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::SimplexRefiner::refine_via_edges(), and MeshInputTest::testVTKPreserveElemIds().

◆ renumber_node()

virtual void libMesh::MeshBase::renumber_node ( dof_id_type  old_id,
dof_id_type  new_id 
)
pure virtualinherited

Changes the id of node old_id, both by changing node(old_id)->id() and by moving node(old_id) in the mesh's internal container.

No element with the id new_id should already exist.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::SimplexRefiner::refine_via_edges().

◆ renumber_nodes_and_elements()

virtual void libMesh::MeshBase::renumber_nodes_and_elements ( )
pure virtualinherited

After partitioning a mesh it is useful to renumber the nodes and elements so that they lie in contiguous blocks on the processors.

This method does just that.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::MeshBase::complete_preparation(), contract(), and write_output().

◆ reserve_elem()

virtual void libMesh::MeshBase::reserve_elem ( const dof_id_type  ne)
pure virtualinherited

Reserves space for a known number of elements.

Note
This method may or may not do anything, depending on the actual Mesh implementation. If you know the number of elements you will add and call this method before repeatedly calling add_point() the implementation will be more efficient.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::MeshTools::Generation::build_extrusion(), copy_nodes_and_elements(), libMesh::ExodusII_IO::read(), libMesh::XdrIO::read_header(), and libMesh::GmshIO::read_mesh().

◆ reserve_nodes()

virtual void libMesh::MeshBase::reserve_nodes ( const dof_id_type  nn)
pure virtualinherited

Reserves space for a known number of nodes.

Note
This method may or may not do anything, depending on the actual Mesh implementation. If you know the number of nodes you will add and call this method before repeatedly calling add_point() the implementation will be more efficient.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by all_complete_order_range(), all_second_order_range(), libMesh::MeshTools::Generation::build_extrusion(), copy_nodes_and_elements(), libMesh::ExodusII_IO::read(), libMesh::XdrIO::read_header(), and libMesh::GmshIO::read_mesh().

◆ set_count_lower_dim_elems_in_point_locator()

void libMesh::MeshBase::set_count_lower_dim_elems_in_point_locator ( bool  count_lower_dim_elems)
inherited

In the point locator, do we count lower dimensional elements when we refine point locator regions? This is relevant in tree-based point locators, for example.

Definition at line 1866 of file mesh_base.C.

References libMesh::MeshBase::_count_lower_dim_elems_in_point_locator.

1867 {
1868  _count_lower_dim_elems_in_point_locator = count_lower_dim_elems;
1869 }
bool _count_lower_dim_elems_in_point_locator
Do we count lower dimensional elements in point locator refinement? This is relevant in tree-based po...
Definition: mesh_base.h:2198

◆ set_default_mapping_data()

void libMesh::MeshBase::set_default_mapping_data ( const unsigned char  data)
inlineinherited

Set the default master space to physical space mapping basis functions to be used on newly added elements.

Definition at line 958 of file mesh_base.h.

References libMesh::MeshBase::_default_mapping_data.

Referenced by libMesh::MeshTools::Modification::all_rbb(), libMesh::ExodusII_IO::read(), and libMesh::DynaIO::read_mesh().

959  {
960  _default_mapping_data = data;
961  }
unsigned char _default_mapping_data
The default mapping data (unused with Lagrange, used for nodal weight lookup index with rational base...
Definition: mesh_base.h:2157

◆ set_default_mapping_type()

void libMesh::MeshBase::set_default_mapping_type ( const ElemMappingType  type)
inlineinherited

Set the default master space to physical space mapping basis functions to be used on newly added elements.

Definition at line 940 of file mesh_base.h.

References libMesh::MeshBase::_default_mapping_type.

Referenced by libMesh::MeshTools::Modification::all_rbb(), libMesh::ExodusII_IO::read(), and libMesh::DynaIO::read_mesh().

941  {
942  _default_mapping_type = type;
943  }
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
Definition: mesh_base.h:2150

◆ set_distributed()

virtual void libMesh::MeshBase::set_distributed ( )
inlinevirtualinherited

Asserts that not all elements and nodes of the mesh necessarily exist on the current processor.

Only valid to call on classes which can be created in a distributed form.

Reimplemented in libMesh::DistributedMesh.

Definition at line 362 of file mesh_base.h.

Referenced by libMesh::CheckpointIO::read().

363  { libmesh_error(); }

◆ set_elem_dimensions()

void libMesh::MeshBase::set_elem_dimensions ( std::set< unsigned char >  elem_dims)
inherited

Most of the time you should not need to call this, as the element dimensions will be set automatically by a call to cache_elem_data(), therefore only call this if you know what you're doing.

In some specialized situations, for example when adding a single Elem on all procs, it can be faster to skip calling cache_elem_data() and simply specify the element dimensions manually, which is why this setter exists.

Definition at line 439 of file mesh_base.C.

References libMesh::MeshBase::_elem_dims, and libMesh::MeshBase::cache_elem_data().

440 {
441 #ifdef DEBUG
442  // In debug mode, we call cache_elem_data() and then make sure
443  // the result actually agrees with what the user specified.
444  parallel_object_only();
445 
446  this->cache_elem_data();
447  libmesh_assert_msg(_elem_dims == elem_dims, \
448  "Specified element dimensions does not match true element dimensions!");
449 #endif
450 
451  _elem_dims = std::move(elem_dims);
452 }
void cache_elem_data()
Definition: mesh_base.C:1959
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:2282

◆ set_interior_mesh()

void libMesh::MeshBase::set_interior_mesh ( MeshBase int_mesh)
inlineinherited

Sets the interior mesh.

For advanced use only.

Definition at line 2018 of file mesh_base.h.

References libMesh::MeshBase::_interior_mesh.

Referenced by libMesh::BoundaryInfo::add_elements(), and copy_nodes_and_elements().

2018 { _interior_mesh = &int_mesh; }
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
Definition: mesh_base.h:2219

◆ set_isnt_prepared()

void libMesh::MeshBase::set_isnt_prepared ( )
inlineinherited

Tells this we have done some operation where we should no longer consider ourself prepared.

This is a very coarse setting; it is generally more efficient to mark finer-grained settings instead.

This method name is now deprecated, in part to match the less awkward unset_has_ names of the more fine-grained methods, in part as a way to prompt older user codes to use the more fine-grained methods where they can, to speed up the complete_preparation() calls afterward.

Definition at line 228 of file mesh_base.h.

References libMesh::MeshBase::_preparation.

229  { libmesh_deprecated(); _preparation = false; }
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ set_mesh_dimension()

void libMesh::MeshBase::set_mesh_dimension ( unsigned char  d)
inlineinherited

◆ set_n_partitions()

unsigned int& libMesh::MeshBase::set_n_partitions ( )
inlineprotectedinherited
Returns
A writable reference to the number of partitions.

Definition at line 2131 of file mesh_base.h.

References libMesh::MeshBase::_n_parts.

Referenced by libMesh::Partitioner::partition(), libMesh::Partitioner::repartition(), and libMesh::BoundaryInfo::sync().

2132  { return _n_parts; }
unsigned int _n_parts
The number of partitions the mesh has.
Definition: mesh_base.h:2144

◆ set_next_unique_id()

virtual void libMesh::MeshBase::set_next_unique_id ( unique_id_type  id)
pure virtualinherited

Sets the next available unique id to be used.

On a ReplicatedMesh, or when adding unpartitioned objects to a DistributedMesh, this must be kept in sync on all processors.

On a DistributedMesh, other unique_id values (larger than this one) may be chosen next, to allow unique_id assignment without communication.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by copy_nodes_and_elements(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read_serialized_nodes(), and libMesh::ExodusII_IO_Helper::set_dof_object_unique_id().

◆ set_point_locator_close_to_point_tol()

void libMesh::MeshBase::set_point_locator_close_to_point_tol ( Real  val)
inherited

Set value used by PointLocatorBase::close_to_point_tol().

Defaults to 0.0. If nonzero, calls close_to_point_tol() whenever a new PointLocator is built for use by this Mesh. Since the Mesh controls the creation and destruction of the PointLocator, if there are any parameters we need to customize on it, the Mesh will need to know about them.

Definition at line 2300 of file mesh_base.C.

References libMesh::MeshBase::_point_locator, and libMesh::MeshBase::_point_locator_close_to_point_tol.

2301 {
2303  if (_point_locator)
2304  {
2305  if (val > 0.)
2306  _point_locator->set_close_to_point_tol(val);
2307  else
2308  _point_locator->unset_close_to_point_tol();
2309  }
2310 }
std::unique_ptr< PointLocatorBase > _point_locator
A PointLocator class for this mesh.
Definition: mesh_base.h:2192
Real _point_locator_close_to_point_tol
If nonzero, we will call PointLocatorBase::set_close_to_point_tol() on any PointLocators that we crea...
Definition: mesh_base.h:2415

◆ set_spatial_dimension()

void libMesh::MeshBase::set_spatial_dimension ( unsigned char  d)
inherited

Sets the "spatial dimension" of the Mesh.

See the documentation for Mesh::spatial_dimension() for more information.

Definition at line 613 of file mesh_base.C.

References libMesh::MeshBase::_spatial_dimension.

Referenced by libMesh::MeshTools::Modification::rotate(), MeshSpatialDimensionTest::test2D(), and InfFERadialTest::testRefinement().

614 {
615  // The user can set the _spatial_dimension however they wish,
616  // libMesh will only *increase* the spatial dimension, however,
617  // never decrease it.
618  _spatial_dimension = d;
619 }
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2332

◆ set_subdomain_name_map()

std::map<subdomain_id_type, std::string>& libMesh::MeshBase::set_subdomain_name_map ( )
inlineinherited
Returns
A writable reference to the whole subdomain name map

Definition at line 1894 of file mesh_base.h.

References libMesh::MeshBase::_block_id_to_name.

Referenced by libMesh::DistributedMesh::DistributedMesh(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::CheckpointIO::read_subdomain_names(), and libMesh::ReplicatedMesh::ReplicatedMesh().

1895  { return _block_id_to_name; }
std::map< subdomain_id_type, std::string > _block_id_to_name
This structure maintains the mapping of named blocks for file formats that support named blocks...
Definition: mesh_base.h:2275

◆ size_elem_extra_integers()

void libMesh::MeshBase::size_elem_extra_integers ( )
protectedinherited

Size extra-integer arrays of all elements in the mesh.

Definition at line 2321 of file mesh_base.C.

References libMesh::MeshBase::_elem_integer_names, libMesh::MeshBase::element_stored_range(), and libMesh::Threads::parallel_for().

Referenced by libMesh::MeshBase::add_elem_data(), libMesh::MeshBase::add_elem_datum(), libMesh::MeshBase::add_elem_integer(), and libMesh::MeshBase::add_elem_integers().

2322 {
2323  const std::size_t new_size = _elem_integer_names.size();
2324 
2326  (this->element_stored_range(),
2327  [new_size, this](const ElemRange & range)
2328  {
2329  for (Elem * elem : range)
2330  elem->add_extra_integers(new_size, this->_elem_integer_default_values);
2331  });
2332 }
void parallel_for(const Range &range, const Body &body, unsigned int n_threads=libMesh::n_threads())
Execute the provided function object in parallel on the specified range.
Definition: threads_none.h:73
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2338
const ElemRange & element_stored_range()
Definition: mesh_base.C:1913
const DofMap &dof_map LIBMESH_COMMA unsigned int Elem * ElemRange
Definition: mesh_base.h:1816

◆ size_node_extra_integers()

void libMesh::MeshBase::size_node_extra_integers ( )
protectedinherited

Size extra-integer arrays of all nodes in the mesh.

Definition at line 2336 of file mesh_base.C.

References libMesh::MeshBase::_node_integer_default_values, and libMesh::MeshBase::_node_integer_names.

Referenced by libMesh::MeshBase::add_node_data(), libMesh::MeshBase::add_node_datum(), libMesh::MeshBase::add_node_integer(), and libMesh::MeshBase::add_node_integers().

2337 {
2338  const std::size_t new_size = _node_integer_names.size();
2339  for (auto node : this->node_ptr_range())
2340  node->add_extra_integers(new_size, _node_integer_default_values);
2341 }
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2350
std::vector< dof_id_type > _node_integer_default_values
The array of default initialization values for integer data associated with each node in the mesh...
Definition: mesh_base.h:2356

◆ skip_noncritical_partitioning() [1/2]

void libMesh::MeshBase::skip_noncritical_partitioning ( bool  skip)
inlineinherited

If true is passed in then the elements on this mesh will no longer be (re)partitioned, and the nodes on this mesh will only be repartitioned if they are found "orphaned" via coarsening or other removal of the last element responsible for their node/element processor id consistency.

Note
It would probably be a bad idea to call this on a DistributedMesh before the first partitioning has happened... because no elements would get assigned to your processor pool.
Skipping partitioning can have adverse effects on your performance when using AMR... i.e. you could get large load imbalances. However you might still want to use this if the communication and computation of the rebalance and repartition is too high for your application.

It is also possible, for backwards-compatibility purposes, to skip noncritical partitioning by resetting the partitioner() pointer for this mesh.

Definition at line 1401 of file mesh_base.h.

References libMesh::MeshBase::_skip_noncritical_partitioning.

Referenced by libMesh::MeshTools::correct_node_proc_ids(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), and MeshInputTest::testCopyNodalSolutionImpl().

1402  { _skip_noncritical_partitioning = skip; }
bool _skip_noncritical_partitioning
If this is true then no partitioning should be done with the possible exception of orphaned nodes...
Definition: mesh_base.h:2225

◆ skip_noncritical_partitioning() [2/2]

bool libMesh::MeshBase::skip_noncritical_partitioning ( ) const
inlineinherited

Definition at line 1404 of file mesh_base.h.

References libMesh::MeshBase::_partitioner, libMesh::MeshBase::_skip_all_partitioning, and libMesh::MeshBase::_skip_noncritical_partitioning.

Referenced by libMesh::MeshBase::partition().

bool _skip_noncritical_partitioning
If this is true then no partitioning should be done with the possible exception of orphaned nodes...
Definition: mesh_base.h:2225
std::unique_ptr< Partitioner > _partitioner
A partitioner to use at each prepare_for_use().
Definition: mesh_base.h:2206
bool _skip_all_partitioning
If this is true then no partitioning should be done.
Definition: mesh_base.h:2230

◆ skip_partitioning() [1/2]

void libMesh::MeshBase::skip_partitioning ( bool  skip)
inlineinherited

If true is passed in then nothing on this mesh will be (re)partitioned.

Note
The caveats for skip_noncritical_partitioning() still apply, and removing elements from a mesh with this setting enabled can leave node processor ids in an inconsistent state (not matching any attached element), causing failures in other library code. Do not use this setting along with element deletion or coarsening.

Definition at line 1419 of file mesh_base.h.

References libMesh::MeshBase::_skip_all_partitioning.

Referenced by libMesh::DistributedMesh::DistributedMesh(), libMesh::CheckpointIO::read(), libMesh::ReplicatedMesh::ReplicatedMesh(), and CheckpointIOTest::testSplitter().

1419 { _skip_all_partitioning = skip; }
bool _skip_all_partitioning
If this is true then no partitioning should be done.
Definition: mesh_base.h:2230

◆ skip_partitioning() [2/2]

bool libMesh::MeshBase::skip_partitioning ( ) const
inlineinherited

◆ spatial_dimension()

unsigned int libMesh::MeshBase::spatial_dimension ( ) const
inherited
Returns
The "spatial dimension" of the mesh.

The spatial dimension is defined as:

1 - for an exactly x-aligned mesh of 1D elements 2 - for an exactly x-y planar mesh of 2D elements 3 - otherwise

No tolerance checks are performed to determine whether the Mesh is x-aligned or x-y planar, only strict equality with zero in the higher dimensions is checked. Also, x-z and y-z planar meshes are considered to have spatial dimension == 3.

The spatial dimension is updated during mesh preparation based on the dimensions of the various elements present in the Mesh, but is never automatically decreased.

For example, if the user calls set_spatial_dimension(2) and then later inserts 3D elements into the mesh, Mesh::spatial_dimension() will return 3 after the next call to prepare_for_use() or complete_preparation(). On the other hand, if the user calls set_spatial_dimension(3) and then inserts only x-aligned 1D elements into the Mesh, mesh.spatial_dimension() will remain 3.

Definition at line 606 of file mesh_base.C.

References libMesh::MeshBase::_spatial_dimension.

Referenced by libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::EquationSystems::build_variable_names(), libMesh::MeshBase::get_info(), libMesh::ExodusII_IO_Helper::initialize(), MeshSpatialDimensionTest::test1D(), and MeshSpatialDimensionTest::test2D().

607 {
608  return cast_int<unsigned int>(_spatial_dimension);
609 }
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2332

◆ stitch_meshes()

std::size_t libMesh::UnstructuredMesh::stitch_meshes ( const MeshBase other_mesh,
boundary_id_type  this_mesh_boundary,
boundary_id_type  other_mesh_boundary,
Real  tol = TOLERANCE,
bool  clear_stitched_boundary_ids = false,
bool  verbose = true,
bool  use_binary_search = true,
bool  enforce_all_nodes_match_on_boundaries = false,
bool  merge_boundary_nodes_all_or_nothing = false,
bool  remap_subdomain_ids = false,
bool  prepare_after_stitching = true 
)

Stitch other_mesh to this mesh so that this mesh is the union of the two meshes.

this_mesh_boundary and other_mesh_boundary are used to specify a dim-1 dimensional surface on which we seek to merge any "overlapping" nodes, where we use the parameter tol as a relative tolerance (relative to the smallest edge length on the surfaces being stitched) to determine whether or not nodes are overlapping. If clear_stitched_boundary_ids==true, this function clears boundary_info IDs in this mesh associated this_mesh_boundary and other_mesh_boundary. If use_binary_search is true, we use an optimized "sort then binary search" algorithm for finding matching nodes. Otherwise we use a N^2 algorithm (which can be more reliable at dealing with slightly misaligned meshes). If enforce_all_nodes_match_on_boundaries is true, we throw an error if the number of nodes on the specified boundaries don't match the number of nodes that were merged. This is a helpful error check in some cases. If this is true, it overrides the value of merge_boundary_nodes_all_or_nothing. If skip_find_neighbors is true, a faster stitching method is used, where the lists of neighbors for each elements are copied as well and patched, without calling the time-consuming find_neighbors() function. This option is now hard-coded to true. If merge_boundary_nodes_all_or_nothing is true, instead of throwing an error like enforce_all_nodes_match_on_boundaries, the meshes are combined anyway but coincident nodes are not merged into single nodes. This is useful in cases where you are not sure if the boundaries are fully conforming beforehand and you want to handle the non-conforming cases differently.

Note that the element IDs for elements in the stitched mesh corresponding to "this" mesh will be unchanged. The IDs for elements corresponding to other_mesh will be incremented by this->max_elem_id().

There is no simple a priori relationship between node IDs in "this" mesh and other_mesh and node IDs in the stitched mesh because the number of nodes (and hence the node IDs) in the stitched mesh depend on how many nodes are stitched.

If remap_subdomain_ids is true then we assume that some subdomain ids might have been autogenerated, so we remap them as necessary, treating subdomain names as the important thing for consistency; if we have missing names and cannot infer a consistent resolution to an id conflict then we exit with an error. If remap_subdomain_ids is false then we revert to the older libMesh behavior: leave all subdomain ids alone and woe unto you if you weren't keeping track of them.

If prepare_after_stitching is true then we prepare the newly stitched mesh for use immediately after stitching. If the mesh does not need to be completely prepared for use yet (e.g. because it will undergo further stitching etc. before repartitioning for load balancing is desired), this can be set to false to potentially improve performance.

Returns
the count of how many nodes were merged between the two meshes. This can be zero in the case of no matching nodes or if merge_boundary_nodes_all_or_nothing was active and relevant.

Definition at line 1869 of file unstructured_mesh.C.

References stitching_helper().

Referenced by DisjointNeighborTest::testDisjointNeighborConflictError(), MeshStitchTest::testNodeElemStitch(), and DisjointNeighborTest::testStitchCrossMesh().

1880 {
1881  LOG_SCOPE("stitch_meshes()", "UnstructuredMesh");
1882  return stitching_helper(&other_mesh,
1883  this_mesh_boundary_id,
1884  other_mesh_boundary_id,
1885  tol,
1886  clear_stitched_boundary_ids,
1887  verbose,
1888  use_binary_search,
1889  enforce_all_nodes_match_on_boundaries,
1890  true,
1891  merge_boundary_nodes_all_or_nothing,
1892  remap_subdomain_ids,
1893  prepare_after_stitching);
1894 }
std::size_t stitching_helper(const MeshBase *other_mesh, boundary_id_type boundary_id_1, boundary_id_type boundary_id_2, Real tol, bool clear_stitched_boundary_ids, bool verbose, bool use_binary_search, bool enforce_all_nodes_match_on_boundaries, bool skip_find_neighbors, bool merge_boundary_nodes_all_or_nothing, bool remap_subdomain_ids, bool prepare_after_stitching)
Helper function for stitch_meshes and stitch_surfaces that does the mesh stitching.

◆ stitch_surfaces()

std::size_t libMesh::UnstructuredMesh::stitch_surfaces ( boundary_id_type  boundary_id_1,
boundary_id_type  boundary_id_2,
Real  tol = TOLERANCE,
bool  clear_stitched_boundary_ids = false,
bool  verbose = true,
bool  use_binary_search = true,
bool  enforce_all_nodes_match_on_boundaries = false,
bool  merge_boundary_nodes_all_or_nothing = false,
bool  prepare_after_stitching = true 
)

Similar to stitch_meshes, except that we stitch two adjacent surfaces within this mesh.

Definition at line 1898 of file unstructured_mesh.C.

References stitching_helper().

1908 {
1909  return stitching_helper(nullptr,
1910  boundary_id_1,
1911  boundary_id_2,
1912  tol,
1913  clear_stitched_boundary_ids,
1914  verbose,
1915  use_binary_search,
1916  enforce_all_nodes_match_on_boundaries,
1917  /* skip_find_neighbors = */ true,
1918  merge_boundary_nodes_all_or_nothing,
1919  /* remap_subdomain_ids = */ false,
1920  prepare_after_stitching);
1921 }
std::size_t stitching_helper(const MeshBase *other_mesh, boundary_id_type boundary_id_1, boundary_id_type boundary_id_2, Real tol, bool clear_stitched_boundary_ids, bool verbose, bool use_binary_search, bool enforce_all_nodes_match_on_boundaries, bool skip_find_neighbors, bool merge_boundary_nodes_all_or_nothing, bool remap_subdomain_ids, bool prepare_after_stitching)
Helper function for stitch_meshes and stitch_surfaces that does the mesh stitching.

◆ stitching_helper()

std::size_t libMesh::UnstructuredMesh::stitching_helper ( const MeshBase other_mesh,
boundary_id_type  boundary_id_1,
boundary_id_type  boundary_id_2,
Real  tol,
bool  clear_stitched_boundary_ids,
bool  verbose,
bool  use_binary_search,
bool  enforce_all_nodes_match_on_boundaries,
bool  skip_find_neighbors,
bool  merge_boundary_nodes_all_or_nothing,
bool  remap_subdomain_ids,
bool  prepare_after_stitching 
)
private

Helper function for stitch_meshes and stitch_surfaces that does the mesh stitching.

Definition at line 1925 of file unstructured_mesh.C.

References libMesh::MeshBase::add_disjoint_neighbor_boundary_pairs(), libMesh::BoundaryInfo::add_edge(), libMesh::MeshBase::add_elemset_code(), libMesh::BoundaryInfo::add_node(), libMesh::BoundaryInfo::add_shellface(), libMesh::BoundaryInfo::add_side(), libMesh::MeshBase::allow_find_neighbors(), libMesh::MeshBase::allow_remote_element_removal(), b, libMesh::Utility::binary_find(), libMesh::PeriodicBoundaries::boundary(), libMesh::BoundaryInfo::boundary_ids(), libMesh::BoundaryInfo::build_edge_list(), libMesh::BoundaryInfo::build_node_list(), libMesh::BoundaryInfo::build_shellface_list(), libMesh::BoundaryInfo::build_side_list(), libMesh::BoundaryInfo::clear_stitched_boundary_side_ids(), copy_nodes_and_elements(), libMesh::MeshBase::delete_node(), libMesh::Elem::dim(), libMesh::BoundaryInfo::edge_boundary_ids(), libMesh::MeshBase::elem_ptr(), find_neighbors(), libMesh::BoundaryInfo::get_boundary_ids(), libMesh::MeshBase::get_boundary_info(), libMesh::MeshBase::get_disjoint_neighbor_boundary_pairs(), libMesh::BoundaryInfo::get_edgeset_name_map(), libMesh::MeshBase::get_elemset_codes(), libMesh::MeshBase::get_elemsets(), libMesh::BoundaryInfo::get_nodeset_name_map(), libMesh::BoundaryInfo::get_sideset_name(), libMesh::BoundaryInfo::get_sideset_name_map(), libMesh::MeshBase::get_subdomain_name_map(), libMesh::BoundaryInfo::has_boundary_id(), libMesh::if(), libMesh::BoundaryInfo::invalid_id, libMesh::invalid_uint, libMesh::MeshBase::is_prepared(), libMesh::Elem::level(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::Elem::local_node(), libMesh::Elem::low_order_key(), libMesh::make_range(), libMesh::MeshBase::max_elem_id(), libMesh::MeshBase::max_node_id(), mesh, libMesh::Elem::neighbor_ptr(), libMesh::Elem::node_ptr(), libMesh::MeshBase::node_ptr(), libMesh::MeshBase::node_ref(), libMesh::NODEELEM, libMesh::TensorTools::norm(), libMesh::out, libMesh::MeshBase::parallel_max_unique_id(), libMesh::MeshBase::point(), libMesh::MeshBase::prepare_for_use(), libMesh::Real, libMesh::MeshBase::remove_disjoint_boundary_pair(), libMesh::BoundaryInfo::set_edgeset_name_map(), libMesh::Elem::set_neighbor(), libMesh::Elem::set_node(), libMesh::BoundaryInfo::set_nodeset_name_map(), libMesh::BoundaryInfo::set_sideset_name_map(), side_id, libMesh::Elem::side_index_range(), libMesh::Elem::side_ptr(), libMesh::Elem::subactive(), libMesh::MeshBase::subdomain_name(), and libMesh::TOLERANCE.

Referenced by stitch_meshes(), and stitch_surfaces().

1937 {
1938 #ifdef DEBUG
1939  // We rely on neighbor links here
1941 #endif
1942 
1943  bool is_valid_disjoint_pair_to_stitch = false;
1944 
1945 #ifdef LIBMESH_ENABLE_PERIODIC
1946  auto * this_db = this->get_disjoint_neighbor_boundary_pairs();
1947  auto * other_db = (other_mesh ? other_mesh->get_disjoint_neighbor_boundary_pairs() : nullptr);
1948  const bool have_disc_bdys =
1949  (this_db && !this_db->empty()) || (other_db && !other_db->empty());
1950 
1951  if (have_disc_bdys)
1952  {
1953  const boundary_id_type a = this_mesh_boundary_id;
1954  const boundary_id_type b = other_mesh_boundary_id;
1955 
1956  auto get_pb = [](const PeriodicBoundaries * db, boundary_id_type id)
1957  {
1958  return db ? db->boundary(id) : nullptr;
1959  };
1960 
1961  // this mesh
1962  const auto * pb_this_a = get_pb(this_db, a);
1963  const auto * pb_this_b = get_pb(this_db, b);
1964  const bool in_this =
1965  (pb_this_a && pb_this_a->pairedboundary == b) ||
1966  (pb_this_b && pb_this_b->pairedboundary == a);
1967 
1968  // other mesh
1969  const auto * pb_other_b = get_pb(other_db, b);
1970  const auto * pb_other_a = get_pb(other_db, a);
1971  const bool in_other =
1972  (pb_other_b && pb_other_b->pairedboundary == a) ||
1973  (pb_other_a && pb_other_a->pairedboundary == b);
1974 
1975  // Conflict conditions:
1976  // Case 1: On "this" mesh, a or b exist but are not paired,
1977  // while the other mesh pairs them.
1978  if (!in_this && (pb_this_a || pb_this_b) && in_other)
1979  libmesh_error_msg("Disjoint neighbor boundary pairing mismatch: on 'this' mesh, "
1980  "boundary (" << a << " or " << b
1981  << ") exists but is not paired; on 'other' mesh the pair is present.");
1982 
1983  // Case 2: On "other" mesh, a or b exist but are not paired,
1984  // while this mesh pairs them.
1985  if (!in_other && (pb_other_a || pb_other_b) && in_this)
1986  libmesh_error_msg("Disjoint neighbor boundary pairing mismatch: on 'other' mesh, "
1987  "boundary (" << a << " or " << b
1988  << ") exists but is not paired; on 'this' mesh the pair is present.");
1989 
1990  // Legal conditions: either side has a correct pairing
1991  if (in_this || in_other)
1992  is_valid_disjoint_pair_to_stitch = true;
1993  }
1994 #endif // LIBMESH_ENABLE_PERIODIC
1995 
1996  // We can't even afford any unset neighbor links here.
1997  if (!this->is_prepared())
1998  this->find_neighbors();
1999 
2000  // FIXME: make distributed mesh support efficient.
2001  // Yes, we currently suck.
2002  MeshSerializer serialize(*this);
2003 
2004  // *Badly*.
2005  std::unique_ptr<MeshSerializer> serialize_other;
2006  if (other_mesh)
2007  serialize_other = std::make_unique<MeshSerializer>
2008  (*const_cast<MeshBase *>(other_mesh));
2009 
2010  std::map<dof_id_type, dof_id_type> node_to_node_map, other_to_this_node_map; // The second is the inverse map of the first
2011  std::map<dof_id_type, std::vector<dof_id_type>> node_to_elems_map;
2012 
2013  typedef dof_id_type key_type;
2014  typedef std::pair<const Elem *, unsigned char> val_type;
2015  typedef std::pair<key_type, val_type> key_val_pair;
2016  typedef std::unordered_multimap<key_type, val_type> map_type;
2017  // Mapping between all side keys in this mesh and elements+side numbers relevant to the boundary in this mesh as well.
2018  map_type side_to_elem_map;
2019 
2020  // If there is only one mesh (i.e. other_mesh == nullptr), then loop over this mesh twice
2021  if (!other_mesh)
2022  {
2023  other_mesh = this;
2024  }
2025 
2026  if ((this_mesh_boundary_id != BoundaryInfo::invalid_id) &&
2027  (other_mesh_boundary_id != BoundaryInfo::invalid_id))
2028  {
2029  LOG_SCOPE("stitch_meshes node merging", "UnstructuredMesh");
2030 
2031  // While finding nodes on the boundary, also find the minimum edge length
2032  // of all faces on both boundaries. This will later be used in relative
2033  // distance checks when stitching nodes.
2034  Real h_min = std::numeric_limits<Real>::max();
2035  bool h_min_updated = false;
2036 
2037  // Loop below fills in these sets for the two meshes.
2038  std::set<dof_id_type> this_boundary_node_ids, other_boundary_node_ids;
2039 
2040  // Pull objects out of the loop to reduce heap operations
2041  std::unique_ptr<const Elem> side;
2042 
2043  {
2044  // Make temporary fixed-size arrays for loop
2045  boundary_id_type id_array[2] = {this_mesh_boundary_id, other_mesh_boundary_id};
2046  std::set<dof_id_type> * set_array[2] = {&this_boundary_node_ids, &other_boundary_node_ids};
2047  const MeshBase * mesh_array[2] = {this, other_mesh};
2048 
2049  for (unsigned i=0; i<2; ++i)
2050  {
2051  // First we deal with node boundary IDs. We only enter
2052  // this loop if we have at least one nodeset. Note that we
2053  // do not attempt to make an h_min determination here.
2054  // The h_min determination is done while looping over the
2055  // Elems and checking their sides and edges for boundary
2056  // information, below.
2057  if (mesh_array[i]->get_boundary_info().n_nodeset_conds() > 0)
2058  {
2059  // build_node_list() returns a vector of (node-id, bc-id) tuples
2060  for (const auto & t : mesh_array[i]->get_boundary_info().build_node_list())
2061  {
2062  boundary_id_type node_bc_id = std::get<1>(t);
2063  if (node_bc_id == id_array[i])
2064  {
2065  dof_id_type this_node_id = std::get<0>(t);
2066  set_array[i]->insert( this_node_id );
2067  }
2068  }
2069  }
2070 
2071  // Container to catch boundary IDs passed back from BoundaryInfo.
2072  std::vector<boundary_id_type> bc_ids;
2073 
2074  // Pointers to boundary NodeElems encountered while looping over the entire Mesh
2075  // and checking side and edge boundary ids. The Nodes associated with NodeElems
2076  // may be in a boundary nodeset, but not connected to any other Elems. In this
2077  // case, we also consider the "minimum node separation distance" amongst all
2078  // NodeElems when determining the relevant h_min value for this mesh.
2079  std::vector<const Elem *> boundary_node_elems;
2080 
2081  for (auto & el : mesh_array[i]->element_ptr_range())
2082  {
2083  // Now check whether elem has a face on the specified boundary
2084  for (auto side_id : el->side_index_range())
2085  {
2086  bool should_stitch_this_side =
2087  (el->neighbor_ptr(side_id) == nullptr) ||
2088  (is_valid_disjoint_pair_to_stitch &&
2089  mesh_array[i]->get_boundary_info().has_boundary_id(el, side_id, id_array[i]));
2090 
2091  if (should_stitch_this_side)
2092  {
2093  // Get *all* boundary IDs on this side, not just the first one!
2094  mesh_array[i]->get_boundary_info().boundary_ids (el, side_id, bc_ids);
2095 
2096  if (std::find(bc_ids.begin(), bc_ids.end(), id_array[i]) != bc_ids.end())
2097  {
2098  el->build_side_ptr(side, side_id);
2099  for (auto & n : side->node_ref_range())
2100  set_array[i]->insert(n.id());
2101 
2102  h_min = std::min(h_min, side->hmin());
2103  h_min_updated = true;
2104 
2105  // This side is on the boundary, add its information to side_to_elem
2106  if (skip_find_neighbors && (i==0))
2107  {
2108  key_type key = el->low_order_key(side_id);
2109  val_type val;
2110  val.first = el;
2111  val.second = cast_int<unsigned char>(side_id);
2112 
2113  key_val_pair kvp;
2114  kvp.first = key;
2115  kvp.second = val;
2116  side_to_elem_map.insert (kvp);
2117  }
2118  }
2119 
2120  // Also, check the edges on this side. We don't have to worry about
2121  // updating neighbor info in this case since elements don't store
2122  // neighbor info on edges.
2123  for (auto edge_id : el->edge_index_range())
2124  {
2125  if (el->is_edge_on_side(edge_id, side_id))
2126  {
2127  // Get *all* boundary IDs on this edge, not just the first one!
2128  mesh_array[i]->get_boundary_info().edge_boundary_ids (el, edge_id, bc_ids);
2129 
2130  if (std::find(bc_ids.begin(), bc_ids.end(), id_array[i]) != bc_ids.end())
2131  {
2132  std::unique_ptr<const Elem> edge (el->build_edge_ptr(edge_id));
2133  for (auto & n : edge->node_ref_range())
2134  set_array[i]->insert( n.id() );
2135 
2136  h_min = std::min(h_min, edge->hmin());
2137  h_min_updated = true;
2138  }
2139  }
2140  } // end for (edge_id)
2141  } // end if (should_stitch_this_side)
2142  } // end for (side_id)
2143 
2144  // Alternatively, is this a boundary NodeElem? If so,
2145  // add it to a list of NodeElems that will later be
2146  // used to set h_min based on the minimum node
2147  // separation distance between all pairs of boundary
2148  // NodeElems.
2149  if (el->type() == NODEELEM)
2150  {
2151  mesh_array[i]->get_boundary_info().boundary_ids(el->node_ptr(0), bc_ids);
2152  if (std::find(bc_ids.begin(), bc_ids.end(), id_array[i]) != bc_ids.end())
2153  {
2154  boundary_node_elems.push_back(el);
2155 
2156  // Debugging:
2157  // libMesh::out << "Elem " << el->id() << " is a NodeElem on boundary " << id_array[i] << std::endl;
2158  }
2159  } // end if (el->type() == NODEELEM)
2160  } // end for (el)
2161 
2162  // Compute the minimum node separation distance amongst
2163  // all boundary NodeElem pairs.
2164  {
2165  const auto N = boundary_node_elems.size();
2166  for (auto node_elem_i : make_range(N))
2167  for (auto node_elem_j : make_range(node_elem_i+1, N))
2168  {
2169  Real node_sep =
2170  (boundary_node_elems[node_elem_i]->point(0) - boundary_node_elems[node_elem_j]->point(0)).norm();
2171 
2172  // We only want to consider non-coincident
2173  // boundary NodeElem pairs when determining the
2174  // minimum node separation distance.
2175  if (node_sep > 0.)
2176  {
2177  h_min = std::min(h_min, node_sep);
2178  h_min_updated = true;
2179  }
2180  } // end for (node_elem_j)
2181  } // end minimum NodeElem separation scope
2182  } // end for (i)
2183  } // end scope
2184 
2185  if (verbose)
2186  {
2187  libMesh::out << "In UnstructuredMesh::stitch_meshes:\n"
2188  << "This mesh has " << this_boundary_node_ids.size()
2189  << " nodes on boundary `"
2190  << this->get_boundary_info().get_sideset_name(this_mesh_boundary_id)
2191  << "' (" << this_mesh_boundary_id << ").\n"
2192  << "Other mesh has " << other_boundary_node_ids.size()
2193  << " nodes on boundary `"
2194  << other_mesh->get_boundary_info().get_sideset_name(other_mesh_boundary_id)
2195  << "' (" << other_mesh_boundary_id << ").\n";
2196 
2197  if (h_min_updated)
2198  {
2199  libMesh::out << "Minimum edge length on both surfaces is " << h_min << ".\n";
2200  }
2201  else
2202  {
2203  libMesh::out << "No minimum edge length determined on specified surfaces." << std::endl;
2204  }
2205  }
2206 
2207  // At this point, if h_min==0 it means that there were at least two coincident
2208  // nodes on the surfaces being stitched, and we don't currently support that case.
2209  // (It might be possible to support, but getting it exactly right would be tricky
2210  // and probably not worth the extra complications to the "normal" case.)
2211  libmesh_error_msg_if(h_min < std::numeric_limits<Real>::epsilon(),
2212  "Coincident nodes detected on source and/or target "
2213  "surface, stitching meshes is not possible.");
2214 
2215  // We require nanoflann for the "binary search" (really kd-tree)
2216  // option to work. If it's not available, turn that option off,
2217  // warn the user, and fall back on the N^2 search algorithm.
2218  if (use_binary_search)
2219  {
2220 #ifndef LIBMESH_HAVE_NANOFLANN
2221  use_binary_search = false;
2222  libmesh_warning("The use_binary_search option in the "
2223  "UnstructuredMesh stitching algorithms requires nanoflann "
2224  "support. Falling back on N^2 search algorithm.");
2225 #endif
2226  }
2227 
2228  if (!this_boundary_node_ids.empty())
2229  {
2230  if (use_binary_search)
2231  {
2232 #ifdef LIBMESH_HAVE_NANOFLANN
2233  typedef nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<Real, VectorOfNodesAdaptor>,
2234  VectorOfNodesAdaptor, 3, std::size_t> kd_tree_t;
2235 
2236  // Create the dataset needed to build the kd tree with nanoflann
2237  std::vector<std::pair<Point, dof_id_type>> this_mesh_nodes(this_boundary_node_ids.size());
2238 
2239  for (auto [it, ctr] = std::make_tuple(this_boundary_node_ids.begin(), 0u);
2240  it != this_boundary_node_ids.end(); ++it, ++ctr)
2241  {
2242  this_mesh_nodes[ctr].first = this->point(*it);
2243  this_mesh_nodes[ctr].second = *it;
2244  }
2245 
2246  VectorOfNodesAdaptor vec_nodes_adaptor(this_mesh_nodes);
2247 
2248  kd_tree_t this_kd_tree(3, vec_nodes_adaptor, 10);
2249  this_kd_tree.buildIndex();
2250 
2251  // Storage for nearest neighbor in the loop below
2252  std::size_t ret_index;
2253  Real ret_dist_sqr;
2254 
2255  // Loop over other mesh. For each node, find its nearest neighbor in this mesh, and fill in the maps.
2256  for (const auto & node_id : other_boundary_node_ids)
2257  {
2258  const auto & p = other_mesh->point(node_id);
2259  const Real query_pt[] = {p(0), p(1), p(2)};
2260  this_kd_tree.knnSearch(&query_pt[0], 1, &ret_index, &ret_dist_sqr);
2261 
2262  // TODO: here we should use the user's specified tolerance
2263  // and the previously determined value of h_min in the
2264  // distance comparison, not just TOLERANCE^2.
2265  if (ret_dist_sqr < TOLERANCE*TOLERANCE)
2266  {
2267  node_to_node_map[this_mesh_nodes[ret_index].second] = node_id;
2268  other_to_this_node_map[node_id] = this_mesh_nodes[ret_index].second;
2269  }
2270  }
2271 
2272  // If the two maps don't have the same size, it means one
2273  // node in this mesh is the nearest neighbor of several
2274  // nodes in other mesh. Since the stitching is ambiguous in
2275  // this case, we throw an error.
2276  libmesh_error_msg_if(node_to_node_map.size() != other_to_this_node_map.size(),
2277  "Error: Found multiple matching nodes in stitch_meshes");
2278 #endif
2279  }
2280  else // !use_binary_search
2281  {
2282  // In the unlikely event that two meshes composed entirely of
2283  // NodeElems are being stitched together, we will not have
2284  // selected a valid h_min value yet, and the distance
2285  // comparison below will be true for essentially any two
2286  // nodes. In this case we simply fall back on an absolute
2287  // distance check.
2288  if (!h_min_updated)
2289  {
2290  libmesh_warning("No valid h_min value was found, falling back on "
2291  "absolute distance check in the N^2 search algorithm.");
2292  h_min = 1.;
2293  }
2294 
2295  // Otherwise, use a simple N^2 search to find the closest matching points. This can be helpful
2296  // in the case that we have tolerance issues which cause mismatch between the two surfaces
2297  // that are being stitched.
2298  for (const auto & this_node_id : this_boundary_node_ids)
2299  {
2300  Node & this_node = this->node_ref(this_node_id);
2301 
2302  bool found_matching_nodes = false;
2303 
2304  for (const auto & other_node_id : other_boundary_node_ids)
2305  {
2306  const Node & other_node = other_mesh->node_ref(other_node_id);
2307 
2308  Real node_distance = (this_node - other_node).norm();
2309 
2310  if (node_distance < tol*h_min)
2311  {
2312  // Make sure we didn't already find a matching node!
2313  libmesh_error_msg_if(found_matching_nodes,
2314  "Error: Found multiple matching nodes in stitch_meshes");
2315 
2316  node_to_node_map[this_node_id] = other_node_id;
2317  other_to_this_node_map[other_node_id] = this_node_id;
2318 
2319  found_matching_nodes = true;
2320  }
2321  }
2322  }
2323  }
2324  }
2325 
2326  // Build up the node_to_elems_map, using only one loop over other_mesh
2327  for (auto & el : other_mesh->element_ptr_range())
2328  {
2329  // For each node on the element, find the corresponding node
2330  // on "this" Mesh, 'this_node_id', if it exists, and push
2331  // the current element ID back onto node_to_elems_map[this_node_id].
2332  // For that we will use the reverse mapping we created at
2333  // the same time as the forward mapping.
2334  for (auto & n : el->node_ref_range())
2335  if (const auto it = other_to_this_node_map.find(/*other_node_id=*/n.id());
2336  it != other_to_this_node_map.end())
2337  node_to_elems_map[/*this_node_id=*/it->second].push_back( el->id() );
2338  }
2339 
2340  if (verbose)
2341  {
2342  libMesh::out << "In UnstructuredMesh::stitch_meshes:\n"
2343  << "Found " << node_to_node_map.size()
2344  << " matching nodes.\n"
2345  << std::endl;
2346  }
2347 
2348  if (enforce_all_nodes_match_on_boundaries)
2349  {
2350  std::size_t n_matching_nodes = node_to_node_map.size();
2351  std::size_t this_mesh_n_nodes = this_boundary_node_ids.size();
2352  std::size_t other_mesh_n_nodes = other_boundary_node_ids.size();
2353  libmesh_error_msg_if((n_matching_nodes != this_mesh_n_nodes) || (n_matching_nodes != other_mesh_n_nodes),
2354  "Error: We expected the number of nodes to match.");
2355  }
2356 
2357  if (merge_boundary_nodes_all_or_nothing)
2358  {
2359  std::size_t n_matching_nodes = node_to_node_map.size();
2360  std::size_t this_mesh_n_nodes = this_boundary_node_ids.size();
2361  std::size_t other_mesh_n_nodes = other_boundary_node_ids.size();
2362  if ((n_matching_nodes != this_mesh_n_nodes) || (n_matching_nodes != other_mesh_n_nodes))
2363  {
2364  if (verbose)
2365  {
2366  libMesh::out << "Skipping node merging in "
2367  "UnstructuredMesh::stitch_meshes because not "
2368  "all boundary nodes were matched."
2369  << std::endl;
2370  }
2371  node_to_node_map.clear();
2372  other_to_this_node_map.clear();
2373  node_to_elems_map.clear();
2374  }
2375  }
2376  }
2377  else
2378  {
2379  if (verbose)
2380  {
2381  libMesh::out << "Skip node merging in UnstructuredMesh::stitch_meshes:" << std::endl;
2382  }
2383  }
2384 
2385  dof_id_type node_delta = this->max_node_id();
2386  dof_id_type elem_delta = this->max_elem_id();
2387 
2388  unique_id_type unique_delta =
2389 #ifdef LIBMESH_ENABLE_UNIQUE_ID
2390  this->parallel_max_unique_id();
2391 #else
2392  0;
2393 #endif
2394 
2395  // If other_mesh != nullptr, then we have to do a bunch of work
2396  // in order to copy it to this mesh
2397  if (this!=other_mesh)
2398  {
2399  LOG_SCOPE("stitch_meshes copying", "UnstructuredMesh");
2400 
2401 #ifdef LIBMESH_ENABLE_PERIODIC
2402  // Copy disjoint neighbor boundary pairs (PeriodicBoundary objects)
2403  // from `other_mesh` to `this` mesh
2404  if (other_db && !other_db->empty())
2405  {
2406  for (const auto & [bdy_id, pb_ptr] : *other_db)
2407  {
2408  const auto & pb = *pb_ptr;
2409  const boundary_id_type a = pb.myboundary;
2410  const boundary_id_type b = pb.pairedboundary;
2411 
2412  if (this_db)
2413  {
2414  // Skip if identical pair already exists
2415  if (const auto * existing_pb = this_db->boundary(a))
2416  if ((existing_pb->myboundary == a && existing_pb->pairedboundary == b) ||
2417  (existing_pb->myboundary == b && existing_pb->pairedboundary == a))
2418  continue;
2419 
2420  // If both boundary ids exist on this mesh but aren't paired here, refuse to create a new pair
2421  const auto & bdy_ids = this->get_boundary_info().get_boundary_ids();
2422  const bool a_exists = bdy_ids.count(a);
2423  const bool b_exists = bdy_ids.count(b);
2424  // If a and b already exist on `this`, we should be screaming and dying
2425  // unless they already have PeriodicBoundary objects connecting them too
2426  if (a_exists && b_exists && !this_db->boundary(a))
2427  libmesh_error_msg("Conflict: boundaries " << a << " and " << b
2428  << " already exist on this mesh but are not paired.");
2429  }
2430 
2431  this->add_disjoint_neighbor_boundary_pairs(a, b, pb.get_corresponding_pos(Point(0.0,0.0,0.0)));
2432  }
2433  }
2434 #endif // LIBMESH_ENABLE_PERIODIC
2435 
2436 
2437  // Increment the node_to_node_map and node_to_elems_map
2438  // to account for id offsets
2439  for (auto & pr : node_to_node_map)
2440  pr.second += node_delta;
2441 
2442  for (auto & pr : node_to_elems_map)
2443  for (auto & entry : pr.second)
2444  entry += elem_delta;
2445 
2446  // We run into problems when the libMesh subdomain standard (the
2447  // id defines the subdomain; the name was an afterthought) and
2448  // the MOOSE standard (the name defines the subdomain; the id
2449  // might be autogenerated) clash.
2450  //
2451  // Subdomain ids with the same name in both meshes are surely
2452  // meant to represent the same subdomain. We can just merge
2453  // them.
2454  //
2455  // Subdomain ids which don't have a name in either mesh are
2456  // almost surely meant to represent the same subdomain. We'll
2457  // just merge them.
2458  //
2459  // Subdomain ids with different names in different meshes, or
2460  // names with different ids in different meshes, are trickier.
2461  // For backwards compatibility we default to the old "just copy
2462  // all the subdomain ids over" behavior, but if requested we'll
2463  // remap any ids that appear to be clear conflicts, and we'll
2464  // scream and die if we see any ids that are ambiguous due to
2465  // being named in one mesh but not the other.
2466  std::unordered_map<subdomain_id_type, subdomain_id_type> id_remapping;
2467  if (remap_subdomain_ids)
2468  {
2469  const auto & this_map = this->get_subdomain_name_map();
2470  const auto & other_map = other_mesh->get_subdomain_name_map();
2471  std::unordered_map<std::string, subdomain_id_type> other_map_reversed;
2472  for (auto & [sid, sname] : other_map)
2473  other_map_reversed.emplace(sname, sid);
2474 
2475  std::unordered_map<std::string, subdomain_id_type> this_map_reversed;
2476  for (auto & [sid, sname] : this_map)
2477  this_map_reversed.emplace(sname, sid);
2478 
2479  // We don't require either mesh to be prepared, but that
2480  // means we need to check for subdomains manually.
2481  auto get_subdomains = [](const MeshBase & mesh) {
2482  std::set<subdomain_id_type> all_subdomains;
2483  for (auto & el : mesh.element_ptr_range())
2484  all_subdomains.insert(el->subdomain_id());
2485  return all_subdomains;
2486  };
2487 
2488  const auto this_subdomains = get_subdomains(*this);
2489  const auto other_subdomains = get_subdomains(*other_mesh);
2490 
2491  for (auto & [sid, sname] : this_map)
2492  {
2493  // The same name with the same id means we're fine. The
2494  // same name with another id means we remap their id to
2495  // ours
2496  if (const auto other_reverse_it = other_map_reversed.find(sname);
2497  other_reverse_it != other_map_reversed.end() && other_reverse_it->second != sid)
2498  id_remapping[other_reverse_it->second] = sid;
2499 
2500  // The same id with a different name, we'll get to
2501  // later. The same id without any name means we don't
2502  // know what the user wants.
2503  if (other_subdomains.count(sid) && !other_map.count(sid))
2504  libmesh_error_msg("Can't safely stitch with a mesh sharing subdomain id "
2505  << sid << " but not subdomain name " << sname);
2506  }
2507 
2508  subdomain_id_type next_free_id = 0;
2509  // We might try to stitch empty meshes ...
2510  if (!this_subdomains.empty())
2511  next_free_id = *this_subdomains.rbegin() + 1;
2512  if (!other_subdomains.empty())
2513  next_free_id =
2514  std::max(next_free_id,
2515  cast_int<subdomain_id_type>
2516  (*other_subdomains.rbegin() + 1));
2517 
2518  for (auto & [sid, sname] : other_map)
2519  {
2520  // At this point we've figured out any remapping
2521  // necessary for an sname that we share. And we don't
2522  // need to remap any sid we don't share.
2523  if (!this_map_reversed.count(sname))
2524  {
2525  // But if we don't have this sname and we do have this
2526  // sid then we can't just merge into that.
2527  if (this_subdomains.count(sid))
2528  {
2529  // If we have this sid with no name, we don't
2530  // know what the user wants.
2531  if (!this_map.count(sid))
2532  libmesh_error_msg("Can't safely stitch with a mesh sharing subdomain id "
2533  << sid << " but under subdomain name " << sname);
2534 
2535  // We have this sid under a different name, so
2536  // we just need to give the other elements a new
2537  // id.
2538 
2539  // Users might have done crazy things with id
2540  // choice so let's make sure they didn't get too
2541  // crazy.
2542  libmesh_error_msg_if ((!this_subdomains.empty() &&
2543  next_free_id < *this_subdomains.rbegin()) ||
2544  (!other_subdomains.empty() &&
2545  next_free_id < *other_subdomains.rbegin()),
2546  "Subdomain id overflow");
2547 
2548  id_remapping[sid] = next_free_id++;
2549  this->subdomain_name(next_free_id) = sname;
2550  }
2551  // If we don't have this subdomain id, well, we're
2552  // about to, so we should have its name too.
2553  else
2554  this->subdomain_name(sid) = sname;
2555  }
2556  }
2557  }
2558 
2559  // Copy mesh data. If we skip the call to find_neighbors(), the lists
2560  // of neighbors will be copied verbatim from the other mesh
2561  this->copy_nodes_and_elements(*other_mesh, skip_find_neighbors,
2562  elem_delta, node_delta,
2563  unique_delta, &id_remapping);
2564 
2565  // Copy BoundaryInfo from other_mesh too. We do this via the
2566  // list APIs rather than element-by-element for speed.
2567  BoundaryInfo & boundary = this->get_boundary_info();
2568  const BoundaryInfo & other_boundary = other_mesh->get_boundary_info();
2569 
2570  for (const auto & t : other_boundary.build_node_list())
2571  boundary.add_node(std::get<0>(t) + node_delta,
2572  std::get<1>(t));
2573 
2574  for (const auto & t : other_boundary.build_side_list())
2575  boundary.add_side(std::get<0>(t) + elem_delta,
2576  std::get<1>(t),
2577  std::get<2>(t));
2578 
2579  for (const auto & t : other_boundary.build_edge_list())
2580  boundary.add_edge(std::get<0>(t) + elem_delta,
2581  std::get<1>(t),
2582  std::get<2>(t));
2583 
2584  for (const auto & t : other_boundary.build_shellface_list())
2585  boundary.add_shellface(std::get<0>(t) + elem_delta,
2586  std::get<1>(t),
2587  std::get<2>(t));
2588 
2589  const auto & other_ns_id_to_name = other_boundary.get_nodeset_name_map();
2590  auto & ns_id_to_name = boundary.set_nodeset_name_map();
2591  ns_id_to_name.insert(other_ns_id_to_name.begin(), other_ns_id_to_name.end());
2592 
2593  const auto & other_ss_id_to_name = other_boundary.get_sideset_name_map();
2594  auto & ss_id_to_name = boundary.set_sideset_name_map();
2595  ss_id_to_name.insert(other_ss_id_to_name.begin(), other_ss_id_to_name.end());
2596 
2597  const auto & other_es_id_to_name = other_boundary.get_edgeset_name_map();
2598  auto & es_id_to_name = boundary.set_edgeset_name_map();
2599  es_id_to_name.insert(other_es_id_to_name.begin(), other_es_id_to_name.end());
2600 
2601  // Merge other_mesh's elemset information with ours. Throw an
2602  // error if this and other_mesh have overlapping elemset codes
2603  // that refer to different elemset ids.
2604  std::vector<dof_id_type> this_elemset_codes = this->get_elemset_codes();
2605  MeshBase::elemset_type this_id_set_to_fill, other_id_set_to_fill;
2606  for (const auto & elemset_code : other_mesh->get_elemset_codes())
2607  {
2608  // Get the elemset ids for this elemset_code on other_mesh
2609  other_mesh->get_elemsets(elemset_code, other_id_set_to_fill);
2610 
2611  // Check that this elemset code does not already exist
2612  // in this mesh, or if it does, that it has the same elemset
2613  // ids associated with it.
2614  //
2615  // Note: get_elemset_codes() is guaranteed to return a
2616  // sorted vector, so we can binary search in it.
2617  auto it = Utility::binary_find(this_elemset_codes.begin(),
2618  this_elemset_codes.end(),
2619  elemset_code);
2620 
2621  if (it != this_elemset_codes.end())
2622  {
2623  // This mesh has the same elemset code. Does it refer to
2624  // the same elemset ids?
2625  this->get_elemsets(elemset_code, this_id_set_to_fill);
2626 
2627  // Throw an error if they don't match, otherwise we
2628  // don't need to do anything
2629  libmesh_error_msg_if(other_id_set_to_fill != this_id_set_to_fill,
2630  "Attempted to stitch together meshes with conflicting elemset codes.");
2631  }
2632  else
2633  {
2634  // Add other_mesh's elemset code to this mesh
2635  this->add_elemset_code(elemset_code, other_id_set_to_fill);
2636  }
2637  }
2638 
2639  } // end if (other_mesh)
2640 
2641  // Finally, we need to "merge" the overlapping nodes
2642  // We do this by iterating over node_to_elems_map and updating
2643  // the elements so that they "point" to the nodes that came
2644  // from this mesh, rather than from other_mesh.
2645  // Then we iterate over node_to_node_map and delete the
2646  // duplicate nodes that came from other_mesh.
2647 
2648  {
2649  LOG_SCOPE("stitch_meshes node updates", "UnstructuredMesh");
2650 
2651  // Container to catch boundary IDs passed back from BoundaryInfo.
2652  std::vector<boundary_id_type> bc_ids;
2653 
2654  for (const auto & [target_node_id, elem_vec] : node_to_elems_map)
2655  {
2656  dof_id_type other_node_id = node_to_node_map[target_node_id];
2657  Node & target_node = this->node_ref(target_node_id);
2658 
2659  std::size_t n_elems = elem_vec.size();
2660  for (std::size_t i=0; i<n_elems; i++)
2661  {
2662  dof_id_type elem_id = elem_vec[i];
2663  Elem * el = this->elem_ptr(elem_id);
2664 
2665  // find the local node index that we want to update
2666  unsigned int local_node_index = el->local_node(other_node_id);
2667  libmesh_assert_not_equal_to(local_node_index, libMesh::invalid_uint);
2668 
2669  // We also need to copy over the nodeset info here,
2670  // because the node will get deleted below
2671  this->get_boundary_info().boundary_ids(el->node_ptr(local_node_index), bc_ids);
2672  el->set_node(local_node_index, &target_node);
2673  this->get_boundary_info().add_node(&target_node, bc_ids);
2674  }
2675  }
2676  }
2677 
2678  {
2679  LOG_SCOPE("stitch_meshes node deletion", "UnstructuredMesh");
2680  for (const auto & [other_node_id, this_node_id] : node_to_node_map)
2681  {
2682  // In the case that this==other_mesh, the two nodes might be the same (e.g. if
2683  // we're stitching a "sliver"), hence we need to skip node deletion in that case.
2684  if ((this == other_mesh) && (this_node_id == other_node_id))
2685  continue;
2686 
2687  this->delete_node( this->node_ptr(this_node_id) );
2688  }
2689  }
2690 
2691  // If find_neighbors() wasn't called in prepare_for_use(), we need to
2692  // manually loop once more over all elements adjacent to the stitched boundary
2693  // and fix their lists of neighbors.
2694  // This is done according to the following steps:
2695  // 1. Loop over all copied elements adjacent to the boundary using node_to_elems_map (trying to avoid duplicates)
2696  // 2. Look at all their sides with a nullptr neighbor and update them using side_to_elem_map if necessary
2697  // 3. Update the corresponding side in side_to_elem_map as well
2698  if (skip_find_neighbors)
2699  {
2700  LOG_SCOPE("stitch_meshes neighbor fixes", "UnstructuredMesh");
2701 
2702  // Pull objects out of the loop to reduce heap operations
2703  std::unique_ptr<const Elem> my_side, their_side;
2704 
2705  std::set<dof_id_type> fixed_elems;
2706  for (const auto & pr : node_to_elems_map)
2707  {
2708  std::size_t n_elems = pr.second.size();
2709  for (std::size_t i=0; i<n_elems; i++)
2710  {
2711  dof_id_type elem_id = pr.second[i];
2712  if (!fixed_elems.count(elem_id))
2713  {
2714  Elem * el = this->elem_ptr(elem_id);
2715  fixed_elems.insert(elem_id);
2716  for (auto s : el->side_index_range())
2717  {
2718  bool has_real_neighbor = (el->neighbor_ptr(s) != nullptr);
2719  bool has_disdjoint_neighbor = is_valid_disjoint_pair_to_stitch &&
2720  (this->get_boundary_info().has_boundary_id(el, s, this_mesh_boundary_id)
2721  || this->get_boundary_info().has_boundary_id(el, s, other_mesh_boundary_id));
2722 
2723  if (!has_real_neighbor || has_disdjoint_neighbor)
2724  {
2725  key_type key = el->low_order_key(s);
2726  auto bounds = side_to_elem_map.equal_range(key);
2727 
2728  if (bounds.first != bounds.second)
2729  {
2730  // Get the side for this element
2731  el->side_ptr(my_side, s);
2732 
2733  // Look at all the entries with an equivalent key
2734  while (bounds.first != bounds.second)
2735  {
2736  // Get the potential element
2737  Elem * neighbor = const_cast<Elem *>(bounds.first->second.first);
2738 
2739  // Get the side for the neighboring element
2740  const unsigned int ns = bounds.first->second.second;
2741  neighbor->side_ptr(their_side, ns);
2742  //libmesh_assert(my_side.get());
2743  //libmesh_assert(their_side.get());
2744 
2745  // If found a match with my side
2746  //
2747  // We need special tests here for 1D:
2748  // since parents and children have an equal
2749  // side (i.e. a node), we need to check
2750  // ns != ms, and we also check level() to
2751  // avoid setting our neighbor pointer to
2752  // any of our neighbor's descendants
2753  if ((*my_side == *their_side) &&
2754  (el->level() == neighbor->level()) &&
2755  ((el->dim() != 1) || (ns != s)))
2756  {
2757  // So share a side. Is this a mixed pair
2758  // of subactive and active/ancestor
2759  // elements?
2760  // If not, then we're neighbors.
2761  // If so, then the subactive's neighbor is
2762 
2763  if (el->subactive() ==
2764  neighbor->subactive())
2765  {
2766  // an element is only subactive if it has
2767  // been coarsened but not deleted
2768  el->set_neighbor (s,neighbor);
2769  neighbor->set_neighbor(ns,el);
2770  }
2771  else if (el->subactive())
2772  {
2773  el->set_neighbor(s,neighbor);
2774  }
2775  else if (neighbor->subactive())
2776  {
2777  neighbor->set_neighbor(ns,el);
2778  }
2779  // It's OK to invalidate the
2780  // bounds.first iterator here,
2781  // as we are immediately going
2782  // to break out of this while
2783  // loop. bounds.first will
2784  // therefore not be used for
2785  // anything else.
2786  side_to_elem_map.erase (bounds.first);
2787  break;
2788  }
2789 
2790  ++bounds.first;
2791  }
2792  }
2793  }
2794  }
2795  }
2796  }
2797  }
2798  }
2799 
2800 #ifdef LIBMESH_ENABLE_PERIODIC
2801  // Remove only the disjoint pair that was actually stitched.
2802  // Safe because `is_valid_disjoint_pair_to_stitch` is true
2803  // only if this exact (a,b) pair exists in the registry.
2804  // Other disjoint pairs remain untouched.
2805  if (is_valid_disjoint_pair_to_stitch)
2806  this->remove_disjoint_boundary_pair(this_mesh_boundary_id, other_mesh_boundary_id);
2807 #endif
2808 
2809  if (prepare_after_stitching)
2810  {
2811  // We set our new neighbor pointers already
2812  const bool old_allow_find_neighbors = this->allow_find_neighbors();
2813  this->allow_find_neighbors(!skip_find_neighbors);
2814 
2815  // We haven't newly remoted any elements
2816  const bool old_allow_remote_element_removal = this->allow_remote_element_removal();
2817  this->allow_remote_element_removal(false);
2818 
2819  this->prepare_for_use();
2820 
2821  this->allow_find_neighbors(old_allow_find_neighbors);
2822  this->allow_remote_element_removal(old_allow_remote_element_removal);
2823  }
2824 
2825  // After the stitching, we may want to clear boundary IDs from element
2826  // faces that are now internal to the mesh
2827  if (clear_stitched_boundary_ids)
2828  {
2829  LOG_SCOPE("stitch_meshes clear bcids", "UnstructuredMesh");
2830 
2832  this_mesh_boundary_id, other_mesh_boundary_id, /*clear_nodeset_data=*/true);
2833  }
2834 
2835  // Return the number of nodes which were merged.
2836  return node_to_node_map.size();
2837 }
std::vector< BCTuple > build_shellface_list() const
Create a list of (element_id, shellface_id, boundary_id) tuples for all relevant shellfaces.
bool is_prepared() const
Definition: mesh_base.C:1057
virtual Node *& set_node(const unsigned int i)
Definition: elem.h:2564
A Node is like a Point, but with more information.
Definition: node.h:52
virtual unique_id_type parallel_max_unique_id() const =0
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:303
std::vector< dof_id_type > get_elemset_codes() const
Return a vector of all elemset codes defined on the mesh.
Definition: mesh_base.C:503
IntRange< unsigned short > side_index_range() const
Definition: elem.h:2724
static constexpr Real TOLERANCE
We&#39;re using a class instead of a typedef to allow forward declarations and future flexibility...
virtual dof_id_type low_order_key(const unsigned int s) const =0
const boundary_id_type side_id
void add_elemset_code(dof_id_type code, MeshBase::elemset_type id_set)
Tabulate a user-defined "code" for elements which belong to the element sets specified in id_set...
Definition: mesh_base.C:456
const std::map< boundary_id_type, std::string > & get_sideset_name_map() const
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
MeshBase & mesh
PeriodicBoundaryBase * boundary(boundary_id_type id)
virtual void find_neighbors(const bool reset_remote_elements=false, const bool reset_current_list=true, const bool assert_valid=true) override
Other functions from MeshBase requiring re-definition.
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:170
std::vector< BCTuple > build_side_list(BCTupleSortBy sort_by=BCTupleSortBy::ELEM_ID) const
This is the MeshBase class.
Definition: mesh_base.h:80
void get_elemsets(dof_id_type elemset_code, MeshBase::elemset_type &id_set_to_fill) const
Look up the element sets for a given elemset code and vice-versa.
Definition: mesh_base.C:487
std::map< boundary_id_type, std::string > & set_sideset_name_map()
void add_node(const Node *node, const boundary_id_type id)
Add Node node with boundary id id to the boundary information data structures.
void add_disjoint_neighbor_boundary_pairs(const boundary_id_type b1, const boundary_id_type b2, const RealVectorValue &translation)
Register a pair of boundaries as disjoint neighbor boundary pairs.
Definition: mesh_base.C:2232
const std::map< boundary_id_type, std::string > & get_nodeset_name_map() const
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
Number used for internal use.
const std::map< subdomain_id_type, std::string > & get_subdomain_name_map() const
Definition: mesh_base.h:1896
PeriodicBoundaries * get_disjoint_neighbor_boundary_pairs()
Definition: mesh_base.C:2256
const std::map< boundary_id_type, std::string > & get_edgeset_name_map() const
virtual dof_id_type max_elem_id() const =0
bool allow_find_neighbors() const
Definition: mesh_base.h:1353
The BoundaryInfo class contains information relevant to boundary conditions including storing faces...
Definition: boundary_info.h:57
std::vector< BCTuple > build_edge_list() const
Create a list of (element_id, edge_id, boundary_id) tuples for all relevant edges.
virtual void delete_node(Node *n)=0
Removes the Node n from the mesh.
std::string & subdomain_name(subdomain_id_type id)
Definition: mesh_base.C:1880
bool allow_remote_element_removal() const
Definition: mesh_base.h:1369
void set_neighbor(const unsigned int i, Elem *n)
Assigns n as the neighbor.
Definition: elem.h:2632
void prepare_for_use()
Definition: mesh_base.C:860
const std::set< boundary_id_type > & get_boundary_ids() const
virtual const Elem * elem_ptr(const dof_id_type i) const =0
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:2612
std::set< elemset_id_type > elemset_type
Typedef for the "set" container used to store elemset ids.
Definition: mesh_base.h:456
unsigned int level() const
Definition: elem.h:3088
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual std::unique_ptr< Elem > side_ptr(unsigned int i)=0
auto norm(const T &a)
Definition: tensor_tools.h:74
virtual unsigned short dim() const =0
Temporarily serialize a DistributedMesh for non-distributed-mesh capable code paths.
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:2513
std::map< boundary_id_type, std::string > & set_nodeset_name_map()
void clear_stitched_boundary_side_ids(boundary_id_type sideset_id, boundary_id_type other_sideset_id, bool clear_nodeset_data=false)
Clear sideset information along a stitched mesh interface.
static const Real b
OStreamProxy out
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
Add side side of element number elem with boundary id id to the boundary information data structure...
const std::string & get_sideset_name(boundary_id_type id) const
void add_shellface(const dof_id_type elem, const unsigned short int shellface, const boundary_id_type id)
Add shell face shellface of element number elem with boundary id id to the boundary information data ...
bool subactive() const
Definition: elem.h:2973
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176
ForwardIterator binary_find(ForwardIterator first, ForwardIterator last, const T &value)
The STL provides std::binary_search() which returns true or false depending on whether the searched-f...
Definition: utility.h:233
virtual void copy_nodes_and_elements(const MeshBase &other_mesh, const bool skip_find_neighbors=false, dof_id_type element_id_offset=0, dof_id_type node_id_offset=0, unique_id_type unique_id_offset=0, std::unordered_map< subdomain_id_type, subdomain_id_type > *id_remapping=nullptr, const bool skip_preparation=false)
Deep copy of nodes and elements from another mesh object (used by subclass copy constructors and by m...
virtual const Node & node_ref(const dof_id_type i) const
Definition: mesh_base.h:735
virtual const Point & point(const dof_id_type i) const =0
unsigned int local_node(const dof_id_type i) const
Definition: elem.h:2493
std::vector< NodeBCTuple > build_node_list(NodeBCTupleSortBy sort_by=NodeBCTupleSortBy::NODE_ID) const
void edge_boundary_ids(const Elem *const elem, const unsigned short int edge, std::vector< boundary_id_type > &vec_to_fill) const
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 desc...
Definition: mesh_tools.C:2320
virtual dof_id_type max_node_id() const =0
void remove_disjoint_boundary_pair(const boundary_id_type b1, const boundary_id_type b2)
Definition: mesh_base.C:2266
virtual const Node * node_ptr(const dof_id_type i) const =0
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
uint8_t unique_id_type
Definition: id_types.h:86
uint8_t dof_id_type
Definition: id_types.h:67
std::map< boundary_id_type, std::string > & set_edgeset_name_map()
void add_edge(const dof_id_type elem, const unsigned short int edge, const boundary_id_type id)
Add edge edge of element number elem with boundary id id to the boundary information data structure...

◆ sub_point_locator()

std::unique_ptr< PointLocatorBase > libMesh::MeshBase::sub_point_locator ( ) const
inherited
Returns
A pointer to a subordinate PointLocatorBase object for this mesh, constructing a master PointLocator first if necessary. This should not be used in threaded or non-parallel_only code unless the master has already been constructed.

Definition at line 1826 of file mesh_base.C.

References libMesh::MeshBase::_point_locator, libMesh::MeshBase::_point_locator_close_to_point_tol, libMesh::PointLocatorBase::build(), libMesh::Threads::in_threads, libMesh::libmesh_assert(), libMesh::NANOFLANN, and libMesh::TREE_ELEMENTS.

Referenced by WriteElemsetData::checkElemsetCodes(), libMesh::DofMap::create_dof_constraints(), find_neighbors(), libMesh::MeshFunction::init(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::OverlapCoupling::mesh_reinit(), libMesh::DefaultCoupling::mesh_reinit(), libMesh::PointNeighborCoupling::mesh_reinit(), MeshPerElemTest< elem_type >::meshes_equal_enough(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), libMesh::MeshRefinement::test_level_one(), PointLocatorTest::testLocator(), MeshInputTest::testMasterCenters(), PointLocatorTest::testPlanar(), SystemsTest::testProjectCube(), SystemsTest::testProjectLine(), and SystemsTest::testProjectSquare().

1827 {
1828  // If there's no master point locator, then we need one.
1829  if (_point_locator.get() == nullptr)
1830  {
1831  // PointLocator construction may not be safe within threads
1833 
1834  // And it may require parallel communication
1835  parallel_object_only();
1836 
1837 #ifdef LIBMESH_ENABLE_NANOFLANN_POINTLOCATOR
1839 #else
1841 #endif
1842 
1844  _point_locator->set_close_to_point_tol(_point_locator_close_to_point_tol);
1845  }
1846 
1847  // Otherwise there was a master point locator, and we can grab a
1848  // sub-locator easily.
1849  return
1850 #ifdef LIBMESH_ENABLE_NANOFLANN_POINTLOCATOR
1852 #else
1854 #endif
1855 }
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!Threadsin_thre...
Definition: threads.C:33
libmesh_assert(ctx)
std::unique_ptr< PointLocatorBase > _point_locator
A PointLocator class for this mesh.
Definition: mesh_base.h:2192
Real _point_locator_close_to_point_tol
If nonzero, we will call PointLocatorBase::set_close_to_point_tol() on any PointLocators that we crea...
Definition: mesh_base.h:2415
static std::unique_ptr< PointLocatorBase > build(PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=nullptr)
Builds an PointLocator for the mesh mesh.

◆ subclass_locally_equals()

virtual bool libMesh::MeshBase::subclass_locally_equals ( const MeshBase other_mesh) const
protectedpure virtualinherited

Shim to allow operator == (&) to behave like a virtual function without having to be one.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::MeshBase::locally_equals().

◆ subdomain_ids()

void libMesh::MeshBase::subdomain_ids ( std::set< subdomain_id_type > &  ids,
const bool  global = true 
) const
inherited

Constructs a list of all subdomain identifiers in the local mesh if global == false, and in the global mesh if global == true (default).

Subdomains correspond to separate subsets of the mesh which could correspond e.g. to different materials in a solid mechanics application, or regions where different physical processes are important. The subdomain mapping is independent from the parallel decomposition.

Unpartitioned elements are included in the set in the case that global == true. If global == false, the unpartitioned elements are not included because unpartitioned elements do not have a sense of locality.

Definition at line 1119 of file mesh_base.C.

References libMesh::MeshBase::active_local_element_stored_range(), libMesh::ParallelObject::comm(), libMesh::Threads::parallel_reduce(), and TIMPI::Communicator::set_union().

Referenced by libMesh::MeshBase::copy_constraint_rows(), libMesh::ReplicatedMesh::get_disconnected_subdomains(), libMesh::MeshBase::n_local_subdomains(), libMesh::MeshBase::n_subdomains(), libMesh::TecplotIO::TecplotIO(), MeshSubdomainIDTest::testMultiple(), and MeshSubdomainIDTest::testUnpartitioned().

1120 {
1121  // This requires an inspection on every processor
1122  if (global)
1123  parallel_object_only();
1124 
1125  struct SBDInserter {
1126  std::set<subdomain_id_type> my_ids;
1127 
1128  SBDInserter () {}
1129  SBDInserter (SBDInserter &, Threads::split) {}
1130 
1131  void operator()(const ConstElemRange & range) {
1132  for (const Elem * elem : range)
1133  my_ids.insert(elem->subdomain_id());
1134  }
1135 
1136  void join(SBDInserter & other) {
1137  my_ids.merge(other.my_ids);
1138  }
1139  };
1140 
1141  SBDInserter inserter;
1143 
1144  ids.swap(inserter.my_ids);
1145 
1146  if (global)
1147  {
1148  // Only include the unpartitioned elements if the user requests the global IDs.
1149  // In the case of the local subdomain IDs, it doesn't make sense to include the
1150  // unpartitioned elements because said elements do not have a sense of locality.
1151  for (const auto & elem : this->active_unpartitioned_element_ptr_range())
1152  ids.insert(elem->subdomain_id());
1153 
1154  // Some subdomains may only live on other processors
1155  this->comm().set_union(ids);
1156  }
1157 }
const Parallel::Communicator & comm() const
const ConstElemRange & active_local_element_stored_range() const
Definition: mesh_base.C:1928
void parallel_reduce(const Range &range, Body &body, unsigned int n_threads=libMesh::n_threads())
Execute the provided reduction operation in parallel on the specified range.
Definition: threads_none.h:109
StoredRange< MeshBase::const_element_iterator, const Elem * > ConstElemRange
Definition: mesh_base.h:1865
tbb::split split
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
Definition: threads_tbb.h:136
void set_union(T &data, const unsigned int root_id) const

◆ subdomain_name() [1/2]

std::string & libMesh::MeshBase::subdomain_name ( subdomain_id_type  id)
inherited
Returns
A writable reference for getting/setting an optional name for a subdomain.

Definition at line 1880 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name.

Referenced by libMesh::AbaqusIO::assign_subdomain_ids(), DMlibMeshSetSystem_libMesh(), libMesh::UNVIO::groups_in(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::GmshIO::read_mesh(), stitching_helper(), MeshStitchTest::testAmbiguousRemappingStitch(), MeshInputTest::testGmshBCIDOverlap(), MeshStitchTest::testRemappingStitch(), libMesh::TecplotIO::write_binary(), and libMesh::ExodusII_IO_Helper::write_elements().

1881 {
1882  return _block_id_to_name[id];
1883 }
std::map< subdomain_id_type, std::string > _block_id_to_name
This structure maintains the mapping of named blocks for file formats that support named blocks...
Definition: mesh_base.h:2275

◆ subdomain_name() [2/2]

const std::string & libMesh::MeshBase::subdomain_name ( subdomain_id_type  id) const
inherited

Definition at line 1885 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name.

1886 {
1887  // An empty string to return when no matching subdomain name is found
1888  static const std::string empty;
1889 
1890  if (const auto iter = _block_id_to_name.find(id);
1891  iter == _block_id_to_name.end())
1892  return empty;
1893  else
1894  return iter->second;
1895 }
std::map< subdomain_id_type, std::string > _block_id_to_name
This structure maintains the mapping of named blocks for file formats that support named blocks...
Definition: mesh_base.h:2275

◆ supported_nodal_order()

Order libMesh::MeshBase::supported_nodal_order ( ) const
inlineinherited
Returns
The smallest supported_nodal_order() of any element present in the mesh, which is thus the maximum supported nodal order on the mesh as a whole.

Definition at line 435 of file mesh_base.h.

References libMesh::MeshBase::_supported_nodal_order.

Referenced by libMesh::MeshBase::get_info().

436  { return _supported_nodal_order; }
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:2295

◆ sync_subdomain_name_map()

void libMesh::MeshBase::sync_subdomain_name_map ( )
inherited

libMesh often expects all processors to know about names of all subdomain ids, but distributed mesh generators may only know about part of a mesh when creating names.

This method can synchronize the subdomain id to name map across processors, assuming no conflicts exist.

Definition at line 2040 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name, libMesh::ParallelObject::comm(), and TIMPI::Communicator::set_union().

2041 {
2042  // This requires every processor
2043  parallel_object_only();
2044 
2045  this->comm().set_union(_block_id_to_name);
2046 }
const Parallel::Communicator & comm() const
std::map< subdomain_id_type, std::string > _block_id_to_name
This structure maintains the mapping of named blocks for file formats that support named blocks...
Definition: mesh_base.h:2275
void set_union(T &data, const unsigned int root_id) const

◆ unset_has_boundary_id_sets()

void libMesh::MeshBase::unset_has_boundary_id_sets ( )
inlineinherited

Tells this we have done some operation which may have invalidated our cached boundary id sets.

User code which removes elements, or which adds or removes boundary entries, should call this method.

Definition at line 340 of file mesh_base.h.

References libMesh::MeshBase::_preparation, and libMesh::MeshBase::Preparation::has_boundary_id_sets.

Referenced by MeshBaseTest::testMeshBaseVerifyRemovalPreparation().

Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ unset_has_cached_elem_data()

void libMesh::MeshBase::unset_has_cached_elem_data ( )
inlineinherited

Tells this we have done some operation (e.g.

adding elements with a new dimension or subdomain value) which may invalidate cached summaries of element data.

User code which adds new elements to this mesh must call this function.

Definition at line 281 of file mesh_base.h.

References libMesh::MeshBase::_preparation, and libMesh::MeshBase::Preparation::has_cached_elem_data.

Referenced by libMesh::MeshTools::Modification::change_subdomain_id(), and MeshBaseTest::testMeshBaseVerifyHasCachedElemData().

Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ unset_has_interior_parent_ptrs()

void libMesh::MeshBase::unset_has_interior_parent_ptrs ( )
inlineinherited

Tells this we have done some operation (e.g.

refining elements with interior parents) which requires interior parent pointers to be found later.

Most user code will not need to call this method; any user code that manipulates interior parents or their boundary elements may be an exception.

Definition at line 293 of file mesh_base.h.

References libMesh::MeshBase::_preparation, and libMesh::MeshBase::Preparation::has_interior_parent_ptrs.

Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ unset_has_neighbor_ptrs()

void libMesh::MeshBase::unset_has_neighbor_ptrs ( )
inlineinherited

Tells this we have done some operation (e.g.

adding elements without setting their neighbor pointers, or adding disjoint neighbor boundary pairs) which requires neighbor pointers to be determined later.

User code which adds new elements to this mesh must call this function or manually set neighbor pointer from and to those elements.

Definition at line 270 of file mesh_base.h.

References libMesh::MeshBase::_preparation, and libMesh::MeshBase::Preparation::has_neighbor_ptrs.

Referenced by MeshBaseTest::testMeshBaseVerifyHasNeighborPtrs().

271  { _preparation.has_neighbor_ptrs = false; }
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ unset_has_reinit_ghosting_functors()

void libMesh::MeshBase::unset_has_reinit_ghosting_functors ( )
inlineinherited

Tells this we have done some operation (e.g.

adding or removing elements) which may require a reinit() of custom ghosting functors.

User code which adds or removes elements should call this method. User code which moves nodes ... should probably call this method, in case ghosting functors depending on position exist?

Definition at line 330 of file mesh_base.h.

References libMesh::MeshBase::_preparation, and libMesh::MeshBase::Preparation::has_reinit_ghosting_functors.

Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ unset_has_removed_orphaned_nodes()

void libMesh::MeshBase::unset_has_removed_orphaned_nodes ( )
inlineinherited

Tells this we have done some operation (e.g.

coarsening) which may have left orphaned nodes in need of removal.

Most user code should probably never need to use this; we can set it in MeshRefinement. User code which deletes elements without carefully deleting orphaned nodes should call this manually.

Definition at line 318 of file mesh_base.h.

References libMesh::MeshBase::_preparation, and libMesh::MeshBase::Preparation::has_removed_orphaned_nodes.

Referenced by MeshBaseTest::testMeshBaseVerifyRemovalPreparation().

Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ unset_has_removed_remote_elements()

void libMesh::MeshBase::unset_has_removed_remote_elements ( )
inlineinherited

Tells this we have done some operation (e.g.

repartitioning) which may have left elements as ghosted which on a distributed mesh should be remote.

User code should probably never need to use this; we can set it in Partitioner. Any user code which manually repartitions elements on distributed meshes may need to call this manually, in addition to manually communicating elements with newly-created ghosting requirements.

Definition at line 307 of file mesh_base.h.

References libMesh::MeshBase::_preparation, and libMesh::MeshBase::Preparation::has_removed_remote_elements.

Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ unset_has_synched_id_counts()

void libMesh::MeshBase::unset_has_synched_id_counts ( )
inlineinherited

Tells this we have done some operation (e.g.

adding objects to a distributed mesh on one processor only) which can lose synchronization of id counts.

User code which does distributed additions of nodes or elements must call either this method or update_parallel_id_counts().

Definition at line 257 of file mesh_base.h.

References libMesh::MeshBase::_preparation, and libMesh::MeshBase::Preparation::has_synched_id_counts.

Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ unset_is_partitioned()

void libMesh::MeshBase::unset_is_partitioned ( )
inlineinherited

Tells this we have done some operation creating unpartitioned elements.

User code which adds elements to this mesh must either partition them too or call this method.

Definition at line 246 of file mesh_base.h.

References libMesh::MeshBase::_preparation, and libMesh::MeshBase::Preparation::is_partitioned.

Referenced by MeshBaseTest::testMeshBaseVerifyRemovalPreparation().

247  { _preparation.is_partitioned = false; }
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ unset_is_prepared()

void libMesh::MeshBase::unset_is_prepared ( )
inherited

Tells this we have done some operation where we should no longer consider ourself prepared.

This is a very coarse setting; it is generally more efficient to mark finer-grained settings instead.

Definition at line 1063 of file mesh_base.C.

References libMesh::MeshBase::_preparation, libMesh::MeshBase::clear_point_locator(), and libMesh::MeshBase::clear_stored_ranges().

Referenced by copy_nodes_and_elements(), and MeshTetTest::testTrisToTets().

1064 {
1065  _preparation = false;
1066  this->clear_point_locator();
1067  this->clear_stored_ranges();
1068 }
void clear_stored_ranges()
Clears stored ranges, to indicate that the mesh has changed and they should be regenerated when next ...
Definition: mesh_base.C:1943
void clear_point_locator()
Releases the current PointLocator object.
Definition: mesh_base.C:1859
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162

◆ update_parallel_id_counts()

virtual void libMesh::MeshBase::update_parallel_id_counts ( )
pure virtualinherited

Updates parallel caches so that methods like n_elem() accurately reflect changes on other processors.

Implemented in libMesh::DistributedMesh, and libMesh::ReplicatedMesh.

Referenced by libMesh::MeshRefinement::_coarsen_elements(), libMesh::MeshRefinement::_refine_elements(), and libMesh::MeshBase::complete_preparation().

◆ update_post_partitioning()

void libMesh::MeshBase::update_post_partitioning ( )
virtualinherited

Recalculate any cached data (or invalidate any caches that are computed on the fly) after elements and nodes have been repartitioned.

Reimplemented in libMesh::DistributedMesh.

Definition at line 1173 of file mesh_base.C.

References libMesh::MeshBase::_const_active_local_element_stored_range.

Referenced by libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), and libMesh::DistributedMesh::update_post_partitioning().

1174 {
1175  // A range over all elements might still be fine here, but any range
1176  // over local elements is obsolete if our partitioner changed the
1177  // definition of "local".
1179 }
std::unique_ptr< ConstElemRange > _const_active_local_element_stored_range
A cached ConstElemRange for threaded calculation on all local elements of this mesh.
Definition: mesh_base.h:2183

◆ write() [1/2]

void libMesh::UnstructuredMesh::write ( const std::string &  name) const
overridevirtual

Write the file specified by name.

Attempts to figure out the proper method by the file extension.

Implements libMesh::MeshBase.

Definition at line 1401 of file unstructured_mesh.C.

References libMesh::Quality::name(), and libMesh::NameBasedIO::write().

Referenced by main().

1402 {
1403  LOG_SCOPE("write()", "Mesh");
1404 
1405  NameBasedIO(*this).write(name);
1406 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
This class supports simple reads and writes in any libMesh-supported format, by dispatching to one of...
Definition: namebased_io.h:44
virtual void write(const std::string &mesh_file) override
This method implements writing a mesh to a specified file.
Definition: namebased_io.C:306

◆ write() [2/2]

void libMesh::UnstructuredMesh::write ( const std::string &  name,
const std::vector< Number > &  values,
const std::vector< std::string > &  variable_names 
) const

Write to the file specified by name.

Attempts to figure out the proper method by the file extension. Also writes data.

Definition at line 1410 of file unstructured_mesh.C.

References libMesh::Quality::name(), and libMesh::NameBasedIO::write_nodal_data().

1413 {
1414  LOG_SCOPE("write()", "Mesh");
1415 
1416  NameBasedIO(*this).write_nodal_data(name, v, vn);
1417 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
This class supports simple reads and writes in any libMesh-supported format, by dispatching to one of...
Definition: namebased_io.h:44
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
This method implements writing a mesh with nodal data to a specified file where the nodal data and va...
Definition: namebased_io.C:471

Member Data Documentation

◆ _all_elemset_ids

MeshBase::elemset_type libMesh::MeshBase::_all_elemset_ids
protectedinherited

◆ _allow_node_and_elem_unique_id_overlap

bool libMesh::MeshBase::_allow_node_and_elem_unique_id_overlap
protectedinherited

The Exodus reader (and potentially other readers in the future?) now supports setting Node and Elem unique_ids based on values from within the Exodus file itself, rather than generating them automatically in LibMesh.

In this case, the unique_ids will not necessarily be unique across the set of all DofObjects, although they should still be unique within the individual sets of Elems and Nodes. The reader can therefore set this Mesh flag (which defaults to false) to indicate we should be less strict when checking the "uniqueness" of unique_ids.

Definition at line 2268 of file mesh_base.h.

Referenced by libMesh::MeshBase::allow_node_and_elem_unique_id_overlap(), libMesh::MeshBase::locally_equals(), and libMesh::MeshBase::operator=().

◆ _allow_remote_element_removal

bool libMesh::MeshBase::_allow_remote_element_removal
protectedinherited

If this is false then even on DistributedMesh remote elements will not be deleted during mesh preparation.

This is true by default.

Definition at line 2255 of file mesh_base.h.

Referenced by libMesh::MeshBase::allow_remote_element_removal(), libMesh::MeshBase::complete_preparation(), libMesh::MeshBase::locally_equals(), libMesh::MeshBase::operator=(), and libMesh::MeshBase::prepare_for_use().

◆ _block_id_to_name

std::map<subdomain_id_type, std::string> libMesh::MeshBase::_block_id_to_name
protectedinherited

This structure maintains the mapping of named blocks for file formats that support named blocks.

Currently this is only implemented for ExodusII

Definition at line 2275 of file mesh_base.h.

Referenced by libMesh::MeshBase::get_id_by_name(), libMesh::MeshBase::get_subdomain_name_map(), libMesh::MeshBase::locally_equals(), libMesh::MeshBase::operator=(), libMesh::MeshBase::set_subdomain_name_map(), libMesh::MeshBase::subdomain_name(), and libMesh::MeshBase::sync_subdomain_name_map().

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _const_active_local_element_stored_range

std::unique_ptr<ConstElemRange> libMesh::MeshBase::_const_active_local_element_stored_range
mutableprotectedinherited

A cached ConstElemRange for threaded calculation on all local elements of this mesh.

This will not actually be built unless needed. Further, since we want our elem_stored_range() method to be const (yet do the dynamic allocating) this needs to be mutable.

Definition at line 2183 of file mesh_base.h.

Referenced by libMesh::MeshBase::active_local_element_stored_range(), libMesh::MeshBase::clear_stored_ranges(), libMesh::MeshBase::operator=(), and libMesh::MeshBase::update_post_partitioning().

◆ _constraint_rows

constraint_rows_type libMesh::MeshBase::_constraint_rows
protectedinherited

◆ _count_lower_dim_elems_in_point_locator

bool libMesh::MeshBase::_count_lower_dim_elems_in_point_locator
protectedinherited

Do we count lower dimensional elements in point locator refinement? This is relevant in tree-based point locators, for example.

Definition at line 2198 of file mesh_base.h.

Referenced by libMesh::MeshBase::get_count_lower_dim_elems_in_point_locator(), libMesh::MeshBase::locally_equals(), libMesh::MeshBase::operator=(), and libMesh::MeshBase::set_count_lower_dim_elems_in_point_locator().

◆ _default_ghosting

std::unique_ptr<GhostingFunctor> libMesh::MeshBase::_default_ghosting
protectedinherited

The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior.

We use a base class pointer here to avoid dragging in more header dependencies.

Definition at line 2382 of file mesh_base.h.

Referenced by libMesh::MeshBase::default_ghosting(), libMesh::MeshBase::locally_equals(), libMesh::MeshBase::MeshBase(), and libMesh::MeshBase::post_dofobject_moves().

◆ _default_mapping_data

unsigned char libMesh::MeshBase::_default_mapping_data
protectedinherited

The default mapping data (unused with Lagrange, used for nodal weight lookup index with rational bases) to assign to newly added elements.

Definition at line 2157 of file mesh_base.h.

Referenced by libMesh::MeshBase::default_mapping_data(), libMesh::MeshBase::locally_equals(), libMesh::MeshBase::operator=(), and libMesh::MeshBase::set_default_mapping_data().

◆ _default_mapping_type

ElemMappingType libMesh::MeshBase::_default_mapping_type
protectedinherited

The default mapping type (typically Lagrange) between master and physical space to assign to newly added elements.

Definition at line 2150 of file mesh_base.h.

Referenced by libMesh::MeshBase::default_mapping_type(), libMesh::MeshBase::locally_equals(), libMesh::MeshBase::operator=(), and libMesh::MeshBase::set_default_mapping_type().

◆ _disjoint_neighbor_boundary_pairs

std::unique_ptr<PeriodicBoundaries> libMesh::MeshBase::_disjoint_neighbor_boundary_pairs
protectedinherited

◆ _elem_default_orders

std::set<Order> libMesh::MeshBase::_elem_default_orders
protectedinherited

We cache the (default) order of the geometric elements present in the mesh.

E.g. if we have a mesh with TRI3 and TRI6 elements, this structure will contain FIRST and SECOND.

Definition at line 2289 of file mesh_base.h.

Referenced by libMesh::MeshBase::cache_elem_data(), libMesh::MeshBase::clear(), libMesh::MeshBase::copy_cached_data(), libMesh::MeshBase::copy_constraint_rows(), libMesh::MeshBase::elem_default_orders(), libMesh::MeshBase::get_info(), libMesh::MeshBase::locally_equals(), and libMesh::MeshBase::operator=().

◆ _elem_dims

std::set<unsigned char> libMesh::MeshBase::_elem_dims
protectedinherited

◆ _elem_integer_default_values

std::vector<dof_id_type> libMesh::MeshBase::_elem_integer_default_values
protectedinherited

◆ _elem_integer_names

std::vector<std::string> libMesh::MeshBase::_elem_integer_names
protectedinherited

◆ _element_stored_range

std::unique_ptr<ElemRange> libMesh::MeshBase::_element_stored_range
mutableprotectedinherited

A cached ElemRange for threaded mutation of all semilocal elements of this mesh.

This will not actually be built unless needed. Further, since we want our elem_stored_range() method to be const (yet do the dynamic allocating) this needs to be mutable.

Definition at line 2172 of file mesh_base.h.

Referenced by libMesh::MeshBase::clear_stored_ranges(), libMesh::MeshBase::element_stored_range(), and libMesh::MeshBase::operator=().

◆ _elemset_codes

std::map<dof_id_type, const MeshBase::elemset_type *> libMesh::MeshBase::_elemset_codes
protectedinherited

Map from "element set code" to list of set ids to which that element belongs (and vice-versa).

Remarks: 1.) The elemset code is a dof_id_type because (if used) it is stored as an extra_integer (named "elemset_code") on all elements, and extra_integers are of type dof_id_type. Elements which do not belong to any set should be assigned an elemset code of DofObject::invalid_id. 2.) Element sets can be thought of as a generalization of the concept of a subdomain. Subdomains have the following restrictions: a.) A given element can only belong to a single subdomain b.) When using Exodus file input/output, subdomains are (unfortunately) tied to the concept of exodus element blocks, which consist of a single geometric element type, somewhat limiting their generality. 3.) The user is responsible for filling in the values of this map in a consistent manner, unless the elemsets are read in from an Exodus file, in which case the elemset codes will be set up automatically. The codes can basically be chosen arbitrarily, with the one requirement that elements which belong to no sets should have a set code of DofObject::invalid_id. 4.) We also keep a list of all the elemset ids which have been added in order to support O(1) performance behavior in n_elemsets() calls.

Definition at line 2324 of file mesh_base.h.

Referenced by libMesh::MeshBase::add_elemset_code(), libMesh::MeshBase::change_elemset_code(), libMesh::MeshBase::change_elemset_id(), libMesh::MeshBase::clear(), libMesh::MeshBase::get_elemset_codes(), libMesh::MeshBase::get_elemsets(), libMesh::MeshBase::get_info(), libMesh::MeshBase::locally_equals(), libMesh::MeshBase::MeshBase(), and libMesh::MeshBase::operator=().

◆ _elemset_codes_inverse_map

std::map<MeshBase::elemset_type, dof_id_type> libMesh::MeshBase::_elemset_codes_inverse_map
protectedinherited

◆ _ghosting_functors

std::vector<GhostingFunctor *> libMesh::MeshBase::_ghosting_functors
protectedinherited

◆ _interior_mesh

MeshBase* libMesh::MeshBase::_interior_mesh
protectedinherited

Defaulting to this, a pointer to the mesh used to generate boundary elements on this.

Definition at line 2219 of file mesh_base.h.

Referenced by copy_nodes_and_elements(), libMesh::MeshBase::interior_mesh(), libMesh::MeshBase::locally_equals(), libMesh::MeshBase::operator=(), and libMesh::MeshBase::set_interior_mesh().

◆ _mesh_subdomains

std::set<subdomain_id_type> libMesh::MeshBase::_mesh_subdomains
protectedinherited

◆ _n_parts

unsigned int libMesh::MeshBase::_n_parts
protectedinherited

The number of partitions the mesh has.

This is set by the partitioners, and may not be changed directly by the user.

Note
The number of partitions need not equal this->n_processors(), consider for example the case where you simply want to partition a mesh on one processor and view the result in GMV.

Definition at line 2144 of file mesh_base.h.

Referenced by libMesh::MeshBase::clear(), libMesh::MeshBase::locally_equals(), libMesh::MeshBase::n_partitions(), libMesh::MeshBase::operator=(), libMesh::MeshBase::recalculate_n_partitions(), and libMesh::MeshBase::set_n_partitions().

◆ _next_unique_id

unique_id_type libMesh::MeshBase::_next_unique_id
protectedinherited

◆ _node_integer_default_values

std::vector<dof_id_type> libMesh::MeshBase::_node_integer_default_values
protectedinherited

◆ _node_integer_names

std::vector<std::string> libMesh::MeshBase::_node_integer_names
protectedinherited

◆ _partitioner

std::unique_ptr<Partitioner> libMesh::MeshBase::_partitioner
protectedinherited

◆ _point_locator

std::unique_ptr<PointLocatorBase> libMesh::MeshBase::_point_locator
mutableprotectedinherited

A PointLocator class for this mesh.

This will not actually be built unless needed. Further, since we want our point_locator() method to be const (yet do the dynamic allocating) this needs to be mutable. Since the PointLocatorBase::build() member is used, and it operates on a constant reference to the mesh, this is OK.

Definition at line 2192 of file mesh_base.h.

Referenced by libMesh::MeshBase::clear_point_locator(), libMesh::MeshBase::operator=(), libMesh::MeshBase::set_point_locator_close_to_point_tol(), and libMesh::MeshBase::sub_point_locator().

◆ _point_locator_close_to_point_tol

Real libMesh::MeshBase::_point_locator_close_to_point_tol
protectedinherited

◆ _preparation

Preparation libMesh::MeshBase::_preparation
protectedinherited

Flags indicating in what ways this mesh has been prepared.

Definition at line 2162 of file mesh_base.h.

Referenced by libMesh::MeshBase::cache_elem_data(), libMesh::MeshBase::clear(), libMesh::MeshBase::complete_preparation(), libMesh::DistributedMesh::delete_remote_elements(), libMesh::MeshBase::delete_remote_elements(), libMesh::MeshBase::detect_interior_parents(), libMesh::DistributedMesh::DistributedMesh(), find_neighbors(), libMesh::MeshBase::is_prepared(), libMesh::MeshBase::locally_equals(), libMesh::MeshBase::operator=(), libMesh::MeshBase::partition(), libMesh::MeshBase::preparation(), libMesh::MeshBase::prepare_for_use(), libMesh::MeshBase::reinit_ghosting_functors(), libMesh::MeshBase::remove_orphaned_nodes(), libMesh::ReplicatedMesh::renumber_nodes_and_elements(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::ReplicatedMesh::ReplicatedMesh(), libMesh::MeshBase::set_isnt_prepared(), libMesh::BoundaryInfo::synchronize_global_id_set(), libMesh::MeshBase::unset_has_boundary_id_sets(), libMesh::MeshBase::unset_has_cached_elem_data(), libMesh::MeshBase::unset_has_interior_parent_ptrs(), libMesh::MeshBase::unset_has_neighbor_ptrs(), libMesh::MeshBase::unset_has_reinit_ghosting_functors(), libMesh::MeshBase::unset_has_removed_orphaned_nodes(), libMesh::MeshBase::unset_has_removed_remote_elements(), libMesh::MeshBase::unset_has_synched_id_counts(), libMesh::MeshBase::unset_is_partitioned(), libMesh::MeshBase::unset_is_prepared(), libMesh::ReplicatedMesh::update_parallel_id_counts(), and libMesh::DistributedMesh::update_parallel_id_counts().

◆ _shared_functors

std::map<GhostingFunctor *, std::shared_ptr<GhostingFunctor> > libMesh::MeshBase::_shared_functors
protectedinherited

Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form.

Definition at line 2397 of file mesh_base.h.

Referenced by libMesh::MeshBase::add_ghosting_functor(), libMesh::MeshBase::post_dofobject_moves(), and libMesh::MeshBase::remove_ghosting_functor().

◆ _skip_all_partitioning

bool libMesh::MeshBase::_skip_all_partitioning
protectedinherited

◆ _skip_detect_interior_parents

bool libMesh::MeshBase::_skip_detect_interior_parents
protectedinherited

If this is true then we will skip detect_interior_parents in prepare_for_use.

Definition at line 2247 of file mesh_base.h.

Referenced by libMesh::MeshBase::allow_detect_interior_parents(), libMesh::MeshBase::complete_preparation(), libMesh::MeshBase::locally_equals(), and libMesh::MeshBase::operator=().

◆ _skip_find_neighbors

bool libMesh::MeshBase::_skip_find_neighbors
protectedinherited

◆ _skip_noncritical_partitioning

bool libMesh::MeshBase::_skip_noncritical_partitioning
protectedinherited

If this is true then no partitioning should be done with the possible exception of orphaned nodes.

Definition at line 2225 of file mesh_base.h.

Referenced by libMesh::MeshBase::locally_equals(), libMesh::MeshBase::operator=(), and libMesh::MeshBase::skip_noncritical_partitioning().

◆ _skip_renumber_nodes_and_elements

bool libMesh::MeshBase::_skip_renumber_nodes_and_elements
protectedinherited

◆ _spatial_dimension

unsigned char libMesh::MeshBase::_spatial_dimension
protectedinherited

◆ _supported_nodal_order

Order libMesh::MeshBase::_supported_nodal_order
protectedinherited

◆ boundary_info

std::unique_ptr<BoundaryInfo> libMesh::MeshBase::boundary_info
protectedinherited

This class holds the boundary information.

It can store nodes, edges, and faces with a corresponding id that facilitates setting boundary conditions.

Direct access to this class is now officially deprecated and will be removed in future libMesh versions. Use the get_boundary_info() accessor instead.

Definition at line 2098 of file mesh_base.h.

Referenced by libMesh::MeshBase::clear(), libMesh::MeshBase::get_boundary_info(), libMesh::MeshBase::locally_equals(), and libMesh::MeshBase::operator=().

◆ ElemRange

const DofMap& dof_map LIBMESH_COMMA unsigned int Elem* libMesh::MeshBase::ElemRange
inherited

Definition at line 1816 of file mesh_base.h.

◆ var_num

const DofMap& dof_map LIBMESH_COMMA unsigned int libMesh::MeshBase::var_num
inherited

Definition at line 1816 of file mesh_base.h.


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