libMesh
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
libMesh::MeshBase Class Referenceabstract

This is the MeshBase class. More...

#include <mesh_base.h>

Inheritance diagram for libMesh::MeshBase:
[legend]

Classes

struct  const_element_iterator
 The definition of the const_element_iterator struct. More...
 
struct  const_node_iterator
 The definition of the const_node_iterator struct. More...
 
struct  element_iterator
 The definition of the element_iterator struct. More...
 
struct  node_iterator
 The definition of the node_iterator struct. More...
 
struct  Preparation
 Flags indicating in what ways a mesh has been prepared for use. More...
 

Public Types

typedef std::set< elemset_id_typeelemset_type
 Typedef for the "set" container used to store elemset ids.
 
typedef std::vector< GhostingFunctor * >::const_iterator GhostingFunctorIterator
 Iterator type for ghosting functor ranges.
 
typedef Predicates::multi_predicate Predicate
 We need an empty, generic class to act as a predicate for this and derived mesh classes.
 
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

 MeshBase (const Parallel::Communicator &comm_in, unsigned char dim=1)
 Constructor.
 
 MeshBase (const MeshBase &other_mesh)
 Copy-constructor.
 
 MeshBase (MeshBase &&)=delete
 Move-constructor - deleted because after a theoretical move-construction and then destruction of the moved-from object, the moved BoundaryInfo would hold an invalid reference to the moved-from mesh.
 
MeshBaseoperator= (const MeshBase &)=delete
 Copy and move assignment are not allowed because MeshBase subclasses manually manage memory (Elems and Nodes) and therefore the default versions of these operators would leak memory.
 
MeshBaseoperator= (MeshBase &&other_mesh)
 
virtual MeshBaseassign (MeshBase &&other_mesh)=0
 Shim to allow operator = (&&) to behave like a virtual function without having to be one.
 
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).
 
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.
 
virtual std::unique_ptr< MeshBaseclone () const =0
 Virtual "copy constructor".
 
virtual ~MeshBase ()
 Destructor.
 
virtual std::unique_ptr< Partitioner > & partitioner ()
 A partitioner to use at each partitioning.
 
const BoundaryInfoget_boundary_info () const
 The information about boundary ids on the mesh.
 
BoundaryInfoget_boundary_info ()
 Writable information about boundary ids on the mesh.
 
virtual void clear ()
 Deletes all the element and node data that is currently stored.
 
virtual void clear_elems ()=0
 Deletes all the element data that is currently stored.
 
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.
 
void unset_is_prepared ()
 Tells this we have done some operation where we should no longer consider ourself prepared.
 
void unset_is_partitioned ()
 Tells this we have done some operation creating unpartitioned elements.
 
void unset_has_synched_id_counts ()
 Tells this we have done some operation (e.g.
 
void unset_has_neighbor_ptrs ()
 Tells this we have done some operation (e.g.
 
void unset_has_cached_elem_data ()
 Tells this we have done some operation (e.g.
 
void unset_has_interior_parent_ptrs ()
 Tells this we have done some operation (e.g.
 
void unset_has_removed_remote_elements ()
 Tells this we have done some operation (e.g.
 
void unset_has_removed_orphaned_nodes ()
 Tells this we have done some operation (e.g.
 
void unset_has_reinit_ghosting_functors ()
 Tells this we have done some operation (e.g.
 
void unset_has_boundary_id_sets ()
 Tells this we have done some operation which may have invalidated our cached boundary id sets.
 
void unset_has_synched_subdomain_name_map ()
 Tells this we have done some operation which may have left the subdomain id to name map inconsistent across processors.
 
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.
 
virtual bool is_replicated () const
 
virtual void allgather ()
 Gathers all elements and nodes of the mesh onto every processor.
 
virtual void gather_to_zero ()
 Gathers all elements and nodes of the mesh onto processor zero.
 
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.
 
void reinit_ghosting_functors ()
 Loops over ghosting functors and calls mesh_reinit()
 
unsigned int mesh_dimension () const
 
void set_mesh_dimension (unsigned char d)
 Resets the logical dimension of the mesh.
 
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.
 
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.
 
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.
 
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.
 
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.
 
void change_elemset_code (dof_id_type old_code, dof_id_type new_code)
 Replace elemset code "old_code" with "new_code".
 
void change_elemset_id (elemset_id_type old_id, elemset_id_type new_id)
 Replace elemset id "old_id" with "new_id".
 
unsigned int spatial_dimension () const
 
void set_spatial_dimension (unsigned char d)
 Sets the "spatial dimension" of the Mesh.
 
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.
 
virtual void reserve_nodes (const dof_id_type nn)=0
 Reserves space for a known number of nodes.
 
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.
 
virtual void update_parallel_id_counts ()=0
 Updates parallel caches so that methods like n_elem() accurately reflect changes on other processors.
 
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.
 
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.
 
virtual Nodeadd_node (Node *n)=0
 Add Node n to the end of the vertex array.
 
virtual Nodeadd_node (std::unique_ptr< Node > n)=0
 Version of add_node() taking a std::unique_ptr by value.
 
virtual void delete_node (Node *n)=0
 Removes the Node n from the mesh.
 
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.
 
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.
 
virtual Elemadd_elem (Elem *e)=0
 Add elem e to the end of the element array.
 
virtual Elemadd_elem (std::unique_ptr< Elem > e)=0
 Version of add_elem() taking a std::unique_ptr by value.
 
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.
 
virtual Eleminsert_elem (std::unique_ptr< Elem > e)=0
 Version of insert_elem() taking a std::unique_ptr by value.
 
virtual void delete_elem (Elem *e)=0
 Removes element e from the mesh.
 
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.
 
ElemMappingType default_mapping_type () const
 Returns the default master space to physical space mapping basis functions to be used on newly added elements.
 
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.
 
unsigned char default_mapping_data () const
 Returns any default data value used by the master space to physical space mapping.
 
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.
 
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 remove_orphaned_nodes ()
 Removes any orphaned nodes, nodes not connected to any elements.
 
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.
 
virtual void fix_broken_node_and_element_numbering ()=0
 There is no reason for a user to ever call this function.
 
virtual bool contract ()=0
 Delete subactive (i.e.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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()).
 
void partition ()
 
virtual void redistribute ()
 Redistribute elements between processors.
 
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.
 
void allow_renumbering (bool allow)
 If false is passed in then this mesh will no longer be renumbered when being prepared for use.
 
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.
 
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.
 
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.
 
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.
 
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.
 
bool skip_noncritical_partitioning () const
 
void skip_partitioning (bool skip)
 If true is passed in then nothing on this mesh will be (re)partitioned.
 
bool skip_partitioning () const
 
void add_ghosting_functor (GhostingFunctor &ghosting_functor)
 Adds a functor which can specify ghosting requirements for use on distributed meshes.
 
void add_ghosting_functor (std::shared_ptr< GhostingFunctor > ghosting_functor)
 Adds a functor which can specify ghosting requirements for use on distributed meshes.
 
void remove_ghosting_functor (GhostingFunctor &ghosting_functor)
 Removes a functor which was previously added to the set of ghosting functors.
 
GhostingFunctorIterator ghosting_functors_begin () const
 Beginning of range of ghosting functors.
 
GhostingFunctorIterator ghosting_functors_end () const
 End of range of ghosting functors.
 
GhostingFunctordefault_ghosting ()
 Default ghosting functor.
 
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).
 
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.
 
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)=0
 Interfaces for reading/writing a mesh to/from a file.
 
virtual void write (const std::string &name) const =0
 
virtual void all_first_order ()=0
 Converts a mesh with higher-order elements into a mesh with linear elements.
 
virtual void all_second_order_range (const SimpleRange< element_iterator > &range, const bool full_ordered=true)=0
 Converts a set of this Mesh's elements defined by range from FIRST order to SECOND order.
 
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.
 
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, i.e.
 
virtual void all_complete_order ()
 Calls the range-based version of this function with a range consisting of all elements in the mesh.
 
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.
 
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().
 
Real get_point_locator_close_to_point_tol () const
 
void clear_point_locator ()
 Releases the current PointLocator object.
 
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.
 
bool get_count_lower_dim_elems_in_point_locator () const
 Get the current value of _count_lower_dim_elems_in_point_locator.
 
virtual void libmesh_assert_valid_parallel_ids () const
 Verify id and processor_id consistency of our elements and nodes containers.
 
std::string & subdomain_name (subdomain_id_type id)
 
const std::string & subdomain_name (subdomain_id_type id) const
 
void set_subdomain_name (subdomain_id_type id, const std::string &name, bool synchronous=false)
 Sets the name for the provided id.
 
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_
 
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
 
 ABSTRACT_ELEM_ITERATORS (semilocal_,) ABSTRACT_ELEM_ITERATORS(ghost_
 
 ABSTRACT_ELEM_ITERATORS (active_semilocal_,) ABSTRACT_ELEM_ITERATORS(evaluable_
 
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.
 
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.
 
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.
 
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.
 
void print_constraint_rows (std::ostream &os=libMesh::out, bool print_nonlocal=false) const
 Prints (from processor 0) all mesh constraint rows.
 
std::string get_local_constraints (bool print_nonlocal=false) const
 Gets a string reporting all mesh constraint rows local to this processor.
 
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.
 
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.
 
const MeshBaseinterior_mesh () const
 
MeshBaseinterior_mesh ()
 
void set_interior_mesh (MeshBase &int_mesh)
 Sets the interior mesh.
 
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.
 
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.
 
typedef variant_filter_iterator< MeshBase::Predicate, Elem *const, Elem *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_filter_iter
 
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, const Elem *const, const Elem *const &, const Elem *const * > const_elem_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, 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.
 
void copy_cached_data (const MeshBase &other_mesh)
 Helper class to copy cached data, to synchronize with a possibly unprepared other_mesh.
 
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 nodes_and_elements_equal (const MeshBase &other_mesh) const
 Tests for equality of all elements and nodes in the mesh.
 
unsigned intset_n_partitions ()
 
void size_elem_extra_integers ()
 Size extra-integer arrays of all elements in the mesh.
 
void size_node_extra_integers ()
 Size extra-integer arrays of all nodes in the mesh.
 
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.
 

Protected Attributes

std::unique_ptr< PeriodicBoundaries_disjoint_neighbor_boundary_pairs
 The disjoint neighbor boundary id pairs.
 
std::unique_ptr< BoundaryInfoboundary_info
 This class holds the boundary information.
 
unsigned int _n_parts
 The number of partitions the mesh has.
 
ElemMappingType _default_mapping_type
 The default mapping type (typically Lagrange) between master and physical space to assign to newly added elements.
 
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.
 
Preparation _preparation
 Flags indicating in what ways this mesh has been prepared.
 
std::unique_ptr< ElemRange_element_stored_range
 A cached ElemRange for threaded mutation of all semilocal elements of this mesh.
 
std::unique_ptr< ConstElemRange_const_active_local_element_stored_range
 A cached ConstElemRange for threaded calculation on all local elements of this mesh.
 
std::unique_ptr< PointLocatorBase_point_locator
 A PointLocator class for this mesh.
 
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.
 
std::unique_ptr< Partitioner_partitioner
 A partitioner to use at each prepare_for_use().
 
unique_id_type _next_unique_id
 The next available unique id for assigning ids to DOF objects.
 
MeshBase_interior_mesh
 Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
 
bool _skip_noncritical_partitioning
 If this is true then no partitioning should be done with the possible exception of orphaned nodes.
 
bool _skip_all_partitioning
 If this is true then no partitioning should be done.
 
bool _skip_renumber_nodes_and_elements
 If this is true then renumbering will be kept to a minimum.
 
bool _skip_find_neighbors
 If this is true then we will skip find_neighbors in prepare_for_use.
 
bool _skip_detect_interior_parents
 If this is true then we will skip detect_interior_parents in prepare_for_use.
 
bool _allow_remote_element_removal
 If this is false then even on DistributedMesh remote elements will not be deleted during mesh preparation.
 
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.
 
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.
 
std::set< unsigned char > _elem_dims
 We cache the dimension of the elements present in the mesh.
 
std::set< Order_elem_default_orders
 We cache the (default) order of the geometric elements present in the mesh.
 
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)
 
std::set< subdomain_id_type_mesh_subdomains
 We cache the subdomain ids of the elements present in the mesh.
 
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).
 
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.
 
std::vector< std::string > _elem_integer_names
 The array of names for integer data associated with each element in the mesh.
 
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.
 
std::vector< std::string > _node_integer_names
 The array of names for integer data associated with each node in the mesh.
 
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.
 
std::unique_ptr< GhostingFunctor_default_ghosting
 The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior.
 
std::vector< GhostingFunctor * > _ghosting_functors
 The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
 
std::map< GhostingFunctor *, std::shared_ptr< GhostingFunctor > > _shared_functors
 Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form.
 
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.
 
const Parallel::Communicator_communicator
 

Friends

class Partitioner
 The partitioner class is a friend so that it can set the number of partitions.
 
class MeshInput< MeshBase >
 The MeshInput classes are friends so that they can set the number of partitions.
 
class BoundaryInfo
 Make the BoundaryInfo class a friend so that it can create and interact with BoundaryMesh.
 
class MeshCommunication
 Make the MeshCommunication class a friend so that it can directly broadcast *_integer_names.
 
std::ostream & operator<< (std::ostream &os, const MeshBase &m)
 Equivalent to calling print_info() above, but now you can write: Mesh mesh; libMesh::out << mesh << std::endl;.
 

Detailed Description

This is the MeshBase class.

This class provides all the data necessary to describe a geometric entity. It allows for the description of a dim dimensional object that lives in LIBMESH_DIM-dimensional space.

A mesh is made of nodes and elements, and this class provides data structures to store and access both. A mesh may be partitioned into a number of subdomains, and this class provides that functionality. Furthermore, this class provides functions for reading and writing a mesh to disk in various formats.
Author
Benjamin S. Kirk
Date
2002

Base class for Mesh.

Definition at line 80 of file mesh_base.h.

Member Typedef Documentation

◆ const_elem_filter_iter [1/2]

Definition at line 2485 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
protected

Definition at line 2505 of file mesh_base.h.

◆ const_node_filter_iter [1/2]

Definition at line 2492 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
protected

Definition at line 2518 of file mesh_base.h.

◆ ConstElemRange

Definition at line 1895 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

Definition at line 1929 of file mesh_base.h.

◆ constraint_rows_type

Definition at line 1930 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 2480 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
protected

Definition at line 2500 of file mesh_base.h.

◆ elemset_type

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 466 of file mesh_base.h.

◆ GhostingFunctorIterator

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

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 1467 of file mesh_base.h.

◆ node_filter_iter [1/2]

Definition at line 2487 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
protected

Definition at line 2513 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 1585 of file mesh_base.h.

Constructor & Destructor Documentation

◆ MeshBase() [1/3]

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

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 64 of file mesh_base.C.

65 :
66 ParallelObject (comm_in),
67 boundary_info (new BoundaryInfo(*this)), // BoundaryInfo has protected ctor, can't use std::make_unique
68 _n_parts (1),
71 _preparation (),
76 _partitioner (),
77#ifdef LIBMESH_ENABLE_UNIQUE_ID
79#endif
80 _interior_mesh(this),
89 _default_ghosting(std::make_unique<GhostPointNeighbors>(*this)),
91{
92 _elem_dims.insert(d);
94 libmesh_assert_less_equal (LIBMESH_DIM, 3);
95 libmesh_assert_greater_equal (LIBMESH_DIM, d);
97}
static constexpr unique_id_type invalid_unique_id
An invalid unique_id to distinguish an uninitialized DofObject.
Definition dof_object.h:478
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:2301
bool _skip_detect_interior_parents
If this is true then we will skip detect_interior_parents in prepare_for_use.
Definition mesh_base.h:2280
friend class BoundaryInfo
Make the BoundaryInfo class a friend so that it can create and interact with BoundaryMesh.
Definition mesh_base.h:2466
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition mesh_base.h:2365
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:2231
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:2288
unique_id_type _next_unique_id
The next available unique id for assigning ids to DOF objects.
Definition mesh_base.h:2245
bool _skip_renumber_nodes_and_elements
If this is true then renumbering will be kept to a minimum.
Definition mesh_base.h:2270
std::unique_ptr< PointLocatorBase > _point_locator
A PointLocator class for this mesh.
Definition mesh_base.h:2225
bool _skip_all_partitioning
If this is true then no partitioning should be done.
Definition mesh_base.h:2263
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:2258
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
Definition mesh_base.h:2275
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
Definition mesh_base.h:2183
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
Definition mesh_base.h:2131
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
Definition mesh_base.h:2252
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition mesh_base.h:2424
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:2216
std::unique_ptr< Partitioner > _partitioner
A partitioner to use at each prepare_for_use().
Definition mesh_base.h:2239
std::unique_ptr< GhostingFunctor > _default_ghosting
The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior.
Definition mesh_base.h:2415
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:2190
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:2448
unsigned int _n_parts
The number of partitions the mesh has.
Definition mesh_base.h:2177
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition mesh_base.h:2315
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition mesh_base.h:2195
std::unique_ptr< ElemRange > _element_stored_range
A cached ElemRange for threaded mutation of all semilocal elements of this mesh.
Definition mesh_base.h:2205
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
libmesh_assert(ctx)
bool initialized()
Checks that library initialization has been done.
Definition libmesh.C:324
bool on_command_line(std::string arg)
Definition libmesh.C:934

References _default_ghosting, _elem_dims, _ghosting_functors, libMesh::initialized(), and libMesh::libmesh_assert().

◆ MeshBase() [2/3]

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

Copy-constructor.

Definition at line 101 of file mesh_base.C.

101 :
102 ParallelObject (other_mesh),
103 boundary_info (new BoundaryInfo(*this)), // BoundaryInfo has protected ctor, can't use std::make_unique
104 _n_parts (other_mesh._n_parts),
105 _default_mapping_type(other_mesh._default_mapping_type),
106 _default_mapping_data(other_mesh._default_mapping_data),
107 _preparation (other_mesh._preparation),
111 _count_lower_dim_elems_in_point_locator(other_mesh._count_lower_dim_elems_in_point_locator),
112 _partitioner (),
113#ifdef LIBMESH_ENABLE_UNIQUE_ID
114 _next_unique_id(other_mesh._next_unique_id),
115#endif
116 // If the other mesh interior_parent pointers just go back to
117 // itself, so should we
118 _interior_mesh((other_mesh._interior_mesh == &other_mesh) ?
119 this : other_mesh._interior_mesh),
127 _elem_dims(other_mesh._elem_dims),
134 _default_ghosting(std::make_unique<GhostPointNeighbors>(*this)),
136{
137 const GhostingFunctor * const other_default_ghosting = other_mesh._default_ghosting.get();
138
139 for (GhostingFunctor * const gf : other_mesh._ghosting_functors)
140 {
141 // If the other mesh is using default ghosting, then we will use our own
142 // default ghosting
143 if (gf == other_default_ghosting)
144 {
145 _ghosting_functors.push_back(_default_ghosting.get());
146 continue;
147 }
148
149 std::shared_ptr<GhostingFunctor> clone_gf = gf->clone();
150 // Some subclasses of GhostingFunctor might not override the
151 // clone function yet. If this is the case, GhostingFunctor will
152 // return nullptr by default. The clone function should be overridden
153 // in all derived classes. This following code ("else") is written
154 // for API upgrade. That will allow users gradually to update their code.
155 // Once the API upgrade is done, we will come back and delete "else."
156 if (clone_gf)
157 {
158 clone_gf->set_mesh(this);
159 add_ghosting_functor(clone_gf);
160 }
161 else
162 {
163 libmesh_deprecated();
165 }
166 }
167
168 if (other_mesh._partitioner.get())
169 _partitioner = other_mesh._partitioner->clone();
170
171#ifdef LIBMESH_ENABLE_PERIODIC
172 // Deep copy of all periodic boundaries
173 if (other_mesh._disjoint_neighbor_boundary_pairs)
174 {
175 _disjoint_neighbor_boundary_pairs = std::make_unique<PeriodicBoundaries>();
176
177 for (const auto & [id, pb] : *other_mesh._disjoint_neighbor_boundary_pairs)
178 if (pb)
180 }
181#endif
182
183 // _elemset_codes stores pointers to entries in _elemset_codes_inverse_map,
184 // so it is not possible to simply copy it directly from other_mesh
185 for (const auto & [set, code] : _elemset_codes_inverse_map)
186 _elemset_codes.emplace(code, &set);
187}
MeshBase::elemset_type _all_elemset_ids
Definition mesh_base.h:2359
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh's elements (the minimum supported_nodal_or...
Definition mesh_base.h:2328
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:2357
std::unique_ptr< PeriodicBoundaries > _disjoint_neighbor_boundary_pairs
The disjoint neighbor boundary id pairs.
Definition mesh_base.h:2119
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition mesh_base.h:2358
virtual std::unique_ptr< MeshBase > clone() const =0
Virtual "copy constructor".
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
Definition mesh_base.h:2333
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition mesh_base.h:2322
void add_ghosting_functor(GhostingFunctor &ghosting_functor)
Adds a functor which can specify ghosting requirements for use on distributed meshes.
Definition mesh_base.C:1078

References _default_ghosting, _disjoint_neighbor_boundary_pairs, _elemset_codes, _elemset_codes_inverse_map, _ghosting_functors, _partitioner, and add_ghosting_functor().

◆ MeshBase() [3/3]

libMesh::MeshBase::MeshBase ( MeshBase &&  )
delete

Move-constructor - deleted because after a theoretical move-construction and then destruction of the moved-from object, the moved BoundaryInfo would hold an invalid reference to the moved-from mesh.

◆ ~MeshBase()

libMesh::MeshBase::~MeshBase ( )
virtual

Destructor.

Definition at line 421 of file mesh_base.C.

422{
423 this->MeshBase::clear();
424
425 libmesh_exceptionless_assert (!libMesh::closed());
426}
virtual void clear()
Deletes all the element and node data that is currently stored.
Definition mesh_base.C:1036
bool closed()
Checks that the library has been closed.
Definition libmesh.C:331

References clear(), and libMesh::closed().

Member Function Documentation

◆ ABSTRACT_ELEM_ITERATORS() [1/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( )

◆ ABSTRACT_ELEM_ITERATORS() [2/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 
)

◆ ABSTRACT_ELEM_ITERATORS() [3/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [4/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( active_semilocal_  )

◆ ABSTRACT_ELEM_ITERATORS() [5/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [6/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [7/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( ancestor_  )

◆ ABSTRACT_ELEM_ITERATORS() [8/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( facelocal_  )

◆ ABSTRACT_ELEM_ITERATORS() [9/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( local_  )

◆ ABSTRACT_ELEM_ITERATORS() [10/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 
)

◆ ABSTRACT_ELEM_ITERATORS() [11/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [12/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [13/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [14/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [15/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( semilocal_  )

◆ active_local_element_stored_range()

const ConstElemRange & libMesh::MeshBase::active_local_element_stored_range ( ) const
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 1954 of file mesh_base.C.

1955{
1957 {
1958 // Range construction may not be safe within threads
1960
1962 std::make_unique<ConstElemRange>(this->active_local_elements_begin(),
1963 this->active_local_elements_end());
1964 }
1965
1967}
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!...
Definition threads.C:33

References _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 subdomain_ids().

◆ active_local_subdomain_elements_ptr_range() [1/2]

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

◆ active_local_subdomain_elements_ptr_range() [2/2]

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

◆ active_subdomain_elements_ptr_range() [1/2]

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

◆ active_subdomain_elements_ptr_range() [2/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 virtual

◆ active_subdomain_set_elements_ptr_range() [1/2]

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

◆ active_subdomain_set_elements_ptr_range() [2/2]

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

◆ 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 
)

Register a pair of boundaries as disjoint neighbor boundary pairs.

Definition at line 2272 of file mesh_base.C.

2275 {
2276 // Lazily allocate the container the first time it’s needed
2278 _disjoint_neighbor_boundary_pairs = std::make_unique<PeriodicBoundaries>();
2279
2280 PeriodicBoundaries & db = *_disjoint_neighbor_boundary_pairs;
2281
2282 // Create forward and inverse boundary mappings
2283 PeriodicBoundary forward(translation);
2284 PeriodicBoundary inverse(translation * -1.0);
2285
2286 forward.myboundary = b1;
2287 forward.pairedboundary = b2;
2288 inverse.myboundary = b2;
2289 inverse.pairedboundary = b1;
2290
2291 // Add both directions into the container
2292 db.emplace(b1, forward.clone());
2293 db.emplace(b2, inverse.clone());
2294 }

References _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(), libMesh::UnstructuredMesh::stitching_helper(), DisjointNeighborTest::testDisjointNeighborConflictError(), and DisjointNeighborTest::testStitchCrossMesh().

◆ add_elem() [1/2]

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

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::MeshRefinement::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::MeshTools::Modification::all_tri(), AllSecondOrderTest::allCompleteOrderMixed(), AllSecondOrderTest::allCompleteOrderRange(), AllSecondOrderTest::allSecondOrderMixed(), AllSecondOrderTest::allSecondOrderRange(), ExodusC0PolyhedronTest::build_c0polyhedron(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), DisjointNeighborTest::build_four_disjoint_elems(), libMesh::InfElemBuilder::build_inf_elem(), ExodusC0PolygonTest::build_pentagon(), DisjointNeighborTest::build_split_mesh_with_interface(), DisjointNeighborTest::build_two_disjoint_elems(), VolumeTest::buildC0Polyhedron(), copy_constraint_rows(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::TriangleWrapper::copy_tri_to_mesh(), libMesh::UnstructuredMesh::create_submesh(), libMesh::TetGenIO::element_in(), libMesh::UNVIO::elements_in(), libMesh::MeshTools::Modification::flatten(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::TetGenMeshInterface::pointset_convexhull(), libMesh::VTKIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::AbaqusIO::read_elements(), libMesh::UCDIO::read_implementation(), libMesh::DynaIO::read_mesh(), libMesh::GmshIO::read_mesh(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::MatlabIO::read_stream(), libMesh::OFFIO::read_stream(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::MeshTools::Generation::surface_octahedron(), AllTriTest::test_helper_c0polyhedron(), AllTriTest::testAllTriC0PolygonOctagon(), VolumeTest::testC0Polygon(), CheckpointIOTest::testC0PolygonCheckpoint(), CheckpointIOTest::testC0PolyhedronCheckpoint(), SystemsTest::testDofCouplingWithVarGroups(), MeshTriangulationTest::testEdge3Mesh(), MeshTriangulationTest::testEdgesMesh(), MeshTriangulationTest::testHalfDomain(), NodalNeighborsTest::testOrientation(), MeshTriangulationTest::testPoly2TriBad1DMultiBoundary(), MeshTriangulationTest::testPoly2TriBad2DMultiBoundary(), MeshTriangulationTest::testPoly2TriBadEdges(), MeshTriangulationTest::testPoly2TriEdge3ToTri6FlipThrows(), 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(), libMesh::Parallel::Packing< Elem * >::unpack(), and libMesh::MeshTetInterface::volume_to_surface_mesh().

◆ add_elem() [2/2]

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

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 
)
inline

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 2654 of file mesh_base.h.

2657{
2658 libmesh_assert(!default_values || default_values->size() == names.size());
2659
2660 std::vector<unsigned int> returnval(names.size());
2661
2662 const std::size_t old_size = _elem_integer_names.size();
2663
2664 for (auto i : index_range(names))
2665 returnval[i] =
2666 this->add_elem_datum<T>(names[i], false,
2667 default_values ?
2668 (*default_values)[i] : nullptr);
2669
2670 if (allocate_data && old_size != _elem_integer_names.size())
2672
2673 return returnval;
2674}
void size_elem_extra_integers()
Size extra-integer arrays of all elements in the mesh.
Definition mesh_base.C:2361
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:2371
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.
Definition mesh_base.h:2630
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

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

◆ 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 
)
inline

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 2630 of file mesh_base.h.

2633{
2634 const std::size_t old_size = _elem_integer_names.size();
2635
2636 unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
2637 std::vector<dof_id_type> int_data(n_more_integers+1, DofObject::invalid_id);
2638 if (default_value)
2639 std::memcpy(int_data.data(), default_value, sizeof(T));
2640
2641 unsigned int start_idx = this->add_elem_integer(name, false, int_data[0]);
2642 for (unsigned int i=0; i != n_more_integers; ++i)
2643 this->add_elem_integer(name+"__"+std::to_string(i), false, int_data[i+1]);
2644
2645 if (allocate_data && old_size != _elem_integer_names.size())
2647
2648 return start_idx;
2649}
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition dof_object.h:473
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
uint8_t dof_id_type
Definition id_types.h:67

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

Referenced by ExtraIntegersTest::build_mesh().

◆ 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 
)

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.

626{
627 for (auto i : index_range(_elem_integer_names))
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)
641 return _elem_integer_names.size()-1;
642}
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:2377
std::string name(const ElemQuality q)
This function returns a string containing some name for q.

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

Referenced by 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().

◆ 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 
)

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.

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)
683
684 return returnval;
685}

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

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

◆ add_elemset_code()

void libMesh::MeshBase::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.

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.

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}

References _all_elemset_ids, _elemset_codes, and _elemset_codes_inverse_map.

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

◆ add_ghosting_functor() [1/2]

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

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 1078 of file mesh_base.C.

1079{
1080 // We used to implicitly support duplicate inserts to std::set
1081#ifdef LIBMESH_ENABLE_DEPRECATED
1082 _ghosting_functors.erase
1083 (std::remove(_ghosting_functors.begin(),
1084 _ghosting_functors.end(),
1085 &ghosting_functor),
1086 _ghosting_functors.end());
1087#endif
1088
1089 // We shouldn't have two copies of the same functor
1090 libmesh_assert(std::find(_ghosting_functors.begin(),
1091 _ghosting_functors.end(),
1092 &ghosting_functor) ==
1093 _ghosting_functors.end());
1094
1095 _ghosting_functors.push_back(&ghosting_functor);
1096}

References _ghosting_functors, and libMesh::libmesh_assert().

Referenced by add_ghosting_functor(), main(), MeshBase(), and EquationSystemsTest::testDisableDefaultGhosting().

◆ add_ghosting_functor() [2/2]

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

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 1452 of file mesh_base.h.

1453 { _shared_functors[ghosting_functor.get()] = ghosting_functor;
1454 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:2430

References _shared_functors, and add_ghosting_functor().

◆ add_node() [1/2]

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

◆ add_node() [2/2]

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

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 
)
inline

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 2703 of file mesh_base.h.

2706{
2707 libmesh_assert(!default_values || default_values->size() == names.size());
2708
2709 std::vector<unsigned int> returnval(names.size());
2710
2711 const std::size_t old_size = _node_integer_names.size();
2712
2713 for (auto i : index_range(names))
2714 returnval[i] =
2715 this->add_node_datum<T>(names[i], false,
2716 default_values ?
2717 (*default_values)[i] : nullptr);
2718
2719 if (allocate_data && old_size != _node_integer_names.size())
2721
2722 return returnval;
2723}
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.
Definition mesh_base.h:2679
void size_node_extra_integers()
Size extra-integer arrays of all nodes in the mesh.
Definition mesh_base.C:2376
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:2383

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

◆ 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 
)
inline

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 2679 of file mesh_base.h.

2682{
2683 const std::size_t old_size = _node_integer_names.size();
2684
2685 unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
2686 std::vector<dof_id_type> int_data(n_more_integers+1, DofObject::invalid_id);
2687 if (default_value)
2688 std::memcpy(int_data.data(), default_value, sizeof(T));
2689
2690 unsigned int start_idx = this->add_node_integer(name, false, int_data[0]);
2691 for (unsigned int i=0; i != n_more_integers; ++i)
2692 this->add_node_integer(name+"__"+std::to_string(i), false, int_data[i+1]);
2693
2694 if (allocate_data && old_size != _node_integer_names.size())
2696
2697 return start_idx;
2698}
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

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

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

◆ 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 
)

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.

715{
716 for (auto i : index_range(_node_integer_names))
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)
730 return _node_integer_names.size()-1;
731}
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:2389

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

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

◆ 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 
)

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.

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)
772
773 return returnval;
774}

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

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

◆ 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 virtual

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(), ExodusC0PolyhedronTest::build_c0polyhedron(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_delaunay_square(), DisjointNeighborTest::build_four_disjoint_elems(), libMesh::InfElemBuilder::build_inf_elem(), ExodusC0PolygonTest::build_pentagon(), DisjointNeighborTest::build_split_mesh_with_interface(), DisjointNeighborTest::build_two_disjoint_elems(), copy_constraint_rows(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::TriangleWrapper::copy_tri_to_mesh(), libMesh::UnstructuredMesh::create_submesh(), libMesh::TriangulatorInterface::insert_any_extra_boundary_points(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::TetGenIO::node_in(), libMesh::UNVIO::nodes_in(), libMesh::VTKIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::STLIO::read_ascii(), libMesh::STLIO::read_binary(), libMesh::UCDIO::read_implementation(), libMesh::DynaIO::read_mesh(), libMesh::GmshIO::read_mesh(), libMesh::AbaqusIO::read_nodes(), libMesh::CheckpointIO::read_nodes(), libMesh::MatlabIO::read_stream(), libMesh::OFFIO::read_stream(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::MeshTools::Generation::surface_octahedron(), libMesh::BoundaryInfo::sync(), AllTriTest::test_helper_c0polyhedron(), AllTriTest::testAllTriC0PolygonOctagon(), VolumeTest::testC0Polygon(), CheckpointIOTest::testC0PolygonCheckpoint(), CheckpointIOTest::testC0PolyhedronCheckpoint(), VolumeTest::testC0PolyhedronCube(), VolumeTest::testC0PolyhedronHexagonalPrism(), SystemsTest::testDofCouplingWithVarGroups(), MeshTriangulationTest::testEdge3Mesh(), MeshTriangulationTest::testEdgesMesh(), MeshTriangulationTest::testHalfDomain(), NodalNeighborsTest::testOrientation(), MeshTriangulationTest::testPoly2TriBad1DMultiBoundary(), MeshTriangulationTest::testPoly2TriBad2DMultiBoundary(), MeshTriangulationTest::testPoly2TriBadEdges(), MeshTriangulationTest::testPoly2TriEdge3ToTri6FlipThrows(), SystemsTest::testProjectMatrix3D(), InfFERadialTest::testRefinement(), SystemsTest::testSetSystemParameterOverEquationSystem(), BoundaryInfoTest::testShellFaceConstraints(), MeshTetTest::testTetsToTets(), MeshTriangulationTest::testTriangulator(), MeshTriangulationTest::testTriangulatorHolePerturbed(), MeshTriangulationTest::testTriangulatorHoles(), MeshTriangulationTest::testTriangulatorHoleTangentPerturbed(), 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 ( )
virtual

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

Definition at line 1808 of file mesh_base.C.

1809{
1810 this->all_complete_order_range(this->element_ptr_range());
1811}
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,...

References all_complete_order_range().

Referenced by AllSecondOrderTest::allCompleteOrder(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTetInterface::increase_tet_order(), libMesh::TriangulatorInterface::increase_triangle_order(), main(), and MeshTetTest::testNetGenTet14Curved().

◆ all_complete_order_range()

virtual void libMesh::MeshBase::all_complete_order_range ( const SimpleRange< element_iterator > &  range)
pure virtual

Converts a set of elements in this (conforming, non-refined) mesh into "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.

Implemented in libMesh::UnstructuredMesh.

Referenced by all_complete_order(), AllSecondOrderTest::allCompleteOrderDoNothing(), AllSecondOrderTest::allCompleteOrderMixed(), AllSecondOrderTest::allCompleteOrderMixedFixing(), AllSecondOrderTest::allCompleteOrderMixedFixing3D(), and AllSecondOrderTest::allCompleteOrderRange().

◆ all_first_order()

virtual void libMesh::MeshBase::all_first_order ( )
pure virtual

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.

Implemented in libMesh::UnstructuredMesh.

Referenced by main(), and ExtraIntegersTest::test_helper().

◆ all_second_order()

void libMesh::MeshBase::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.

Definition at line 1803 of file mesh_base.C.

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

References all_second_order_range().

Referenced by AllSecondOrderTest::allSecondOrder(), libMesh::MeshTools::Generation::build_cube(), build_domain(), libMesh::MeshTetInterface::increase_tet_order(), libMesh::TriangulatorInterface::increase_triangle_order(), main(), ExtraIntegersTest::test_helper(), MeshTetTest::testNetGenQuadraticCurved(), and InfFERadialTest::testRefinement().

◆ all_second_order_range()

virtual void libMesh::MeshBase::all_second_order_range ( const SimpleRange< element_iterator > &  range,
const bool  full_ordered = true 
)
pure virtual

Converts a set of this Mesh's elements defined by range from FIRST order to SECOND order.

Must be called on conforming, non-refined meshes. 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.

Implemented in libMesh::UnstructuredMesh.

Referenced by all_second_order(), AllSecondOrderTest::allSecondOrderDoNothing(), AllSecondOrderTest::allSecondOrderMixed(), AllSecondOrderTest::allSecondOrderMixedFixing(), AllSecondOrderTest::allSecondOrderMixedFixing3D(), AllSecondOrderTest::allSecondOrderRange(), and MixedOrderTest::testFindNeighbors().

◆ allgather()

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

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

Reimplemented in libMesh::DistributedMesh.

Definition at line 386 of file mesh_base.h.

386{}

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

◆ allow_detect_interior_parents() [1/2]

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

◆ allow_detect_interior_parents() [2/2]

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

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

Definition at line 1369 of file mesh_base.h.

References _skip_detect_interior_parents.

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

◆ allow_find_neighbors() [1/2]

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

◆ allow_find_neighbors() [2/2]

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

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

Definition at line 1362 of file mesh_base.h.

1362{ _skip_find_neighbors = !allow; }

References _skip_find_neighbors.

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

◆ allow_node_and_elem_unique_id_overlap() [1/2]

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

Definition at line 1388 of file mesh_base.h.

References _allow_node_and_elem_unique_id_overlap.

◆ allow_node_and_elem_unique_id_overlap() [2/2]

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

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 1387 of file mesh_base.h.

References _allow_node_and_elem_unique_id_overlap.

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

◆ allow_remote_element_removal() [1/2]

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

◆ allow_remote_element_removal() [2/2]

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

◆ allow_renumbering() [1/2]

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

◆ allow_renumbering() [2/2]

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

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 1355 of file mesh_base.h.

References _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::ErrorVector::plot_error(), libMesh::GMVIO::read(), libMesh::NameBasedIO::read(), libMesh::ReplicatedMesh::ReplicatedMesh(), libMesh::C0Polyhedron::retriangulate(), WriteVecAndScalar::setupTests(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshGenerationTest::testBuildSphere(), CheckpointIOTest::testC0PolygonCheckpoint(), CheckpointIOTest::testC0PolyhedronCheckpoint(), 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(), WriteElemsetData::testWriteImpl(), WriteNodesetData::testWriteImpl(), and WriteSidesetData::testWriteImpl().

◆ assign()

virtual MeshBase & libMesh::MeshBase::assign ( MeshBase &&  other_mesh)
pure virtual

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

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

Referenced by MeshAssignTest::testMeshMoveAssign().

◆ cache_elem_data()

void libMesh::MeshBase::cache_elem_data ( )

Definition at line 1985 of file mesh_base.C.

1986{
1987 // This requires an inspection on every processor
1988 parallel_object_only();
1989
1990 // Need to clear containers first in case all elements of a
1991 // particular dimension/order/subdomain have been deleted.
1992 _elem_dims.clear();
1993 _elem_default_orders.clear();
1994 _mesh_subdomains.clear();
1996
1997 for (const auto & elem : this->active_element_ptr_range())
1998 {
1999 _elem_dims.insert(cast_int<unsigned char>(elem->dim()));
2000 _elem_default_orders.insert(elem->default_order());
2001 _mesh_subdomains.insert(elem->subdomain_id());
2003 static_cast<Order>
2004 (std::min(static_cast<int>(_supported_nodal_order),
2005 static_cast<int>(elem->supported_nodal_order())));
2006 }
2007
2008 if (!this->is_serial())
2009 {
2010 // Some different dimension/order/subdomain elements may only live
2011 // on other processors
2012 this->comm().set_union(_elem_dims);
2016 }
2017
2018 // If the largest element dimension found is larger than the current
2019 // _spatial_dimension, increase _spatial_dimension.
2020 unsigned int max_dim = this->mesh_dimension();
2021 if (max_dim > _spatial_dimension)
2022 _spatial_dimension = cast_int<unsigned char>(max_dim);
2023
2024 // _spatial_dimension may need to increase from 1->2 or 2->3 if the
2025 // mesh is full of 1D elements but they are not x-aligned, or the
2026 // mesh is full of 2D elements but they are not in the x-y plane.
2027 // If the mesh is x-aligned or x-y planar, we will end up checking
2028 // every node's coordinates and not breaking out of the loop
2029 // early...
2030 if (_spatial_dimension < LIBMESH_DIM)
2031 {
2032 for (const auto & node : this->node_ptr_range())
2033 {
2034 // Note: the exact floating point comparison is intentional,
2035 // we don't want to get tripped up by tolerances.
2036 if ((*node)(0) != 0. && _spatial_dimension < 1)
2038
2039 if ((*node)(1) != 0. && _spatial_dimension < 2)
2040 {
2042#if LIBMESH_DIM == 2
2043 // If libmesh is compiled in 2D mode, this is the
2044 // largest spatial dimension possible so we can break
2045 // out.
2046 break;
2047#endif
2048 }
2049
2050#if LIBMESH_DIM > 2
2051 if ((*node)(2) != 0.)
2052 {
2053 // Spatial dimension can't get any higher than this, so
2054 // we can break out.
2056 break;
2057 }
2058#endif
2059 }
2060 }
2061
2063}
void min(const T &r, T &o, Request &req) const
void set_union(T &data, const unsigned int root_id) const
virtual bool is_serial() const
Definition mesh_base.h:357
unsigned int mesh_dimension() const
Definition mesh_base.C:430
const Parallel::Communicator & comm() const

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

Referenced by ExodusC0PolyhedronTest::build_c0polyhedron(), cache_elem_dims(), complete_preparation(), main(), set_elem_dimensions(), ExodusC0PolyhedronTest::test_write_cube_header(), MeshSmootherTest::testVariationalSmoother(), and libMesh::NetGenMeshInterface::triangulate().

◆ cache_elem_dims()

void libMesh::MeshBase::cache_elem_dims ( )
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 1977 of file mesh_base.C.

1978{
1979 libmesh_deprecated();
1980
1981 this->cache_elem_data();
1982}

References cache_elem_data().

◆ change_elemset_code()

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

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.

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}
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:1939
bool has_elem_integer(std::string_view name) const
Definition mesh_base.C:701
const DofMap &dof_map LIBMESH_COMMA unsigned int Elem * ElemRange
Definition mesh_base.h:1894
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
std::set< elemset_id_type > elemset_type
Typedef for the "set" container used to store elemset ids.
Definition mesh_base.h:466
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.

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

◆ change_elemset_id()

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

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.

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}

References _all_elemset_ids, _elemset_codes, and _elemset_codes_inverse_map.

◆ clear()

void libMesh::MeshBase::clear ( )
virtual

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 1036 of file mesh_base.C.

1037{
1038 // Reset the number of partitions
1039 _n_parts = 1;
1040
1041 // Reset the preparation flags
1042 _preparation = false;
1043
1044 // Clear boundary information
1045 if (boundary_info)
1046 boundary_info->clear();
1047
1048 // Clear cached element data
1049 _elem_dims.clear();
1050 _elem_default_orders.clear();
1052
1053 _elemset_codes.clear();
1055
1056 _constraint_rows.clear();
1057
1058 // Clear our point locator.
1059 this->clear_point_locator();
1060 this->clear_stored_ranges();
1061}
constraint_rows_type _constraint_rows
Definition mesh_base.h:2442
void clear_point_locator()
Releases the current PointLocator object.
Definition mesh_base.C:1866
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:1969

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

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

◆ clear_elems()

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

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 ( )

◆ clear_stored_ranges()

void libMesh::MeshBase::clear_stored_ranges ( )

◆ clone()

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

◆ 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.

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

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::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), 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::System::add_matrix(), libMesh::System::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::System::add_vector(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::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(), cache_elem_data(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::MeshTetInterface::check_hull_integrity(), 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::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), PetscSolverConfiguration::configure_solver(), libMesh::ContinuationSystem::ContinuationSystem(), 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(), detect_interior_parents(), 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::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::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(), 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::RBEIMConstruction::get_random_point(), libMesh::RBEIMConstruction::get_random_point(), libMesh::MeshTetInterface::improve_hull_integrity(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::StaticCondensation::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::LocationMap< T >::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), ElasticitySystem::init_data(), 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::Modification::interpolate_surface(), 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_snes_mffd_interface(), libMesh::libmesh_petsc_snes_postcheck(), 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::MeshCommunication::make_elems_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::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(), 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< T >::operator=(), operator==(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::ReplicatedMesh::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(), LaplaceSystem::postprocess(), PoissonSystem::postprocess(), 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(), libMesh::XdrIO::read(), libMesh::Nemesis_IO::read(), FEMParameters::read(), libMesh::EquationSystems::read(), libMesh::CheckpointIO::read_header(), libMesh::ExodusII_IO::read_header(), libMesh::System::read_header(), libMesh::XdrIO::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::RBConstruction::read_riesz_representors_from_files(), libMesh::TransientRBConstruction::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(), recalculate_n_partitions(), 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::NoxNonlinearSolver< Number >::solve(), libMesh::ClawSystem::solve_conservation_law(), libMesh::split_mesh(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), subdomain_ids(), libMesh::BoundaryInfo::sync(), 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(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), ExodusC0PolyhedronTest::test_write_and_read_hexagonal_prism(), ExodusC0PolygonTest::test_write_and_read_pentagon(), DofMapTest::testBadElemFECombo(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), CheckpointIOTest::testC0PolygonCheckpoint(), VolumeTest::testC0PolygonMethods(), CheckpointIOTest::testC0PolyhedronCheckpoint(), VolumeTest::testC0PolyhedronMethods(), ConstraintOperatorTest::testCoreform(), ConnectedComponentsTest::testEdge(), MeshInputTest::testExodusIGASidesets(), MeshTriangulationTest::testFoundCenters(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), BoundaryMeshSubdomainTest::testPerBoundarySubdomain(), PointLocatorTest::testPlanar(), MeshTriangulationTest::testPoly2TriEdge3ToTri7CenterFixup(), MeshTriangulationTest::testPoly2TriRefinementBase(), SystemsTest::testProjectCubeWithMeshFunction(), SystemsTest::testProjectScalarCoarsening(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testSelectiveRenumber(), BoundaryMeshSubdomainTest::testSingleSubdomain(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), MeshSmootherTest::testVariationalSmoother(), libMesh::MeshTools::total_weight(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::Poly2TriTriangulator::triangulate(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::truth_assembly(), update_current_local_solution(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::XdrIO::write(), libMesh::NameBasedIO::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::RBConstruction::write_riesz_representors_to_files(), libMesh::TransientRBConstruction::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().

◆ complete_preparation()

void libMesh::MeshBase::complete_preparation ( )

Definition at line 874 of file mesh_base.C.

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 // libMesh expects every processor to know about every subdomain
942 // name, but distributed mesh generators may only have set names for
943 // the part of the mesh they know about, so make sure the map is
944 // consistent everywhere.
947
948 // Search the mesh for elements that have a neighboring element
949 // of dim+1 and set that element as the interior parent
951 {
954 else
955 {
956 // We must set the flag that says "interior parent pointers have been set up"
957 // even though we skip detect_interior_parents().
959 }
960 }
961
962 // Fix up node unique ids in case mesh generation code didn't take
963 // exceptional care to do so.
964 // MeshCommunication().make_node_unique_ids_parallel_consistent(*this);
965
966 // We're going to still require that mesh generation code gets
967 // element unique ids consistent.
968#if defined(DEBUG) && defined(LIBMESH_ENABLE_UNIQUE_ID)
970#endif
971
972 // Allow our GhostingFunctor objects to reinit if necessary.
973 // Do this before partitioning and redistributing, and before
974 // deleting remote elements.
977
978 // Partition the mesh unless *all* partitioning is to be skipped.
979 // If only noncritical partitioning is to be skipped, the
980 // partition() call will still check for orphaned nodes.
982 this->partition();
983 else if (!this->n_unpartitioned_elem() &&
984 !this->n_unpartitioned_nodes())
986
987 // If we're using DistributedMesh, we'll probably want it
988 // parallelized.
992 else
994
995 // Much of our boundary info may have been for now-remote parts of the mesh,
996 // in which case we don't want to keep local copies of data meant to be
997 // local. On the other hand we may have deleted, or the user may have added in
998 // a distributed fashion, boundary data that is meant to be global. So we
999 // handle both of those scenarios here
1002
1005
1006 // The mesh is now prepared for use, with the possible exception of
1007 // partitioning that was supposed to be skipped, and it should know
1008 // it.
1009#ifndef NDEBUG
1010 Preparation completed_preparation = _preparation;
1011 if (skip_partitioning())
1012 completed_preparation.is_partitioned = true;
1013 libmesh_assert(completed_preparation);
1014#endif
1015
1016#ifdef DEBUG
1018#ifdef LIBMESH_ENABLE_UNIQUE_ID
1020#endif
1021#endif
1022}
void regenerate_id_sets()
Clears and regenerates the cached sets of ids.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition mesh_base.h:170
bool skip_partitioning() const
Definition mesh_base.h:1431
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...
dof_id_type n_unpartitioned_elem() const
Definition mesh_base.h:703
void remove_orphaned_nodes()
Removes any orphaned nodes, nodes not connected to any elements.
Definition mesh_base.C:801
dof_id_type n_unpartitioned_nodes() const
Definition mesh_base.h:597
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:399
void sync_subdomain_name_map()
libMesh often expects all processors to know about names of all subdomain ids, but distributed mesh g...
Definition mesh_base.C:2066
virtual void update_parallel_id_counts()=0
Updates parallel caches so that methods like n_elem() accurately reflect changes on other processors.
void reinit_ghosting_functors()
Loops over ghosting functors and calls mesh_reinit()
Definition mesh_base.C:1025
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 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:2077
void libmesh_assert_valid_unique_ids(const MeshBase &mesh)
A function for verifying that unique ids match across processors.
void libmesh_assert_valid_boundary_ids(const MeshBase &mesh)
A function for verifying that boundary condition ids match across processors.
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...

References _allow_remote_element_removal, _preparation, _skip_detect_interior_parents, _skip_find_neighbors, _skip_renumber_nodes_and_elements, cache_elem_data(), libMesh::ParallelObject::comm(), delete_remote_elements(), detect_interior_parents(), find_neighbors(), 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::has_synched_subdomain_name_map, libMesh::MeshBase::Preparation::is_partitioned, 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(), n_unpartitioned_elem(), n_unpartitioned_nodes(), partition(), libMesh::BoundaryInfo::regenerate_id_sets(), reinit_ghosting_functors(), remove_orphaned_nodes(), renumber_nodes_and_elements(), skip_partitioning(), sync_subdomain_name_map(), and update_parallel_id_counts().

Referenced by main(), prepare_for_use(), BoundaryMeshSubdomainTest::testDefaultSubdomain(), MeshBaseTest::testMeshBaseVerifyHasCachedElemData(), MeshBaseTest::testMeshBaseVerifyHasNeighborPtrs(), MeshBaseTest::testMeshBaseVerifyRemovalPreparation(), BoundaryMeshSubdomainTest::testPerBoundarySubdomain(), and BoundaryMeshSubdomainTest::testSingleSubdomain().

◆ contract()

virtual bool libMesh::MeshBase::contract ( )
pure virtual

Delete subactive (i.e.

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

Implemented in libMesh::UnstructuredMesh.

Referenced by libMesh::EquationSystems::reinit_solutions().

◆ copy_cached_data()

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

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

Definition at line 2431 of file mesh_base.C.

2432{
2433 this->_spatial_dimension = other_mesh._spatial_dimension;
2434 this->_elem_dims = other_mesh._elem_dims;
2435 this->_elem_default_orders = other_mesh._elem_default_orders;
2436 this->_supported_nodal_order = other_mesh._supported_nodal_order;
2437 this->_mesh_subdomains = other_mesh._mesh_subdomains;
2438}

References _elem_default_orders, _elem_dims, _mesh_subdomains, _spatial_dimension, and _supported_nodal_order.

◆ copy_constraint_rows() [1/2]

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

Copy the constraints from the other mesh to this mesh.

Definition at line 2490 of file mesh_base.C.

2491{
2492 LOG_SCOPE("copy_constraint_rows(mesh)", "MeshBase");
2493
2494 _constraint_rows.clear();
2495
2496 const auto & other_constraint_rows = other_mesh.get_constraint_rows();
2497 for (const auto & [other_node, other_node_constraints] : other_constraint_rows)
2498 {
2499 const Node * const our_node = this->node_ptr(other_node->id());
2500 constraint_rows_mapped_type our_node_constraints;
2501 for (const auto & [other_inner_key_pair, constraint_value] : other_node_constraints)
2502 {
2503 const auto & [other_elem, local_node_id] = other_inner_key_pair;
2504 const Elem * const our_elem = this->elem_ptr(other_elem->id());
2505 our_node_constraints.emplace_back(std::make_pair(our_elem, local_node_id), constraint_value);
2506 }
2507 _constraint_rows[our_node] = std::move(our_node_constraints);
2508 }
2509}
virtual const Node * node_ptr(const dof_id_type i) const =0
std::vector< std::pair< std::pair< const Elem *, unsigned int >, Real > > constraint_rows_mapped_type
Definition mesh_base.h:1929
virtual const Elem * elem_ptr(const dof_id_type i) const =0

References _constraint_rows, elem_ptr(), get_constraint_rows(), and node_ptr().

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

◆ copy_constraint_rows() [2/2]

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

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 2514 of file mesh_base.C.

2516{
2517 LOG_SCOPE("copy_constraint_rows(mat)", "MeshBase");
2518
2519 this->_constraint_rows.clear();
2520
2521 // We're not going to support doing this distributed yet; it'd be
2522 // pointless unless we temporarily had a linear partitioning to
2523 // better match the constraint operator.
2524 MeshSerializer serialize(*this);
2525
2526 // Our current mesh should already reflect the desired assembly space
2527 libmesh_error_msg_if(this->n_nodes() != constraint_operator.m(),
2528 "Constraint operator matrix with " <<
2529 constraint_operator.m() <<
2530 "rows does not match this mesh with " <<
2531 this->n_nodes() << " nodes");
2532
2533 // First, find what new unconstrained DoFs we need to add. We can't
2534 // iterate over columns in a SparseMatrix, so we'll iterate over
2535 // rows and keep track of columns.
2536
2537 // If we have nodes that will work unconstrained, keep track of
2538 // their node ids and corresponding column indices.
2539 // existing_unconstrained_nodes[column_id] = node_id
2540 std::map<dof_id_type, dof_id_type> existing_unconstrained_columns;
2541 std::set<dof_id_type> existing_unconstrained_nodes;
2542
2543 // In case we need new nodes, keep track of their columns.
2544 // columns[j][k] will be the kth row index and value of column j
2545 typedef
2546 std::unordered_map<dof_id_type,
2547 std::vector<std::pair<dof_id_type, Real>>>
2548 columns_type;
2549 columns_type columns(constraint_operator.n());
2550
2551 // If we need to precondition the constraint operator (e.g. it's an
2552 // unpreconditioned extraction operator for a Flex IGA matrix),
2553 // we'll want to keep track of the sum of each column, because we'll
2554 // be dividing each column by that sum (Jacobi preconditioning on
2555 // the right, which then leads to symmetric preconditioning on a
2556 // physics Jacobian).
2557 std::unordered_map<dof_id_type, Real> column_sums;
2558
2559 // Work in parallel, though we'll have to sync shortly
2560 for (auto i : make_range(constraint_operator.row_start(),
2561 constraint_operator.row_stop()))
2562 {
2563 std::vector<numeric_index_type> indices;
2564 std::vector<T> values;
2565
2566 constraint_operator.get_row(i, indices, values);
2567 libmesh_assert_equal_to(indices.size(), values.size());
2568
2569 if (indices.size() == 1 &&
2570 values[0] == T(1))
2571 {
2572 // If we have multiple simple Ui=Uj constraints, let the
2573 // first one be our "unconstrained" node and let the others
2574 // be constrained to it.
2575 if (existing_unconstrained_columns.find(indices[0]) !=
2576 existing_unconstrained_columns.end())
2577 {
2578 const auto j = indices[0];
2579 columns[j].emplace_back(i, 1);
2580 }
2581 else
2582 {
2583 existing_unconstrained_nodes.insert(i);
2584 existing_unconstrained_columns.emplace(indices[0],i);
2585 }
2586 }
2587 else
2588 for (auto jj : index_range(indices))
2589 {
2590 const auto j = indices[jj];
2591 const Real coef = libmesh_real(values[jj]);
2592 libmesh_assert_equal_to(coef, values[jj]);
2593 columns[j].emplace_back(i, coef);
2594 }
2595 }
2596
2597 // Merge data from different processors' slabs of the matrix
2598 this->comm().set_union(existing_unconstrained_nodes);
2599 this->comm().set_union(existing_unconstrained_columns);
2600
2601 std::vector<columns_type> all_columns;
2602 this->comm().allgather(columns, all_columns);
2603
2604 columns.clear();
2605 for (auto p : index_range(all_columns))
2606 for (auto & [j, subcol] : all_columns[p])
2607 for (auto [i, v] : subcol)
2608 columns[j].emplace_back(i,v);
2609
2610 // Keep track of elements on which unconstrained nodes exist, and
2611 // their local node indices.
2612 // node_to_elem_ptrs[node] = [elem_id, local_node_num]
2613 std::unordered_map<const Node *, std::pair<dof_id_type, unsigned int>> node_to_elem_ptrs;
2614
2615 // Find elements attached to any existing nodes that will stay
2616 // unconstrained. We'll also build a subdomain set here so we don't
2617 // have to assert that the mesh is already prepared before we pick a
2618 // new subdomain for any NodeElems we need to add.
2619 std::set<subdomain_id_type> subdomain_ids;
2620 for (const Elem * elem : this->element_ptr_range())
2621 {
2622 subdomain_ids.insert(elem->subdomain_id());
2623 for (auto n : make_range(elem->n_nodes()))
2624 {
2625 const Node * node = elem->node_ptr(n);
2626 if (existing_unconstrained_nodes.count(node->id()))
2627 node_to_elem_ptrs.emplace(node, std::make_pair(elem->id(), n));
2628 }
2629 }
2630
2631 const subdomain_id_type new_sbd_id = *subdomain_ids.rbegin() + 1;
2632
2633 for (auto j : make_range(constraint_operator.n()))
2634 {
2635 // If we already have a good node for this then we're done
2636 if (existing_unconstrained_columns.count(j))
2637 continue;
2638
2639 // Get a half-decent spot to place a new NodeElem for
2640 // unconstrained DoF(s) here. Getting a *fully*-decent spot
2641 // would require finding a Moore-Penrose pseudoinverse, and I'm
2642 // not going to do that, but scaling a transpose will at least
2643 // get us a little uniqueness to make visualization reasonable.
2644 Point newpt;
2645 Real total_scaling = 0;
2646 unsigned int total_entries = 0;
2647
2648 // We'll get a decent initial pid choice here too, if only to
2649 // aid in later repartitioning.
2650 std::map<processor_id_type, int> pids;
2651
2652 auto & column = columns[j];
2653 for (auto [i, r] : column)
2654 {
2655 Node & constrained_node = this->node_ref(i);
2656 const Point constrained_pt = constrained_node;
2657 newpt += r*constrained_pt;
2658 total_scaling += r;
2659 ++total_entries;
2660 ++pids[constrained_node.processor_id()];
2661 }
2662
2663 if (precondition_constraint_operator)
2664 column_sums[j] = total_scaling;
2665
2666 libmesh_error_msg_if
2667 (!total_entries,
2668 "Empty column " << j <<
2669 " found in constraint operator matrix");
2670
2671 // If we have *cancellation* here then we can end up dividing by
2672 // zero; try just evenly scaling across all constrained node
2673 // points instead.
2674 if (total_scaling > TOLERANCE)
2675 newpt /= total_scaling;
2676 else
2677 newpt /= total_entries;
2678
2679 Node *n = this->add_point(newpt);
2680 std::unique_ptr<Elem> elem = Elem::build(NODEELEM);
2681 elem->set_node(0, n);
2682 elem->subdomain_id() = new_sbd_id;
2683
2684 Elem * added_elem = this->add_elem(std::move(elem));
2685 this->_elem_dims.insert(0);
2686 this->_elem_default_orders.insert(added_elem->default_order());
2688 static_cast<Order>
2689 (std::min(static_cast<int>(this->_supported_nodal_order),
2690 static_cast<int>(added_elem->supported_nodal_order())));
2691 this->_mesh_subdomains.insert(new_sbd_id);
2692 node_to_elem_ptrs.emplace(n, std::make_pair(added_elem->id(), 0));
2693 existing_unconstrained_columns.emplace(j,n->id());
2694
2695 // Repartition the new objects *after* adding them, so a
2696 // DistributedMesh doesn't get confused and think you're not
2697 // adding them on all processors at once.
2698 int n_pids = 0;
2699 for (auto [pid, count] : pids)
2700 if (count >= n_pids)
2701 {
2702 n_pids = count;
2703 added_elem->processor_id() = pid;
2704 n->processor_id() = pid;
2705 }
2706 }
2707
2708 // Calculate constraint rows in an indexed form that's easy for us
2709 // to allgather
2710 std::unordered_map<dof_id_type,
2711 std::vector<std::pair<std::pair<dof_id_type, unsigned int>,Real>>>
2712 indexed_constraint_rows;
2713
2714 for (auto i : make_range(constraint_operator.row_start(),
2715 constraint_operator.row_stop()))
2716 {
2717 if (existing_unconstrained_nodes.count(i))
2718 continue;
2719
2720 std::vector<numeric_index_type> indices;
2721 std::vector<T> values;
2722
2723 constraint_operator.get_row(i, indices, values);
2724
2725 std::vector<std::pair<std::pair<dof_id_type, unsigned int>, Real>> constraint_row;
2726
2727 for (auto jj : index_range(indices))
2728 {
2729 const dof_id_type node_id =
2730 existing_unconstrained_columns[indices[jj]];
2731
2732 Node & constraining_node = this->node_ref(node_id);
2733
2734 libmesh_assert(node_to_elem_ptrs.count(&constraining_node));
2735
2736 auto p = node_to_elem_ptrs[&constraining_node];
2737
2738 Real coef = libmesh_real(values[jj]);
2739 libmesh_assert_equal_to(coef, values[jj]);
2740
2741 // If we're preconditioning and we created a nodeelem then
2742 // we can scale the meaning of that nodeelem's value to give
2743 // us a better-conditioned matrix after the constraints are
2744 // applied.
2745 if (precondition_constraint_operator)
2746 if (auto sum_it = column_sums.find(indices[jj]);
2747 sum_it != column_sums.end())
2748 {
2749 const Real scaling = sum_it->second;
2750
2751 if (scaling > TOLERANCE)
2752 coef /= scaling;
2753 }
2754
2755 constraint_row.emplace_back(std::make_pair(p, coef));
2756 }
2757
2758 indexed_constraint_rows.emplace(i, std::move(constraint_row));
2759 }
2760
2761 this->comm().set_union(indexed_constraint_rows);
2762
2763 // Add constraint rows as mesh constraint rows
2764 for (auto & [node_id, indexed_row] : indexed_constraint_rows)
2765 {
2766 Node * constrained_node = this->node_ptr(node_id);
2767
2768 constraint_rows_mapped_type constraint_row;
2769
2770 for (auto [p, coef] : indexed_row)
2771 {
2772 const Elem * elem = this->elem_ptr(p.first);
2773 constraint_row.emplace_back
2774 (std::make_pair(std::make_pair(elem, p.second), coef));
2775 }
2776
2777 this->_constraint_rows.emplace(constrained_node,
2778 std::move(constraint_row));
2779 }
2780}
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
Definition elem.C:442
virtual const Node & node_ref(const dof_id_type i) const
Definition mesh_base.h:745
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,...
Definition mesh_base.C:1126
virtual dof_id_type n_nodes() const =0
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.
T libmesh_real(T a)
TestClass subdomain_id_type
Based on the 4-byte comment warning above, this probably doesn't work with exodusII at all....
Definition id_types.h:43
static constexpr Real TOLERANCE
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

References _constraint_rows, _elem_default_orders, _elem_dims, _mesh_subdomains, _supported_nodal_order, add_elem(), add_point(), libMesh::Parallel::Communicator::allgather(), libMesh::Elem::build(), libMesh::ParallelObject::comm(), libMesh::Elem::default_order(), 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(), n_nodes(), node_ptr(), node_ref(), libMesh::NODEELEM, libMesh::DofObject::processor_id(), libMesh::Real, libMesh::SparseMatrix< T >::row_start(), libMesh::SparseMatrix< T >::row_stop(), libMesh::Parallel::Communicator::set_union(), subdomain_ids(), libMesh::Elem::supported_nodal_order(), and libMesh::TOLERANCE.

◆ default_ghosting()

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

Default ghosting functor.

Definition at line 1484 of file mesh_base.h.

1484{ return *_default_ghosting; }

References _default_ghosting.

◆ default_mapping_data()

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

◆ default_mapping_type()

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

◆ delete_elem()

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

◆ delete_node()

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

◆ delete_remote_elements()

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

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 399 of file mesh_base.h.

399 {
401 }

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

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

◆ detect_interior_parents()

void libMesh::MeshBase::detect_interior_parents ( )

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

Definition at line 2077 of file mesh_base.C.

2078{
2079 LOG_SCOPE("detect_interior_parents()", "MeshBase");
2080
2081 // This requires an inspection on every processor
2082 parallel_object_only();
2083
2084 // This requires up-to-date mesh dimensions, but if we don't have
2085 // them cached then we can't update them without changing the mesh
2086 // in unexpected ways that interfere with our tests of
2087 // partially-prepared meshes in MeshTools::*valid_is_prepared
2088 std::set<unsigned char> elem_dims_copy;
2090 elem_dims_copy = this->elem_dimensions();
2091 else
2092 {
2093 for (const auto & elem : this->active_element_ptr_range())
2094 elem_dims_copy.insert(cast_int<unsigned char>(elem->dim()));
2095 if (!this->is_serial())
2096 this->comm().set_union(elem_dims_copy);
2097 }
2098
2099 // Early return if the mesh is empty or has elements of a single spatial dimension.
2100 if (elem_dims_copy.size() <= 1)
2101 {
2103 return;
2104 }
2105
2106 // Convenient elem_dimensions iterators
2107 const auto dim_start = elem_dims_copy.begin();
2108 const auto dim_end = elem_dims_copy.end();
2109
2110 // In this function we find only +1 dimensional interior parents,
2111 // (so, for a given element el, the interior parent p must satisfy p.dim() == el.dim() + 1).
2112 // Therefore, we can avoid checking the existence of interior parents
2113 // for all those elements el such there there is no p with p.dim() == el.dim() + 1.
2114 // We store whether to skip any given dimension in the construction of interior parents
2115 // inside the vector in dimensions_to_skip_for_interior_parents.
2116 std::vector<bool> skip_dimension_for_interior_parents(/*count=*/LIBMESH_DIM+1, /*value=*/false);
2117 skip_dimension_for_interior_parents.back() = true;
2118
2119 // Moreover, in the following, we will build a node-to-elem map.
2120 // It is among the elems of this map that we will look for interior parents.
2121 // Therefore, we can skip all elems p such that there is no el with el.dim() == p.dim() - 1.
2122 // We store whether to skip any given dimension in the construction of the node-to-elem map
2123 // in the vector skip_dimensions_for_node_to_el_map.
2124 std::vector<bool> skip_dimensions_for_node_to_el_map(/*count=*/LIBMESH_DIM+1, /*value=*/false);
2125 skip_dimensions_for_node_to_el_map[*dim_start] = true;
2126
2127 // We also create a flag to know if all dimensions should be skipped,
2128 // and if we should therefore return early.
2129 bool skip_all_dimensions = true;
2130
2131 // Fill dimensions_to_skip_for_interior_parents and dimensions_to_skip_for_node_to_el_map.
2132 for (auto [it, next] = std::make_tuple(dim_start, std::next(dim_start));
2133 next != dim_end; ++it, ++next)
2134 {
2135 if (*it + 1 != *next) // if sequential dimensions differ by exactly 1
2136 {
2137 skip_dimension_for_interior_parents[*it] = true;
2138 skip_dimensions_for_node_to_el_map[*next] = true;
2139 }
2140 else if (!skip_dimension_for_interior_parents[*it])
2141 skip_all_dimensions = false;
2142 }
2143
2144 // There is nothing to do if all dimensions should be
2145 // skipped. Before returning, we must also set the flag that says
2146 // "interior parent pointers have been set up" even though we
2147 // determined there was no work to be done.
2148 if (skip_all_dimensions)
2149 {
2151 return;
2152 }
2153
2154 // Do we have interior parent pointers going to a different mesh?
2155 // If so then we'll still check to make sure that's the only place
2156 // they go, so we can libmesh_not_implemented() if not.
2157 const bool separate_interior_mesh = (&(this->interior_mesh()) != this);
2158
2159 // This map will be used to set interior parents
2160 std::unordered_map<dof_id_type, std::vector<dof_id_type>> node_to_elem;
2161
2162 for (const auto & elem : this->element_ptr_range())
2163 {
2164 // Ignore element if it cannot be interior parent of any other elem.
2165 if (skip_dimensions_for_node_to_el_map[elem->dim()])
2166 continue;
2167
2168 // Populating the node_to_elem map, same as MeshTools::build_nodes_to_elem_map
2169 for (auto n : make_range(elem->n_vertices()))
2170 {
2171 libmesh_assert_less (elem->id(), this->max_elem_id());
2172
2173 node_to_elem[elem->node_id(n)].push_back(elem->id());
2174 }
2175 }
2176
2177 // Automatically set interior parents
2178 for (const auto & element : this->element_ptr_range())
2179 {
2180 // Ignore elements with dimensions to skip
2181 // or elements that already have an interior parent.
2182 if (skip_dimension_for_interior_parents[element->dim()] || element->interior_parent())
2183 continue;
2184
2185 // Start by generating sets of dim+1 dimensional elements that
2186 // touch each vertex of the current element. If we encounter a
2187 // vertex not connected to _any_ dim+1 dimensional elements,
2188 // then we can exit the loop without checking the remaining
2189 // vertices since an interior parent (if it exists) will be
2190 // connected to all vertices of the current element.
2191 std::vector<std::set<dof_id_type>> neighbors( element->n_vertices() );
2192
2193 bool found_interior_parents = true;
2194
2195 for (auto n : make_range(element->n_vertices()))
2196 {
2197 auto it = node_to_elem.find(element->node_id(n));
2198
2199 // Check at first that this node is not isolated.
2200 if (it == node_to_elem.end())
2201 {
2202 found_interior_parents = false;
2203 break; // out of n-loop
2204 }
2205
2206 for (const auto & vertex_neighbor_id : it->second)
2207 if (this->elem_ref(vertex_neighbor_id).dim() == element->dim()+1)
2208 neighbors[n].insert(vertex_neighbor_id);
2209
2210 if (neighbors[n].empty())
2211 {
2212 // We have found an empty set for one vertex, no reason
2213 // to continue.
2214 found_interior_parents = false;
2215 break; // out of n-loop
2216 }
2217 }
2218
2219 // If we have generated a non-empty set of elements for each
2220 // vertex, we will now look for a vertex_neighbor_id that
2221 // appears in _all_ of those sets. If found, this is our interior
2222 // parent id. If multiple such common ids are found, we will
2223 // take the lowest such id to be the interior parent id.
2224 if (found_interior_parents)
2225 {
2226 std::set<dof_id_type> & neighbors_0 = neighbors[0];
2227 for (const auto & interior_parent_id : neighbors_0)
2228 {
2229 found_interior_parents = false;
2230 for (auto n : make_range(1u, element->n_vertices()))
2231 {
2232 if (neighbors[n].count(interior_parent_id))
2233 {
2234 found_interior_parents = true;
2235 }
2236 else
2237 {
2238 found_interior_parents = false;
2239 break;
2240 }
2241 }
2242
2243 if (found_interior_parents)
2244 {
2245 element->set_interior_parent(this->elem_ptr(interior_parent_id));
2246 break;
2247 }
2248 }
2249
2250 // Do we have a mixed dimensional mesh that contains some of
2251 // its own interior parents, but we already expect to have
2252 // interior parents on a different mesh? That's going to
2253 // take some work to support if anyone needs it.
2254 if (separate_interior_mesh)
2255 libmesh_not_implemented_msg
2256 ("interior_parent() values in multiple meshes are unsupported.");
2257 }
2258 }
2259
2260 // This flag doesn't necessarily mean any Elems actually have
2261 // interior parent pointers, just that we did all the work to
2262 // determine whether or not they do.
2264}
unsigned int dim
const std::set< unsigned char > & elem_dimensions() const
Definition mesh_base.h:430
const MeshBase & interior_mesh() const
Definition mesh_base.h:2040
virtual const Elem & elem_ref(const dof_id_type i) const
Definition mesh_base.h:788
Tnew cast_int(Told oldvar)

References _preparation, libMesh::ParallelObject::comm(), libMesh::Elem::dim(), elem_dimensions(), elem_ptr(), elem_ref(), libMesh::MeshBase::Preparation::has_cached_elem_data, libMesh::MeshBase::Preparation::has_interior_parent_ptrs, interior_mesh(), is_serial(), libMesh::make_range(), and libMesh::Parallel::Communicator::set_union().

Referenced by complete_preparation().

◆ elem_default_orders()

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

Definition at line 437 of file mesh_base.h.

438 { return _elem_default_orders; }

References _elem_default_orders.

Referenced by MeshSmootherTest::testVariationalSmoother().

◆ elem_dimensions()

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

Definition at line 430 of file mesh_base.h.

431 { return _elem_dims; }

References _elem_dims.

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

◆ elem_ptr() [1/2]

virtual const Elem * libMesh::MeshBase::elem_ptr ( const dof_id_type  i) const
pure virtual
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(), copy_constraint_rows(), copy_constraint_rows(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), detect_interior_parents(), libMesh::DTKAdapter::DTKAdapter(), elem_ref(), elem_ref(), libMesh::DTKEvaluator::evaluate(), libMesh::UnstructuredMesh::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(), libMesh::UnstructuredMesh::stitching_helper(), VolumeTest::testHex20PLevelTrueCentroid(), InfFERadialTest::testInfQuants(), InfFERadialTest::testInfQuants_numericDeriv(), InfFERadialTest::testRefinement(), EquationSystemsTest::testRefineThenReinitPreserveFlags(), InfFERadialTest::testSides(), InfFERadialTest::testSingleOrder(), VolumeTest::testTwistedVolume(), libMesh::Parallel::Packing< Elem * >::unpack(), 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 virtual
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 Elem & libMesh::MeshBase::elem_ref ( const dof_id_type  i)
inlinevirtual
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 798 of file mesh_base.h.

799 {
800 return *this->elem_ptr(i);
801 }

References elem_ptr().

◆ elem_ref() [2/2]

virtual const Elem & libMesh::MeshBase::elem_ref ( const dof_id_type  i) const
inlinevirtual
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 788 of file mesh_base.h.

789 {
790 return *this->elem_ptr(i);
791 }

References elem_ptr().

Referenced by libMesh::SyncSubdomainIds::act_on_data(), libMesh::SyncElementIntegers::act_on_data(), libMesh::SyncRefinementFlags::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::InfElemBuilder::build_inf_elem(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), detect_interior_parents(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::SyncSubdomainIds::gather_data(), libMesh::SyncElementIntegers::gather_data(), libMesh::SyncRefinementFlags::gather_data(), libMesh::MeshTetInterface::improve_hull_integrity(), main(), 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::FroIO::write(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::Nemesis_IO_Helper::write_elements(), libMesh::GmshIO::write_mesh(), and libMesh::ExodusII_IO_Helper::write_sidesets().

◆ element_stored_range()

const ElemRange & libMesh::MeshBase::element_stored_range ( )
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 1939 of file mesh_base.C.

1940{
1942 {
1943 // Range construction may not be safe within threads
1945
1947 std::make_unique<ElemRange>(this->elements_begin(),
1948 this->elements_end());
1949 }
1950
1951 return *_element_stored_range;
1952}

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

Referenced by libMesh::EquationSystems::allgather(), change_elemset_code(), libMesh::MeshTools::Modification::change_subdomain_id(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::EquationSystems::reinit_mesh(), libMesh::EquationSystems::reinit_solutions(), and size_elem_extra_integers().

◆ find_neighbors()

virtual void libMesh::MeshBase::find_neighbors ( const bool  reset_remote_elements = false,
const bool  reset_current_list = true,
const bool  assert_valid = true 
)
pure virtual

Locate element face (edge in 2D) neighbors.

This is done with the help of a std::map that functions like a hash table. After this routine is called all the elements with a nullptr neighbor pointer are guaranteed to be on the boundary. Thus this routine is useful for automatically determining the boundaries of the domain.

If reset_remote_elements is left to false, remote neighbor links are not reset and searched for in the local mesh.

If reset_current_list is left as true, then any existing links will be reset before initiating the algorithm, while honoring the value of the reset_remote_elements flag.

If assert_valid is left as true, then in dbg mode extensive consistency checking is performed before returning.

Implemented in libMesh::UnstructuredMesh.

Referenced by libMesh::InfElemBuilder::build_inf_elem(), complete_preparation(), main(), MixedOrderTest::testFindNeighbors(), and tetrahedralize_domain().

◆ fix_broken_node_and_element_numbering()

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

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 ( )
inlinevirtual

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

Reimplemented in libMesh::DistributedMesh.

Definition at line 392 of file mesh_base.h.

392{}

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

◆ get_boundary_info() [1/2]

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

Writable information about boundary ids on the mesh.

Definition at line 175 of file mesh_base.h.

175{ return *boundary_info; }

References boundary_info.

◆ get_boundary_info() [2/2]

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

The information about boundary ids on the mesh.

Definition at line 170 of file mesh_base.h.

170{ return *boundary_info; }

References boundary_info.

Referenced by libMesh::MeshTools::Subdivision::add_boundary_ghosts(), libMesh::UnstructuredMesh::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(), AssemblyF0::boundary_assembly(), AssemblyF1::boundary_assembly(), AssemblyF2::boundary_assembly(), AssemblyA0::boundary_assembly(), AssemblyA1::boundary_assembly(), AssemblyA2::boundary_assembly(), libMesh::MeshTools::Generation::build_cube(), 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(), complete_preparation(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::TriangleWrapper::copy_tri_to_mesh(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTetInterface::delete_2D_hull_elements(), libMesh::DistributedMesh::delete_elem(), libMesh::ReplicatedMesh::delete_elem(), libMesh::DistributedMesh::delete_node(), libMesh::ReplicatedMesh::delete_node(), libMesh::DistributedMesh::delete_remote_elements(), libMesh::DistributedMesh::DistributedMesh(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshTools::Modification::flatten(), get_info(), AssemblyPointLoadX::get_nodal_rhs_values(), AssemblyPointLoadY::get_nodal_rhs_values(), AssemblyPointLoadZ::get_nodal_rhs_values(), libMesh::UNVIO::groups_in(), libMesh::MeshTetInterface::improve_hull_integrity(), libMesh::HDGProblem::init(), ElasticitySystem::init_data(), libMesh::ExodusII_IO_Helper::initialize(), LinearElasticityWithContact::initialize_contact_load_paths(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::MeshTools::Modification::interpolate_surface(), libMesh::HDGProblem::jacobian(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), main(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), libMesh::PeriodicBoundaries::neighbor(), libMesh::MeshTools::Modification::orient_elements(), libMesh::TetGenMeshInterface::pointset_convexhull(), libMesh::Nemesis_IO::prepare_to_write_nodal_data(), libMesh::Nemesis_IO::read(), libMesh::AbaqusIO::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::DistributedMesh::renumber_nodes_and_elements(), libMesh::ReplicatedMesh::renumber_nodes_and_elements(), libMesh::ReplicatedMesh::ReplicatedMesh(), libMesh::HDGProblem::residual(), libMesh::RBEIMEvaluation::side_distribute_bfs(), libMesh::PetscDiffSolver::solve(), libMesh::UnstructuredMesh::stitching_helper(), libMesh::MeshTools::Generation::surface_octahedron(), libMesh::BoundaryInfo::sync(), AllTriTest::test_helper(), AllTriTest::test_helper_c0polyhedron(), ExodusC0PolyhedronTest::test_write_cube_header(), AllTriTest::testAllTriC0Polygon(), AllTriTest::testAllTriC0PolygonOctagon(), MeshTetTest::testBcids(), BoundaryInfoTest::testBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundarySides(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), SystemsTest::testBoundaryProjectCube(), BoundaryInfoTest::testBuildNodeListFromSideList(), BoundaryInfoTest::testBuildSideListFromNodeList(), VolumeTest::testC0PolygonMethods(), BoundaryMeshSubdomainTest::testDefaultSubdomain(), DisjointNeighborTest::testDisjointNeighborConflictError(), BoundaryInfoTest::testEdgeBoundaryConditions(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testGmshBCIDOverlap(), BoundaryInfoTest::testInternalBoundary(), MeshInputTest::testLowOrderEdgeBlocks(), BoundaryInfoTest::testMesh(), BoundaryInfoTest::testNameCopying(), BoundaryMeshSubdomainTest::testPerBoundarySubdomain(), PeriodicBCTest::testPeriodicBC(), MeshTriangulationTest::testPoly2TriHolesInteriorRefinedBase(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testSelectiveRenumber(), BoundaryInfoTest::testShellFaceConstraints(), BoundaryMeshSubdomainTest::testSingleSubdomain(), DisjointNeighborTest::testStitchCrossMesh(), MeshTetTest::testTrisToTets(), MeshSmootherTest::testVariationalSmoother(), WriteEdgesetData::testWriteImpl(), WriteNodesetData::testWriteImpl(), WriteSidesetData::testWriteImpl(), libMesh::NetGenMeshInterface::triangulate(), libMesh::Poly2TriTriangulator::triangulate_current_points(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::MeshTetInterface::volume_to_surface_mesh(), libMesh::FroIO::write(), libMesh::XdrIO::write(), libMesh::Nemesis_IO::write(), libMesh::ExodusII_IO::write(), libMesh::CheckpointIO::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().

◆ get_constraint_rows() [1/2]

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

◆ get_constraint_rows() [2/2]

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

Definition at line 1938 of file mesh_base.h.

1939 { return _constraint_rows; }

References _constraint_rows.

◆ get_count_lower_dim_elems_in_point_locator()

bool libMesh::MeshBase::get_count_lower_dim_elems_in_point_locator ( ) const

Get the current value of _count_lower_dim_elems_in_point_locator.

Definition at line 1880 of file mesh_base.C.

1881{
1883}

References _count_lower_dim_elems_in_point_locator.

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

◆ get_disjoint_neighbor_boundary_pairs() [1/2]

PeriodicBoundaries * libMesh::MeshBase::get_disjoint_neighbor_boundary_pairs ( )

◆ get_disjoint_neighbor_boundary_pairs() [2/2]

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

Definition at line 2301 of file mesh_base.C.

2302 {
2304 }

References _disjoint_neighbor_boundary_pairs.

◆ get_elem_integer_index()

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

Definition at line 689 of file mesh_base.C.

690{
691 for (auto i : index_range(_elem_integer_names))
693 return i;
694
695 libmesh_error_msg("Unknown elem integer " << name);
697}
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

References _elem_integer_names, libMesh::index_range(), and libMesh::invalid_uint.

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

◆ get_elem_integer_name()

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

Definition at line 1079 of file mesh_base.h.

1080 { return _elem_integer_names[i]; }

References _elem_integer_names.

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

◆ get_elemset_code()

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

Definition at line 497 of file mesh_base.C.

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}

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

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

◆ get_elemset_codes()

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

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.

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}

References _elemset_codes.

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

◆ get_elemsets()

void libMesh::MeshBase::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.

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.

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}

References _elemset_codes.

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

◆ get_id_by_name()

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

Definition at line 1926 of file mesh_base.C.

1927{
1928 // Linear search over the map values.
1929 for (const auto & [sbd_id, sbd_name] : _block_id_to_name)
1930 if (sbd_name == name)
1931 return sbd_id;
1932
1933 // If we made it here without returning, we don't have a subdomain
1934 // with the requested name, so return Elem::invalid_subdomain_id.
1936}
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:2308

References _block_id_to_name, and libMesh::Elem::invalid_subdomain_id.

◆ get_info()

std::string libMesh::MeshBase::get_info ( const unsigned int  verbosity = 0,
const bool  global = true 
) const
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 1275 of file mesh_base.C.

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

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

Referenced by print_info().

◆ get_local_constraints()

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

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 2811 of file mesh_base.C.

2812{
2813 std::ostringstream os;
2814
2815 if (print_nonlocal)
2816 os << "All ";
2817 else
2818 os << "Local ";
2819
2820 os << "Mesh Constraint Rows:"
2821 << std::endl;
2822
2823 for (const auto & [node, row] : _constraint_rows)
2824 {
2825 const bool local = (node->processor_id() == this->processor_id());
2826
2827 // Skip non-local dofs if requested
2828 if (!print_nonlocal && !local)
2829 continue;
2830
2831 os << "Constraints for " << (local ? "Local" : "Ghost") << " Node " << node->id()
2832 << ": \t";
2833
2834 for (const auto & [elem_and_node, coef] : row)
2835 os << " ((" << elem_and_node.first->id() << ',' << elem_and_node.second << "), " << coef << ")\t";
2836
2837 os << std::endl;
2838 }
2839
2840 return os.str();
2841}

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

Referenced by print_constraint_rows().

◆ get_mesh_subdomains()

const std::set< subdomain_id_type > & libMesh::MeshBase::get_mesh_subdomains ( ) const
inline
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 2057 of file mesh_base.h.

2058 { libmesh_assert(this->is_prepared()); return _mesh_subdomains; }

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

◆ get_node_integer_index()

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

Definition at line 778 of file mesh_base.C.

779{
780 for (auto i : index_range(_node_integer_names))
782 return i;
783
784 libmesh_error_msg("Unknown node integer " << name);
786}

References _node_integer_names, libMesh::index_range(), and libMesh::invalid_uint.

◆ get_node_integer_name()

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

Definition at line 1201 of file mesh_base.h.

1202 { return _node_integer_names[i]; }

References _node_integer_names.

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

◆ get_point_locator_close_to_point_tol()

Real libMesh::MeshBase::get_point_locator_close_to_point_tol ( ) const

Definition at line 2354 of file mesh_base.C.

2355{
2357}

References _point_locator_close_to_point_tol.

◆ get_subdomain_name_map()

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

◆ ghosting_functors_begin()

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

◆ ghosting_functors_end()

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

◆ has_elem_integer()

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

◆ has_node_integer()

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

Definition at line 790 of file mesh_base.C.

791{
792 for (auto & entry : _node_integer_names)
793 if (entry == name)
794 return true;
795
796 return false;
797}

References _node_integer_names.

Referenced by ExtraIntegersTest::checkpoint_helper().

◆ insert_elem() [1/2]

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

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 libMesh::UnstructuredMesh::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 virtual

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]

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

Definition at line 2045 of file mesh_base.h.

2045{ return *_interior_mesh; }

References _interior_mesh.

◆ interior_mesh() [2/2]

const MeshBase & libMesh::MeshBase::interior_mesh ( ) const
inline
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 2040 of file mesh_base.h.

2040{ return *_interior_mesh; }

References _interior_mesh.

Referenced by libMesh::BoundaryInfo::add_elements(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), detect_interior_parents(), and libMesh::Parallel::Packing< Elem * >::unpack().

◆ is_prepared()

bool libMesh::MeshBase::is_prepared ( ) const

◆ is_replicated()

virtual bool libMesh::MeshBase::is_replicated ( ) const
inlinevirtual
Returns
true if new elements and nodes can and should be created in synchronization on all processors, false otherwise

Reimplemented in libMesh::DistributedMesh.

Definition at line 379 of file mesh_base.h.

380 { return true; }

Referenced by libMesh::BoundaryInfo::add_elements(), libMesh::MeshTools::Modification::all_tri(), libMesh::MeshTools::Modification::flatten(), get_info(), main(), libMesh::CheckpointIO::read(), libMesh::SimplexRefiner::refine_via_edges(), and libMesh::MeshTetInterface::volume_to_surface_mesh().

◆ is_serial()

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

Reimplemented in libMesh::DistributedMesh.

Definition at line 357 of file mesh_base.h.

358 { return true; }

Referenced by 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::MeshTools::build_nodes_to_elem_map(), cache_elem_data(), complete_preparation(), libMesh::DofMap::create_dof_constraints(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshCommunication::delete_remote_elements(), detect_interior_parents(), libMesh::LocationMap< T >::init(), libMesh::MeshTools::Modification::interpolate_surface(), main(), libMesh::MeshSerializer::MeshSerializer(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), 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::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().

◆ is_serial_on_zero()

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

Reimplemented in libMesh::DistributedMesh.

Definition at line 364 of file mesh_base.h.

365 { return true; }

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

◆ libmesh_assert_valid_parallel_ids()

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

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 1698 of file mesh_base.h.

1698{}

Referenced by libMesh::InfElemBuilder::build_inf_elem().

◆ locally_equals()

bool libMesh::MeshBase::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.

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

Definition at line 281 of file mesh_base.C.

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}
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.
std::map< const Node *, constraint_rows_mapped_type > constraint_rows_type
Definition mesh_base.h:1930

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

Referenced by operator==().

◆ max_elem_id()

virtual dof_id_type libMesh::MeshBase::max_elem_id ( ) const
pure virtual
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::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(), libMesh::UnstructuredMesh::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 virtual
Returns
A number one greater than the maximum node id in the mesh. A more apt name for this method would be end_node_id

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

Referenced by libMesh::UnstructuredMesh::all_first_order(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::MeshTools::build_nodes_to_elem_map(), libMesh::MeshTools::build_nodes_to_elem_map(), libMesh::EquationSystems::build_parallel_solution_vector(), CopyNodesAndElementsTest::collectMeshes(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::MeshTools::Modification::distort(), libMesh::LaplaceMeshSmoother::init(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::TriangulatorInterface::insert_any_extra_boundary_points(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_equal_points(), libMesh::MeshTools::libmesh_assert_valid_constraint_rows(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), main(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::UnstructuredMesh::stitching_helper(), ConnectedComponentsTest::testEdge(), libMesh::TriangleInterface::triangulate(), libMesh::Poly2TriTriangulator::triangulate_current_points(), libMesh::XdrIO::write(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::ExodusII_IO_Helper::write_elements(), and libMesh::XdrIO::write_serialized_nodes().

◆ merge_extra_integer_names()

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

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 2385 of file mesh_base.C.

2386{
2387 std::pair<std::vector<unsigned int>, std::vector<unsigned int>> returnval;
2388 returnval.first = this->add_elem_integers(other._elem_integer_names, true, &other._elem_integer_default_values);
2389 returnval.second = this->add_node_integers(other._node_integer_names, true, &other._node_integer_default_values);
2390 return returnval;
2391}
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
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,...
Definition mesh_base.C:646

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

Referenced by libMesh::UnstructuredMesh::copy_nodes_and_elements(), and libMesh::UnstructuredMesh::create_submesh().

◆ mesh_dimension()

unsigned int libMesh::MeshBase::mesh_dimension ( ) const
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.

431{
432 if (!_elem_dims.empty())
433 return cast_int<unsigned int>(*_elem_dims.rbegin());
434 return 0;
435}

References _elem_dims.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::HPCoarsenTest::add_projection(), libMesh::UnstructuredMesh::all_complete_order_range(), libMesh::UnstructuredMesh::all_second_order_range(), libMesh::MeshTools::Modification::all_tri(), alternative_fe_assembly(), LinearElasticity::assemble(), assemble(), assemble(), assemble_1D(), AssembleOptimization::assemble_A_and_F(), assemble_biharmonic(), assemble_cd(), assemble_cd(), assemble_divgrad(), assemble_elasticity(), assemble_ellipticdg(), assemble_func(), assemble_graddiv(), assemble_helmholtz(), assemble_laplace(), assemble_mass(), assemble_matrices(), assemble_poisson(), assemble_poisson(), assemble_poisson(), assemble_SchroedingerEquation(), assemble_shell(), assemble_stokes(), assemble_temperature_jump(), assemble_wave(), assemble_wave(), libMesh::MeshTools::Generation::build_cube(), cache_elem_data(), compute_enriched_soln(), compute_jacobian(), compute_residual(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), LinearElasticityWithContact::compute_stresses(), compute_stresses(), libMesh::VariationalSmootherConstraint::constrain(), libMesh::VariationalSmootherConstraint::constrain_node_to_line(), libMesh::VariationalSmootherConstraint::constrain_node_to_plane(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshTools::Modification::distort(), NavierSystem::element_constraint(), HeatSystem::element_time_derivative(), NavierSystem::element_time_derivative(), SolidSystem::element_time_derivative(), libMesh::ExactErrorEstimator::estimate_error(), fe_assembly(), libMesh::VariationalSmootherConstraint::fix_node(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), NavierSystem::forcing(), form_functionA(), form_functionB(), form_matrixA(), libMesh::ReplicatedMesh::get_boundary_points(), libMesh::LaplaceMeshSmoother::init(), libMesh::PointLocatorTree::init(), NavierSystem::init_data(), SolidSystem::init_data(), ElasticityRBConstruction::init_data(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::Nemesis_IO_Helper::initialize(), integrate_function(), LargeDeformationElasticity::jacobian(), LaplaceYoung::jacobian(), main(), NavierSystem::mass_residual(), Integrate::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SmoothnessEstimator::EstimateSmoothness::operator()(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), NavierSystem::postprocess(), libMesh::VTKIO::read(), libMesh::Nemesis_IO::read(), libMesh::GMVIO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::System::read_header(), libMesh::UCDIO::read_implementation(), libMesh::XdrIO::read_serialized_connectivity(), LargeDeformationElasticity::residual(), LaplaceYoung::residual(), LinearElasticityWithContact::residual_and_jacobian(), SolidSystem::save_initial_mesh(), libMesh::HPCoarsenTest::select_refinement(), libMesh::PetscPreconditioner< T >::set_hypre_ads_data(), libMesh::PetscPreconditioner< T >::set_hypre_ams_data(), libMesh::PetscPreconditioner< T >::set_petsc_aux_data(), setup(), NavierSystem::side_constraint(), libMesh::MeshTools::Modification::smooth(), MeshSpatialDimensionTest::test1D(), MeshSpatialDimensionTest::test2D(), CheckpointIOTest::testC0PolygonCheckpoint(), CheckpointIOTest::testC0PolyhedronCheckpoint(), BoundaryMeshSubdomainTest::testDefaultSubdomain(), InfFERadialTest::testInfQuants(), InfFERadialTest::testInfQuants_numericDeriv(), BoundaryMeshSubdomainTest::testPerBoundarySubdomain(), InfFERadialTest::testSides(), InfFERadialTest::testSingleOrder(), BoundaryMeshSubdomainTest::testSingleSubdomain(), MeshSmootherTest::testVariationalSmootherRegression(), libMesh::BoundaryVolumeSolutionTransfer::transfer(), libMesh::DTKSolutionTransfer::transfer(), libMesh::MeshTools::volume(), libMesh::PostscriptIO::write(), libMesh::CheckpointIO::write(), libMesh::GMVIO::write_binary(), libMesh::TecplotIO::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().

◆ n_active_elem()

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

◆ n_active_elem_on_proc()

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

Definition at line 1242 of file mesh_base.C.

1243{
1244 libmesh_assert_less (proc_id, this->n_processors());
1245 return static_cast<dof_id_type>(std::distance (this->active_pid_elements_begin(proc_id),
1246 this->active_pid_elements_end (proc_id)));
1247}

References libMesh::ParallelObject::n_processors().

Referenced by n_active_local_elem().

◆ n_active_local_elem()

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

◆ n_active_sub_elem()

dof_id_type libMesh::MeshBase::n_active_sub_elem ( ) const

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

Definition at line 1263 of file mesh_base.C.

1264{
1265 dof_id_type ne=0;
1266
1267 for (const auto & elem : this->active_element_ptr_range())
1268 ne += elem->n_sub_elem();
1269
1270 return ne;
1271}
dof_id_type n_sub_elem() const
Definition mesh_base.C:1251

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

◆ n_constraint_rows()

dof_id_type libMesh::MeshBase::n_constraint_rows ( ) const

Definition at line 2471 of file mesh_base.C.

2472{
2473 dof_id_type n_local_rows=0, n_unpartitioned_rows=0;
2474 for (const auto & [node, node_constraints] : _constraint_rows)
2475 {
2476 // Unpartitioned nodes
2477 if (node->processor_id() == DofObject::invalid_processor_id)
2478 n_unpartitioned_rows++;
2479 else if (node->processor_id() == this->processor_id())
2480 n_local_rows++;
2481 }
2482
2483 this->comm().sum(n_local_rows);
2484
2485 return n_unpartitioned_rows + n_local_rows;
2486}

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

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

◆ n_elem()

virtual dof_id_type libMesh::MeshBase::n_elem ( ) const
pure virtual
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_cube(), 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(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::DofMap::create_dof_constraints(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTools::Modification::distort(), libMesh::TriangulatorInterface::elems_to_segments(), 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(), AllTriTest::test_helper_c0polyhedron(), MeshInputTest::testAbaqusRead(), AllTriTest::testAllTriC0Polygon(), AllTriTest::testAllTriC0PolygonOctagon(), MeshGenerationTest::testBuildCube(), MeshGenerationTest::testBuildLine(), MeshGenerationTest::testBuildSquare(), CheckpointIOTest::testC0PolygonCheckpoint(), CheckpointIOTest::testC0PolyhedronCheckpoint(), 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::testPoly2TriEdge3ToTri7CenterFixup(), MeshTriangulationTest::testPoly2TriRefinementBase(), EquationSystemsTest::testSelectivePRefine(), InfFERadialTest::testSides(), InfFERadialTest::testSingleOrder(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTetTest::testTetInterfaceBase(), MeshTriangulationTest::testTriangulatorBase(), MeshTriangulationTest::testTriangulatorHolePerturbed(), MeshTriangulationTest::testTriangulatorHoles(), MeshTriangulationTest::testTriangulatorHoleTangentPerturbed(), 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
inline

◆ n_elem_on_proc()

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

Definition at line 1229 of file mesh_base.C.

1230{
1231 // We're either counting a processor's elements or unpartitioned
1232 // elements
1233 libmesh_assert (proc_id < this->n_processors() ||
1235
1236 return static_cast<dof_id_type>(std::distance (this->pid_elements_begin(proc_id),
1237 this->pid_elements_end (proc_id)));
1238}

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

Referenced by n_local_elem(), and n_unpartitioned_elem().

◆ n_elemsets()

unsigned int libMesh::MeshBase::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 at line 482 of file mesh_base.C.

483{
484 return _all_elemset_ids.size();
485}

References _all_elemset_ids.

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

◆ n_local_elem()

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

Definition at line 697 of file mesh_base.h.

698 { 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:1229

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

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

◆ n_local_nodes()

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

Definition at line 591 of file mesh_base.h.

592 { 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:1216

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

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

◆ n_local_subdomains()

subdomain_id_type libMesh::MeshBase::n_local_subdomains ( ) const
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 1204 of file mesh_base.C.

1205{
1206 std::set<subdomain_id_type> ids;
1207
1208 this->subdomain_ids (ids, /* global = */ false);
1209
1210 return cast_int<subdomain_id_type>(ids.size());
1211}

References subdomain_ids().

Referenced by get_info().

◆ n_node_integers()

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

◆ n_nodes()

virtual dof_id_type libMesh::MeshBase::n_nodes ( ) const
pure virtual
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 libMesh::UnstructuredMesh::all_complete_order_range(), libMesh::UnstructuredMesh::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(), copy_constraint_rows(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTools::Modification::distort(), fill_dirichlet_bc(), libMesh::TetGenMeshInterface::fill_pointlist(), 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(), CheckpointIOTest::testC0PolygonCheckpoint(), CheckpointIOTest::testC0PolyhedronCheckpoint(), 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::TreeNode< N >::transform_nodes_to_elements(), libMesh::NetGenMeshInterface::triangulate(), libMesh::TriangleInterface::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::GMVIO::write_binary(), libMesh::TecplotIO::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
Returns
The number of nodes on processor proc.

Definition at line 1216 of file mesh_base.C.

1217{
1218 // We're either counting a processor's nodes or unpartitioned
1219 // nodes
1220 libmesh_assert (proc_id < this->n_processors() ||
1222
1223 return static_cast<dof_id_type>(std::distance (this->pid_nodes_begin(proc_id),
1224 this->pid_nodes_end (proc_id)));
1225}

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

Referenced by n_local_nodes(), and n_unpartitioned_nodes().

◆ n_partitions()

unsigned int libMesh::MeshBase::n_partitions ( ) const
inline
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 1526 of file mesh_base.h.

1527 { return _n_parts; }

References _n_parts.

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

◆ 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.

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 }
processor_id_type size() const
uint8_t processor_id_type
Definition id_types.h:104

References libMesh::ParallelObject::_communicator, libMesh::libmesh_assert(), and libMesh::Parallel::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::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(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMEvaluation::gather_bfs(), get_info(), libMesh::StaticCondensation::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::NumericVector< T >::is_effectively_ghosted(), libMesh::NumericVector< T >::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(), n_active_elem_on_proc(), libMesh::DofMap::n_dofs_per_processor(), n_elem_on_proc(), n_nodes_on_proc(), libMesh::RBEIMEvaluation::node_gather_bfs(), partition(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::Partitioner::partition_unpartitioned_elements(), print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::NameBasedIO::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::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::VTKIO::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().

◆ n_sub_elem()

dof_id_type libMesh::MeshBase::n_sub_elem ( ) const
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 1251 of file mesh_base.C.

1252{
1253 dof_id_type ne=0;
1254
1255 for (const auto & elem : this->element_ptr_range())
1256 ne += elem->n_sub_elem();
1257
1258 return ne;
1259}

◆ n_subdomains()

subdomain_id_type libMesh::MeshBase::n_subdomains ( ) const
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 1190 of file mesh_base.C.

1191{
1192 // This requires an inspection on every processor
1193 parallel_object_only();
1194
1195 std::set<subdomain_id_type> ids;
1196
1197 this->subdomain_ids (ids);
1198
1199 return cast_int<subdomain_id_type>(ids.size());
1200}

References subdomain_ids().

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

◆ n_unpartitioned_elem()

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

Definition at line 703 of file mesh_base.h.

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

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

◆ n_unpartitioned_nodes()

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

Definition at line 597 of file mesh_base.h.

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

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

◆ next_unique_id()

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

Definition at line 610 of file mesh_base.h.

610{ return _next_unique_id; }

References _next_unique_id.

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

◆ node_ptr() [1/2]

virtual const Node * libMesh::MeshBase::node_ptr ( const dof_id_type  i) const
pure virtual
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(), ExodusC0PolyhedronTest::build_c0polyhedron(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), DisjointNeighborTest::build_four_disjoint_elems(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), ExodusC0PolygonTest::build_pentagon(), DisjointNeighborTest::build_split_mesh_with_interface(), DisjointNeighborTest::build_two_disjoint_elems(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), copy_constraint_rows(), copy_constraint_rows(), libMesh::TriangleWrapper::copy_tri_to_mesh(), libMesh::UnstructuredMesh::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(), node_ref(), node_ref(), libMesh::BoundaryInfo::operator=(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::VTKIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::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::MatlabIO::read_stream(), libMesh::OFFIO::read_stream(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::DofMap::scatter_constraints(), libMesh::UnstructuredMesh::stitching_helper(), libMesh::MeshTools::Generation::surface_octahedron(), libMesh::BoundaryInfo::sync(), AllTriTest::test_helper_c0polyhedron(), VolumeTest::testC0PolygonMethods(), CheckpointIOTest::testC0PolyhedronCheckpoint(), 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(), libMesh::Parallel::Packing< Elem * >::unpack(), and libMesh::CheckpointIO::write_nodesets().

◆ node_ptr() [2/2]

virtual Node * libMesh::MeshBase::node_ptr ( const dof_id_type  i)
pure virtual
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 Node & libMesh::MeshBase::node_ref ( const dof_id_type  i)
inlinevirtual
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 754 of file mesh_base.h.

755 {
756 return *this->node_ptr(i);
757 }

References node_ptr().

◆ node_ref() [2/2]

virtual const Node & libMesh::MeshBase::node_ref ( const dof_id_type  i) const
inlinevirtual
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 745 of file mesh_base.h.

746 {
747 return *this->node_ptr(i);
748 }

References node_ptr().

Referenced by libMesh::SyncNodalPositions::act_on_data(), LinearElasticityWithContact::add_contact_edge_elements(), add_cube_convex_hull_to_mesh(), assemble_matrix_and_rhs(), libMesh::InfElemBuilder::build_inf_elem(), copy_constraint_rows(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::DTKAdapter::DTKAdapter(), fill_dirichlet_bc(), libMesh::MeshTools::Modification::interpolate_surface(), main(), libMesh::DistributedMesh::point(), libMesh::ReplicatedMesh::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(), libMesh::UnstructuredMesh::stitching_helper(), MeshTriangulationTest::testPoly2TriHolesInterpRefined(), MeshSmootherTest::testVariationalSmoother(), MeshSmootherTest::testVariationalSmootherRegression(), libMesh::DTKAdapter::update_variable_values(), and libMesh::GmshIO::write_mesh().

◆ nodes_and_elements_equal()

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

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

Helper function for subclass_equals() in unstructured mesh subclasses.

Definition at line 2441 of file mesh_base.C.

2442{
2443 for (const auto & other_node : other_mesh.node_ptr_range())
2444 {
2445 const Node * node = this->query_node_ptr(other_node->id());
2446 if (!node)
2447 return false;
2448 if (*other_node != *node)
2449 return false;
2450 }
2451 for (const auto & node : this->node_ptr_range())
2452 if (!other_mesh.query_node_ptr(node->id()))
2453 return false;
2454
2455 for (const auto & other_elem : other_mesh.element_ptr_range())
2456 {
2457 const Elem * elem = this->query_elem_ptr(other_elem->id());
2458 if (!elem)
2459 return false;
2460 if (!other_elem->topologically_equal(*elem))
2461 return false;
2462 }
2463 for (const auto & elem : this->element_ptr_range())
2464 if (!other_mesh.query_elem_ptr(elem->id()))
2465 return false;
2466
2467 return true;
2468}
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

References query_elem_ptr(), and query_node_ptr().

◆ operator!=()

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

Definition at line 138 of file mesh_base.h.

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

◆ operator=() [1/2]

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

Copy and move assignment are not allowed because MeshBase subclasses manually manage memory (Elems and Nodes) and therefore the default versions of these operators would leak memory.

Since we don't want to maintain non-default copy and move assignment operators at this time, the safest and most self-documenting approach is to delete them.

If you need to copy a Mesh, use the clone() method.

◆ operator=() [2/2]

MeshBase & libMesh::MeshBase::operator= ( MeshBase &&  other_mesh)

Definition at line 189 of file mesh_base.C.

190{
191 LOG_SCOPE("operator=(&&)", "MeshBase");
192
193 // Move assign as a ParallelObject.
194 this->ParallelObject::operator=(other_mesh);
195
196 _n_parts = other_mesh.n_partitions();
197 _default_mapping_type = other_mesh.default_mapping_type();
198 _default_mapping_data = other_mesh.default_mapping_data();
199 _preparation = other_mesh._preparation;
200 _element_stored_range = std::move(other_mesh._element_stored_range);
201 _const_active_local_element_stored_range = std::move(other_mesh._const_active_local_element_stored_range);
202 _point_locator = std::move(other_mesh._point_locator);
203 _count_lower_dim_elems_in_point_locator = other_mesh.get_count_lower_dim_elems_in_point_locator();
204#ifdef LIBMESH_ENABLE_UNIQUE_ID
205 _next_unique_id = other_mesh.next_unique_id();
206#endif
207 // If the other mesh interior_parent pointers just go back to
208 // itself, so should we
209 _interior_mesh = (other_mesh._interior_mesh == &other_mesh) ?
210 this : other_mesh._interior_mesh;
212 _skip_all_partitioning = other_mesh.skip_partitioning();
213 _skip_renumber_nodes_and_elements = !(other_mesh.allow_renumbering());
214 _skip_find_neighbors = !(other_mesh.allow_find_neighbors());
215 _skip_detect_interior_parents = !(other_mesh.allow_detect_interior_parents());
216 _allow_remote_element_removal = other_mesh.allow_remote_element_removal();
217 _allow_node_and_elem_unique_id_overlap = other_mesh.allow_node_and_elem_unique_id_overlap();
218 _block_id_to_name = std::move(other_mesh._block_id_to_name);
219 _elem_dims = std::move(other_mesh.elem_dimensions());
220 _elem_default_orders = std::move(other_mesh.elem_default_orders());
221 _supported_nodal_order = other_mesh.supported_nodal_order();
222 _mesh_subdomains = other_mesh._mesh_subdomains;
223 _elemset_codes = std::move(other_mesh._elemset_codes);
224 _elemset_codes_inverse_map = std::move(other_mesh._elemset_codes_inverse_map);
225 _all_elemset_ids = std::move(other_mesh._all_elemset_ids);
226 _spatial_dimension = other_mesh.spatial_dimension();
227 _elem_integer_names = std::move(other_mesh._elem_integer_names);
228 _elem_integer_default_values = std::move(other_mesh._elem_integer_default_values);
229 _node_integer_names = std::move(other_mesh._node_integer_names);
230 _node_integer_default_values = std::move(other_mesh._node_integer_default_values);
231 _point_locator_close_to_point_tol = other_mesh.get_point_locator_close_to_point_tol();
232
233#ifdef LIBMESH_ENABLE_PERIODIC
234 // Deep copy of all periodic boundaries:
235 // We must clone each PeriodicBoundaryBase in the source map,
236 // since unique_ptr cannot be copied and we need independent instances
237 if (other_mesh._disjoint_neighbor_boundary_pairs)
238 {
239 _disjoint_neighbor_boundary_pairs = std::make_unique<PeriodicBoundaries>();
240
241 for (const auto & [id, pb] : *other_mesh._disjoint_neighbor_boundary_pairs)
242 if (pb)
244 }
245#endif
246
247 // This relies on our subclasses *not* invalidating pointers when we
248 // do their portion of the move assignment later!
249 boundary_info = std::move(other_mesh.boundary_info);
250 boundary_info->set_mesh(*this);
251
252#ifdef DEBUG
253 // Make sure that move assignment worked for pointers
254 for (const auto & [set, code] : _elemset_codes_inverse_map)
255 {
256 auto it = _elemset_codes.find(code);
257 libmesh_assert_msg(it != _elemset_codes.end(),
258 "Elemset code " << code << " not found in _elmset_codes container.");
259 libmesh_assert_equal_to(it->second, &set);
260 }
261#endif
262
263 // We're *not* really done at this point, but we have the problem
264 // that some of our data movement might be expecting subclasses data
265 // movement to happen first. We'll let subclasses handle that by
266 // calling our post_dofobject_moves()
267 return *this;
268}
void skip_noncritical_partitioning(bool skip)
If true is passed in then the elements on this mesh will no longer be (re)partitioned,...
Definition mesh_base.h:1411
ParallelObject & operator=(const ParallelObject &libmesh_dbg_var(other))
"Assignment" operator.

References _all_elemset_ids, _allow_node_and_elem_unique_id_overlap, _allow_remote_element_removal, _block_id_to_name, _const_active_local_element_stored_range, _count_lower_dim_elems_in_point_locator, _default_mapping_data, _default_mapping_type, _disjoint_neighbor_boundary_pairs, _elem_default_orders, _elem_dims, _elem_integer_default_values, _elem_integer_names, _element_stored_range, _elemset_codes, _elemset_codes_inverse_map, _interior_mesh, _mesh_subdomains, _n_parts, _next_unique_id, _node_integer_default_values, _node_integer_names, _point_locator, _point_locator_close_to_point_tol, _preparation, _skip_all_partitioning, _skip_detect_interior_parents, _skip_find_neighbors, _skip_noncritical_partitioning, _skip_renumber_nodes_and_elements, _spatial_dimension, _supported_nodal_order, boundary_info, and libMesh::ParallelObject::operator=().

◆ operator==()

bool libMesh::MeshBase::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).

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.

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}
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

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

◆ own_node()

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

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 869 of file mesh_base.h.

869{}

◆ parallel_max_unique_id()

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

◆ parallel_n_elem()

virtual dof_id_type libMesh::MeshBase::parallel_n_elem ( ) const
pure virtual
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 virtual
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 ( )
inline

Definition at line 1320 of file mesh_base.h.

1321 { this->partition(this->n_processors()); }

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

Referenced by complete_preparation(), and partition().

◆ partition() [2/2]

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

Call the default partitioner (currently metis_partition()).

Definition at line 1769 of file mesh_base.C.

1770{
1771 // If we get here and we have unpartitioned elements, we need that
1772 // fixed.
1773 if (this->n_unpartitioned_elem() > 0)
1774 {
1776 libmesh_assert (this->is_serial());
1777 partitioner()->partition (*this, n_parts);
1778 }
1779 // A nullptr partitioner or a skip_partitioning(true) call or a
1780 // skip_noncritical_partitioning(true) call means don't repartition;
1781 // skip_noncritical_partitioning() checks all these.
1783 {
1784 partitioner()->partition (*this, n_parts);
1785 }
1786 else
1787 {
1788 // Adaptive coarsening may have "orphaned" nodes on processors
1789 // whose elements no longer share them. We need to check for
1790 // and possibly fix that.
1792
1793 // Make sure locally cached partition count is correct
1795
1796 // Make sure any other locally cached data is correct
1798 }
1799
1801}
virtual std::unique_ptr< Partitioner > & partitioner()
A partitioner to use at each partitioning.
Definition mesh_base.h:165
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:1813
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:1180
bool skip_noncritical_partitioning() const
Definition mesh_base.h:1414
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...
const Elem & get(const ElemType type_in)

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

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

◆ partitioner()

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

◆ point()

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

◆ post_dofobject_moves()

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

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 2396 of file mesh_base.C.

2397{
2398 // Now that all the DofObject moving is done, we can move the GhostingFunctor objects
2399 // which include the _default_ghosting,_ghosting_functors and _shared_functors. We also need
2400 // to set the mesh object associated with these functors to the assignee mesh.
2401
2402 // _default_ghosting
2403 _default_ghosting = std::move(other_mesh._default_ghosting);
2404 _default_ghosting->set_mesh(this);
2405
2406 // _ghosting_functors
2407 _ghosting_functors = std::move(other_mesh._ghosting_functors);
2408
2409 for (const auto gf : _ghosting_functors )
2410 {
2411 gf->set_mesh(this);
2412 }
2413
2414 // _shared_functors
2415 _shared_functors = std::move(other_mesh._shared_functors);
2416
2417 for (const auto & sf : _shared_functors )
2418 {
2419 (sf.second)->set_mesh(this);
2420 }
2421
2422 // _constraint_rows
2423 _constraint_rows = std::move(other_mesh._constraint_rows);
2424
2425 if (other_mesh.partitioner())
2426 _partitioner = std::move(other_mesh.partitioner());
2427}

References _constraint_rows, _default_ghosting, _ghosting_functors, _partitioner, and _shared_functors.

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

◆ preparation()

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

Definition at line 213 of file mesh_base.h.

214 { return _preparation; }

References _preparation.

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

◆ prepare_for_use() [1/3]

void libMesh::MeshBase::prepare_for_use ( )

◆ prepare_for_use() [2/3]

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

Definition at line 843 of file mesh_base.C.

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}
bool allow_renumbering() const
Definition mesh_base.h:1356
void prepare_for_use()
Definition mesh_base.C:860

References allow_renumbering(), and prepare_for_use().

◆ prepare_for_use() [3/3]

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

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.

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:1363

References allow_find_neighbors(), allow_renumbering(), and prepare_for_use().

Referenced by LinearElasticityWithContact::add_contact_edge_elements(), libMesh::MeshTools::Subdivision::all_subdivision(), libMesh::MeshTools::Modification::all_tri(), ExodusC0PolyhedronTest::build_c0polyhedron(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), DisjointNeighborTest::build_four_disjoint_elems(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::InfElemBuilder::build_inf_elem(), ExodusC0PolygonTest::build_pentagon(), DisjointNeighborTest::build_split_mesh_with_interface(), DisjointNeighborTest::build_two_disjoint_elems(), VolumeTest::buildC0Polyhedron(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTools::Modification::flatten(), main(), libMesh::MeshTools::Subdivision::prepare_subdivision_mesh(), libMesh::GMVIO::read(), libMesh::SimplexRefiner::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(), ExodusTest< elem_type >::test_read_gold(), XdrIOTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), XdrIOTest< elem_type >::test_write(), ExodusC0PolyhedronTest::test_write_and_read_hexagonal_prism(), ExodusC0PolygonTest::test_write_and_read_pentagon(), MeshInputTest::testAbaqusRead(), AllTriTest::testAllTriC0PolygonOctagon(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundarySides(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), CheckpointIOTest::testC0PolygonCheckpoint(), CheckpointIOTest::testC0PolyhedronCheckpoint(), 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(), MeshTetTest::testNetGenQuadraticCurved(), MeshTetTest::testNetGenTet14Curved(), NodalNeighborsTest::testOrientation(), PeriodicBCTest::testPeriodicBC(), MeshTriangulationTest::testPoly2TriBad1DMultiBoundary(), MeshTriangulationTest::testPoly2TriBad2DMultiBoundary(), MeshTriangulationTest::testPoly2TriBadEdges(), MeshTriangulationTest::testPoly2TriEdge3ToTri6FlipThrows(), EquationSystemsTest::testPostInitAddElem(), SystemsTest::testProjectMatrix3D(), SystemsTest::testProjectScalarCoarsening(), 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::NetGenMeshInterface::triangulate(), libMesh::TriangleInterface::triangulate(), libMesh::Poly2TriTriangulator::triangulate(), and libMesh::MeshTetInterface::volume_to_surface_mesh().

◆ print_constraint_rows()

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

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 2783 of file mesh_base.C.

2785{
2786 parallel_object_only();
2787
2788 std::string local_constraints =
2789 this->get_local_constraints(print_nonlocal);
2790
2791 if (this->processor_id())
2792 {
2793 this->comm().send(0, local_constraints);
2794 }
2795 else
2796 {
2797 os << "Processor 0:\n";
2798 os << local_constraints;
2799
2800 for (auto p : IntRange<processor_id_type>(1, this->n_processors()))
2801 {
2802 this->comm().receive(p, local_constraints);
2803 os << "Processor " << p << ":\n";
2804 os << local_constraints;
2805 }
2806 }
2807}
Status receive(const unsigned int dest_processor_id, T &buf, const MessageTag &tag=any_tag) const
void send(const unsigned int dest_processor_id, const T &buf, const MessageTag &tag=no_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:2811

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

◆ print_info()

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

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 1755 of file mesh_base.C.

1756{
1757 os << this->get_info(verbosity, global)
1758 << std::endl;
1759}
std::string get_info(const unsigned int verbosity=0, const bool global=true) const
Definition mesh_base.C:1275

References get_info().

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

◆ 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.

115 { return cast_int<processor_id_type>(_communicator.rank()); }
processor_id_type rank() const

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

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DistributedMesh::add_node(), libMesh::MeshTools::Modification::all_tri(), 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::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DistributedMesh::DistributedMesh(), 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(), libMesh::UnstructuredMesh::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(), 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(), 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::MeshTools::Modification::interpolate_surface(), libMesh::SparsityPattern::Build::join(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::TransientRBEvaluation::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(), main(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::MeshTools::n_connected_components(), n_constraint_rows(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMapBase::n_local_dofs(), n_local_elem(), 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(), 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::XdrIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::NameBasedIO::read(), libMesh::EquationSystems::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::CheckpointIO::read_header(), libMesh::ExodusII_IO::read_header(), libMesh::System::read_header(), libMesh::XdrIO::read_header(), libMesh::DynaIO::read_mesh(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::TransientRBConstruction::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::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(), ExodusC0PolyhedronTest::test_write_and_read_hexagonal_prism(), ExodusC0PolygonTest::test_write_and_read_pentagon(), 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(), BoundaryMeshSubdomainTest::testPerBoundarySubdomain(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), BoundaryMeshSubdomainTest::testSingleSubdomain(), WriteVecAndScalar::testSolution(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshSmootherTest::testVariationalSmoother(), libMesh::MeshTools::total_weight(), libMesh::NetGenMeshInterface::triangulate(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::XdrIO::write(), libMesh::NameBasedIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO::write_element_data_from_discontinuous_nodal_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::ExodusII_IO::write_nodal_data(), libMesh::VTKIO::write_nodal_data(), libMesh::UCDIO::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::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_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::ExodusII_IO_Helper::write_sidesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

◆ query_elem_ptr() [1/2]

virtual const Elem * libMesh::MeshBase::query_elem_ptr ( const dof_id_type  i) const
pure virtual
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::ExodusII_IO::copy_elemental_solution(), libMesh::Nemesis_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(), 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(), ExodusC0PolyhedronTest::test_write_and_read_hexagonal_prism(), DofMapTest::testArrayDofIndicesWithType(), BoundaryInfoTest::testBoundaryIDs(), CheckpointIOTest::testC0PolygonCheckpoint(), VolumeTest::testC0PolygonMethods(), CheckpointIOTest::testC0PolyhedronCheckpoint(), VolumeTest::testC0PolyhedronMethods(), MeshDeletionsTest::testDeleteElem(), VolumeTest::testEdge3Volume(), ExtraIntegersTest::testExtraIntegersExodusReading(), MeshBaseTest::testMeshBaseVerifyHasCachedElemData(), EquationSystemsTest::testRefineThenReinitPreserveFlags(), EquationSystemsTest::testSelectivePRefine(), BoundaryInfoTest::testSelectiveRenumber(), BoundaryInfoTest::testShellFaceConstraints(), DisjointNeighborTest::testTempJump(), MeshInputTest::testTetgenIO(), and libMesh::Parallel::Packing< Elem * >::unpack().

◆ query_elem_ptr() [2/2]

virtual Elem * libMesh::MeshBase::query_elem_ptr ( const dof_id_type  i)
pure virtual
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 virtual

◆ query_node_ptr() [2/2]

virtual Node * libMesh::MeshBase::query_node_ptr ( const dof_id_type  i)
pure virtual
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()

virtual void libMesh::MeshBase::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 
)
pure virtual

◆ recalculate_n_partitions()

unsigned int libMesh::MeshBase::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.

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 1813 of file mesh_base.C.

1814{
1815 // This requires an inspection on every processor
1816 parallel_object_only();
1817
1818 unsigned int max_proc_id=0;
1819
1820 for (const auto & elem : this->active_local_element_ptr_range())
1821 max_proc_id = std::max(max_proc_id, static_cast<unsigned int>(elem->processor_id()));
1822
1823 // The number of partitions is one more than the max processor ID.
1824 _n_parts = max_proc_id+1;
1825
1826 this->comm().max(_n_parts);
1827
1828 return _n_parts;
1829}
void ErrorVector unsigned int

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

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

◆ redistribute()

void libMesh::MeshBase::redistribute ( )
virtual

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 1168 of file mesh_base.C.

1169{
1170 // We now have all elements and nodes redistributed; our ghosting
1171 // functors should be ready to redistribute and/or recompute any
1172 // cached data they use too.
1173 for (auto & gf : as_range(this->ghosting_functors_begin(),
1174 this->ghosting_functors_end()))
1175 gf->redistribute();
1176}
virtual void redistribute()
Redistribute elements between processors.
Definition mesh_base.C:1168
GhostingFunctorIterator ghosting_functors_begin() const
Beginning of range of ghosting functors.
Definition mesh_base.h:1472
GhostingFunctorIterator ghosting_functors_end() const
End of range of ghosting functors.
Definition mesh_base.h:1478
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.

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

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

◆ reinit_ghosting_functors()

void libMesh::MeshBase::reinit_ghosting_functors ( )

Loops over ghosting functors and calls mesh_reinit()

Definition at line 1025 of file mesh_base.C.

1026{
1027 for (auto & gf : _ghosting_functors)
1028 {
1029 libmesh_assert(gf);
1030 gf->mesh_reinit();
1031 }
1032
1034}

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

Referenced by complete_preparation().

◆ remove_disjoint_boundary_pair()

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

Definition at line 2306 of file mesh_base.C.

2308 {
2309 // Nothing to remove if not allocated or empty
2311 return;
2312
2313 auto & pairs = *_disjoint_neighbor_boundary_pairs;
2314
2315 // Helper to check and erase both directions
2316 auto erase_if_match = [](boundary_id_type key,
2317 boundary_id_type pair,
2318 PeriodicBoundaries & pb_map)
2319 {
2320 auto it = pb_map.find(key);
2321 if (it != pb_map.end())
2322 {
2323 const auto & pb = *(it->second);
2324 // Check both directions
2325 if ((pb.myboundary == key && pb.pairedboundary == pair) ||
2326 (pb.pairedboundary == key && pb.myboundary == pair))
2327 pb_map.erase(it);
2328 }
2329 };
2330
2331 erase_if_match(b1, b2, pairs);
2332 erase_if_match(b2, b1, pairs);
2333 }
int8_t boundary_id_type
Definition id_types.h:51

References _disjoint_neighbor_boundary_pairs.

Referenced by libMesh::UnstructuredMesh::stitching_helper().

◆ remove_ghosting_functor()

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

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

Definition at line 1100 of file mesh_base.C.

1101{
1102 auto raw_it = std::find(_ghosting_functors.begin(),
1103 _ghosting_functors.end(), &ghosting_functor);
1104
1105 // The DofMap has a "to_mesh" parameter that tells it to avoid
1106 // registering a new functor with the mesh, but it doesn't keep
1107 // track of which functors weren't added, so we'll support "remove a
1108 // functor that isn't there" just like we did with set::erase
1109 // before.
1110 if (raw_it != _ghosting_functors.end())
1111 _ghosting_functors.erase(raw_it);
1112
1113 // We shouldn't have had two copies of the same functor
1114 libmesh_assert(std::find(_ghosting_functors.begin(),
1115 _ghosting_functors.end(),
1116 &ghosting_functor) ==
1117 _ghosting_functors.end());
1118
1119 if (const auto it = _shared_functors.find(&ghosting_functor);
1120 it != _shared_functors.end())
1121 _shared_functors.erase(it);
1122}

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

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

◆ remove_orphaned_nodes()

void libMesh::MeshBase::remove_orphaned_nodes ( )

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.

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.

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

Referenced by complete_preparation().

◆ renumber_elem()

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

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 virtual

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 virtual

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 complete_preparation(), libMesh::UnstructuredMesh::contract(), and write_output().

◆ reserve_elem()

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

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::ReplicatedMesh, and libMesh::DistributedMesh.

Referenced by libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::UnstructuredMesh::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 virtual

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::ReplicatedMesh, and libMesh::DistributedMesh.

Referenced by libMesh::UnstructuredMesh::all_complete_order_range(), libMesh::UnstructuredMesh::all_second_order_range(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::UnstructuredMesh::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)

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 1873 of file mesh_base.C.

1874{
1875 _count_lower_dim_elems_in_point_locator = count_lower_dim_elems;
1876}

References _count_lower_dim_elems_in_point_locator.

◆ set_default_mapping_data()

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

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

Definition at line 968 of file mesh_base.h.

969 {
971 }

References _default_mapping_data.

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

◆ set_default_mapping_type()

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

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

Definition at line 950 of file mesh_base.h.

951 {
953 }

References _default_mapping_type.

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

◆ set_distributed()

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

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 372 of file mesh_base.h.

373 { libmesh_error(); }

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

◆ set_elem_dimensions()

void libMesh::MeshBase::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.

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.

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}

References _elem_dims, and cache_elem_data().

◆ set_interior_mesh()

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

Sets the interior mesh.

For advanced use only.

Definition at line 2050 of file mesh_base.h.

2050{ _interior_mesh = &int_mesh; }

References _interior_mesh.

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

◆ set_isnt_prepared()

void libMesh::MeshBase::set_isnt_prepared ( )
inline

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.

229 { libmesh_deprecated(); _preparation = false; }

References _preparation.

◆ set_mesh_dimension()

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

◆ set_n_partitions()

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

Definition at line 2164 of file mesh_base.h.

2165 { return _n_parts; }

References _n_parts.

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

◆ set_next_unique_id()

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

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 libMesh::UnstructuredMesh::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)

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 2340 of file mesh_base.C.

2341{
2343 if (_point_locator)
2344 {
2345 if (val > 0.)
2346 _point_locator->set_close_to_point_tol(val);
2347 else
2348 _point_locator->unset_close_to_point_tol();
2349 }
2350}

References _point_locator, and _point_locator_close_to_point_tol.

◆ set_spatial_dimension()

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

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.

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.
619}

References _spatial_dimension.

Referenced by libMesh::MeshTools::Generation::build_cube(), MeshSpatialDimensionTest::test2D(), and InfFERadialTest::testRefinement().

◆ set_subdomain_name()

void libMesh::MeshBase::set_subdomain_name ( subdomain_id_type  id,
const std::string &  name,
bool  synchronous = false 
)

Sets the name for the provided id.

Parameters
idThe subdomain id to set the name for
nameThe subdomain name
synchronousWhether this method is being called across all mesh ranks. If this is true, then we don't have to register this collective container as being out of sync

Definition at line 1914 of file mesh_base.C.

1917{
1918 if (synchronous)
1919 parallel_object_only();
1920 else
1922 _block_id_to_name[id] = name;
1923}
void unset_has_synched_subdomain_name_map()
Tells this we have done some operation which may have left the subdomain id to name map inconsistent ...
Definition mesh_base.h:350

References _block_id_to_name, and unset_has_synched_subdomain_name_map().

Referenced by libMesh::AbaqusIO::assign_subdomain_ids(), libMesh::UNVIO::groups_in(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::GmshIO::read_mesh(), libMesh::UnstructuredMesh::stitching_helper(), MeshStitchTest::testAmbiguousRemappingStitch(), and MeshStitchTest::testRemappingStitch().

◆ set_subdomain_name_map()

std::map< subdomain_id_type, std::string > & libMesh::MeshBase::set_subdomain_name_map ( )
inline

◆ size_elem_extra_integers()

void libMesh::MeshBase::size_elem_extra_integers ( )
protected

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

Definition at line 2361 of file mesh_base.C.

2362{
2363 const std::size_t new_size = _elem_integer_names.size();
2364
2366 (this->element_stored_range(),
2367 [new_size, this](const ElemRange & range)
2368 {
2369 for (Elem * elem : range)
2370 elem->add_extra_integers(new_size, this->_elem_integer_default_values);
2371 });
2372}

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

Referenced by add_elem_data(), add_elem_datum(), add_elem_integer(), and add_elem_integers().

◆ size_node_extra_integers()

void libMesh::MeshBase::size_node_extra_integers ( )
protected

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

Definition at line 2376 of file mesh_base.C.

2377{
2378 const std::size_t new_size = _node_integer_names.size();
2379 for (auto node : this->node_ptr_range())
2380 node->add_extra_integers(new_size, _node_integer_default_values);
2381}

References _node_integer_default_values, and _node_integer_names.

Referenced by add_node_data(), add_node_datum(), add_node_integer(), and add_node_integers().

◆ skip_noncritical_partitioning() [1/2]

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

◆ skip_noncritical_partitioning() [2/2]

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

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 1411 of file mesh_base.h.

References _skip_noncritical_partitioning.

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

◆ skip_partitioning() [1/2]

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

◆ skip_partitioning() [2/2]

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

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 1429 of file mesh_base.h.

1429{ _skip_all_partitioning = skip; }

References _skip_all_partitioning.

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

◆ spatial_dimension()

unsigned int libMesh::MeshBase::spatial_dimension ( ) const
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.

607{
608 return cast_int<unsigned int>(_spatial_dimension);
609}

References _spatial_dimension.

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

◆ sub_point_locator()

std::unique_ptr< PointLocatorBase > libMesh::MeshBase::sub_point_locator ( ) const
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 1833 of file mesh_base.C.

1834{
1835 // If there's no master point locator, then we need one.
1836 if (_point_locator.get() == nullptr)
1837 {
1838 // PointLocator construction may not be safe within threads
1840
1841 // And it may require parallel communication
1842 parallel_object_only();
1843
1844#ifdef LIBMESH_ENABLE_NANOFLANN_POINTLOCATOR
1846#else
1848#endif
1849
1851 _point_locator->set_close_to_point_tol(_point_locator_close_to_point_tol);
1852 }
1853
1854 // Otherwise there was a master point locator, and we can grab a
1855 // sub-locator easily.
1856 return
1857#ifdef LIBMESH_ENABLE_NANOFLANN_POINTLOCATOR
1859#else
1861#endif
1862}
static std::unique_ptr< PointLocatorBase > build(PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=nullptr)
Builds an PointLocator for the mesh mesh.

References _point_locator, _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(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshFunction::init(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), main(), libMesh::DefaultCoupling::mesh_reinit(), libMesh::OverlapCoupling::mesh_reinit(), libMesh::PointNeighborCoupling::mesh_reinit(), MeshPerElemTest< elem_type >::meshes_equal_enough(), OverlappingCouplingFunctor::operator()(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), PointLocatorTest::testLocator(), MeshInputTest::testMasterCenters(), PointLocatorTest::testPlanar(), SystemsTest::testProjectCube(), SystemsTest::testProjectLine(), and SystemsTest::testProjectSquare().

◆ subclass_locally_equals()

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

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

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

Referenced by locally_equals().

◆ subdomain_ids()

void libMesh::MeshBase::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).

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 1126 of file mesh_base.C.

1127{
1128 // This requires an inspection on every processor
1129 if (global)
1130 parallel_object_only();
1131
1132 struct SBDInserter {
1133 std::set<subdomain_id_type> my_ids;
1134
1135 SBDInserter () {}
1136 SBDInserter (SBDInserter &, Threads::split) {}
1137
1138 void operator()(const ConstElemRange & range) {
1139 for (const Elem * elem : range)
1140 my_ids.insert(elem->subdomain_id());
1141 }
1142
1143 void join(SBDInserter & other) {
1144 my_ids.merge(other.my_ids);
1145 }
1146 };
1147
1148 SBDInserter inserter;
1150
1151 ids.swap(inserter.my_ids);
1152
1153 if (global)
1154 {
1155 // Only include the unpartitioned elements if the user requests the global IDs.
1156 // In the case of the local subdomain IDs, it doesn't make sense to include the
1157 // unpartitioned elements because said elements do not have a sense of locality.
1158 for (const auto & elem : this->active_unpartitioned_element_ptr_range())
1159 ids.insert(elem->subdomain_id());
1160
1161 // Some subdomains may only live on other processors
1162 this->comm().set_union(ids);
1163 }
1164}
const ConstElemRange & active_local_element_stored_range() const
Definition mesh_base.C:1954
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.

References active_local_element_stored_range(), libMesh::ParallelObject::comm(), libMesh::Threads::parallel_reduce(), and libMesh::Parallel::Communicator::set_union().

Referenced by copy_constraint_rows(), libMesh::ReplicatedMesh::get_disconnected_subdomains(), n_local_subdomains(), n_subdomains(), OverlappingCouplingFunctor::OverlappingCouplingFunctor(), libMesh::TecplotIO::TecplotIO(), MeshSubdomainIDTest::testMultiple(), and MeshSubdomainIDTest::testUnpartitioned().

◆ subdomain_name() [1/2]

std::string & libMesh::MeshBase::subdomain_name ( subdomain_id_type  id)
Deprecated:
Returns
A writable reference for setting an optional name for a subdomain. This method is deprecated; use set_subdomain_name() instead.

Definition at line 1887 of file mesh_base.C.

1888{
1889 // Use set_subdomain_name() instead
1890 libmesh_deprecated();
1891
1892 // We'd like to do this so our preparation isn't invalidated by a
1893 // write, but for all we know the user is just reading from a
1894 // non-const mesh!
1895 // this->unset_has_synched_subdomain_name_map();
1896
1897 return _block_id_to_name[id];
1898}

References _block_id_to_name.

Referenced by DMlibMeshSetSystem_libMesh(), MeshInputTest::testGmshBCIDOverlap(), libMesh::TecplotIO::write_binary(), and libMesh::ExodusII_IO_Helper::write_elements().

◆ subdomain_name() [2/2]

const std::string & libMesh::MeshBase::subdomain_name ( subdomain_id_type  id) const
Returns
A reference for getting an optional name for a subdomain.

Definition at line 1902 of file mesh_base.C.

1903{
1904 // An empty string to return when no matching subdomain name is found
1905 static const std::string empty;
1906
1907 if (const auto iter = _block_id_to_name.find(id);
1908 iter == _block_id_to_name.end())
1909 return empty;
1910 else
1911 return iter->second;
1912}

References _block_id_to_name.

◆ supported_nodal_order()

Order libMesh::MeshBase::supported_nodal_order ( ) const
inline
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 445 of file mesh_base.h.

446 { return _supported_nodal_order; }

References _supported_nodal_order.

Referenced by get_info().

◆ sync_subdomain_name_map()

void libMesh::MeshBase::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.

This method can synchronize the subdomain id to name map across processors, assuming no conflicts exist. It is called automatically during complete_preparation() unless the map is already known to be synchronized.

Definition at line 2066 of file mesh_base.C.

2067{
2068 // This requires every processor
2069 parallel_object_only();
2070
2072
2074}

References _block_id_to_name, _preparation, libMesh::ParallelObject::comm(), libMesh::MeshBase::Preparation::has_synched_subdomain_name_map, and libMesh::Parallel::Communicator::set_union().

Referenced by complete_preparation().

◆ unset_has_boundary_id_sets()

void libMesh::MeshBase::unset_has_boundary_id_sets ( )
inline

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 _preparation, and libMesh::MeshBase::Preparation::has_boundary_id_sets.

Referenced by libMesh::BoundaryInfo::add_elements(), and MeshBaseTest::testMeshBaseVerifyRemovalPreparation().

◆ unset_has_cached_elem_data()

void libMesh::MeshBase::unset_has_cached_elem_data ( )
inline

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 _preparation, and libMesh::MeshBase::Preparation::has_cached_elem_data.

Referenced by libMesh::BoundaryInfo::add_elements(), libMesh::MeshTools::Modification::change_subdomain_id(), libMesh::MeshTools::Modification::redistribute(), libMesh::MeshTools::Modification::rotate(), libMesh::MeshTools::Modification::scale(), MeshBaseTest::testMeshBaseVerifyHasCachedElemData(), and libMesh::MeshTools::Modification::translate().

◆ unset_has_interior_parent_ptrs()

void libMesh::MeshBase::unset_has_interior_parent_ptrs ( )
inline

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 _preparation, and libMesh::MeshBase::Preparation::has_interior_parent_ptrs.

◆ unset_has_neighbor_ptrs()

void libMesh::MeshBase::unset_has_neighbor_ptrs ( )
inline

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 _preparation, and libMesh::MeshBase::Preparation::has_neighbor_ptrs.

Referenced by libMesh::BoundaryInfo::add_elements(), and MeshBaseTest::testMeshBaseVerifyHasNeighborPtrs().

◆ unset_has_reinit_ghosting_functors()

void libMesh::MeshBase::unset_has_reinit_ghosting_functors ( )
inline

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 _preparation, and libMesh::MeshBase::Preparation::has_reinit_ghosting_functors.

Referenced by libMesh::BoundaryInfo::add_elements().

◆ unset_has_removed_orphaned_nodes()

void libMesh::MeshBase::unset_has_removed_orphaned_nodes ( )
inline

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 _preparation, and libMesh::MeshBase::Preparation::has_removed_orphaned_nodes.

Referenced by MeshBaseTest::testMeshBaseVerifyRemovalPreparation().

◆ unset_has_removed_remote_elements()

void libMesh::MeshBase::unset_has_removed_remote_elements ( )
inline

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 _preparation, and libMesh::MeshBase::Preparation::has_removed_remote_elements.

◆ unset_has_synched_id_counts()

void libMesh::MeshBase::unset_has_synched_id_counts ( )
inline

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 _preparation, and libMesh::MeshBase::Preparation::has_synched_id_counts.

◆ unset_has_synched_subdomain_name_map()

void libMesh::MeshBase::unset_has_synched_subdomain_name_map ( )
inline

Tells this we have done some operation which may have left the subdomain id to name map inconsistent across processors.

User code which adds or changes subdomain names should call this method.

Definition at line 350 of file mesh_base.h.

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

Referenced by set_subdomain_name(), and set_subdomain_name_map().

◆ unset_is_partitioned()

void libMesh::MeshBase::unset_is_partitioned ( )
inline

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.

247 { _preparation.is_partitioned = false; }

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

Referenced by MeshBaseTest::testMeshBaseVerifyRemovalPreparation().

◆ unset_is_prepared()

void libMesh::MeshBase::unset_is_prepared ( )

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 1070 of file mesh_base.C.

1071{
1072 _preparation = false;
1073 this->clear_point_locator();
1074 this->clear_stored_ranges();
1075}

References _preparation, clear_point_locator(), and clear_stored_ranges().

Referenced by libMesh::UnstructuredMesh::copy_nodes_and_elements(), and MeshTetTest::testTrisToTets().

◆ update_parallel_id_counts()

virtual void libMesh::MeshBase::update_parallel_id_counts ( )
pure virtual

Updates parallel caches so that methods like n_elem() accurately reflect changes on other processors.

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

Referenced by complete_preparation().

◆ update_post_partitioning()

void libMesh::MeshBase::update_post_partitioning ( )
virtual

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 1180 of file mesh_base.C.

1181{
1182 // A range over all elements might still be fine here, but any range
1183 // over local elements is obsolete if our partitioner changed the
1184 // definition of "local".
1186}

References _const_active_local_element_stored_range.

Referenced by partition(), libMesh::Partitioner::partition(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), and libMesh::DistributedMesh::update_post_partitioning().

◆ write()

virtual void libMesh::MeshBase::write ( const std::string &  name) const
pure virtual

Friends And Related Symbol Documentation

◆ BoundaryInfo

friend class BoundaryInfo
friend

Make the BoundaryInfo class a friend so that it can create and interact with BoundaryMesh.

Definition at line 2466 of file mesh_base.h.

◆ MeshCommunication

friend class MeshCommunication
friend

Make the MeshCommunication class a friend so that it can directly broadcast *_integer_names.

Definition at line 2472 of file mesh_base.h.

◆ MeshInput< MeshBase >

friend class MeshInput< MeshBase >
friend

The MeshInput classes are friends so that they can set the number of partitions.

Definition at line 2454 of file mesh_base.h.

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const MeshBase m 
)
friend

Equivalent to calling print_info() above, but now you can write: Mesh mesh; libMesh::out << mesh << std::endl;.

Definition at line 1762 of file mesh_base.C.

1763{
1764 m.print_info(os);
1765 return os;
1766}

◆ Partitioner

friend class Partitioner
friend

The partitioner class is a friend so that it can set the number of partitions.

Definition at line 2454 of file mesh_base.h.

Member Data Documentation

◆ _all_elemset_ids

MeshBase::elemset_type libMesh::MeshBase::_all_elemset_ids
protected

◆ _allow_node_and_elem_unique_id_overlap

bool libMesh::MeshBase::_allow_node_and_elem_unique_id_overlap
protected

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 2301 of file mesh_base.h.

Referenced by allow_node_and_elem_unique_id_overlap(), allow_node_and_elem_unique_id_overlap(), locally_equals(), and operator=().

◆ _allow_remote_element_removal

bool libMesh::MeshBase::_allow_remote_element_removal
protected

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 2288 of file mesh_base.h.

Referenced by allow_remote_element_removal(), allow_remote_element_removal(), complete_preparation(), locally_equals(), operator=(), and prepare_for_use().

◆ _block_id_to_name

std::map<subdomain_id_type, std::string> libMesh::MeshBase::_block_id_to_name
protected

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 2308 of file mesh_base.h.

Referenced by get_id_by_name(), get_subdomain_name_map(), locally_equals(), operator=(), set_subdomain_name(), set_subdomain_name_map(), subdomain_name(), subdomain_name(), and 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
mutableprotected

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 2216 of file mesh_base.h.

Referenced by active_local_element_stored_range(), clear_stored_ranges(), operator=(), and update_post_partitioning().

◆ _constraint_rows

constraint_rows_type libMesh::MeshBase::_constraint_rows
protected

◆ _count_lower_dim_elems_in_point_locator

bool libMesh::MeshBase::_count_lower_dim_elems_in_point_locator
protected

Do we count lower dimensional elements in point locator refinement? This is relevant in tree-based point locators, for example.

Definition at line 2231 of file mesh_base.h.

Referenced by get_count_lower_dim_elems_in_point_locator(), locally_equals(), operator=(), and set_count_lower_dim_elems_in_point_locator().

◆ _default_ghosting

std::unique_ptr<GhostingFunctor> libMesh::MeshBase::_default_ghosting
protected

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 2415 of file mesh_base.h.

Referenced by default_ghosting(), locally_equals(), MeshBase(), MeshBase(), and post_dofobject_moves().

◆ _default_mapping_data

unsigned char libMesh::MeshBase::_default_mapping_data
protected

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 2190 of file mesh_base.h.

Referenced by default_mapping_data(), locally_equals(), operator=(), and set_default_mapping_data().

◆ _default_mapping_type

ElemMappingType libMesh::MeshBase::_default_mapping_type
protected

The default mapping type (typically Lagrange) between master and physical space to assign to newly added elements.

Definition at line 2183 of file mesh_base.h.

Referenced by default_mapping_type(), locally_equals(), operator=(), and set_default_mapping_type().

◆ _disjoint_neighbor_boundary_pairs

std::unique_ptr<PeriodicBoundaries> libMesh::MeshBase::_disjoint_neighbor_boundary_pairs
protected

◆ _elem_default_orders

std::set<Order> libMesh::MeshBase::_elem_default_orders
protected

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 2322 of file mesh_base.h.

Referenced by cache_elem_data(), clear(), copy_cached_data(), copy_constraint_rows(), elem_default_orders(), get_info(), locally_equals(), and operator=().

◆ _elem_dims

std::set<unsigned char> libMesh::MeshBase::_elem_dims
protected

We cache the dimension of the elements present in the mesh.

So, if we have a mesh with 1D and 2D elements, this structure will contain 1 and 2.

Definition at line 2315 of file mesh_base.h.

Referenced by cache_elem_data(), clear(), copy_cached_data(), copy_constraint_rows(), elem_dimensions(), get_info(), locally_equals(), mesh_dimension(), MeshBase(), operator=(), set_elem_dimensions(), and set_mesh_dimension().

◆ _elem_integer_default_values

std::vector<dof_id_type> libMesh::MeshBase::_elem_integer_default_values
protected

◆ _elem_integer_names

std::vector<std::string> libMesh::MeshBase::_elem_integer_names
protected

◆ _element_stored_range

std::unique_ptr<ElemRange> libMesh::MeshBase::_element_stored_range
mutableprotected

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 2205 of file mesh_base.h.

Referenced by clear_stored_ranges(), element_stored_range(), and operator=().

◆ _elemset_codes

std::map<dof_id_type, const MeshBase::elemset_type *> libMesh::MeshBase::_elemset_codes
protected

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 2357 of file mesh_base.h.

Referenced by add_elemset_code(), change_elemset_code(), change_elemset_id(), clear(), get_elemset_codes(), get_elemsets(), get_info(), locally_equals(), MeshBase(), and operator=().

◆ _elemset_codes_inverse_map

std::map<MeshBase::elemset_type, dof_id_type> libMesh::MeshBase::_elemset_codes_inverse_map
protected

◆ _ghosting_functors

std::vector<GhostingFunctor *> libMesh::MeshBase::_ghosting_functors
protected

The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.

Basically unused by ReplicatedMesh for now, but belongs to MeshBase because the cost is trivial.

Definition at line 2424 of file mesh_base.h.

Referenced by add_ghosting_functor(), ghosting_functors_begin(), ghosting_functors_end(), locally_equals(), MeshBase(), MeshBase(), post_dofobject_moves(), reinit_ghosting_functors(), and remove_ghosting_functor().

◆ _interior_mesh

MeshBase* libMesh::MeshBase::_interior_mesh
protected

Defaulting to this, a pointer to the mesh used to generate boundary elements on this.

Definition at line 2252 of file mesh_base.h.

Referenced by libMesh::UnstructuredMesh::copy_nodes_and_elements(), interior_mesh(), interior_mesh(), locally_equals(), operator=(), and set_interior_mesh().

◆ _mesh_subdomains

std::set<subdomain_id_type> libMesh::MeshBase::_mesh_subdomains
protected

We cache the subdomain ids of the elements present in the mesh.

Definition at line 2333 of file mesh_base.h.

Referenced by cache_elem_data(), copy_cached_data(), copy_constraint_rows(), get_mesh_subdomains(), locally_equals(), and operator=().

◆ _n_parts

unsigned int libMesh::MeshBase::_n_parts
protected

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 2177 of file mesh_base.h.

Referenced by clear(), locally_equals(), n_partitions(), operator=(), recalculate_n_partitions(), and set_n_partitions().

◆ _next_unique_id

unique_id_type libMesh::MeshBase::_next_unique_id
protected

◆ _node_integer_default_values

std::vector<dof_id_type> libMesh::MeshBase::_node_integer_default_values
protected

The array of default initialization values for integer data associated with each node in the mesh.

Definition at line 2389 of file mesh_base.h.

Referenced by libMesh::DistributedMesh::add_node(), libMesh::ReplicatedMesh::add_node(), add_node_integer(), add_node_integers(), libMesh::ReplicatedMesh::add_point(), locally_equals(), merge_extra_integer_names(), operator=(), and size_node_extra_integers().

◆ _node_integer_names

std::vector<std::string> libMesh::MeshBase::_node_integer_names
protected

◆ _partitioner

std::unique_ptr<Partitioner> libMesh::MeshBase::_partitioner
protected

A partitioner to use at each prepare_for_use().

This will be built in the constructor of each derived class, but can be replaced by the user through the partitioner() accessor.

Definition at line 2239 of file mesh_base.h.

Referenced by libMesh::DistributedMesh::DistributedMesh(), locally_equals(), MeshBase(), partitioner(), post_dofobject_moves(), libMesh::ReplicatedMesh::ReplicatedMesh(), and skip_noncritical_partitioning().

◆ _point_locator

std::unique_ptr<PointLocatorBase> libMesh::MeshBase::_point_locator
mutableprotected

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 2225 of file mesh_base.h.

Referenced by clear_point_locator(), operator=(), set_point_locator_close_to_point_tol(), and sub_point_locator().

◆ _point_locator_close_to_point_tol

Real libMesh::MeshBase::_point_locator_close_to_point_tol
protected

If nonzero, we will call PointLocatorBase::set_close_to_point_tol() on any PointLocators that we create.

Definition at line 2448 of file mesh_base.h.

Referenced by get_point_locator_close_to_point_tol(), locally_equals(), operator=(), set_point_locator_close_to_point_tol(), and sub_point_locator().

◆ _preparation

Preparation libMesh::MeshBase::_preparation
protected

◆ _shared_functors

std::map<GhostingFunctor *, std::shared_ptr<GhostingFunctor> > libMesh::MeshBase::_shared_functors
protected

Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form.

Definition at line 2430 of file mesh_base.h.

Referenced by add_ghosting_functor(), post_dofobject_moves(), and remove_ghosting_functor().

◆ _skip_all_partitioning

bool libMesh::MeshBase::_skip_all_partitioning
protected

If this is true then no partitioning should be done.

Definition at line 2263 of file mesh_base.h.

Referenced by locally_equals(), operator=(), skip_noncritical_partitioning(), skip_partitioning(), and skip_partitioning().

◆ _skip_detect_interior_parents

bool libMesh::MeshBase::_skip_detect_interior_parents
protected

If this is true then we will skip detect_interior_parents in prepare_for_use.

Definition at line 2280 of file mesh_base.h.

Referenced by allow_detect_interior_parents(), allow_detect_interior_parents(), complete_preparation(), locally_equals(), and operator=().

◆ _skip_find_neighbors

bool libMesh::MeshBase::_skip_find_neighbors
protected

If this is true then we will skip find_neighbors in prepare_for_use.

Definition at line 2275 of file mesh_base.h.

Referenced by allow_find_neighbors(), allow_find_neighbors(), complete_preparation(), locally_equals(), operator=(), and prepare_for_use().

◆ _skip_noncritical_partitioning

bool libMesh::MeshBase::_skip_noncritical_partitioning
protected

If this is true then no partitioning should be done with the possible exception of orphaned nodes.

Definition at line 2258 of file mesh_base.h.

Referenced by locally_equals(), operator=(), skip_noncritical_partitioning(), and skip_noncritical_partitioning().

◆ _skip_renumber_nodes_and_elements

bool libMesh::MeshBase::_skip_renumber_nodes_and_elements
protected

If this is true then renumbering will be kept to a minimum.

This is set when prepare_for_use() is called.

Definition at line 2270 of file mesh_base.h.

Referenced by allow_renumbering(), allow_renumbering(), complete_preparation(), locally_equals(), operator=(), libMesh::DistributedMesh::renumber_nodes_and_elements(), and libMesh::ReplicatedMesh::renumber_nodes_and_elements().

◆ _spatial_dimension

unsigned char libMesh::MeshBase::_spatial_dimension
protected

The "spatial dimension" of the Mesh.

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

Definition at line 2365 of file mesh_base.h.

Referenced by cache_elem_data(), copy_cached_data(), locally_equals(), operator=(), set_spatial_dimension(), and spatial_dimension().

◆ _supported_nodal_order

Order libMesh::MeshBase::_supported_nodal_order
protected

We cache the maximum nodal order supported by all the mesh's elements (the minimum supported_nodal_order() of any element)

Definition at line 2328 of file mesh_base.h.

Referenced by cache_elem_data(), clear(), copy_cached_data(), copy_constraint_rows(), locally_equals(), operator=(), and supported_nodal_order().

◆ boundary_info

std::unique_ptr<BoundaryInfo> libMesh::MeshBase::boundary_info
protected

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 2131 of file mesh_base.h.

Referenced by clear(), get_boundary_info(), get_boundary_info(), locally_equals(), and operator=().

◆ ElemRange

const DofMap& dof_map LIBMESH_COMMA unsigned int Elem* libMesh::MeshBase::ElemRange

Definition at line 1894 of file mesh_base.h.

◆ var_num

const DofMap& dof_map LIBMESH_COMMA unsigned int libMesh::MeshBase::var_num

Definition at line 1846 of file mesh_base.h.


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