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

Public Types

typedef std::set< elemset_id_typeelemset_type
 Typedef for the "set" container used to store elemset ids. More...
 
typedef std::vector< GhostingFunctor * >::const_iterator GhostingFunctorIterator
 Iterator type for ghosting functor ranges. More...
 
typedef Predicates::multi_predicate Predicate
 We need an empty, generic class to act as a predicate for this and derived mesh classes. More...
 
typedef 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. More...
 
 MeshBase (const MeshBase &other_mesh)
 Copy-constructor. More...
 
 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. More...
 
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. More...
 
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. More...
 
bool operator== (const MeshBase &other_mesh) const
 This tests for exactly-equal data in all the senses that a mathematician would care about (element connectivity, nodal coordinates), but in the senses a programmer would care about it allows for non-equal equivalence in some ways (we accept different Elem/Node addresses in memory) but not others (we do not accept different subclass types, nor even different Elem/Node ids). More...
 
bool operator!= (const MeshBase &other_mesh) const
 
bool locally_equals (const MeshBase &other_mesh) const
 This behaves the same as operator==, but only for the local and ghosted aspects of the mesh; i.e. More...
 
virtual std::unique_ptr< MeshBaseclone () const =0
 Virtual "copy constructor". More...
 
virtual ~MeshBase ()
 Destructor. More...
 
virtual std::unique_ptr< Partitioner > & partitioner ()
 A partitioner to use at each prepare_for_use() More...
 
const BoundaryInfoget_boundary_info () const
 The information about boundary ids on the mesh. More...
 
BoundaryInfoget_boundary_info ()
 Writable information about boundary ids on the mesh. More...
 
virtual void clear ()
 Deletes all the element and node data that is currently stored. More...
 
virtual void clear_elems ()=0
 Deletes all the element data that is currently stored. More...
 
bool is_prepared () const
 
void set_isnt_prepared ()
 Tells this we have done some operation where we should no longer consider ourself prepared. More...
 
virtual bool is_serial () const
 
virtual bool is_serial_on_zero () const
 
virtual void set_distributed ()
 Asserts that not all elements and nodes of the mesh necessarily exist on the current processor. More...
 
virtual bool is_replicated () const
 
virtual void allgather ()
 Gathers all elements and nodes of the mesh onto every processor. More...
 
virtual void gather_to_zero ()
 Gathers all elements and nodes of the mesh onto processor zero. More...
 
virtual void delete_remote_elements ()
 When supported, deletes all nonlocal elements of the mesh except for "ghosts" which touch a local element, and deletes all nodes which are not part of a local or ghost element. More...
 
void reinit_ghosting_functors ()
 Loops over ghosting functors and calls mesh_reinit() More...
 
unsigned int mesh_dimension () const
 
void set_mesh_dimension (unsigned char d)
 Resets the logical dimension of the mesh. More...
 
const std::set< unsigned char > & elem_dimensions () const
 
const std::set< Order > & elem_default_orders () const
 
Order supported_nodal_order () const
 
void set_elem_dimensions (std::set< unsigned char > elem_dims)
 Most of the time you should not need to call this, as the element dimensions will be set automatically by a call to cache_elem_data(), therefore only call this if you know what you're doing. More...
 
void add_elemset_code (dof_id_type code, MeshBase::elemset_type id_set)
 Tabulate a user-defined "code" for elements which belong to the element sets specified in id_set. More...
 
unsigned int n_elemsets () const
 Returns the number of unique elemset ids which have been added via add_elemset_code(), which is the size of the _all_elemset_ids set. More...
 
void get_elemsets (dof_id_type elemset_code, MeshBase::elemset_type &id_set_to_fill) const
 Look up the element sets for a given elemset code and vice-versa. More...
 
dof_id_type get_elemset_code (const MeshBase::elemset_type &id_set) const
 
std::vector< dof_id_typeget_elemset_codes () const
 Return a vector of all elemset codes defined on the mesh. More...
 
void change_elemset_code (dof_id_type old_code, dof_id_type new_code)
 Replace elemset code "old_code" with "new_code". More...
 
void change_elemset_id (elemset_id_type old_id, elemset_id_type new_id)
 Replace elemset id "old_id" with "new_id". More...
 
unsigned int spatial_dimension () const
 
void set_spatial_dimension (unsigned char d)
 Sets the "spatial dimension" of the Mesh. More...
 
virtual dof_id_type n_nodes () const =0
 
virtual dof_id_type parallel_n_nodes () const =0
 
dof_id_type n_nodes_on_proc (const processor_id_type proc) const
 
dof_id_type n_local_nodes () const
 
dof_id_type n_unpartitioned_nodes () const
 
virtual dof_id_type max_node_id () const =0
 
unique_id_type next_unique_id ()
 
virtual void set_next_unique_id (unique_id_type id)=0
 Sets the next available unique id to be used. More...
 
virtual void reserve_nodes (const dof_id_type nn)=0
 Reserves space for a known number of nodes. More...
 
virtual dof_id_type n_elem () const =0
 
virtual dof_id_type parallel_n_elem () const =0
 
virtual dof_id_type max_elem_id () const =0
 
virtual unique_id_type parallel_max_unique_id () const =0
 
virtual void reserve_elem (const dof_id_type ne)=0
 Reserves space for a known number of elements. More...
 
virtual void update_parallel_id_counts ()=0
 Updates parallel caches so that methods like n_elem() accurately reflect changes on other processors. More...
 
virtual dof_id_type n_active_elem () const =0
 
dof_id_type n_elem_on_proc (const processor_id_type proc) const
 
dof_id_type n_local_elem () const
 
dof_id_type n_unpartitioned_elem () const
 
dof_id_type n_active_elem_on_proc (const processor_id_type proc) const
 
dof_id_type n_active_local_elem () const
 
dof_id_type n_sub_elem () const
 
dof_id_type n_active_sub_elem () const
 Same as n_sub_elem(), but only counts active elements. More...
 
virtual const Pointpoint (const dof_id_type i) const =0
 
virtual const Nodenode_ref (const dof_id_type i) const
 
virtual Nodenode_ref (const dof_id_type i)
 
virtual const Nodenode_ptr (const dof_id_type i) const =0
 
virtual Nodenode_ptr (const dof_id_type i)=0
 
virtual const Nodequery_node_ptr (const dof_id_type i) const =0
 
virtual Nodequery_node_ptr (const dof_id_type i)=0
 
virtual const Elemelem_ref (const dof_id_type i) const
 
virtual Elemelem_ref (const dof_id_type i)
 
virtual const Elemelem_ptr (const dof_id_type i) const =0
 
virtual Elemelem_ptr (const dof_id_type i)=0
 
virtual const Elemquery_elem_ptr (const dof_id_type i) const =0
 
virtual Elemquery_elem_ptr (const dof_id_type i)=0
 
virtual Nodeadd_point (const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
 Add a new Node at Point p to the end of the vertex array, with processor_id procid. More...
 
virtual Nodeadd_node (Node *n)=0
 Add Node n to the end of the vertex array. More...
 
virtual Nodeadd_node (std::unique_ptr< Node > n)=0
 Version of add_node() taking a std::unique_ptr by value. More...
 
virtual Nodeinsert_node (Node *n)=0
 This method is deprecated. More...
 
virtual Nodeinsert_node (std::unique_ptr< Node > n)=0
 This method is deprecated. More...
 
virtual void delete_node (Node *n)=0
 Removes the Node n from the mesh. More...
 
virtual void own_node (Node &)
 Takes ownership of node n on this partition of a distributed mesh, by setting n.processor_id() to this->processor_id(), as well as changing n.id() and moving it in the mesh's internal container to give it a new authoritative id. More...
 
virtual void renumber_node (dof_id_type old_id, dof_id_type new_id)=0
 Changes the id of node old_id, both by changing node(old_id)->id() and by moving node(old_id) in the mesh's internal container. More...
 
virtual Elemadd_elem (Elem *e)=0
 Add elem e to the end of the element array. More...
 
virtual Elemadd_elem (std::unique_ptr< Elem > e)=0
 Version of add_elem() taking a std::unique_ptr by value. More...
 
virtual Eleminsert_elem (Elem *e)=0
 Insert elem e to the element array, preserving its id and replacing/deleting any existing element with the same id. More...
 
virtual Eleminsert_elem (std::unique_ptr< Elem > e)=0
 Version of insert_elem() taking a std::unique_ptr by value. More...
 
virtual void delete_elem (Elem *e)=0
 Removes element e from the mesh. More...
 
virtual void renumber_elem (dof_id_type old_id, dof_id_type new_id)=0
 Changes the id of element old_id, both by changing elem(old_id)->id() and by moving elem(old_id) in the mesh's internal container. More...
 
ElemMappingType default_mapping_type () const
 Returns the default master space to physical space mapping basis functions to be used on newly added elements. More...
 
void set_default_mapping_type (const ElemMappingType type)
 Set the default master space to physical space mapping basis functions to be used on newly added elements. More...
 
unsigned char default_mapping_data () const
 Returns any default data value used by the master space to physical space mapping. More...
 
void set_default_mapping_data (const unsigned char data)
 Set the default master space to physical space mapping basis functions to be used on newly added elements. More...
 
virtual void find_neighbors (const bool reset_remote_elements=false, const bool reset_current_list=true)=0
 Locate element face (edge in 2D) neighbors. More...
 
void remove_orphaned_nodes ()
 Removes any orphaned nodes, nodes not connected to any elements. More...
 
virtual void renumber_nodes_and_elements ()=0
 After partitioning a mesh it is useful to renumber the nodes and elements so that they lie in contiguous blocks on the processors. More...
 
virtual void fix_broken_node_and_element_numbering ()=0
 There is no reason for a user to ever call this function. More...
 
virtual bool contract ()=0
 Delete subactive (i.e. More...
 
unsigned int add_elem_integer (std::string name, bool allocate_data=true, dof_id_type default_value=DofObject::invalid_id)
 Register an integer datum (of type dof_id_type) to be added to each element in the mesh. More...
 
std::vector< unsigned intadd_elem_integers (const std::vector< std::string > &names, bool allocate_data=true, const std::vector< dof_id_type > *default_values=nullptr)
 Register integer data (of type dof_id_type) to be added to each element in the mesh, one string name for each new integer. More...
 
unsigned int get_elem_integer_index (std::string_view name) const
 
bool has_elem_integer (std::string_view name) const
 
const std::string & get_elem_integer_name (unsigned int i) const
 
unsigned int n_elem_integers () const
 
template<typename T >
unsigned int add_elem_datum (const std::string &name, bool allocate_data=true, const T *default_value=nullptr)
 Register a datum (of type T) to be added to each element in the mesh. More...
 
template<typename T >
std::vector< unsigned intadd_elem_data (const std::vector< std::string > &names, bool allocate_data=true, const std::vector< T > *default_values=nullptr)
 Register data (of type T) to be added to each element in the mesh. More...
 
unsigned int add_node_integer (std::string name, bool allocate_data=true, dof_id_type default_value=DofObject::invalid_id)
 Register an integer datum (of type dof_id_type) to be added to each node in the mesh. More...
 
std::vector< unsigned intadd_node_integers (const std::vector< std::string > &names, bool allocate_data=true, const std::vector< dof_id_type > *default_values=nullptr)
 Register integer data (of type dof_id_type) to be added to each node in the mesh. More...
 
unsigned int get_node_integer_index (std::string_view name) const
 
bool has_node_integer (std::string_view name) const
 
const std::string & get_node_integer_name (unsigned int i) const
 
unsigned int n_node_integers () const
 
template<typename T >
unsigned int add_node_datum (const std::string &name, bool allocate_data=true, const T *default_value=nullptr)
 Register a datum (of type T) to be added to each node in the mesh. More...
 
template<typename T >
std::vector< unsigned intadd_node_data (const std::vector< std::string > &name, bool allocate_data=true, const std::vector< T > *default_values=nullptr)
 Register data (of type T) to be added to each node in the mesh. More...
 
void prepare_for_use (const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
 Prepare a newly ecreated (or read) mesh for use. More...
 
void prepare_for_use (const bool skip_renumber_nodes_and_elements)
 
void prepare_for_use ()
 
virtual void partition (const unsigned int n_parts)
 Call the default partitioner (currently metis_partition()). More...
 
void partition ()
 
virtual void redistribute ()
 Redistribute elements between processors. More...
 
virtual void update_post_partitioning ()
 Recalculate any cached data after elements and nodes have been repartitioned. More...
 
void allow_renumbering (bool allow)
 If false is passed in then this mesh will no longer be renumbered when being prepared for use. More...
 
bool allow_renumbering () const
 
void allow_find_neighbors (bool allow)
 If false is passed then this mesh will no longer work to find element neighbors when being prepared for use. More...
 
bool allow_find_neighbors () const
 
void allow_remote_element_removal (bool allow)
 If false is passed in then this mesh will no longer have remote elements deleted when being prepared for use; i.e. More...
 
bool allow_remote_element_removal () const
 
void skip_noncritical_partitioning (bool skip)
 If true is passed in then the elements on this mesh will no longer be (re)partitioned, and the nodes on this mesh will only be repartitioned if they are found "orphaned" via coarsening or other removal of the last element responsible for their node/element processor id consistency. More...
 
bool skip_noncritical_partitioning () const
 
void skip_partitioning (bool skip)
 If true is passed in then nothing on this mesh will be (re)partitioned. More...
 
bool skip_partitioning () const
 
void add_ghosting_functor (GhostingFunctor &ghosting_functor)
 Adds a functor which can specify ghosting requirements for use on distributed meshes. More...
 
void add_ghosting_functor (std::shared_ptr< GhostingFunctor > ghosting_functor)
 Adds a functor which can specify ghosting requirements for use on distributed meshes. More...
 
void remove_ghosting_functor (GhostingFunctor &ghosting_functor)
 Removes a functor which was previously added to the set of ghosting functors. More...
 
GhostingFunctorIterator ghosting_functors_begin () const
 Beginning of range of ghosting functors. More...
 
GhostingFunctorIterator ghosting_functors_end () const
 End of range of ghosting functors. More...
 
GhostingFunctordefault_ghosting ()
 Default ghosting functor. More...
 
void subdomain_ids (std::set< subdomain_id_type > &ids, const bool global=true) const
 Constructs a list of all subdomain identifiers in the local mesh if global == false, and in the global mesh if global == true (default). More...
 
subdomain_id_type n_subdomains () const
 
subdomain_id_type n_local_subdomains () const
 
unsigned int n_partitions () const
 
std::string get_info (const unsigned int verbosity=0, const bool global=true) const
 
void print_info (std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
 Prints relevant information about the mesh. More...
 
virtual void read (const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
 Interfaces for reading/writing a mesh to/from a file. More...
 
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. More...
 
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. More...
 
void all_second_order (const bool full_ordered=true)
 Calls the range-based version of this function with a range consisting of all elements in the mesh. More...
 
virtual void all_complete_order_range (const SimpleRange< element_iterator > &range)=0
 Converts a set of elements in this (conforming, non-refined) mesh into "complete" order elements, i.e. More...
 
virtual void all_complete_order ()
 Calls the range-based version of this function with a range consisting of all elements in the mesh. More...
 
unsigned int recalculate_n_partitions ()
 In a few (very rare) cases, the user may have manually tagged the elements with specific processor IDs by hand, without using a partitioner. More...
 
std::unique_ptr< PointLocatorBasesub_point_locator () const
 
void set_point_locator_close_to_point_tol (Real val)
 Set value used by PointLocatorBase::close_to_point_tol(). More...
 
Real get_point_locator_close_to_point_tol () const
 
void clear_point_locator ()
 Releases the current PointLocator object. More...
 
void set_count_lower_dim_elems_in_point_locator (bool count_lower_dim_elems)
 In the point locator, do we count lower dimensional elements when we refine point locator regions? This is relevant in tree-based point locators, for example. More...
 
bool get_count_lower_dim_elems_in_point_locator () const
 Get the current value of _count_lower_dim_elems_in_point_locator. More...
 
virtual void libmesh_assert_valid_parallel_ids () const
 Verify id and processor_id consistency of our elements and nodes containers. More...
 
std::string & subdomain_name (subdomain_id_type id)
 
const std::string & subdomain_name (subdomain_id_type id) const
 
subdomain_id_type get_id_by_name (std::string_view name) const
 
 ABSTRACT_ELEM_ITERATORS (,) ABSTRACT_ELEM_ITERATORS(active_
 
 ABSTRACT_ELEM_ITERATORS (ancestor_,) ABSTRACT_ELEM_ITERATORS(subactive_
 
 ABSTRACT_ELEM_ITERATORS (local_,) ABSTRACT_ELEM_ITERATORS(unpartitioned_
 
 ABSTRACT_ELEM_ITERATORS (facelocal_,) ABSTRACT_ELEM_ITERATORS(level_
 
unsigned int level ABSTRACT_ELEM_ITERATORS (pid_, processor_id_type pid) ABSTRACT_ELEM_ITERATORS(type_
 
unsigned int level ElemType type ABSTRACT_ELEM_ITERATORS (active_subdomain_, subdomain_id_type sid) ABSTRACT_ELEM_ITERATORS(active_subdomain_set_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss ABSTRACT_ELEM_ITERATORS (not_active_,) ABSTRACT_ELEM_ITERATORS(not_ancestor_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss ABSTRACT_ELEM_ITERATORS (not_subactive_,) ABSTRACT_ELEM_ITERATORS(not_local_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss ABSTRACT_ELEM_ITERATORS (not_level_, unsigned int level) ABSTRACT_ELEM_ITERATORS(active_local_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss ABSTRACT_ELEM_ITERATORS (active_not_local_,) ABSTRACT_ELEM_ITERATORS(active_unpartitioned_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss ABSTRACT_ELEM_ITERATORS (active_type_, ElemType type) ABSTRACT_ELEM_ITERATORS(active_pid_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss processor_id_type pid ABSTRACT_ELEM_ITERATORS (local_level_, unsigned int level) ABSTRACT_ELEM_ITERATORS(local_not_level_
 
unsigned int level ElemType type std::set< subdomain_id_type > ss processor_id_type pid unsigned int level ABSTRACT_ELEM_ITERATORS (active_local_subdomain_, subdomain_id_type sid) ABSTRACT_ELEM_ITERATORS(active_local_subdomain_set_
 
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 DofMap &dof_map LIBMESH_COMMA unsigned int std::string & set_subdomain_name_map ()
 
const std::map< subdomain_id_type, std::string > & get_subdomain_name_map () const
 
constraint_rows_typeget_constraint_rows ()
 Constraint rows accessors. More...
 
const constraint_rows_typeget_constraint_rows () const
 
dof_id_type n_constraint_rows () const
 
void copy_constraint_rows (const MeshBase &other_mesh)
 Copy the constraints from the other mesh to this mesh. More...
 
template<typename T >
void copy_constraint_rows (const SparseMatrix< T > &constraint_operator, bool precondition_constraint_operator=false)
 Copy the constraints from the given matrix to this mesh. More...
 
void print_constraint_rows (std::ostream &os=libMesh::out, bool print_nonlocal=false) const
 Prints (from processor 0) all mesh constraint rows. More...
 
std::string get_local_constraints (bool print_nonlocal=false) const
 Gets a string reporting all mesh constraint rows local to this processor. More...
 
void cache_elem_dims ()
 
void cache_elem_data ()
 
void detect_interior_parents ()
 Search the mesh for elements that have a neighboring element of dim+1 and set that element as the interior parent. More...
 
const MeshBaseinterior_mesh () const
 
MeshBaseinterior_mesh ()
 
void set_interior_mesh (MeshBase &int_mesh)
 Sets the interior mesh. More...
 
const std::set< subdomain_id_type > & get_mesh_subdomains () const
 
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
 

Protected Types

typedef variant_filter_iterator< MeshBase::Predicate, Elem * > elem_filter_iter
 The original iterator classes weren't properly const-safe; relying on their const-incorrectness is now deprecated. More...
 
typedef variant_filter_iterator< MeshBase::Predicate, Elem *const, Elem *const &, Elem *const * > const_elem_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. More...
 
void copy_cached_data (const MeshBase &other_mesh)
 Helper class to copy cached data, to synchronize with a possibly unprepared other_mesh. More...
 
virtual bool subclass_locally_equals (const MeshBase &other_mesh) const =0
 Shim to allow operator == (&) to behave like a virtual function without having to be one. More...
 
bool nodes_and_elements_equal (const MeshBase &other_mesh) const
 Tests for equality of all elements and nodes in the mesh. More...
 
unsigned intset_n_partitions ()
 
void size_elem_extra_integers ()
 Size extra-integer arrays of all elements in the mesh. More...
 
void size_node_extra_integers ()
 Size extra-integer arrays of all nodes in the mesh. More...
 
std::pair< std::vector< unsigned int >, std::vector< unsigned int > > merge_extra_integer_names (const MeshBase &other)
 Merge extra-integer arrays from an other mesh. More...
 

Protected Attributes

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

Friends

class Partitioner
 The partitioner class is a friend so that it can set the number of partitions. More...
 
class MeshInput< MeshBase >
 The MeshInput classes are friends so that they can set the number of partitions. More...
 
class BoundaryInfo
 Make the BoundaryInfo class a friend so that it can create and interact with BoundaryMesh. More...
 
class MeshCommunication
 Make the MeshCommunication class a friend so that it can directly broadcast *_integer_names. More...
 
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;. More...
 

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

Member Typedef Documentation

◆ const_elem_filter_iter [1/2]

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

◆ const_node_filter_iter [1/2]

Definition at line 2160 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 2186 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 1703 of file mesh_base.h.

◆ constraint_rows_type

Definition at line 1704 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 2148 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 2168 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 318 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 1292 of file mesh_base.h.

◆ node_filter_iter [1/2]

Definition at line 2155 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 2181 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 1409 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 59 of file mesh_base.C.

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

60  :
61  ParallelObject (comm_in),
62  boundary_info (new BoundaryInfo(*this)), // BoundaryInfo has protected ctor, can't use std::make_unique
63  _n_parts (1),
66  _is_prepared (false),
67  _point_locator (),
69  _partitioner (),
70 #ifdef LIBMESH_ENABLE_UNIQUE_ID
72 #endif
73  _interior_mesh(this),
75  _skip_all_partitioning(libMesh::on_command_line("--skip-partitioning")),
77  _skip_find_neighbors(false),
80  _default_ghosting(std::make_unique<GhostPointNeighbors>(*this)),
82 {
83  _elem_dims.insert(d);
84  _ghosting_functors.push_back(_default_ghosting.get());
85  libmesh_assert_less_equal (LIBMESH_DIM, 3);
86  libmesh_assert_greater_equal (LIBMESH_DIM, d);
88 }
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
bool _skip_renumber_nodes_and_elements
If this is true then renumbering will be kept to a minimum.
Definition: mesh_base.h:1956
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
Definition: mesh_base.h:1938
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2092
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:1944
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2033
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
Definition: mesh_base.h:1836
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:1969
friend class BoundaryInfo
Make the BoundaryInfo class a friend so that it can create and interact with BoundaryMesh.
Definition: mesh_base.h:2134
unique_id_type _next_unique_id
The next available unique id for assigning ids to DOF objects.
Definition: mesh_base.h:1931
unsigned int _n_parts
The number of partitions the mesh has.
Definition: mesh_base.h:1884
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:1897
static const unique_id_type invalid_unique_id
An invalid unique_id to distinguish an uninitialized DofObject.
Definition: dof_object.h:487
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
Definition: mesh_base.h:1890
std::unique_ptr< Partitioner > _partitioner
A partitioner to use at each prepare_for_use().
Definition: mesh_base.h:1925
libmesh_assert(ctx)
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
Definition: mesh_base.h:1961
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983
bool _is_prepared
Flag indicating if the mesh has been prepared for use.
Definition: mesh_base.h:1902
std::unique_ptr< GhostingFunctor > _default_ghosting
The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior...
Definition: mesh_base.h:2083
bool initialized()
Checks that library initialization has been done.
Definition: libmesh.C:276
bool _skip_all_partitioning
If this is true then no partitioning should be done.
Definition: mesh_base.h:1949
bool on_command_line(std::string arg)
Definition: libmesh.C:987
std::unique_ptr< PointLocatorBase > _point_locator
A PointLocator class for this mesh.
Definition: mesh_base.h:1911
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:2116
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:1917

◆ MeshBase() [2/3]

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

Copy-constructor.

Definition at line 92 of file mesh_base.C.

References _default_ghosting, _elemset_codes, _elemset_codes_inverse_map, _ghosting_functors, _partitioner, add_ghosting_functor(), and libMesh::GhostingFunctor::clone().

92  :
93  ParallelObject (other_mesh),
94  boundary_info (new BoundaryInfo(*this)), // BoundaryInfo has protected ctor, can't use std::make_unique
95  _n_parts (other_mesh._n_parts),
96  _default_mapping_type(other_mesh._default_mapping_type),
97  _default_mapping_data(other_mesh._default_mapping_data),
98  _is_prepared (other_mesh._is_prepared),
99  _point_locator (),
100  _count_lower_dim_elems_in_point_locator(other_mesh._count_lower_dim_elems_in_point_locator),
101  _partitioner (),
102 #ifdef LIBMESH_ENABLE_UNIQUE_ID
103  _next_unique_id(other_mesh._next_unique_id),
104 #endif
105  // If the other mesh interior_parent pointers just go back to
106  // itself, so should we
107  _interior_mesh((other_mesh._interior_mesh == &other_mesh) ?
108  this : other_mesh._interior_mesh),
109  _skip_noncritical_partitioning(other_mesh._skip_noncritical_partitioning),
110  _skip_all_partitioning(other_mesh._skip_all_partitioning),
111  _skip_renumber_nodes_and_elements(other_mesh._skip_renumber_nodes_and_elements),
112  _skip_find_neighbors(other_mesh._skip_find_neighbors),
113  _allow_remote_element_removal(other_mesh._allow_remote_element_removal),
114  _elem_dims(other_mesh._elem_dims),
115  _elem_default_orders(other_mesh._elem_default_orders),
116  _supported_nodal_order(other_mesh._supported_nodal_order),
117  _elemset_codes_inverse_map(other_mesh._elemset_codes_inverse_map),
118  _all_elemset_ids(other_mesh._all_elemset_ids),
119  _spatial_dimension(other_mesh._spatial_dimension),
120  _default_ghosting(std::make_unique<GhostPointNeighbors>(*this)),
121  _point_locator_close_to_point_tol(other_mesh._point_locator_close_to_point_tol)
122 {
123  const GhostingFunctor * const other_default_ghosting = other_mesh._default_ghosting.get();
124 
125  for (GhostingFunctor * const gf : other_mesh._ghosting_functors)
126  {
127  // If the other mesh is using default ghosting, then we will use our own
128  // default ghosting
129  if (gf == other_default_ghosting)
130  {
131  _ghosting_functors.push_back(_default_ghosting.get());
132  continue;
133  }
134 
135  std::shared_ptr<GhostingFunctor> clone_gf = gf->clone();
136  // Some subclasses of GhostingFunctor might not override the
137  // clone function yet. If this is the case, GhostingFunctor will
138  // return nullptr by default. The clone function should be overridden
139  // in all derived classes. This following code ("else") is written
140  // for API upgrade. That will allow users gradually to update their code.
141  // Once the API upgrade is done, we will come back and delete "else."
142  if (clone_gf)
143  {
144  clone_gf->set_mesh(this);
145  add_ghosting_functor(clone_gf);
146  }
147  else
148  {
149  libmesh_deprecated();
151  }
152  }
153 
154  if (other_mesh._partitioner.get())
155  _partitioner = other_mesh._partitioner->clone();
156 
157  // _elemset_codes stores pointers to entries in _elemset_codes_inverse_map,
158  // so it is not possible to simply copy it directly from other_mesh
159  for (const auto & [set, code] : _elemset_codes_inverse_map)
160  _elemset_codes.emplace(code, &set);
161 }
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
bool _skip_renumber_nodes_and_elements
If this is true then renumbering will be kept to a minimum.
Definition: mesh_base.h:1956
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
Definition: mesh_base.h:1938
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:2025
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2092
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:1944
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2033
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
Definition: mesh_base.h:1836
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:1969
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2026
MeshBase::elemset_type _all_elemset_ids
Definition: mesh_base.h:2027
friend class BoundaryInfo
Make the BoundaryInfo class a friend so that it can create and interact with BoundaryMesh.
Definition: mesh_base.h:2134
unique_id_type _next_unique_id
The next available unique id for assigning ids to DOF objects.
Definition: mesh_base.h:1931
unsigned int _n_parts
The number of partitions the mesh has.
Definition: mesh_base.h:1884
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:1897
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
Definition: mesh_base.h:1890
std::unique_ptr< Partitioner > _partitioner
A partitioner to use at each prepare_for_use().
Definition: mesh_base.h:1925
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:1990
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
Definition: mesh_base.h:1961
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:1996
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983
bool _is_prepared
Flag indicating if the mesh has been prepared for use.
Definition: mesh_base.h:1902
std::unique_ptr< GhostingFunctor > _default_ghosting
The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior...
Definition: mesh_base.h:2083
bool _skip_all_partitioning
If this is true then no partitioning should be done.
Definition: mesh_base.h:1949
std::unique_ptr< PointLocatorBase > _point_locator
A PointLocator class for this mesh.
Definition: mesh_base.h:1911
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:2116
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:1917
void add_ghosting_functor(GhostingFunctor &ghosting_functor)
Adds a functor which can specify ghosting requirements for use on distributed meshes.
Definition: mesh_base.C:948

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

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

364 {
365  this->MeshBase::clear();
366 
367  libmesh_exceptionless_assert (!libMesh::closed());
368 }
bool closed()
Checks that the library has been closed.
Definition: libmesh.C:283
virtual void clear()
Deletes all the element and node data that is currently stored.
Definition: mesh_base.C:920

Member Function Documentation

◆ ABSTRACT_ELEM_ITERATORS() [1/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( )

◆ ABSTRACT_ELEM_ITERATORS() [2/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( ancestor_  )

◆ ABSTRACT_ELEM_ITERATORS() [3/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( local_  )

◆ ABSTRACT_ELEM_ITERATORS() [4/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( facelocal_  )

◆ ABSTRACT_ELEM_ITERATORS() [5/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [6/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [7/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [8/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [9/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [10/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [11/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [12/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [13/15]

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

◆ ABSTRACT_ELEM_ITERATORS() [14/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( semilocal_  )

◆ ABSTRACT_ELEM_ITERATORS() [15/15]

libMesh::MeshBase::ABSTRACT_ELEM_ITERATORS ( active_semilocal_  )

◆ active_local_subdomain_elements_ptr_range() [1/2]

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

◆ active_local_subdomain_elements_ptr_range() [2/2]

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

◆ active_subdomain_elements_ptr_range() [1/2]

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

◆ active_subdomain_elements_ptr_range() [2/2]

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

◆ active_subdomain_set_elements_ptr_range() [1/2]

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

◆ active_subdomain_set_elements_ptr_range() [2/2]

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

◆ 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::prepare_for_use() after elements are added to and/or deleted from the mesh.

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

Referenced by libMesh::GMVIO::_read_one_cell(), libMesh::MeshTools::Subdivision::add_boundary_ghosts(), LinearElasticityWithContact::add_contact_edge_elements(), add_cube_convex_hull_to_mesh(), libMesh::MeshRefinement::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::MeshTools::Modification::all_tri(), AllSecondOrderTest::allCompleteOrderMixed(), AllSecondOrderTest::allCompleteOrderRange(), AllSecondOrderTest::allSecondOrderMixed(), AllSecondOrderTest::allSecondOrderRange(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), 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::mesh_inserter_iterator< T >::operator=(), libMesh::TetGenMeshInterface::pointset_convexhull(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::AbaqusIO::read_elements(), libMesh::UCDIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::DynaIO::read_mesh(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::MeshTools::Generation::surface_octahedron(), VolumeTest::testC0Polygon(), VolumeTest::testC0Polyhedron(), SystemsTest::testDofCouplingWithVarGroups(), MeshTriangulationTest::testEdgesMesh(), MeshTriangulationTest::testHalfDomain(), NodalNeighborsTest::testOrientation(), MeshTriangulationTest::testPoly2TriBad1DMultiBoundary(), MeshTriangulationTest::testPoly2TriBad2DMultiBoundary(), MeshTriangulationTest::testPoly2TriBadEdges(), EquationSystemsTest::testPostInitAddElem(), SystemsTest::testProjectMatrix3D(), InfFERadialTest::testRefinement(), EquationSystemsTest::testReinitWithNodeElem(), SystemsTest::testSetSystemParameterOverEquationSystem(), BoundaryInfoTest::testShellFaceConstraints(), MeshTetTest::testTetsToTets(), MeshSubdomainIDTest::testUnpartitioned(), libMesh::NetGenMeshInterface::triangulate(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::Poly2TriTriangulator::triangulate_current_points(), libMesh::TetGenMeshInterface::triangulate_pointset(), and libMesh::MeshTetInterface::volume_to_surface_mesh().

◆ add_elem() [2/2]

virtual Elem* libMesh::MeshBase::add_elem ( std::unique_ptr< Elem e)
pure 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 2322 of file mesh_base.h.

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

2325 {
2326  libmesh_assert(!default_values || default_values->size() == names.size());
2327 
2328  std::vector<unsigned int> returnval(names.size());
2329 
2330  const std::size_t old_size = _elem_integer_names.size();
2331 
2332  for (auto i : index_range(names))
2333  returnval[i] =
2334  this->add_elem_datum<T>(names[i], false,
2335  default_values ?
2336  (*default_values)[i] : nullptr);
2337 
2338  if (allocate_data && old_size != _elem_integer_names.size())
2339  this->size_elem_extra_integers();
2340 
2341  return returnval;
2342 }
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:2039
libmesh_assert(ctx)
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:117
void size_elem_extra_integers()
Size extra-integer arrays of all elements in the mesh.
Definition: mesh_base.C:1977

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

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

Referenced by ExtraIntegersTest::build_mesh().

2301 {
2302  const std::size_t old_size = _elem_integer_names.size();
2303 
2304  unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
2305  std::vector<dof_id_type> int_data(n_more_integers+1, DofObject::invalid_id);
2306  if (default_value)
2307  std::memcpy(int_data.data(), default_value, sizeof(T));
2308 
2309  unsigned int start_idx = this->add_elem_integer(name, false, int_data[0]);
2310  for (unsigned int i=0; i != n_more_integers; ++i)
2311  this->add_elem_integer(name+"__"+std::to_string(i), false, int_data[i+1]);
2312 
2313  if (allocate_data && old_size != _elem_integer_names.size())
2314  this->size_elem_extra_integers();
2315 
2316  return start_idx;
2317 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2039
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:560
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:482
void size_elem_extra_integers()
Size extra-integer arrays of all elements in the mesh.
Definition: mesh_base.C:1977
uint8_t dof_id_type
Definition: id_types.h:67

◆ add_elem_integer()

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

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

References _elem_integer_default_values, _elem_integer_names, libMesh::index_range(), libMesh::Quality::name(), 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().

563 {
564  for (auto i : index_range(_elem_integer_names))
565  if (_elem_integer_names[i] == name)
566  {
567  libmesh_assert_less(i, _elem_integer_default_values.size());
568  _elem_integer_default_values[i] = default_value;
569  return i;
570  }
571 
572  libmesh_assert_equal_to(_elem_integer_names.size(),
574  _elem_integer_names.push_back(std::move(name));
575  _elem_integer_default_values.push_back(default_value);
576  if (allocate_data)
577  this->size_elem_extra_integers();
578  return _elem_integer_names.size()-1;
579 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2039
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:2045
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:117
void size_elem_extra_integers()
Size extra-integer arrays of all elements in the mesh.
Definition: mesh_base.C:1977

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

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

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

586 {
587  libmesh_assert(!default_values || default_values->size() == names.size());
588  libmesh_assert_equal_to(_elem_integer_names.size(), _elem_integer_default_values.size());
589 
590  std::unordered_map<std::string, std::size_t> name_indices;
591  for (auto i : index_range(_elem_integer_names))
592  name_indices[_elem_integer_names[i]] = i;
593 
594  std::vector<unsigned int> returnval(names.size());
595 
596  bool added_an_integer = false;
597  for (auto i : index_range(names))
598  {
599  const std::string & name = names[i];
600  if (const auto it = name_indices.find(name);
601  it != name_indices.end())
602  {
603  returnval[i] = it->second;
604  _elem_integer_default_values[it->second] =
605  default_values ? (*default_values)[i] : DofObject::invalid_id;
606  }
607  else
608  {
609  returnval[i] = _elem_integer_names.size();
610  name_indices[name] = returnval[i];
611  _elem_integer_names.push_back(name);
613  (default_values ? (*default_values)[i] : DofObject::invalid_id);
614  added_an_integer = true;
615  }
616  }
617 
618  if (allocate_data && added_an_integer)
619  this->size_elem_extra_integers();
620 
621  return returnval;
622 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2039
libmesh_assert(ctx)
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:482
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:2045
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:117
void size_elem_extra_integers()
Size extra-integer arrays of all elements in the mesh.
Definition: mesh_base.C:1977

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

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

399 {
400  // Populate inverse map, stealing id_set's resources
401  auto [it1, inserted1] = _elemset_codes_inverse_map.emplace(std::move(id_set), code);
402 
403  // Reference to the newly inserted (or previously existing) id_set
404  const auto & inserted_id_set = it1->first;
405 
406  // Keep track of all elemset ids ever added for O(1) n_elemsets()
407  // performance. Only need to do this if we didn't know about this
408  // id_set before...
409  if (inserted1)
410  _all_elemset_ids.insert(inserted_id_set.begin(), inserted_id_set.end());
411 
412  // Take the address of the newly emplaced set to use in
413  // _elemset_codes, avoid duplicating std::set storage
414  auto [it2, inserted2] = _elemset_codes.emplace(code, &inserted_id_set);
415 
416  // Throw an error if this code already exists with a pointer to a
417  // different set of ids.
418  libmesh_error_msg_if(!inserted2 && it2->second != &inserted_id_set,
419  "The elemset code " << code << " already exists with a different id_set.");
420 }
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:2025
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2026
MeshBase::elemset_type _all_elemset_ids
Definition: mesh_base.h:2027

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

References _ghosting_functors, and libMesh::libmesh_assert().

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

949 {
950  // We used to implicitly support duplicate inserts to std::set
951 #ifdef LIBMESH_ENABLE_DEPRECATED
952  _ghosting_functors.erase
953  (std::remove(_ghosting_functors.begin(),
954  _ghosting_functors.end(),
955  &ghosting_functor),
956  _ghosting_functors.end());
957 #endif
958 
959  // We shouldn't have two copies of the same functor
960  libmesh_assert(std::find(_ghosting_functors.begin(),
961  _ghosting_functors.end(),
962  &ghosting_functor) ==
963  _ghosting_functors.end());
964 
965  _ghosting_functors.push_back(&ghosting_functor);
966 }
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2092
libmesh_assert(ctx)

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

References _shared_functors, and add_ghosting_functor().

1278  { _shared_functors[ghosting_functor.get()] = ghosting_functor;
1279  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:2098
void add_ghosting_functor(GhostingFunctor &ghosting_functor)
Adds a functor which can specify ghosting requirements for use on distributed meshes.
Definition: mesh_base.C:948

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

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

2374 {
2375  libmesh_assert(!default_values || default_values->size() == names.size());
2376 
2377  std::vector<unsigned int> returnval(names.size());
2378 
2379  const std::size_t old_size = _node_integer_names.size();
2380 
2381  for (auto i : index_range(names))
2382  returnval[i] =
2383  this->add_node_datum<T>(names[i], false,
2384  default_values ?
2385  (*default_values)[i] : nullptr);
2386 
2387  if (allocate_data && old_size != _node_integer_names.size())
2388  this->size_node_extra_integers();
2389 
2390  return returnval;
2391 }
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:2051
libmesh_assert(ctx)
void size_node_extra_integers()
Size extra-integer arrays of all nodes in the mesh.
Definition: mesh_base.C:1986
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:117

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

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

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

2350 {
2351  const std::size_t old_size = _node_integer_names.size();
2352 
2353  unsigned int n_more_integers = (sizeof(T)-1)/sizeof(dof_id_type);
2354  std::vector<dof_id_type> int_data(n_more_integers+1, DofObject::invalid_id);
2355  if (default_value)
2356  std::memcpy(int_data.data(), default_value, sizeof(T));
2357 
2358  unsigned int start_idx = this->add_node_integer(name, false, int_data[0]);
2359  for (unsigned int i=0; i != n_more_integers; ++i)
2360  this->add_node_integer(name+"__"+std::to_string(i), false, int_data[i+1]);
2361 
2362  if (allocate_data && old_size != _node_integer_names.size())
2363  this->size_node_extra_integers();
2364 
2365  return start_idx;
2366 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2051
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:482
void size_node_extra_integers()
Size extra-integer arrays of all nodes in the mesh.
Definition: mesh_base.C:1986
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:649
uint8_t dof_id_type
Definition: id_types.h:67

◆ add_node_integer()

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

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

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

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

652 {
653  for (auto i : index_range(_node_integer_names))
654  if (_node_integer_names[i] == name)
655  {
656  libmesh_assert_less(i, _node_integer_default_values.size());
657  _node_integer_default_values[i] = default_value;
658  return i;
659  }
660 
661  libmesh_assert_equal_to(_node_integer_names.size(),
663  _node_integer_names.push_back(std::move(name));
664  _node_integer_default_values.push_back(default_value);
665  if (allocate_data)
666  this->size_node_extra_integers();
667  return _node_integer_names.size()-1;
668 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2051
void size_node_extra_integers()
Size extra-integer arrays of all nodes in the mesh.
Definition: mesh_base.C:1986
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:2057
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:117

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

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

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

675 {
676  libmesh_assert(!default_values || default_values->size() == names.size());
677  libmesh_assert_equal_to(_node_integer_names.size(), _node_integer_default_values.size());
678 
679  std::unordered_map<std::string, std::size_t> name_indices;
680  for (auto i : index_range(_node_integer_names))
681  name_indices[_node_integer_names[i]] = i;
682 
683  std::vector<unsigned int> returnval(names.size());
684 
685  bool added_an_integer = false;
686  for (auto i : index_range(names))
687  {
688  const std::string & name = names[i];
689  if (const auto it = name_indices.find(name);
690  it != name_indices.end())
691  {
692  returnval[i] = it->second;
693  _node_integer_default_values[it->second] =
694  default_values ? (*default_values)[i] : DofObject::invalid_id;
695  }
696  else
697  {
698  returnval[i] = _node_integer_names.size();
699  name_indices[name] = returnval[i];
700  _node_integer_names.push_back(name);
702  (default_values ? (*default_values)[i] : DofObject::invalid_id);
703  added_an_integer = true;
704  }
705  }
706 
707  if (allocate_data && added_an_integer)
708  this->size_node_extra_integers();
709 
710  return returnval;
711 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2051
libmesh_assert(ctx)
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:482
void size_node_extra_integers()
Size extra-integer arrays of all nodes in the mesh.
Definition: mesh_base.C:1986
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:2057
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:117

◆ 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(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::InfElemBuilder::build_inf_elem(), 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::mesh_inserter_iterator< T >::operator=(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::STLIO::read_ascii(), libMesh::STLIO::read_binary(), libMesh::UCDIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::DynaIO::read_mesh(), libMesh::AbaqusIO::read_nodes(), libMesh::CheckpointIO::read_nodes(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::MeshTools::Generation::surface_octahedron(), libMesh::BoundaryInfo::sync(), VolumeTest::testC0Polygon(), VolumeTest::testC0PolyhedronCube(), SystemsTest::testDofCouplingWithVarGroups(), MeshTriangulationTest::testEdgesMesh(), MeshTriangulationTest::testHalfDomain(), NodalNeighborsTest::testOrientation(), MeshTriangulationTest::testPoly2TriBad1DMultiBoundary(), MeshTriangulationTest::testPoly2TriBad2DMultiBoundary(), MeshTriangulationTest::testPoly2TriBadEdges(), SystemsTest::testProjectMatrix3D(), InfFERadialTest::testRefinement(), SystemsTest::testSetSystemParameterOverEquationSystem(), BoundaryInfoTest::testShellFaceConstraints(), MeshTetTest::testTetsToTets(), MeshTriangulationTest::testTriangulator(), MeshTriangulationTest::testTriangulatorHoles(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), MeshTriangulationTest::testTriangulatorSegments(), MeshTriangulationTest::testTriangulatorTrapMesh(), MeshSubdomainIDTest::testUnpartitioned(), libMesh::NetGenMeshInterface::triangulate(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::Poly2TriTriangulator::triangulate_current_points(), and triangulate_domain().

◆ all_complete_order()

void libMesh::MeshBase::all_complete_order ( )
virtual

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

Definition at line 1650 of file mesh_base.C.

References all_complete_order_range().

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

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

◆ all_complete_order_range()

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

References all_second_order_range().

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

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

◆ all_second_order_range()

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

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

240 {}

◆ allow_find_neighbors() [1/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 1203 of file mesh_base.h.

References _skip_find_neighbors.

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

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

◆ allow_find_neighbors() [2/2]

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

◆ allow_remote_element_removal() [1/2]

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

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

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

Definition at line 1212 of file mesh_base.h.

References _allow_remote_element_removal.

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

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

◆ allow_remote_element_removal() [2/2]

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

Definition at line 1213 of file mesh_base.h.

References _allow_remote_element_removal.

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

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

◆ allow_renumbering() [1/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 1196 of file mesh_base.h.

References _skip_renumber_nodes_and_elements.

Referenced by AllSecondOrderTest::allSecondOrderMixedFixing(), libMesh::DistributedMesh::DistributedMesh(), AllSecondOrderTest::MixedFixingImpl(), libMesh::NameBasedIO::read(), libMesh::GMVIO::read(), libMesh::ReplicatedMesh::ReplicatedMesh(), libMesh::C0Polyhedron::retriangulate(), WriteVecAndScalar::setupTests(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshGenerationTest::testBuildSphere(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), ConstraintOperatorTest::testCoreform(), MeshGenerationTest::tester(), ExtraIntegersTest::testExtraIntegersExodusReading(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), EquationSystemsTest::testRefineThenReinitPreserveFlags(), EquationSystemsTest::testRepartitionThenReinit(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testVTKPreserveElemIds(), MeshInputTest::testVTKPreserveSubdomainIds(), WriteNodesetData::testWriteImpl(), WriteSidesetData::testWriteImpl(), and WriteElemsetData::testWriteImpl().

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

◆ allow_renumbering() [2/2]

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

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

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

Referenced by cache_elem_dims(), prepare_for_use(), and set_elem_dimensions().

1771 {
1772  // This requires an inspection on every processor
1773  parallel_object_only();
1774 
1775  // Need to clear containers first in case all elements of a
1776  // particular dimension/order/subdomain have been deleted.
1777  _elem_dims.clear();
1778  _elem_default_orders.clear();
1779  _mesh_subdomains.clear();
1781 
1782  for (const auto & elem : this->active_element_ptr_range())
1783  {
1784  _elem_dims.insert(cast_int<unsigned char>(elem->dim()));
1785  _elem_default_orders.insert(elem->default_order());
1786  _mesh_subdomains.insert(elem->subdomain_id());
1788  static_cast<Order>
1789  (std::min(static_cast<int>(_supported_nodal_order),
1790  static_cast<int>(elem->supported_nodal_order())));
1791  }
1792 
1793  if (!this->is_serial())
1794  {
1795  // Some different dimension/order/subdomain elements may only live
1796  // on other processors
1797  this->comm().set_union(_elem_dims);
1799  this->comm().min(_supported_nodal_order);
1800  this->comm().set_union(_mesh_subdomains);
1801  }
1802 
1803  // If the largest element dimension found is larger than the current
1804  // _spatial_dimension, increase _spatial_dimension.
1805  unsigned int max_dim = this->mesh_dimension();
1806  if (max_dim > _spatial_dimension)
1807  _spatial_dimension = cast_int<unsigned char>(max_dim);
1808 
1809  // _spatial_dimension may need to increase from 1->2 or 2->3 if the
1810  // mesh is full of 1D elements but they are not x-aligned, or the
1811  // mesh is full of 2D elements but they are not in the x-y plane.
1812  // If the mesh is x-aligned or x-y planar, we will end up checking
1813  // every node's coordinates and not breaking out of the loop
1814  // early...
1815  if (_spatial_dimension < LIBMESH_DIM)
1816  {
1817  for (const auto & node : this->node_ptr_range())
1818  {
1819  // Note: the exact floating point comparison is intentional,
1820  // we don't want to get tripped up by tolerances.
1821  if ((*node)(0) != 0. && _spatial_dimension < 1)
1822  _spatial_dimension = 1;
1823 
1824  if ((*node)(1) != 0. && _spatial_dimension < 2)
1825  {
1826  _spatial_dimension = 2;
1827 #if LIBMESH_DIM == 2
1828  // If libmesh is compiled in 2D mode, this is the
1829  // largest spatial dimension possible so we can break
1830  // out.
1831  break;
1832 #endif
1833  }
1834 
1835 #if LIBMESH_DIM > 2
1836  if ((*node)(2) != 0.)
1837  {
1838  // Spatial dimension can't get any higher than this, so
1839  // we can break out.
1840  _spatial_dimension = 3;
1841  break;
1842  }
1843 #endif
1844  }
1845  }
1846 }
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
Definition: mesh_base.h:2001
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
const Parallel::Communicator & comm() const
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2033
virtual bool is_serial() const
Definition: mesh_base.h:211
void min(const T &r, T &o, Request &req) const
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:1990
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:1996
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983
unsigned int mesh_dimension() const
Definition: mesh_base.C:372
void set_union(T &data, const unsigned int root_id) const

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

References cache_elem_data().

1763 {
1764  libmesh_deprecated();
1765 
1766  this->cache_elem_data();
1767 }
void cache_elem_data()
Definition: mesh_base.C:1770

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

References _elemset_codes, _elemset_codes_inverse_map, add_elemset_code(), get_elem_integer_index(), and has_elem_integer().

455 {
456  // Look up elemset ids for old_code
457  auto it = _elemset_codes.find(old_code);
458 
459  // If we don't have the old_code, then do nothing. Alternatively, we
460  // could throw an error since trying to change an elemset code you
461  // don't have could indicate there's a problem...
462  if (it == _elemset_codes.end())
463  return;
464 
465  // Make copy of the set of elemset ids. We are not changing these,
466  // only updating the elemset code it corresponds to.
467  elemset_type id_set_copy = *(it->second);
468 
469  // Look up the corresponding entry in the inverse map. Note: we want
470  // the iterator because we are going to remove it.
471  auto inverse_it = _elemset_codes_inverse_map.find(id_set_copy);
472  libmesh_error_msg_if(inverse_it == _elemset_codes_inverse_map.end(),
473  "Expected _elemset_codes_inverse_map entry for elemset code " << old_code);
474 
475  // Erase entry from inverse map
476  _elemset_codes_inverse_map.erase(inverse_it);
477 
478  // Erase entry from forward map
479  _elemset_codes.erase(it);
480 
481  // Add new code with original set of ids.
482  this->add_elemset_code(new_code, id_set_copy);
483 
484  // We can't update any actual elemset codes if there is no extra integer defined for it.
485  if (!this->has_elem_integer("elemset_code"))
486  return;
487 
488  // Get index of elemset_code extra integer
489  unsigned int elemset_index = this->get_elem_integer_index("elemset_code");
490 
491  // Loop over all elems and update code
492  for (auto & elem : this->element_ptr_range())
493  {
494  dof_id_type elemset_code =
495  elem->get_extra_integer(elemset_index);
496 
497  if (elemset_code == old_code)
498  elem->set_extra_integer(elemset_index, new_code);
499  }
500 }
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:2025
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:398
bool has_elem_integer(std::string_view name) const
Definition: mesh_base.C:638
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2026
unsigned int get_elem_integer_index(std::string_view name) const
Definition: mesh_base.C:626
std::set< elemset_id_type > elemset_type
Typedef for the "set" container used to store elemset ids.
Definition: mesh_base.h:318
uint8_t dof_id_type
Definition: id_types.h:67

◆ change_elemset_id()

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

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

References _all_elemset_ids, _elemset_codes, and _elemset_codes_inverse_map.

503 {
504  // Early return if we don't have old_id
505  if (!_all_elemset_ids.count(old_id))
506  return;
507 
508  // Throw an error if the new_id is already used
509  libmesh_error_msg_if(_all_elemset_ids.count(new_id),
510  "Cannot change elemset id " << old_id <<
511  " to " << new_id << ", " << new_id << " already exists.");
512 
513  // We will build up a new version of the inverse map so we can iterate over
514  // the current one without invalidating anything.
515  std::map<MeshBase::elemset_type, dof_id_type> new_elemset_codes_inverse_map;
516  for (const auto & [id_set, elemset_code] : _elemset_codes_inverse_map)
517  {
518  auto id_set_copy = id_set;
519  if (id_set_copy.count(old_id))
520  {
521  // Remove old_id, insert new_id
522  id_set_copy.erase(old_id);
523  id_set_copy.insert(new_id);
524  }
525 
526  // Store in new version of map
527  new_elemset_codes_inverse_map.emplace(id_set_copy, elemset_code);
528  }
529 
530  // Swap existing map with newly-built one
531  _elemset_codes_inverse_map.swap(new_elemset_codes_inverse_map);
532 
533  // Reconstruct _elemset_codes map
534  _elemset_codes.clear();
535  for (const auto & [id_set, elemset_code] : _elemset_codes_inverse_map)
536  _elemset_codes.emplace(elemset_code, &id_set);
537 
538  // Update _all_elemset_ids
539  _all_elemset_ids.erase(old_id);
540  _all_elemset_ids.insert(new_id);
541 }
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:2025
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2026
MeshBase::elemset_type _all_elemset_ids
Definition: mesh_base.h:2027

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

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

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

921 {
922  // Reset the number of partitions
923  _n_parts = 1;
924 
925  // Reset the _is_prepared flag
926  _is_prepared = false;
927 
928  // Clear boundary information
929  if (boundary_info)
930  boundary_info->clear();
931 
932  // Clear cached element data
933  _elem_dims.clear();
934  _elem_default_orders.clear();
936 
937  _elemset_codes.clear();
939 
940  _constraint_rows.clear();
941 
942  // Clear our point locator.
943  this->clear_point_locator();
944 }
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:2025
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2110
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
Definition: mesh_base.h:1836
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2026
unsigned int _n_parts
The number of partitions the mesh has.
Definition: mesh_base.h:1884
void clear_point_locator()
Releases the current PointLocator object.
Definition: mesh_base.C:1708
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:1990
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:1996
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983
bool _is_prepared
Flag indicating if the mesh has been prepared for use.
Definition: mesh_base.h:1902

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

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

Releases the current PointLocator object.

Definition at line 1708 of file mesh_base.C.

References _point_locator.

Referenced by clear(), libMesh::UnstructuredMesh::contract(), libMesh::MeshCommunication::delete_remote_elements(), and prepare_for_use().

1709 {
1710  _point_locator.reset(nullptr);
1711 }
std::unique_ptr< PointLocatorBase > _point_locator
A PointLocator class for this mesh.
Definition: mesh_base.h:1911

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

References libMesh::ParallelObject::_communicator.

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

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

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

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

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

2042 {
2043  this->_spatial_dimension = other_mesh._spatial_dimension;
2044  this->_elem_dims = other_mesh._elem_dims;
2045  this->_elem_default_orders = other_mesh._elem_default_orders;
2046  this->_supported_nodal_order = other_mesh._supported_nodal_order;
2047  this->_mesh_subdomains = other_mesh._mesh_subdomains;
2048 }
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
Definition: mesh_base.h:2001
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2033
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:1990
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:1996
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983

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

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

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

2101 {
2102  LOG_SCOPE("copy_constraint_rows(mesh)", "MeshBase");
2103 
2104  _constraint_rows.clear();
2105 
2106  const auto & other_constraint_rows = other_mesh.get_constraint_rows();
2107  for (const auto & [other_node, other_node_constraints] : other_constraint_rows)
2108  {
2109  const Node * const our_node = this->node_ptr(other_node->id());
2110  constraint_rows_mapped_type our_node_constraints;
2111  for (const auto & [other_inner_key_pair, constraint_value] : other_node_constraints)
2112  {
2113  const auto & [other_elem, local_node_id] = other_inner_key_pair;
2114  const Elem * const our_elem = this->elem_ptr(other_elem->id());
2115  our_node_constraints.emplace_back(std::make_pair(our_elem, local_node_id), constraint_value);
2116  }
2117  _constraint_rows[our_node] = std::move(our_node_constraints);
2118  }
2119 }
std::vector< std::pair< std::pair< const Elem *, unsigned int >, Real > > constraint_rows_mapped_type
Definition: mesh_base.h:1703
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2110
virtual const Elem * elem_ptr(const dof_id_type i) const =0
virtual const Node * node_ptr(const dof_id_type i) const =0

◆ copy_constraint_rows() [2/2]

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

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

References _constraint_rows, _elem_default_orders, _elem_dims, _mesh_subdomains, _supported_nodal_order, add_elem(), add_point(), TIMPI::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(), TIMPI::Communicator::set_union(), subdomain_ids(), libMesh::Elem::supported_nodal_order(), and libMesh::TOLERANCE.

2126 {
2127  LOG_SCOPE("copy_constraint_rows(mat)", "MeshBase");
2128 
2129  this->_constraint_rows.clear();
2130 
2131  // We're not going to support doing this distributed yet; it'd be
2132  // pointless unless we temporarily had a linear partitioning to
2133  // better match the constraint operator.
2134  MeshSerializer serialize(*this);
2135 
2136  // Our current mesh should already reflect the desired assembly space
2137  libmesh_error_msg_if(this->n_nodes() != constraint_operator.m(),
2138  "Constraint operator matrix with " <<
2139  constraint_operator.m() <<
2140  "rows does not match this mesh with " <<
2141  this->n_nodes() << " nodes");
2142 
2143  // First, find what new unconstrained DoFs we need to add. We can't
2144  // iterate over columns in a SparseMatrix, so we'll iterate over
2145  // rows and keep track of columns.
2146 
2147  // If we have nodes that will work unconstrained, keep track of
2148  // their node ids and corresponding column indices.
2149  // existing_unconstrained_nodes[column_id] = node_id
2150  std::map<dof_id_type, dof_id_type> existing_unconstrained_columns;
2151  std::set<dof_id_type> existing_unconstrained_nodes;
2152 
2153  // In case we need new nodes, keep track of their columns.
2154  // columns[j][k] will be the kth row index and value of column j
2155  typedef
2156  std::unordered_map<dof_id_type,
2157  std::vector<std::pair<dof_id_type, Real>>>
2158  columns_type;
2159  columns_type columns(constraint_operator.n());
2160 
2161  // If we need to precondition the constraint operator (e.g. it's an
2162  // unpreconditioned extraction operator for a Flex IGA matrix),
2163  // we'll want to keep track of the sum of each column, because we'll
2164  // be dividing each column by that sum (Jacobi preconditioning on
2165  // the right, which then leads to symmetric preconditioning on a
2166  // physics Jacobian).
2167  std::unordered_map<dof_id_type, Real> column_sums;
2168 
2169  // Work in parallel, though we'll have to sync shortly
2170  for (auto i : make_range(constraint_operator.row_start(),
2171  constraint_operator.row_stop()))
2172  {
2173  std::vector<numeric_index_type> indices;
2174  std::vector<T> values;
2175 
2176  constraint_operator.get_row(i, indices, values);
2177  libmesh_assert_equal_to(indices.size(), values.size());
2178 
2179  if (indices.size() == 1 &&
2180  values[0] == T(1))
2181  {
2182  // If we have multiple simple Ui=Uj constraints, let the
2183  // first one be our "unconstrained" node and let the others
2184  // be constrained to it.
2185  if (existing_unconstrained_columns.find(indices[0]) !=
2186  existing_unconstrained_columns.end())
2187  {
2188  const auto j = indices[0];
2189  columns[j].emplace_back(i, 1);
2190  }
2191  else
2192  {
2193  existing_unconstrained_nodes.insert(i);
2194  existing_unconstrained_columns.emplace(indices[0],i);
2195  }
2196  }
2197  else
2198  for (auto jj : index_range(indices))
2199  {
2200  const auto j = indices[jj];
2201  const Real coef = libmesh_real(values[jj]);
2202  libmesh_assert_equal_to(coef, values[jj]);
2203  columns[j].emplace_back(i, coef);
2204  }
2205  }
2206 
2207  // Merge data from different processors' slabs of the matrix
2208  this->comm().set_union(existing_unconstrained_nodes);
2209  this->comm().set_union(existing_unconstrained_columns);
2210 
2211  std::vector<columns_type> all_columns;
2212  this->comm().allgather(columns, all_columns);
2213 
2214  columns.clear();
2215  for (auto p : index_range(all_columns))
2216  for (auto & [j, subcol] : all_columns[p])
2217  for (auto [i, v] : subcol)
2218  columns[j].emplace_back(i,v);
2219 
2220  // Keep track of elements on which unconstrained nodes exist, and
2221  // their local node indices.
2222  // node_to_elem_ptrs[node] = [elem_id, local_node_num]
2223  std::unordered_map<const Node *, std::pair<dof_id_type, unsigned int>> node_to_elem_ptrs;
2224 
2225  // Find elements attached to any existing nodes that will stay
2226  // unconstrained. We'll also build a subdomain set here so we don't
2227  // have to assert that the mesh is already prepared before we pick a
2228  // new subdomain for any NodeElems we need to add.
2229  std::set<subdomain_id_type> subdomain_ids;
2230  for (const Elem * elem : this->element_ptr_range())
2231  {
2232  subdomain_ids.insert(elem->subdomain_id());
2233  for (auto n : make_range(elem->n_nodes()))
2234  {
2235  const Node * node = elem->node_ptr(n);
2236  if (existing_unconstrained_nodes.count(node->id()))
2237  node_to_elem_ptrs.emplace(node, std::make_pair(elem->id(), n));
2238  }
2239  }
2240 
2241  const subdomain_id_type new_sbd_id = *subdomain_ids.rbegin() + 1;
2242 
2243  for (auto j : make_range(constraint_operator.n()))
2244  {
2245  // If we already have a good node for this then we're done
2246  if (existing_unconstrained_columns.count(j))
2247  continue;
2248 
2249  // Get a half-decent spot to place a new NodeElem for
2250  // unconstrained DoF(s) here. Getting a *fully*-decent spot
2251  // would require finding a Moore-Penrose pseudoinverse, and I'm
2252  // not going to do that, but scaling a transpose will at least
2253  // get us a little uniqueness to make visualization reasonable.
2254  Point newpt;
2255  Real total_scaling = 0;
2256  unsigned int total_entries = 0;
2257 
2258  // We'll get a decent initial pid choice here too, if only to
2259  // aid in later repartitioning.
2260  std::map<processor_id_type, int> pids;
2261 
2262  auto & column = columns[j];
2263  for (auto [i, r] : column)
2264  {
2265  Node & constrained_node = this->node_ref(i);
2266  const Point constrained_pt = constrained_node;
2267  newpt += r*constrained_pt;
2268  total_scaling += r;
2269  ++total_entries;
2270  ++pids[constrained_node.processor_id()];
2271  }
2272 
2273  if (precondition_constraint_operator)
2274  column_sums[j] = total_scaling;
2275 
2276  libmesh_error_msg_if
2277  (!total_entries,
2278  "Empty column " << j <<
2279  " found in constraint operator matrix");
2280 
2281  // If we have *cancellation* here then we can end up dividing by
2282  // zero; try just evenly scaling across all constrained node
2283  // points instead.
2284  if (total_scaling > TOLERANCE)
2285  newpt /= total_scaling;
2286  else
2287  newpt /= total_entries;
2288 
2289  Node *n = this->add_point(newpt);
2290  std::unique_ptr<Elem> elem = Elem::build(NODEELEM);
2291  elem->set_node(0, n);
2292  elem->subdomain_id() = new_sbd_id;
2293 
2294  Elem * added_elem = this->add_elem(std::move(elem));
2295  this->_elem_dims.insert(0);
2296  this->_elem_default_orders.insert(added_elem->default_order());
2297  this->_supported_nodal_order =
2298  static_cast<Order>
2299  (std::min(static_cast<int>(this->_supported_nodal_order),
2300  static_cast<int>(added_elem->supported_nodal_order())));
2301  this->_mesh_subdomains.insert(new_sbd_id);
2302  node_to_elem_ptrs.emplace(n, std::make_pair(added_elem->id(), 0));
2303  existing_unconstrained_columns.emplace(j,n->id());
2304 
2305  // Repartition the new objects *after* adding them, so a
2306  // DistributedMesh doesn't get confused and think you're not
2307  // adding them on all processors at once.
2308  int n_pids = 0;
2309  for (auto [pid, count] : pids)
2310  if (count >= n_pids)
2311  {
2312  n_pids = count;
2313  added_elem->processor_id() = pid;
2314  n->processor_id() = pid;
2315  }
2316  }
2317 
2318  // Calculate constraint rows in an indexed form that's easy for us
2319  // to allgather
2320  std::unordered_map<dof_id_type,
2321  std::vector<std::pair<std::pair<dof_id_type, unsigned int>,Real>>>
2322  indexed_constraint_rows;
2323 
2324  for (auto i : make_range(constraint_operator.row_start(),
2325  constraint_operator.row_stop()))
2326  {
2327  if (existing_unconstrained_nodes.count(i))
2328  continue;
2329 
2330  std::vector<numeric_index_type> indices;
2331  std::vector<T> values;
2332 
2333  constraint_operator.get_row(i, indices, values);
2334 
2335  std::vector<std::pair<std::pair<dof_id_type, unsigned int>, Real>> constraint_row;
2336 
2337  for (auto jj : index_range(indices))
2338  {
2339  const dof_id_type node_id =
2340  existing_unconstrained_columns[indices[jj]];
2341 
2342  Node & constraining_node = this->node_ref(node_id);
2343 
2344  libmesh_assert(node_to_elem_ptrs.count(&constraining_node));
2345 
2346  auto p = node_to_elem_ptrs[&constraining_node];
2347 
2348  Real coef = libmesh_real(values[jj]);
2349  libmesh_assert_equal_to(coef, values[jj]);
2350 
2351  // If we're preconditioning and we created a nodeelem then
2352  // we can scale the meaning of that nodeelem's value to give
2353  // us a better-conditioned matrix after the constraints are
2354  // applied.
2355  if (precondition_constraint_operator)
2356  if (auto sum_it = column_sums.find(indices[jj]);
2357  sum_it != column_sums.end())
2358  {
2359  const Real scaling = sum_it->second;
2360 
2361  if (scaling > TOLERANCE)
2362  coef /= scaling;
2363  }
2364 
2365  constraint_row.emplace_back(std::make_pair(p, coef));
2366  }
2367 
2368  indexed_constraint_rows.emplace(i, std::move(constraint_row));
2369  }
2370 
2371  this->comm().set_union(indexed_constraint_rows);
2372 
2373  // Add constraint rows as mesh constraint rows
2374  for (auto & [node_id, indexed_row] : indexed_constraint_rows)
2375  {
2376  Node * constrained_node = this->node_ptr(node_id);
2377 
2378  constraint_rows_mapped_type constraint_row;
2379 
2380  for (auto [p, coef] : indexed_row)
2381  {
2382  const Elem * elem = this->elem_ptr(p.first);
2383  constraint_row.emplace_back
2384  (std::make_pair(std::make_pair(elem, p.second), coef));
2385  }
2386 
2387  this->_constraint_rows.emplace(constrained_node,
2388  std::move(constraint_row));
2389  }
2390 }
T libmesh_real(T a)
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
Definition: mesh_base.h:2001
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
static constexpr Real TOLERANCE
std::vector< std::pair< std::pair< const Elem *, unsigned int >, Real > > constraint_rows_mapped_type
Definition: mesh_base.h:1703
TestClass subdomain_id_type
Based on the 4-byte comment warning above, this probably doesn&#39;t work with exodusII at all...
Definition: id_types.h:43
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2110
const Parallel::Communicator & comm() const
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
Add a new Node at Point p to the end of the vertex array, with processor_id procid.
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
Definition: elem.C:444
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:1990
void subdomain_ids(std::set< subdomain_id_type > &ids, const bool global=true) const
Constructs a list of all subdomain identifiers in the local mesh if global == false, and in the global mesh if global == true (default).
Definition: mesh_base.C:996
libmesh_assert(ctx)
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:1996
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983
virtual const Elem * elem_ptr(const dof_id_type i) const =0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
virtual const Node & node_ref(const dof_id_type i) const
Definition: mesh_base.h:596
virtual const Node * node_ptr(const dof_id_type i) const =0
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:117
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67
void set_union(T &data, const unsigned int root_id) const

◆ default_ghosting()

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

Default ghosting functor.

Definition at line 1309 of file mesh_base.h.

References _default_ghosting.

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

◆ default_mapping_data()

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

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

Definition at line 830 of file mesh_base.h.

References _default_mapping_data.

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

831  {
832  return _default_mapping_data;
833  }
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:1897

◆ default_mapping_type()

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

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

Definition at line 812 of file mesh_base.h.

References _default_mapping_type.

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

813  {
814  return _default_mapping_type;
815  }
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
Definition: mesh_base.h:1890

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

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

253 {}

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

References dim, elem_dimensions(), elem_ptr(), elem_ref(), interior_mesh(), libMesh::make_range(), and max_elem_id().

Referenced by prepare_for_use().

1849 {
1850  // This requires an inspection on every processor
1851  parallel_object_only();
1852 
1853  // Check if the mesh contains mixed dimensions. If so, then we may
1854  // have interior parents to set. Otherwise return.
1855  if (this->elem_dimensions().size() == 1)
1856  return;
1857 
1858  // Do we have interior parent pointers going to a different mesh?
1859  // If so then we'll still check to make sure that's the only place
1860  // they go, so we can libmesh_not_implemented() if not.
1861  const bool separate_interior_mesh = (&(this->interior_mesh()) != this);
1862 
1863  // This map will be used to set interior parents
1864  std::unordered_map<dof_id_type, std::vector<dof_id_type>> node_to_elem;
1865 
1866  for (const auto & elem : this->element_ptr_range())
1867  {
1868  // Populating the node_to_elem map, same as MeshTools::build_nodes_to_elem_map
1869  for (auto n : make_range(elem->n_vertices()))
1870  {
1871  libmesh_assert_less (elem->id(), this->max_elem_id());
1872 
1873  node_to_elem[elem->node_id(n)].push_back(elem->id());
1874  }
1875  }
1876 
1877  // Automatically set interior parents
1878  for (const auto & element : this->element_ptr_range())
1879  {
1880  // Ignore an 3D element or an element that already has an interior parent
1881  if (element->dim()>=LIBMESH_DIM || element->interior_parent())
1882  continue;
1883 
1884  // Start by generating a SET of elements that are dim+1 to the current
1885  // element at each vertex of the current element, thus ignoring interior nodes.
1886  // If one of the SET of elements is empty, then we will not have an interior parent
1887  // since an interior parent must be connected to all vertices of the current element
1888  std::vector<std::set<dof_id_type>> neighbors( element->n_vertices() );
1889 
1890  bool found_interior_parents = false;
1891 
1892  for (auto n : make_range(element->n_vertices()))
1893  {
1894  std::vector<dof_id_type> & element_ids = node_to_elem[element->node_id(n)];
1895  for (const auto & eid : element_ids)
1896  if (this->elem_ref(eid).dim() == element->dim()+1)
1897  neighbors[n].insert(eid);
1898 
1899  if (neighbors[n].size()>0)
1900  {
1901  found_interior_parents = true;
1902  }
1903  else
1904  {
1905  // We have found an empty set, no reason to continue
1906  // Ensure we set this flag to false before the break since it could have
1907  // been set to true for previous vertex
1908  found_interior_parents = false;
1909  break;
1910  }
1911  }
1912 
1913  // If we have successfully generated a set of elements for each vertex, we will compare
1914  // the set for vertex 0 will the sets for the vertices until we find a id that exists in
1915  // all sets. If found, this is our an interior parent id. The interior parent id found
1916  // will be the lowest element id if there is potential for multiple interior parents.
1917  if (found_interior_parents)
1918  {
1919  std::set<dof_id_type> & neighbors_0 = neighbors[0];
1920  for (const auto & interior_parent_id : neighbors_0)
1921  {
1922  found_interior_parents = false;
1923  for (auto n : make_range(1u, element->n_vertices()))
1924  {
1925  if (neighbors[n].count(interior_parent_id))
1926  {
1927  found_interior_parents = true;
1928  }
1929  else
1930  {
1931  found_interior_parents = false;
1932  break;
1933  }
1934  }
1935 
1936  if (found_interior_parents)
1937  {
1938  element->set_interior_parent(this->elem_ptr(interior_parent_id));
1939  break;
1940  }
1941  }
1942 
1943  // Do we have a mixed dimensional mesh that contains some of
1944  // its own interior parents, but we already expect to have
1945  // interior parents on a different mesh? That's going to
1946  // take some work to support if anyone needs it.
1947  if (separate_interior_mesh)
1948  libmesh_not_implemented_msg
1949  ("interior_parent() values in multiple meshes are unsupported.");
1950  }
1951  }
1952 }
const MeshBase & interior_mesh() const
Definition: mesh_base.h:1803
unsigned int dim
virtual dof_id_type max_elem_id() const =0
const std::set< unsigned char > & elem_dimensions() const
Definition: mesh_base.h:282
virtual const Elem * elem_ptr(const dof_id_type i) const =0
virtual const Elem & elem_ref(const dof_id_type i) const
Definition: mesh_base.h:639
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:140

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

References _elem_default_orders.

Referenced by MeshSmootherTest::testVariationalSmoother().

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

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

References _elem_dims.

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

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

◆ 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(), copy_constraint_rows(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), detect_interior_parents(), libMesh::DTKAdapter::DTKAdapter(), elem_ref(), libMesh::DTKEvaluator::evaluate(), libMesh::ExodusII_IO_Helper::get_sideset_data_indices(), libMesh::UNVIO::groups_in(), libMesh::ErrorVector::is_active_elem(), libMesh::MeshTools::libmesh_assert_valid_constraint_rows(), main(), 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::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 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 639 of file mesh_base.h.

References elem_ptr().

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

640  {
641  return *this->elem_ptr(i);
642  }
virtual const Elem * elem_ptr(const dof_id_type i) const =0

◆ elem_ref() [2/2]

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

References elem_ptr().

650  {
651  return *this->elem_ptr(i);
652  }
virtual const Elem * elem_ptr(const dof_id_type i) const =0

◆ find_neighbors()

virtual void libMesh::MeshBase::find_neighbors ( const bool  reset_remote_elements = false,
const bool  reset_current_list = 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.

Implemented in libMesh::UnstructuredMesh.

Referenced by libMesh::InfElemBuilder::build_inf_elem(), main(), prepare_for_use(), 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 246 of file mesh_base.h.

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

246 {}

◆ get_boundary_info() [1/2]

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

The information about boundary ids on the mesh.

Definition at line 165 of file mesh_base.h.

References boundary_info.

Referenced by libMesh::MeshRefinement::_coarsen_elements(), 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(), libMesh::AbaqusIO::assign_boundary_node_ids(), libMesh::AbaqusIO::assign_sideset_ids(), AssemblyA0::boundary_assembly(), AssemblyA1::boundary_assembly(), AssemblyF0::boundary_assembly(), AssemblyF1::boundary_assembly(), AssemblyA2::boundary_assembly(), AssemblyF2::boundary_assembly(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshTools::Modification::change_boundary_id(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::TriangleWrapper::copy_tri_to_mesh(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTetInterface::delete_2D_hull_elements(), libMesh::ReplicatedMesh::delete_elem(), libMesh::DistributedMesh::delete_elem(), libMesh::ReplicatedMesh::delete_node(), libMesh::DistributedMesh::delete_node(), libMesh::DistributedMesh::delete_remote_elements(), libMesh::DistributedMesh::DistributedMesh(), libMesh::MeshTools::Modification::flatten(), get_info(), libMesh::UNVIO::groups_in(), libMesh::HDGProblem::init(), libMesh::ExodusII_IO_Helper::initialize(), LinearElasticityWithContact::initialize_contact_load_paths(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::HDGProblem::jacobian(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), main(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), libMesh::MeshTools::Modification::orient_elements(), libMesh::TetGenMeshInterface::pointset_convexhull(), prepare_for_use(), libMesh::Nemesis_IO::prepare_to_write_nodal_data(), libMesh::AbaqusIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_bcs(), libMesh::ExodusII_IO_Helper::read_edge_blocks(), libMesh::CheckpointIO::read_header(), libMesh::GmshIO::read_mesh(), libMesh::CheckpointIO::read_nodesets(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::SimplexRefiner::refine_via_edges(), MeshStitchTest::renameAndShift(), libMesh::ReplicatedMesh::renumber_nodes_and_elements(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::ReplicatedMesh::ReplicatedMesh(), libMesh::HDGProblem::residual(), SolidSystem::side_time_derivative(), libMesh::PetscDiffSolver::solve(), libMesh::UnstructuredMesh::stitching_helper(), libMesh::MeshTools::Generation::surface_octahedron(), libMesh::BoundaryInfo::sync(), AllTriTest::test_helper_2D(), AllTriTest::test_helper_3D(), MeshTetTest::testBcids(), BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundarySides(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), SystemsTest::testBoundaryProjectCube(), VolumeTest::testC0PolygonMethods(), BoundaryInfoTest::testEdgeBoundaryConditions(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testGmshBCIDOverlap(), MeshInputTest::testLowOrderEdgeBlocks(), BoundaryInfoTest::testMesh(), BoundaryInfoTest::testNameCopying(), PeriodicBCTest::testPeriodicBC(), MeshTriangulationTest::testPoly2TriHolesInteriorRefinedBase(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testShellFaceConstraints(), MeshSmootherTest::testVariationalSmoother(), WriteNodesetData::testWriteImpl(), WriteEdgesetData::testWriteImpl(), WriteSidesetData::testWriteImpl(), libMesh::NetGenMeshInterface::triangulate(), libMesh::Poly2TriTriangulator::triangulate_current_points(), libMesh::MeshTetInterface::volume_to_surface_mesh(), libMesh::FroIO::write(), libMesh::Nemesis_IO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::ExodusII_IO::write(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::GmshIO::write_mesh(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_nodesets(), and libMesh::ExodusII_IO_Helper::write_sidesets().

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

◆ get_boundary_info() [2/2]

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

Writable information about boundary ids on the mesh.

Definition at line 170 of file mesh_base.h.

References boundary_info.

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

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

References _constraint_rows.

1713  { return _constraint_rows; }
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2110

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

References _count_lower_dim_elems_in_point_locator.

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

1723 {
1725 }
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:1917

◆ get_elem_integer_index()

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

Definition at line 626 of file mesh_base.C.

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

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

627 {
628  for (auto i : index_range(_elem_integer_names))
629  if (_elem_integer_names[i] == name)
630  return i;
631 
632  libmesh_error_msg("Unknown elem integer " << name);
633  return libMesh::invalid_uint;
634 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:310
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:2039
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:117

◆ get_elem_integer_name()

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

Definition at line 944 of file mesh_base.h.

References _elem_integer_names.

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

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

◆ get_elemset_code()

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

Definition at line 439 of file mesh_base.C.

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

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

440 {
441  auto it = _elemset_codes_inverse_map.find(id_set);
442  return (it == _elemset_codes_inverse_map.end()) ? DofObject::invalid_id : it->second;
443 }
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2026
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:482

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

References _elemset_codes.

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

446 {
447  std::vector<dof_id_type> ret;
448  ret.reserve(_elemset_codes.size());
449  for (const auto & pr : _elemset_codes)
450  ret.push_back(pr.first);
451  return ret;
452 }
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:2025

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

References _elemset_codes.

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

430 {
431  // If we don't recognize this elemset_code, hand back an empty set
432  id_set_to_fill.clear();
433 
434  if (const auto it = _elemset_codes.find(elemset_code);
435  it != _elemset_codes.end())
436  id_set_to_fill.insert(it->second->begin(), it->second->end());
437 }
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:2025

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

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

1750 {
1751  // Linear search over the map values.
1752  for (const auto & [sbd_id, sbd_name] : _block_id_to_name)
1753  if (sbd_name == name)
1754  return sbd_id;
1755 
1756  // If we made it here without returning, we don't have a subdomain
1757  // with the requested name, so return Elem::invalid_subdomain_id.
1759 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
static const subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
Definition: elem.h:251
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:1976

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

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::MeshTools::elem_types(), libMesh::Utility::enum_to_string(), get_boundary_info(), libMesh::BoundaryInfo::get_edge_boundary_ids(), libMesh::BoundaryInfo::get_edgeset_name_map(), libMesh::BoundaryInfo::get_node_boundary_ids(), libMesh::BoundaryInfo::get_nodeset_name_map(), libMesh::BoundaryInfo::get_side_boundary_ids(), libMesh::BoundaryInfo::get_sideset_name_map(), get_subdomain_name_map(), libMesh::DofObject::id(), libMesh::DofObject::invalid_processor_id, is_prepared(), is_replicated(), libMesh::libmesh_assert(), libMesh::Elem::loose_bounding_box(), TIMPI::Communicator::max(), TIMPI::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::Quality::name(), libMesh::Elem::node_ref_range(), libMesh::ParallelObject::processor_id(), libMesh::Real, TIMPI::Communicator::set_union(), spatial_dimension(), TIMPI::Communicator::sum(), supported_nodal_order(), libMesh::Elem::type(), libMesh::BoundingBox::union_with(), libMesh::MeshTools::volume(), and libMesh::Elem::volume().

Referenced by print_info().

1120 {
1121  std::ostringstream oss;
1122 
1123  oss << " Mesh Information:" << '\n';
1124 
1125  if (!_elem_dims.empty())
1126  {
1127  oss << " elem_dimensions()={";
1128  std::copy(_elem_dims.begin(),
1129  --_elem_dims.end(), // --end() is valid if the set is non-empty
1130  std::ostream_iterator<unsigned int>(oss, ", "));
1131  oss << cast_int<unsigned int>(*_elem_dims.rbegin());
1132  oss << "}\n";
1133  }
1134 
1135  if (!_elem_default_orders.empty())
1136  {
1137  oss << " elem_default_orders()={";
1138  std::transform(_elem_default_orders.begin(),
1139  --_elem_default_orders.end(),
1140  std::ostream_iterator<std::string>(oss, ", "),
1141  [](Order o)
1142  { return Utility::enum_to_string<Order>(o); });
1143  oss << Utility::enum_to_string<Order>(*_elem_default_orders.rbegin());
1144  oss << "}\n";
1145  }
1146 
1147  oss << " supported_nodal_order()=" << this->supported_nodal_order() << '\n'
1148  << " spatial_dimension()=" << this->spatial_dimension() << '\n'
1149  << " n_nodes()=" << this->n_nodes() << '\n'
1150  << " n_local_nodes()=" << this->n_local_nodes() << '\n'
1151  << " n_elem()=" << this->n_elem() << '\n'
1152  << " n_local_elem()=" << this->n_local_elem() << '\n';
1153 #ifdef LIBMESH_ENABLE_AMR
1154  oss << " n_active_elem()=" << this->n_active_elem() << '\n';
1155 #endif
1156  if (global)
1157  oss << " n_subdomains()=" << static_cast<std::size_t>(this->n_subdomains()) << '\n';
1158  else
1159  oss << " n_local_subdomains()= " << static_cast<std::size_t>(this->n_local_subdomains()) << '\n';
1160  oss << " n_elemsets()=" << static_cast<std::size_t>(this->n_elemsets()) << '\n';
1161  if (!_elemset_codes.empty())
1162  oss << " n_elemset_codes=" << _elemset_codes.size() << '\n';
1163  oss << " n_partitions()=" << static_cast<std::size_t>(this->n_partitions()) << '\n'
1164  << " n_processors()=" << static_cast<std::size_t>(this->n_processors()) << '\n'
1165  << " n_threads()=" << static_cast<std::size_t>(libMesh::n_threads()) << '\n'
1166  << " processor_id()=" << static_cast<std::size_t>(this->processor_id()) << '\n'
1167  << " is_prepared()=" << (this->is_prepared() ? "true" : "false") << '\n'
1168  << " is_replicated()=" << (this->is_replicated() ? "true" : "false") << '\n';
1169 
1170  if (verbosity > 0)
1171  {
1172  if (global)
1173  {
1174  libmesh_parallel_only(this->comm());
1175  if (this->processor_id() != 0)
1176  oss << "\n Detailed global get_info() (verbosity > 0) is reduced and output to only rank 0.";
1177  }
1178 
1179  // Helper for printing element types
1180  const auto elem_type_helper = [](const std::set<int> & elem_types) {
1181  std::stringstream ss;
1182  for (auto it = elem_types.begin(); it != elem_types.end();)
1183  {
1184  ss << Utility::enum_to_string((ElemType)*it);
1185  if (++it != elem_types.end())
1186  ss << ", ";
1187  }
1188  return ss.str();
1189  };
1190 
1191  // Helper for whether or not the given DofObject is to be included. If we're doing
1192  // a global reduction, we also count unpartitioned objects on rank 0.
1193  const auto include_object = [this, &global](const DofObject & dof_object) {
1194  return this->processor_id() == dof_object.processor_id() ||
1195  (global &&
1196  this->processor_id() == 0 &&
1197  dof_object.processor_id() == DofObject::invalid_processor_id);
1198  };
1199 
1200  Real volume = 0;
1201 
1202  // Add bounding box information
1203  const auto bbox = global ? MeshTools::create_bounding_box(*this) : MeshTools::create_local_bounding_box(*this);
1204  if (!global || this->processor_id() == 0)
1205  oss << "\n " << (global ? "" : "Local ") << "Mesh Bounding Box:\n"
1206  << " Minimum: " << bbox.min() << "\n"
1207  << " Maximum: " << bbox.max() << "\n"
1208  << " Delta: " << (bbox.max() - bbox.min()) << "\n";
1209 
1210  // Obtain the global or local element types
1211  std::set<int> elem_types;
1212  for (const Elem * elem : this->active_local_element_ptr_range())
1213  elem_types.insert(elem->type());
1214  if (global)
1215  {
1216  // Pick up unpartitioned elems on rank 0
1217  if (this->processor_id() == 0)
1218  for (const Elem * elem : this->active_unpartitioned_element_ptr_range())
1219  elem_types.insert(elem->type());
1220 
1221  this->comm().set_union(elem_types);
1222  }
1223 
1224  // Add element types
1225  if (!global || this->processor_id() == 0)
1226  oss << "\n " << (global ? "" : "Local ") << "Mesh Element Type(s):\n "
1227  << elem_type_helper(elem_types) << "\n";
1228 
1229  // Reduce the nodeset ids
1230  auto nodeset_ids = this->get_boundary_info().get_node_boundary_ids();
1231  if (global)
1232  this->comm().set_union(nodeset_ids);
1233 
1234  // Accumulate local information for each nodeset
1235  struct NodesetInfo
1236  {
1237  std::size_t num_nodes = 0;
1238  BoundingBox bbox;
1239  };
1240  std::map<boundary_id_type, NodesetInfo> nodeset_info_map;
1241  for (const auto & [node, id] : this->get_boundary_info().get_nodeset_map())
1242  {
1243  if (!include_object(*node))
1244  continue;
1245 
1246  NodesetInfo & info = nodeset_info_map[id];
1247 
1248  ++info.num_nodes;
1249 
1250  if (verbosity > 1)
1251  info.bbox.union_with(*node);
1252  }
1253 
1254  // Add nodeset info
1255  if (!global || this->processor_id() == 0)
1256  {
1257  oss << "\n " << (global ? "" : "Local ") << "Mesh Nodesets:\n";
1258  if (nodeset_ids.empty())
1259  oss << " None\n";
1260  }
1261 
1262  const auto & nodeset_name_map = this->get_boundary_info().get_nodeset_name_map();
1263  for (const auto id : nodeset_ids)
1264  {
1265  NodesetInfo & info = nodeset_info_map[id];
1266 
1267  // Reduce the local information for this nodeset if required
1268  if (global)
1269  {
1270  this->comm().sum(info.num_nodes);
1271  if (verbosity > 1)
1272  {
1273  this->comm().min(info.bbox.min());
1274  this->comm().max(info.bbox.max());
1275  }
1276  }
1277 
1278  const bool has_name = nodeset_name_map.count(id) && nodeset_name_map.at(id).size();
1279  const std::string name = has_name ? nodeset_name_map.at(id) : "";
1280  if (global)
1281  libmesh_assert(this->comm().verify(name));
1282 
1283  if (global ? this->processor_id() == 0 : info.num_nodes > 0)
1284  {
1285  oss << " Nodeset " << id;
1286  if (has_name)
1287  oss << " (" << name << ")";
1288  oss << ", " << info.num_nodes << " " << (global ? "" : "local ") << "nodes\n";
1289 
1290  if (verbosity > 1)
1291  {
1292  oss << " " << (global ? "Bounding" : "Local bounding") << " box minimum: "
1293  << info.bbox.min() << "\n"
1294  << " " << (global ? "Bounding" : "Local bounding") << " box maximum: "
1295  << info.bbox.max() << "\n"
1296  << " " << (global ? "Bounding" : "Local bounding") << " box delta: "
1297  << (info.bbox.max() - info.bbox.min()) << "\n";
1298  }
1299  }
1300  }
1301 
1302  // Reduce the sideset ids
1303  auto sideset_ids = this->get_boundary_info().get_side_boundary_ids();
1304  if (global)
1305  this->comm().set_union(sideset_ids);
1306 
1307  // Accumulate local information for each sideset
1308  struct SidesetInfo
1309  {
1310  std::size_t num_sides = 0;
1311  Real volume = 0;
1312  std::set<int> side_elem_types;
1313  std::set<int> elem_types;
1314  std::set<dof_id_type> elem_ids;
1315  std::set<dof_id_type> node_ids;
1316  BoundingBox bbox;
1317  };
1318  ElemSideBuilder side_builder;
1319  std::map<boundary_id_type, SidesetInfo> sideset_info_map;
1320  for (const auto & pair : this->get_boundary_info().get_sideset_map())
1321  {
1322  const Elem * elem = pair.first;
1323  if (!include_object(*elem))
1324  continue;
1325 
1326  const auto id = pair.second.second;
1327  SidesetInfo & info = sideset_info_map[id];
1328 
1329  const auto s = pair.second.first;
1330  const Elem & side = side_builder(*elem, s);
1331 
1332  ++info.num_sides;
1333  info.side_elem_types.insert(side.type());
1334  info.elem_types.insert(elem->type());
1335  info.elem_ids.insert(elem->id());
1336 
1337  for (const Node & node : side.node_ref_range())
1338  if (include_object(node))
1339  info.node_ids.insert(node.id());
1340 
1341  if (verbosity > 1)
1342  {
1343  info.volume += side.volume();
1344  info.bbox.union_with(side.loose_bounding_box());
1345  }
1346  }
1347 
1348  // Add sideset info
1349  if (!global || this->processor_id() == 0)
1350  {
1351  oss << "\n " << (global ? "" : "Local ") << "Mesh Sidesets:\n";
1352  if (sideset_ids.empty())
1353  oss << " None\n";
1354  }
1355  const auto & sideset_name_map = this->get_boundary_info().get_sideset_name_map();
1356  for (const auto id : sideset_ids)
1357  {
1358  SidesetInfo & info = sideset_info_map[id];
1359 
1360  auto num_elems = info.elem_ids.size();
1361  auto num_nodes = info.node_ids.size();
1362 
1363  // Reduce the local information for this sideset if required
1364  if (global)
1365  {
1366  this->comm().sum(info.num_sides);
1367  this->comm().set_union(info.side_elem_types, 0);
1368  this->comm().sum(num_elems);
1369  this->comm().set_union(info.elem_types, 0);
1370  this->comm().sum(num_nodes);
1371  if (verbosity > 1)
1372  {
1373  this->comm().sum(info.volume);
1374  this->comm().min(info.bbox.min());
1375  this->comm().max(info.bbox.max());
1376  }
1377  }
1378 
1379  const bool has_name = sideset_name_map.count(id) && sideset_name_map.at(id).size();
1380  const std::string name = has_name ? sideset_name_map.at(id) : "";
1381  if (global)
1382  libmesh_assert(this->comm().verify(name));
1383 
1384  if (global ? this->processor_id() == 0 : info.num_sides > 0)
1385  {
1386  oss << " Sideset " << id;
1387  if (has_name)
1388  oss << " (" << name << ")";
1389  oss << ", " << info.num_sides << " sides (" << elem_type_helper(info.side_elem_types) << ")"
1390  << ", " << num_elems << " " << (global ? "" : "local ") << "elems (" << elem_type_helper(info.elem_types) << ")"
1391  << ", " << num_nodes << " " << (global ? "" : "local ") << "nodes\n";
1392 
1393  if (verbosity > 1)
1394  {
1395  oss << " " << (global ? "Side" : "Local side") << " volume: " << info.volume << "\n"
1396  << " " << (global ? "Bounding" : "Local bounding") << " box minimum: "
1397  << info.bbox.min() << "\n"
1398  << " " << (global ? "Bounding" : "Local bounding") << " box maximum: "
1399  << info.bbox.max() << "\n"
1400  << " " << (global ? "Bounding" : "Local bounding") << " box delta: "
1401  << (info.bbox.max() - info.bbox.min()) << "\n";
1402  }
1403  }
1404  }
1405 
1406  // Reduce the edgeset ids
1407  auto edgeset_ids = this->get_boundary_info().get_edge_boundary_ids();
1408  if (global)
1409  this->comm().set_union(edgeset_ids);
1410 
1411  // Accumulate local information for each edgeset
1412  struct EdgesetInfo
1413  {
1414  std::size_t num_edges = 0;
1415  std::set<int> edge_elem_types;
1416  BoundingBox bbox;
1417  };
1418  std::map<boundary_id_type, EdgesetInfo> edgeset_info_map;
1419  std::unique_ptr<const Elem> edge;
1420 
1421  for (const auto & pair : this->get_boundary_info().get_edgeset_map())
1422  {
1423  const Elem * elem = pair.first;
1424  if (!include_object(*elem))
1425  continue;
1426 
1427  const auto id = pair.second.second;
1428  EdgesetInfo & info = edgeset_info_map[id];
1429 
1430  elem->build_edge_ptr(edge, pair.second.first);
1431 
1432  ++info.num_edges;
1433  info.edge_elem_types.insert(edge->type());
1434 
1435  if (verbosity > 1)
1436  info.bbox.union_with(edge->loose_bounding_box());
1437  }
1438 
1439  // Add edgeset info
1440  if (!global || this->processor_id() == 0)
1441  {
1442  oss << "\n " << (global ? "" : "Local ") << "Mesh Edgesets:\n";
1443  if (edgeset_ids.empty())
1444  oss << " None\n";
1445  }
1446 
1447  const auto & edgeset_name_map = this->get_boundary_info().get_edgeset_name_map();
1448  for (const auto id : edgeset_ids)
1449  {
1450  EdgesetInfo & info = edgeset_info_map[id];
1451 
1452  // Reduce the local information for this edgeset if required
1453  if (global)
1454  {
1455  this->comm().sum(info.num_edges);
1456  this->comm().set_union(info.edge_elem_types, 0);
1457  if (verbosity > 1)
1458  {
1459  this->comm().min(info.bbox.min());
1460  this->comm().min(info.bbox.max());
1461  }
1462  }
1463 
1464  const bool has_name = edgeset_name_map.count(id) && edgeset_name_map.at(id).size();
1465  const std::string name = has_name ? edgeset_name_map.at(id) : "";
1466  if (global)
1467  libmesh_assert(this->comm().verify(name));
1468 
1469  if (global ? this->processor_id() == 0 : info.num_edges > 0)
1470  {
1471  oss << " Edgeset " << id;
1472  if (has_name)
1473  oss << " (" << name << ")";
1474  oss << ", " << info.num_edges << " " << (global ? "" : "local ") << "edges ("
1475  << elem_type_helper(info.edge_elem_types) << ")\n";
1476 
1477  if (verbosity > 1)
1478  {
1479  oss << " " << (global ? "Bounding" : "Local bounding") << " box minimum: "
1480  << info.bbox.min() << "\n"
1481  << " " << (global ? "Bounding" : "Local bounding") << " box maximum: "
1482  << info.bbox.max() << "\n"
1483  << " " << (global ? "Bounding" : "Local bounding") << " box delta: "
1484  << (info.bbox.max() - info.bbox.min()) << "\n";
1485  }
1486  }
1487  }
1488 
1489  // Reduce the block IDs and block names
1490  std::set<subdomain_id_type> subdomains;
1491  for (const Elem * elem : this->active_element_ptr_range())
1492  if (include_object(*elem))
1493  subdomains.insert(elem->subdomain_id());
1494  if (global)
1495  this->comm().set_union(subdomains);
1496 
1497  // Accumulate local information for each subdomain
1498  struct SubdomainInfo
1499  {
1500  std::size_t num_elems = 0;
1501  Real volume = 0;
1502  std::set<int> elem_types;
1503  std::set<dof_id_type> active_node_ids;
1504 #ifdef LIBMESH_ENABLE_AMR
1505  std::size_t num_active_elems = 0;
1506 #endif
1507  BoundingBox bbox;
1508  };
1509  std::map<subdomain_id_type, SubdomainInfo> subdomain_info_map;
1510  for (const Elem * elem : this->element_ptr_range())
1511  if (include_object(*elem))
1512  {
1513  SubdomainInfo & info = subdomain_info_map[elem->subdomain_id()];
1514 
1515  ++info.num_elems;
1516  info.elem_types.insert(elem->type());
1517 
1518 #ifdef LIBMESH_ENABLE_AMR
1519  if (elem->active())
1520  ++info.num_active_elems;
1521 #endif
1522 
1523  for (const Node & node : elem->node_ref_range())
1524  if (include_object(node) && node.active())
1525  info.active_node_ids.insert(node.id());
1526 
1527  if (verbosity > 1 && elem->active())
1528  {
1529  info.volume += elem->volume();
1530  info.bbox.union_with(elem->loose_bounding_box());
1531  }
1532  }
1533 
1534  // Add subdomain info
1535  oss << "\n " << (global ? "" : "Local ") << "Mesh Subdomains:\n";
1536  const auto & subdomain_name_map = this->get_subdomain_name_map();
1537  for (const auto id : subdomains)
1538  {
1539  SubdomainInfo & info = subdomain_info_map[id];
1540 
1541  auto num_active_nodes = info.active_node_ids.size();
1542 
1543  // Reduce the information for this subdomain if needed
1544  if (global)
1545  {
1546  this->comm().sum(info.num_elems);
1547 #ifdef LIBMESH_ENABLE_AMR
1548  this->comm().sum(info.num_active_elems);
1549 #endif
1550  this->comm().sum(num_active_nodes);
1551  this->comm().set_union(info.elem_types, 0);
1552  if (verbosity > 1)
1553  {
1554  this->comm().min(info.bbox.min());
1555  this->comm().max(info.bbox.max());
1556  this->comm().sum(info.volume);
1557  }
1558  }
1559  if (verbosity > 1)
1560  volume += info.volume;
1561 
1562  const bool has_name = subdomain_name_map.count(id);
1563  const std::string name = has_name ? subdomain_name_map.at(id) : "";
1564  if (global)
1565  libmesh_assert(this->comm().verify(name));
1566 
1567  if (!global || this->processor_id() == 0)
1568  {
1569  oss << " Subdomain " << id;
1570  if (has_name)
1571  oss << " (" << name << ")";
1572  oss << ": " << info.num_elems << " " << (global ? "" : "local ") << "elems "
1573  << "(" << elem_type_helper(info.elem_types);
1574 #ifdef LIBMESH_ENABLE_AMR
1575  oss << ", " << info.num_active_elems << " active";
1576 #endif
1577  oss << "), " << num_active_nodes << " " << (global ? "" : "local ") << "active nodes\n";
1578  if (verbosity > 1)
1579  {
1580  oss << " " << (global ? "Volume" : "Local volume") << ": " << info.volume << "\n";
1581  oss << " " << (global ? "Bounding" : "Local bounding") << " box minimum: "
1582  << info.bbox.min() << "\n"
1583  << " " << (global ? "Bounding" : "Local bounding") << " box maximum: "
1584  << info.bbox.max() << "\n"
1585  << " " << (global ? "Bounding" : "Local bounding") << " box delta: "
1586  << (info.bbox.max() - info.bbox.min()) << "\n";
1587  }
1588  }
1589  }
1590 
1591  oss << " " << (global ? "Global" : "Local") << " mesh volume = " << volume << "\n";
1592 
1593  }
1594 
1595  return oss.str();
1596 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
ElemType
Defines an enum for geometric element types.
void elem_types(const MeshBase &mesh, std::vector< ElemType > &et)
Fills in a vector of all element types in the mesh.
Definition: mesh_tools.C:716
const std::set< boundary_id_type > & get_side_boundary_ids() const
bool is_prepared() const
Definition: mesh_base.h:198
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
virtual dof_id_type n_active_elem() const =0
unsigned int n_threads()
Definition: libmesh_base.h:96
MPI_Info info
libMesh::BoundingBox create_bounding_box(const MeshBase &mesh)
Definition: mesh_tools.C:559
subdomain_id_type n_local_subdomains() const
Definition: mesh_base.C:1048
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:2025
void sum(T &r) const
const std::map< boundary_id_type, std::string > & get_sideset_name_map() const
dof_id_type n_local_nodes() const
Definition: mesh_base.h:442
const Parallel::Communicator & comm() const
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:165
dof_id_type n_local_elem() const
Definition: mesh_base.h:548
libMesh::BoundingBox create_local_bounding_box(const MeshBase &mesh)
Definition: mesh_tools.C:624
const std::set< boundary_id_type > & get_node_boundary_ids() const
Order supported_nodal_order() const
Definition: mesh_base.h:297
processor_id_type n_processors() const
const std::map< boundary_id_type, std::string > & get_nodeset_name_map() const
void min(const T &r, T &o, Request &req) const
const std::map< subdomain_id_type, std::string > & get_subdomain_name_map() const
Definition: mesh_base.h:1700
static const 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:493
const Point & min() const
Definition: bounding_box.h:77
const std::map< boundary_id_type, std::string > & get_edgeset_name_map() const
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:1990
libmesh_assert(ctx)
unsigned int n_elemsets() const
Returns the number of unique elemset ids which have been added via add_elemset_code(), which is the size of the _all_elemset_ids set.
Definition: mesh_base.C:424
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983
Real volume(const MeshBase &mesh, unsigned int dim=libMesh::invalid_uint)
Find the total volume of a mesh (interpreting that as area for dim = 2, or total arc length for dim =...
Definition: mesh_tools.C:985
std::string enum_to_string(const T e)
unsigned int n_partitions() const
Definition: mesh_base.h:1351
subdomain_id_type n_subdomains() const
Definition: mesh_base.C:1034
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void max(const T &r, T &o, Request &req) const
unsigned int spatial_dimension() const
Definition: mesh_base.C:543
const std::set< boundary_id_type > & get_edge_boundary_ids() const
virtual bool is_replicated() const
Definition: mesh_base.h:233
virtual dof_id_type n_elem() const =0
processor_id_type processor_id() const
virtual dof_id_type n_nodes() const =0
void set_union(T &data, const unsigned int root_id) const

◆ get_local_constraints()

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

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

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

Referenced by print_constraint_rows().

2422 {
2423  std::ostringstream os;
2424 
2425  if (print_nonlocal)
2426  os << "All ";
2427  else
2428  os << "Local ";
2429 
2430  os << "Mesh Constraint Rows:"
2431  << std::endl;
2432 
2433  for (const auto & [node, row] : _constraint_rows)
2434  {
2435  const bool local = (node->processor_id() == this->processor_id());
2436 
2437  // Skip non-local dofs if requested
2438  if (!print_nonlocal && !local)
2439  continue;
2440 
2441  os << "Constraints for " << (local ? "Local" : "Ghost") << " Node " << node->id()
2442  << ": \t";
2443 
2444  for (const auto & [elem_and_node, coef] : row)
2445  os << " ((" << elem_and_node.first->id() << ',' << elem_and_node.second << "), " << coef << ")\t";
2446 
2447  os << std::endl;
2448  }
2449 
2450  return os.str();
2451 }
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2110
processor_id_type processor_id() const

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

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

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

◆ get_node_integer_index()

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

Definition at line 715 of file mesh_base.C.

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

716 {
717  for (auto i : index_range(_node_integer_names))
718  if (_node_integer_names[i] == name)
719  return i;
720 
721  libmesh_error_msg("Unknown node integer " << name);
722  return libMesh::invalid_uint;
723 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:310
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:2051
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:117

◆ get_node_integer_name()

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

Definition at line 1066 of file mesh_base.h.

References _node_integer_names.

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

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

◆ get_point_locator_close_to_point_tol()

Real libMesh::MeshBase::get_point_locator_close_to_point_tol ( ) const

Definition at line 1970 of file mesh_base.C.

References _point_locator_close_to_point_tol.

1971 {
1973 }
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:2116

◆ get_subdomain_name_map()

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

Definition at line 1700 of file mesh_base.h.

References _block_id_to_name.

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

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

◆ ghosting_functors_begin()

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

Beginning of range of ghosting functors.

Definition at line 1297 of file mesh_base.h.

References _ghosting_functors.

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

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

◆ ghosting_functors_end()

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

End of range of ghosting functors.

Definition at line 1303 of file mesh_base.h.

References _ghosting_functors.

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

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

◆ has_elem_integer()

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

Definition at line 638 of file mesh_base.C.

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

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

639 {
640  for (auto & entry : _elem_integer_names)
641  if (entry == name)
642  return true;
643 
644  return false;
645 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _elem_integer_names
The array of names for integer data associated with each element in the mesh.
Definition: mesh_base.h:2039

◆ has_node_integer()

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

Definition at line 727 of file mesh_base.C.

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

Referenced by ExtraIntegersTest::checkpoint_helper().

728 {
729  for (auto & entry : _node_integer_names)
730  if (entry == name)
731  return true;
732 
733  return false;
734 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::vector< std::string > _node_integer_names
The array of names for integer data associated with each node in the mesh.
Definition: mesh_base.h:2051

◆ 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::prepare_for_use() 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.

◆ insert_node() [1/2]

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

This method is deprecated.

Please use add_node instead Insert Node n into the Mesh at a location consistent with n->id(), allocating extra storage if necessary. Will error rather than overwriting an existing Node. Only use if you know what you are doing...

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

Referenced by libMesh::mesh_inserter_iterator< T >::operator=().

◆ insert_node() [2/2]

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

This method is deprecated.

Please use add_node instead Version of insert_node() taking a std::unique_ptr by value. 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.

◆ interior_mesh() [1/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 1803 of file mesh_base.h.

References _interior_mesh.

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

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

◆ interior_mesh() [2/2]

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

Definition at line 1808 of file mesh_base.h.

References _interior_mesh.

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

◆ is_prepared()

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

◆ is_replicated()

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

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

Referenced by libMesh::MeshRefinement::_coarsen_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::BoundaryInfo::add_elements(), libMesh::MeshTools::Modification::all_tri(), libMesh::EquationSystems::allgather(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::MeshTools::build_nodes_to_elem_map(), cache_elem_data(), libMesh::DofMap::create_dof_constraints(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::LocationMap< T >::init(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshSerializer::MeshSerializer(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), partition(), prepare_for_use(), 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(), MeshInputTest::testExodusIGASidesets(), PointLocatorTest::testLocator(), MeshInputTest::testLowOrderEdgeBlocks(), BoundaryInfoTest::testMesh(), PointLocatorTest::testPlanar(), BoundaryInfoTest::testRenumber(), MeshInputTest::testTetgenIO(), WriteNodesetData::testWriteImpl(), WriteSidesetData::testWriteImpl(), libMesh::MeshTools::total_weight(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::STLIO::write(), libMesh::CheckpointIO::write(), and libMesh::XdrIO::write_parallel().

212  { return true; }

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

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

219  { return true; }

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

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

1522 {}

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

References _all_elemset_ids, _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, _elem_default_orders, _elem_dims, _elem_integer_default_values, _elem_integer_names, _elemset_codes, _ghosting_functors, _interior_mesh, _is_prepared, _mesh_subdomains, _n_parts, _node_integer_default_values, _node_integer_names, _partitioner, _point_locator_close_to_point_tol, _skip_all_partitioning, _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==().

237 {
238  // Check whether (almost) everything in the base is equal
239  //
240  // We don't check _next_unique_id here, because it's expected to
241  // change in a DistributedMesh prepare_for_use(); it's conceptually
242  // "mutable".
243  //
244  // We use separate if statements instead of logical operators here,
245  // to make it easy to see the failing condition when using a
246  // debugger to figure out why a MeshTools::valid_is_prepared(mesh)
247  // is failing.
248  if (_n_parts != other_mesh._n_parts)
249  return false;
250  if (_default_mapping_type != other_mesh._default_mapping_type)
251  return false;
252  if (_default_mapping_data != other_mesh._default_mapping_data)
253  return false;
254  if (_is_prepared != other_mesh._is_prepared)
255  return false;
257  other_mesh._count_lower_dim_elems_in_point_locator)
258  return false;
259 
260  // We should either both have our own interior parents or both not;
261  // but if we both don't then we can't really assert anything else
262  // because pointing at the same interior mesh is fair but so is
263  // pointing at two different copies of "the same" interior mesh.
264  if ((_interior_mesh == this) !=
265  (other_mesh._interior_mesh == &other_mesh))
266  return false;
267 
268  if (_skip_noncritical_partitioning != other_mesh._skip_noncritical_partitioning)
269  return false;
270  if (_skip_all_partitioning != other_mesh._skip_all_partitioning)
271  return false;
272  if (_skip_renumber_nodes_and_elements != other_mesh._skip_renumber_nodes_and_elements)
273  return false;
274  if (_skip_find_neighbors != other_mesh._skip_find_neighbors)
275  return false;
276  if (_allow_remote_element_removal != other_mesh._allow_remote_element_removal)
277  return false;
278  if (_spatial_dimension != other_mesh._spatial_dimension)
279  return false;
280  if (_point_locator_close_to_point_tol != other_mesh._point_locator_close_to_point_tol)
281  return false;
282  if (_block_id_to_name != other_mesh._block_id_to_name)
283  return false;
284  if (_elem_dims != other_mesh._elem_dims)
285  return false;
286  if (_elem_default_orders != other_mesh._elem_default_orders)
287  return false;
288  if (_supported_nodal_order != other_mesh._supported_nodal_order)
289  return false;
290  if (_mesh_subdomains != other_mesh._mesh_subdomains)
291  return false;
292  if (_all_elemset_ids != other_mesh._all_elemset_ids)
293  return false;
294  if (_elem_integer_names != other_mesh._elem_integer_names)
295  return false;
296  if (_elem_integer_default_values != other_mesh._elem_integer_default_values)
297  return false;
298  if (_node_integer_names != other_mesh._node_integer_names)
299  return false;
300  if (_node_integer_default_values != other_mesh._node_integer_default_values)
301  return false;
302  if (bool(_default_ghosting) != bool(other_mesh._default_ghosting))
303  return false;
304  if (bool(_partitioner) != bool(other_mesh._partitioner))
305  return false;
306  if (*boundary_info != *other_mesh.boundary_info)
307  return false;
308 
309  const constraint_rows_type & other_rows =
310  other_mesh.get_constraint_rows();
311  for (const auto & [node, row] : this->_constraint_rows)
312  {
313  const dof_id_type node_id = node->id();
314  const Node * other_node = other_mesh.query_node_ptr(node_id);
315  if (!other_node)
316  return false;
317 
318  auto it = other_rows.find(other_node);
319  if (it == other_rows.end())
320  return false;
321 
322  const auto & other_row = it->second;
323  if (row.size() != other_row.size())
324  return false;
325 
326  for (auto i : index_range(row))
327  {
328  const auto & [elem_pair, coef] = row[i];
329  const auto & [other_elem_pair, other_coef] = other_row[i];
330  libmesh_assert(elem_pair.first);
331  libmesh_assert(other_elem_pair.first);
332  if (elem_pair.first->id() !=
333  other_elem_pair.first->id() ||
334  elem_pair.second !=
335  other_elem_pair.second ||
336  coef != other_coef)
337  return false;
338  }
339  }
340 
341  for (const auto & [elemset_code, elemset_ptr] : this->_elemset_codes)
342  if (const auto it = other_mesh._elemset_codes.find(elemset_code);
343  it == other_mesh._elemset_codes.end() || *elemset_ptr != *it->second)
344  return false;
345 
346  // FIXME: we have no good way to compare ghosting functors, since
347  // they're in a vector of pointers, and we have no way *at all*
348  // to compare ghosting functors, since they don't have operator==
349  // defined and we encourage users to subclass them. We can check if
350  // we have the same number, is all.
351  if (_ghosting_functors.size() !=
352  other_mesh._ghosting_functors.size())
353  return false;
354 
355  // Same deal for partitioners. We tested that we both have one or
356  // both don't, but are they equivalent? Let's guess "yes".
357 
358  // Now let the subclasses decide whether everything else is equal
359  return this->subclass_locally_equals(other_mesh);
360 }
std::set< subdomain_id_type > _mesh_subdomains
We cache the subdomain ids of the elements present in the mesh.
Definition: mesh_base.h:2001
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 _skip_renumber_nodes_and_elements
If this is true then renumbering will be kept to a minimum.
Definition: mesh_base.h:1956
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:2039
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
Definition: mesh_base.h:1938
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:2025
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2092
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2110
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:1944
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2033
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
Definition: mesh_base.h:1836
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:1969
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:2051
MeshBase::elemset_type _all_elemset_ids
Definition: mesh_base.h:2027
unsigned int _n_parts
The number of partitions the mesh has.
Definition: mesh_base.h:1884
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:1897
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
Definition: mesh_base.h:1890
std::unique_ptr< Partitioner > _partitioner
A partitioner to use at each prepare_for_use().
Definition: mesh_base.h:1925
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:1990
libmesh_assert(ctx)
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
Definition: mesh_base.h:1961
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:1996
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983
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:2057
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:2045
std::map< const Node *, constraint_rows_mapped_type > constraint_rows_type
Definition: mesh_base.h:1704
bool _is_prepared
Flag indicating if the mesh has been prepared for use.
Definition: mesh_base.h:1902
std::unique_ptr< GhostingFunctor > _default_ghosting
The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior...
Definition: mesh_base.h:2083
bool _skip_all_partitioning
If this is true then no partitioning should be done.
Definition: mesh_base.h:1949
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:2116
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:1917
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:1976
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:117
uint8_t dof_id_type
Definition: id_types.h:67

◆ 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(), detect_interior_parents(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_equal_connectivity(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), main(), AllSecondOrderTest::MixedFixingImpl(), libMesh::MeshTools::Modification::permute_elements(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::UnstructuredMesh::stitching_helper(), 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

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

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

1996 {
1997  std::pair<std::vector<unsigned int>, std::vector<unsigned int>> returnval;
1998  returnval.first = this->add_elem_integers(other._elem_integer_names, true, &other._elem_integer_default_values);
1999  returnval.second = this->add_node_integers(other._node_integer_names, true, &other._node_integer_default_values);
2000  return returnval;
2001 }
std::vector< unsigned int > add_elem_integers(const std::vector< std::string > &names, bool allocate_data=true, const std::vector< dof_id_type > *default_values=nullptr)
Register integer data (of type dof_id_type) to be added to each element in the mesh, one string name for each new integer.
Definition: mesh_base.C:583
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:672

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

References _elem_dims.

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

373 {
374  if (!_elem_dims.empty())
375  return cast_int<unsigned int>(*_elem_dims.rbegin());
376  return 0;
377 }
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983

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

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

Referenced by n_active_local_elem().

1087 {
1088  libmesh_assert_less (proc_id, this->n_processors());
1089  return static_cast<dof_id_type>(std::distance (this->active_pid_elements_begin(proc_id),
1090  this->active_pid_elements_end (proc_id)));
1091 }
Real distance(const Point &p)
processor_id_type n_processors() const
uint8_t dof_id_type
Definition: id_types.h:67

◆ n_active_local_elem()

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

Definition at line 565 of file mesh_base.h.

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

Referenced by libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::Partitioner::assign_partitioning(), libMesh::Partitioner::build_graph(), libMesh::VTKIO::cells_to_vtk(), and BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen().

566  { return this->n_active_elem_on_proc (this->processor_id()); }
dof_id_type n_active_elem_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:1086
processor_id_type processor_id() const

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

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

1108 {
1109  dof_id_type ne=0;
1110 
1111  for (const auto & elem : this->active_element_ptr_range())
1112  ne += elem->n_sub_elem();
1113 
1114  return ne;
1115 }
uint8_t dof_id_type
Definition: id_types.h:67

◆ n_constraint_rows()

dof_id_type libMesh::MeshBase::n_constraint_rows ( ) const

Definition at line 2081 of file mesh_base.C.

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

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

2082 {
2083  dof_id_type n_local_rows=0, n_unpartitioned_rows=0;
2084  for (const auto & [node, node_constraints] : _constraint_rows)
2085  {
2086  // Unpartitioned nodes
2087  if (node->processor_id() == DofObject::invalid_processor_id)
2088  n_unpartitioned_rows++;
2089  else if (node->processor_id() == this->processor_id())
2090  n_local_rows++;
2091  }
2092 
2093  this->comm().sum(n_local_rows);
2094 
2095  return n_unpartitioned_rows + n_local_rows;
2096 }
void sum(T &r) const
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2110
const Parallel::Communicator & comm() const
static const 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:493
processor_id_type processor_id() const
uint8_t dof_id_type
Definition: id_types.h:67

◆ n_elem()

virtual dof_id_type libMesh::MeshBase::n_elem ( ) const
pure 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_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(), AllTriTest::test_helper_2D(), AllTriTest::test_helper_3D(), MeshInputTest::testAbaqusRead(), MeshGenerationTest::testBuildCube(), MeshGenerationTest::testBuildLine(), MeshGenerationTest::testBuildSquare(), MeshDeletionsTest::testDeleteElem(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testGoodGmsh(), MeshInputTest::testGoodSTL(), MeshInputTest::testGoodSTLBinary(), InfFERadialTest::testInfQuants(), InfFERadialTest::testInfQuants_numericDeriv(), MeshAssignTest::testMeshMoveAssign(), MeshInputTest::testNemesisReadImpl(), MeshTriangulationTest::testPoly2TriRefinementBase(), EquationSystemsTest::testSelectivePRefine(), InfFERadialTest::testSides(), InfFERadialTest::testSingleOrder(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTetTest::testTetInterfaceBase(), MeshTriangulationTest::testTriangulatorBase(), MeshTriangulationTest::testTriangulatorHoles(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), MeshInputTest::testVTKPreserveElemIds(), MeshInputTest::testVTKPreserveSubdomainIds(), libMesh::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

Definition at line 955 of file mesh_base.h.

References _elem_integer_names.

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

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

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

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

Referenced by n_local_elem(), and n_unpartitioned_elem().

1074 {
1075  // We're either counting a processor's elements or unpartitioned
1076  // elements
1077  libmesh_assert (proc_id < this->n_processors() ||
1078  proc_id == DofObject::invalid_processor_id);
1079 
1080  return static_cast<dof_id_type>(std::distance (this->pid_elements_begin(proc_id),
1081  this->pid_elements_end (proc_id)));
1082 }
Real distance(const Point &p)
processor_id_type n_processors() const
static const 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:493
libmesh_assert(ctx)
uint8_t dof_id_type
Definition: id_types.h:67

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

References _all_elemset_ids.

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

425 {
426  return _all_elemset_ids.size();
427 }
MeshBase::elemset_type _all_elemset_ids
Definition: mesh_base.h:2027

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

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

549  { 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:1073
processor_id_type processor_id() const

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

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

443  { 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:1060
processor_id_type processor_id() const

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

References subdomain_ids().

Referenced by get_info().

1049 {
1050  std::set<subdomain_id_type> ids;
1051 
1052  this->subdomain_ids (ids, /* global = */ false);
1053 
1054  return cast_int<subdomain_id_type>(ids.size());
1055 }
void subdomain_ids(std::set< subdomain_id_type > &ids, const bool global=true) const
Constructs a list of all subdomain identifiers in the local mesh if global == false, and in the global mesh if global == true (default).
Definition: mesh_base.C:996

◆ n_node_integers()

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

Definition at line 1077 of file mesh_base.h.

References _node_integer_names.

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

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

◆ 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(), 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(), MeshInputTest::testVTKPreserveElemIds(), MeshInputTest::testVTKPreserveSubdomainIds(), libMesh::DirectSolutionTransfer::transfer(), libMesh::TreeNode< N >::transform_nodes_to_elements(), libMesh::TriangleInterface::triangulate(), libMesh::NetGenMeshInterface::triangulate(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::Poly2TriTriangulator::triangulate_current_points(), libMesh::FroIO::write(), libMesh::TetGenIO::write(), libMesh::MEDITIO::write_ascii(), libMesh::TecplotIO::write_ascii(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::TecplotIO::write_binary(), libMesh::GMVIO::write_binary(), libMesh::UCDIO::write_header(), libMesh::GmshIO::write_mesh(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::GmshIO::write_post(), libMesh::System::write_serialized_vectors(), and libMesh::UCDIO::write_soln().

◆ n_nodes_on_proc()

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

Definition at line 1060 of file mesh_base.C.

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

Referenced by n_local_nodes(), and n_unpartitioned_nodes().

1061 {
1062  // We're either counting a processor's nodes or unpartitioned
1063  // nodes
1064  libmesh_assert (proc_id < this->n_processors() ||
1065  proc_id == DofObject::invalid_processor_id);
1066 
1067  return static_cast<dof_id_type>(std::distance (this->pid_nodes_begin(proc_id),
1068  this->pid_nodes_end (proc_id)));
1069 }
Real distance(const Point &p)
processor_id_type n_processors() const
static const 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:493
libmesh_assert(ctx)
uint8_t dof_id_type
Definition: id_types.h:67

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

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

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

◆ n_processors()

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

Definition at line 103 of file parallel_object.h.

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

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

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

◆ n_sub_elem()

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

1096 {
1097  dof_id_type ne=0;
1098 
1099  for (const auto & elem : this->element_ptr_range())
1100  ne += elem->n_sub_elem();
1101 
1102  return ne;
1103 }
uint8_t dof_id_type
Definition: id_types.h:67

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

References subdomain_ids().

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

1035 {
1036  // This requires an inspection on every processor
1037  parallel_object_only();
1038 
1039  std::set<subdomain_id_type> ids;
1040 
1041  this->subdomain_ids (ids);
1042 
1043  return cast_int<subdomain_id_type>(ids.size());
1044 }
void subdomain_ids(std::set< subdomain_id_type > &ids, const bool global=true) const
Constructs a list of all subdomain identifiers in the local mesh if global == false, and in the global mesh if global == true (default).
Definition: mesh_base.C:996

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

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

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

dof_id_type n_elem_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:1073
static const 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:493

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

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

Referenced by libMesh::DistributedMesh::parallel_n_nodes().

static const 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:493
dof_id_type n_nodes_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:1060

◆ next_unique_id()

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

Definition at line 461 of file mesh_base.h.

References _next_unique_id.

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

◆ 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(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), 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(), libMesh::BoundaryInfo::operator=(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::ExodusII_IO_Helper::read_edge_blocks(), libMesh::AbaqusIO::read_elements(), libMesh::UCDIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::DofMap::scatter_constraints(), libMesh::UnstructuredMesh::stitching_helper(), libMesh::MeshTools::Generation::surface_octahedron(), libMesh::BoundaryInfo::sync(), VolumeTest::testC0PolygonMethods(), VolumeTest::testC0PolyhedronCube(), NodalNeighborsTest::testOrientation(), EquationSystemsTest::testPostInitAddElem(), SystemsTest::testProjectMatrix3D(), InfFERadialTest::testRefinement(), EquationSystemsTest::testReinitWithNodeElem(), BoundaryInfoTest::testShellFaceConstraints(), MeshTetTest::testTetsToTets(), MeshSubdomainIDTest::testUnpartitioned(), libMesh::NetGenMeshInterface::triangulate(), and libMesh::CheckpointIO::write_nodesets().

◆ node_ptr() [2/2]

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

◆ node_ref() [2/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 605 of file mesh_base.h.

References node_ptr().

606  {
607  return *this->node_ptr(i);
608  }
virtual const Node * node_ptr(const dof_id_type i) const =0

◆ nodes_and_elements_equal()

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

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

Helper function for subclass_equals() in unstructured mesh subclasses.

Definition at line 2051 of file mesh_base.C.

References query_elem_ptr(), and query_node_ptr().

2052 {
2053  for (const auto & other_node : other_mesh.node_ptr_range())
2054  {
2055  const Node * node = this->query_node_ptr(other_node->id());
2056  if (!node)
2057  return false;
2058  if (*other_node != *node)
2059  return false;
2060  }
2061  for (const auto & node : this->node_ptr_range())
2062  if (!other_mesh.query_node_ptr(node->id()))
2063  return false;
2064 
2065  for (const auto & other_elem : other_mesh.element_ptr_range())
2066  {
2067  const Elem * elem = this->query_elem_ptr(other_elem->id());
2068  if (!elem)
2069  return false;
2070  if (!other_elem->topologically_equal(*elem))
2071  return false;
2072  }
2073  for (const auto & elem : this->element_ptr_range())
2074  if (!other_mesh.query_elem_ptr(elem->id()))
2075  return false;
2076 
2077  return true;
2078 }
virtual const Node * query_node_ptr(const dof_id_type i) const =0
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0

◆ operator!=()

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

Definition at line 133 of file mesh_base.h.

134  {
135  return !(*this == other_mesh);
136  }

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

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

164 {
165  LOG_SCOPE("operator=(&&)", "MeshBase");
166 
167  // Move assign as a ParallelObject.
168  this->ParallelObject::operator=(other_mesh);
169 
170  _n_parts = other_mesh.n_partitions();
171  _default_mapping_type = other_mesh.default_mapping_type();
172  _default_mapping_data = other_mesh.default_mapping_data();
173  _is_prepared = other_mesh.is_prepared();
174  _point_locator = std::move(other_mesh._point_locator);
175  _count_lower_dim_elems_in_point_locator = other_mesh.get_count_lower_dim_elems_in_point_locator();
176 #ifdef LIBMESH_ENABLE_UNIQUE_ID
177  _next_unique_id = other_mesh.next_unique_id();
178 #endif
179  // If the other mesh interior_parent pointers just go back to
180  // itself, so should we
181  _interior_mesh = (other_mesh._interior_mesh == &other_mesh) ?
182  this : other_mesh._interior_mesh;
183  _skip_noncritical_partitioning = other_mesh.skip_noncritical_partitioning();
184  _skip_all_partitioning = other_mesh.skip_partitioning();
185  _skip_renumber_nodes_and_elements = !(other_mesh.allow_renumbering());
186  _skip_find_neighbors = !(other_mesh.allow_find_neighbors());
187  _allow_remote_element_removal = other_mesh.allow_remote_element_removal();
188  _block_id_to_name = std::move(other_mesh._block_id_to_name);
189  _elem_dims = std::move(other_mesh.elem_dimensions());
190  _elem_default_orders = std::move(other_mesh.elem_default_orders());
191  _supported_nodal_order = other_mesh.supported_nodal_order();
192  _elemset_codes = std::move(other_mesh._elemset_codes);
193  _elemset_codes_inverse_map = std::move(other_mesh._elemset_codes_inverse_map);
194  _all_elemset_ids = std::move(other_mesh._all_elemset_ids);
195  _spatial_dimension = other_mesh.spatial_dimension();
196  _elem_integer_names = std::move(other_mesh._elem_integer_names);
197  _elem_integer_default_values = std::move(other_mesh._elem_integer_default_values);
198  _node_integer_names = std::move(other_mesh._node_integer_names);
199  _node_integer_default_values = std::move(other_mesh._node_integer_default_values);
200  _point_locator_close_to_point_tol = other_mesh.get_point_locator_close_to_point_tol();
201 
202  // This relies on our subclasses *not* invalidating pointers when we
203  // do their portion of the move assignment later!
204  boundary_info = std::move(other_mesh.boundary_info);
205  boundary_info->set_mesh(*this);
206 
207 #ifdef DEBUG
208  // Make sure that move assignment worked for pointers
209  for (const auto & [set, code] : _elemset_codes_inverse_map)
210  {
211  auto it = _elemset_codes.find(code);
212  libmesh_assert_msg(it != _elemset_codes.end(),
213  "Elemset code " << code << " not found in _elmset_codes container.");
214  libmesh_assert_equal_to(it->second, &set);
215  }
216 #endif
217 
218  // We're *not* really done at this point, but we have the problem
219  // that some of our data movement might be expecting subclasses data
220  // movement to happen first. We'll let subclasses handle that by
221  // calling our post_dofobject_moves()
222  return *this;
223 }
bool _skip_renumber_nodes_and_elements
If this is true then renumbering will be kept to a minimum.
Definition: mesh_base.h:1956
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:2039
MeshBase * _interior_mesh
Defaulting to this, a pointer to the mesh used to generate boundary elements on this.
Definition: mesh_base.h:1938
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:2025
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:1944
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2033
std::unique_ptr< BoundaryInfo > boundary_info
This class holds the boundary information.
Definition: mesh_base.h:1836
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:1969
std::map< MeshBase::elemset_type, dof_id_type > _elemset_codes_inverse_map
Definition: mesh_base.h:2026
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:2051
MeshBase::elemset_type _all_elemset_ids
Definition: mesh_base.h:2027
ParallelObject & operator=(const ParallelObject &libmesh_dbg_var(other))
"Assignment" operator.
unique_id_type _next_unique_id
The next available unique id for assigning ids to DOF objects.
Definition: mesh_base.h:1931
unsigned int _n_parts
The number of partitions the mesh has.
Definition: mesh_base.h:1884
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:1897
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
Definition: mesh_base.h:1890
std::set< Order > _elem_default_orders
We cache the (default) order of the geometric elements present in the mesh.
Definition: mesh_base.h:1990
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
Definition: mesh_base.h:1961
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:1996
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983
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:2057
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:2045
bool _is_prepared
Flag indicating if the mesh has been prepared for use.
Definition: mesh_base.h:1902
bool _skip_all_partitioning
If this is true then no partitioning should be done.
Definition: mesh_base.h:1949
std::unique_ptr< PointLocatorBase > _point_locator
A PointLocator class for this mesh.
Definition: mesh_base.h:1911
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:2116
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:1917
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:1976

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

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

227 {
228  LOG_SCOPE("operator==()", "MeshBase");
229 
230  bool is_equal = this->locally_equals(other_mesh);
231  this->comm().min(is_equal);
232  return is_equal;
233 }
const Parallel::Communicator & comm() const
void min(const T &r, T &o, Request &req) const
bool locally_equals(const MeshBase &other_mesh) const
This behaves the same as operator==, but only for the local and ghosted aspects of the mesh; i...
Definition: mesh_base.C:236

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

740 {}

◆ 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(), and libMesh::Nemesis_IO::read().

◆ partition() [1/2]

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

Call the default partitioner (currently metis_partition()).

Definition at line 1613 of file mesh_base.C.

References libMesh::MeshTools::correct_node_proc_ids(), 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().

1614 {
1615  // If we get here and we have unpartitioned elements, we need that
1616  // fixed.
1617  if (this->n_unpartitioned_elem() > 0)
1618  {
1619  libmesh_assert (partitioner().get());
1620  libmesh_assert (this->is_serial());
1621  partitioner()->partition (*this, n_parts);
1622  }
1623  // A nullptr partitioner or a skip_partitioning(true) call or a
1624  // skip_noncritical_partitioning(true) call means don't repartition;
1625  // skip_noncritical_partitioning() checks all these.
1626  else if (!skip_noncritical_partitioning())
1627  {
1628  partitioner()->partition (*this, n_parts);
1629  }
1630  else
1631  {
1632  // Adaptive coarsening may have "orphaned" nodes on processors
1633  // whose elements no longer share them. We need to check for
1634  // and possibly fix that.
1636 
1637  // Make sure locally cached partition count is correct
1638  this->recalculate_n_partitions();
1639 
1640  // Make sure any other locally cached data is correct
1641  this->update_post_partitioning();
1642  }
1643 }
void correct_node_proc_ids(MeshBase &)
Changes the processor ids on each node so be the same as the id of the lowest element touching that n...
Definition: mesh_tools.C:2393
bool skip_noncritical_partitioning() const
Definition: mesh_base.h:1239
virtual std::unique_ptr< Partitioner > & partitioner()
A partitioner to use at each prepare_for_use()
Definition: mesh_base.h:160
dof_id_type n_unpartitioned_elem() const
Definition: mesh_base.h:554
virtual bool is_serial() const
Definition: mesh_base.h:211
libmesh_assert(ctx)
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:1655
virtual void update_post_partitioning()
Recalculate any cached data after elements and nodes have been repartitioned.
Definition: mesh_base.h:1177

◆ partition() [2/2]

void libMesh::MeshBase::partition ( )
inline

Definition at line 1162 of file mesh_base.h.

References libMesh::ParallelObject::n_processors().

Referenced by prepare_for_use().

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

◆ partitioner()

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

A partitioner to use at each prepare_for_use()

Definition at line 160 of file mesh_base.h.

References _partitioner.

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

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

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

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

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

2007 {
2008  // Now that all the DofObject moving is done, we can move the GhostingFunctor objects
2009  // which include the _default_ghosting,_ghosting_functors and _shared_functors. We also need
2010  // to set the mesh object associated with these functors to the assignee mesh.
2011 
2012  // _default_ghosting
2013  _default_ghosting = std::move(other_mesh._default_ghosting);
2014  _default_ghosting->set_mesh(this);
2015 
2016  // _ghosting_functors
2017  _ghosting_functors = std::move(other_mesh._ghosting_functors);
2018 
2019  for (const auto gf : _ghosting_functors )
2020  {
2021  gf->set_mesh(this);
2022  }
2023 
2024  // _shared_functors
2025  _shared_functors = std::move(other_mesh._shared_functors);
2026 
2027  for (const auto & sf : _shared_functors )
2028  {
2029  (sf.second)->set_mesh(this);
2030  }
2031 
2032  // _constraint_rows
2033  _constraint_rows = std::move(other_mesh._constraint_rows);
2034 
2035  if (other_mesh.partitioner())
2036  _partitioner = std::move(other_mesh.partitioner());
2037 }
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2092
constraint_rows_type _constraint_rows
Definition: mesh_base.h:2110
std::unique_ptr< Partitioner > _partitioner
A partitioner to use at each prepare_for_use().
Definition: mesh_base.h:1925
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:2098
std::unique_ptr< GhostingFunctor > _default_ghosting
The default geometric GhostingFunctor, used to implement standard libMesh element ghosting behavior...
Definition: mesh_base.h:2083

◆ prepare_for_use() [1/3]

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

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

This involves 4 steps: 1.) call find_neighbors() 2.) call partition() 3.) call renumber_nodes_and_elements() 4.) call cache_elem_data()

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

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(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::MeshRefinement::coarsen_elements(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTools::Modification::flatten(), main(), libMesh::MeshTools::Subdivision::prepare_subdivision_mesh(), libMesh::GMVIO::read(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::SimplexRefiner::refine_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::C0Polyhedron::retriangulate(), libMesh::MeshTools::Generation::surface_octahedron(), libMesh::BoundaryInfo::sync(), MeshSpatialDimensionTest::test1D(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshSpatialDimensionTest::test2D(), ExodusTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), MeshInputTest::testAbaqusRead(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundarySides(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), ConstraintOperatorTest::testCoreform(), MeshDeletionsTest::testDeleteElem(), SystemsTest::testDofCouplingWithVarGroups(), MeshInputTest::testDynaFileMappings(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), ConnectedComponentsTest::testEdge(), MeshTriangulationTest::testEdgesMesh(), MeshInputTest::testExodusFileMappings(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), MeshInputTest::testLowOrderEdgeBlocks(), MeshInputTest::testNemesisReadImpl(), NodalNeighborsTest::testOrientation(), MeshTriangulationTest::testPoly2TriBad1DMultiBoundary(), MeshTriangulationTest::testPoly2TriBad2DMultiBoundary(), MeshTriangulationTest::testPoly2TriBadEdges(), EquationSystemsTest::testPostInitAddElem(), SystemsTest::testProjectMatrix3D(), InfFERadialTest::testRefinement(), EquationSystemsTest::testReinitWithNodeElem(), SystemsTest::testSetSystemParameterOverEquationSystem(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), MeshInputTest::testTetgenIO(), MeshTetTest::testTetsToTets(), MeshTetTest::testTrisToTetsError(), MeshInputTest::testVTKPreserveElemIds(), MeshInputTest::testVTKPreserveSubdomainIds(), tetrahedralize_domain(), libMesh::TriangleInterface::triangulate(), libMesh::Poly2TriTriangulator::triangulate(), libMesh::NetGenMeshInterface::triangulate(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::MeshRefinement::uniformly_refine(), and libMesh::MeshTetInterface::volume_to_surface_mesh().

760 {
761  libmesh_deprecated();
762 
763  // We only respect the users wish if they tell us to skip renumbering. If they tell us not to
764  // skip renumbering but someone previously called allow_renumbering(false), then the latter takes
765  // precedence
766  if (skip_renumber_nodes_and_elements)
767  this->allow_renumbering(false);
768 
769  // We always accept the user's value for skip_find_neighbors, in contrast to skip_renumber
770  const bool old_allow_find_neighbors = this->allow_find_neighbors();
771  this->allow_find_neighbors(!skip_find_neighbors);
772 
773  this->prepare_for_use();
774 
775  this->allow_find_neighbors(old_allow_find_neighbors);
776 }
bool allow_find_neighbors() const
Definition: mesh_base.h:1204
void prepare_for_use()
Definition: mesh_base.C:794
bool allow_renumbering() const
Definition: mesh_base.h:1197

◆ prepare_for_use() [2/3]

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

Definition at line 778 of file mesh_base.C.

References allow_renumbering(), and prepare_for_use().

779 {
780  libmesh_deprecated();
781 
782  // We only respect the users wish if they tell us to skip renumbering. If they tell us not to
783  // skip renumbering but someone previously called allow_renumbering(false), then the latter takes
784  // precedence
785  if (skip_renumber_nodes_and_elements)
786  this->allow_renumbering(false);
787 
788  this->prepare_for_use();
789 }
void prepare_for_use()
Definition: mesh_base.C:794
bool allow_renumbering() const
Definition: mesh_base.h:1197

◆ prepare_for_use() [3/3]

void libMesh::MeshBase::prepare_for_use ( )

Definition at line 794 of file mesh_base.C.

References _allow_remote_element_removal, _is_prepared, _skip_find_neighbors, _skip_renumber_nodes_and_elements, cache_elem_data(), clear_point_locator(), libMesh::ParallelObject::comm(), delete_remote_elements(), detect_interior_parents(), find_neighbors(), get_boundary_info(), 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(), partition(), libMesh::BoundaryInfo::regenerate_id_sets(), reinit_ghosting_functors(), remove_orphaned_nodes(), renumber_nodes_and_elements(), skip_partitioning(), and update_parallel_id_counts().

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

795 {
796  LOG_SCOPE("prepare_for_use()", "MeshBase");
797 
798  parallel_object_only();
799 
800  libmesh_assert(this->comm().verify(this->is_serial()));
801 
802  // If we don't go into this method with valid constraint rows, we're
803  // only going to be able to make that worse.
804 #ifdef DEBUG
806 #endif
807 
808  // A distributed mesh may have processors with no elements (or
809  // processors with no elements of higher dimension, if we ever
810  // support mixed-dimension meshes), but we want consistent
811  // mesh_dimension anyways.
812  //
813  // cache_elem_data() should get the elem_dimensions() and
814  // mesh_dimension() correct later, and we don't need it earlier.
815 
816 
817  // Renumber the nodes and elements so that they in contiguous
818  // blocks. By default, _skip_renumber_nodes_and_elements is false.
819  //
820  // Instances where you if prepare_for_use() should not renumber the nodes
821  // and elements include reading in e.g. an xda/r or gmv file. In
822  // this case, the ordering of the nodes may depend on an accompanying
823  // solution, and the node ordering cannot be changed.
824 
825 
826  // Mesh modification operations might not leave us with consistent
827  // id counts, or might leave us with orphaned nodes we're no longer
828  // using, but our partitioner might need that consistency and/or
829  // might be confused by orphaned nodes.
832  else
833  {
834  this->remove_orphaned_nodes();
836  }
837 
838  // Let all the elements find their neighbors
840  this->find_neighbors();
841 
842  // The user may have set boundary conditions. We require that the
843  // boundary conditions were set consistently. Because we examine
844  // neighbors when evaluating non-raw boundary condition IDs, this
845  // assert is only valid when our neighbor links are in place.
846 #ifdef DEBUG
848 #endif
849 
850  // Search the mesh for all the dimensions of the elements
851  // and cache them.
852  this->cache_elem_data();
853 
854  // Search the mesh for elements that have a neighboring element
855  // of dim+1 and set that element as the interior parent
856  this->detect_interior_parents();
857 
858  // Fix up node unique ids in case mesh generation code didn't take
859  // exceptional care to do so.
860  // MeshCommunication().make_node_unique_ids_parallel_consistent(*this);
861 
862  // We're going to still require that mesh generation code gets
863  // element unique ids consistent.
864 #if defined(DEBUG) && defined(LIBMESH_ENABLE_UNIQUE_ID)
866 #endif
867 
868  // Reset our PointLocator. Any old locator is invalidated any time
869  // the elements in the underlying elements in the mesh have changed,
870  // so we clear it here.
871  this->clear_point_locator();
872 
873  // Allow our GhostingFunctor objects to reinit if necessary.
874  // Do this before partitioning and redistributing, and before
875  // deleting remote elements.
876  this->reinit_ghosting_functors();
877 
878  // Partition the mesh unless *all* partitioning is to be skipped.
879  // If only noncritical partitioning is to be skipped, the
880  // partition() call will still check for orphaned nodes.
881  if (!skip_partitioning())
882  this->partition();
883 
884  // If we're using DistributedMesh, we'll probably want it
885  // parallelized.
887  this->delete_remote_elements();
888 
889  // Much of our boundary info may have been for now-remote parts of the mesh,
890  // in which case we don't want to keep local copies of data meant to be
891  // local. On the other hand we may have deleted, or the user may have added in
892  // a distributed fashion, boundary data that is meant to be global. So we
893  // handle both of those scenarios here
895 
898 
899  // The mesh is now prepared for use.
900  _is_prepared = true;
901 
902 #ifdef DEBUG
904 #ifdef LIBMESH_ENABLE_UNIQUE_ID
906 #endif
907 #endif
908 }
bool _skip_renumber_nodes_and_elements
If this is true then renumbering will be kept to a minimum.
Definition: mesh_base.h:1956
void remove_orphaned_nodes()
Removes any orphaned nodes, nodes not connected to any elements.
Definition: mesh_base.C:738
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:1848
void libmesh_assert_valid_constraint_rows(const MeshBase &mesh)
A function for verifying that all mesh constraint rows express relations between nodes and elements t...
Definition: mesh_tools.C:1665
const Parallel::Communicator & comm() const
bool _allow_remote_element_removal
If this is false then even on DistributedMesh remote elements will not be deleted during mesh prepara...
Definition: mesh_base.h:1969
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:165
virtual bool is_serial() const
Definition: mesh_base.h:211
virtual void find_neighbors(const bool reset_remote_elements=false, const bool reset_current_list=true)=0
Locate element face (edge in 2D) neighbors.
virtual void update_parallel_id_counts()=0
Updates parallel caches so that methods like n_elem() accurately reflect changes on other processors...
void cache_elem_data()
Definition: mesh_base.C:1770
void clear_point_locator()
Releases the current PointLocator object.
Definition: mesh_base.C:1708
libmesh_assert(ctx)
void libmesh_assert_valid_boundary_ids(const MeshBase &mesh)
A function for verifying that boundary condition ids match across processors.
Definition: mesh_tools.C:1708
bool _skip_find_neighbors
If this is true then we will skip find_neighbors in prepare_for_use.
Definition: mesh_base.h:1961
void regenerate_id_sets()
Clears and regenerates the cached sets of ids.
bool skip_partitioning() const
Definition: mesh_base.h:1256
bool _is_prepared
Flag indicating if the mesh has been prepared for use.
Definition: mesh_base.h:1902
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:253
void reinit_ghosting_functors()
Loops over ghosting functors and calls mesh_reinit()
Definition: mesh_base.C:911
void libmesh_assert_valid_unique_ids(const MeshBase &mesh)
A function for verifying that unique ids match across processors.
Definition: mesh_tools.C:1906
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...

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

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

2395 {
2396  parallel_object_only();
2397 
2398  std::string local_constraints =
2399  this->get_local_constraints(print_nonlocal);
2400 
2401  if (this->processor_id())
2402  {
2403  this->comm().send(0, local_constraints);
2404  }
2405  else
2406  {
2407  os << "Processor 0:\n";
2408  os << local_constraints;
2409 
2410  for (auto p : IntRange<processor_id_type>(1, this->n_processors()))
2411  {
2412  this->comm().receive(p, local_constraints);
2413  os << "Processor " << p << ":\n";
2414  os << local_constraints;
2415  }
2416  }
2417 }
const Parallel::Communicator & comm() const
processor_id_type n_processors() const
Status receive(const unsigned int dest_processor_id, T &buf, const MessageTag &tag=any_tag) const
std::string get_local_constraints(bool print_nonlocal=false) const
Gets a string reporting all mesh constraint rows local to this processor.
Definition: mesh_base.C:2421
void send(const unsigned int dest_processor_id, const T &buf, const MessageTag &tag=no_tag) const
processor_id_type processor_id() const

◆ print_info()

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

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

References get_info().

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

1600 {
1601  os << this->get_info(verbosity, global)
1602  << std::endl;
1603 }
std::string get_info(const unsigned int verbosity=0, const bool global=true) const
Definition: mesh_base.C:1119

◆ processor_id()

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

Definition at line 114 of file parallel_object.h.

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

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

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

◆ query_elem_ptr() [1/2]

virtual const Elem* libMesh::MeshBase::query_elem_ptr ( const dof_id_type  i) const
pure 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 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(), 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(), ParsedFEMFunctionTest::setUp(), VolumeTest::testC0PolygonMethods(), VolumeTest::testC0PolyhedronMethods(), MeshDeletionsTest::testDeleteElem(), VolumeTest::testEdge3Volume(), ExtraIntegersTest::testExtraIntegersExodusReading(), MeshBaseTest::testMeshBaseVerifyIsPrepared(), EquationSystemsTest::testRefineThenReinitPreserveFlags(), EquationSystemsTest::testSelectivePRefine(), BoundaryInfoTest::testShellFaceConstraints(), and MeshInputTest::testTetgenIO().

◆ 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 
)
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 1655 of file mesh_base.C.

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

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

1656 {
1657  // This requires an inspection on every processor
1658  parallel_object_only();
1659 
1660  unsigned int max_proc_id=0;
1661 
1662  for (const auto & elem : this->active_local_element_ptr_range())
1663  max_proc_id = std::max(max_proc_id, static_cast<unsigned int>(elem->processor_id()));
1664 
1665  // The number of partitions is one more than the max processor ID.
1666  _n_parts = max_proc_id+1;
1667 
1668  this->comm().max(_n_parts);
1669 
1670  return _n_parts;
1671 }
const Parallel::Communicator & comm() const
unsigned int _n_parts
The number of partitions the mesh has.
Definition: mesh_base.h:1884
void max(const T &r, T &o, Request &req) const

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

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

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

1023 {
1024  // We now have all elements and nodes redistributed; our ghosting
1025  // functors should be ready to redistribute and/or recompute any
1026  // cached data they use too.
1027  for (auto & gf : as_range(this->ghosting_functors_begin(),
1028  this->ghosting_functors_end()))
1029  gf->redistribute();
1030 }
GhostingFunctorIterator ghosting_functors_begin() const
Beginning of range of ghosting functors.
Definition: mesh_base.h:1297
GhostingFunctorIterator ghosting_functors_end() const
End of range of ghosting functors.
Definition: mesh_base.h:1303
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
Definition: simple_range.h:57

◆ reinit_ghosting_functors()

void libMesh::MeshBase::reinit_ghosting_functors ( )

Loops over ghosting functors and calls mesh_reinit()

Definition at line 911 of file mesh_base.C.

References _ghosting_functors, and libMesh::libmesh_assert().

Referenced by prepare_for_use().

912 {
913  for (auto & gf : _ghosting_functors)
914  {
915  libmesh_assert(gf);
916  gf->mesh_reinit();
917  }
918 }
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2092
libmesh_assert(ctx)

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

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

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

971 {
972  auto raw_it = std::find(_ghosting_functors.begin(),
973  _ghosting_functors.end(), &ghosting_functor);
974 
975  // The DofMap has a "to_mesh" parameter that tells it to avoid
976  // registering a new functor with the mesh, but it doesn't keep
977  // track of which functors weren't added, so we'll support "remove a
978  // functor that isn't there" just like we did with set::erase
979  // before.
980  if (raw_it != _ghosting_functors.end())
981  _ghosting_functors.erase(raw_it);
982 
983  // We shouldn't have had two copies of the same functor
984  libmesh_assert(std::find(_ghosting_functors.begin(),
985  _ghosting_functors.end(),
986  &ghosting_functor) ==
987  _ghosting_functors.end());
988 
989  if (const auto it = _shared_functors.find(&ghosting_functor);
990  it != _shared_functors.end())
991  _shared_functors.erase(it);
992 }
std::vector< GhostingFunctor * > _ghosting_functors
The list of all GhostingFunctor objects to be used when distributing a DistributedMesh.
Definition: mesh_base.h:2092
libmesh_assert(ctx)
std::map< GhostingFunctor *, std::shared_ptr< GhostingFunctor > > _shared_functors
Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form...
Definition: mesh_base.h:2098

◆ remove_orphaned_nodes()

void libMesh::MeshBase::remove_orphaned_nodes ( )

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

Typically done automatically in prepare_for_use

Definition at line 738 of file mesh_base.C.

References delete_node().

Referenced by prepare_for_use().

739 {
740  LOG_SCOPE("remove_orphaned_nodes()", "MeshBase");
741 
742  // Will hold the set of nodes that are currently connected to elements
743  std::unordered_set<Node *> connected_nodes;
744 
745  // Loop over the elements. Find which nodes are connected to at
746  // least one of them.
747  for (const auto & element : this->element_ptr_range())
748  for (auto & n : element->node_ref_range())
749  connected_nodes.insert(&n);
750 
751  for (const auto & node : this->node_ptr_range())
752  if (!connected_nodes.count(node))
753  this->delete_node(node);
754 }
virtual void delete_node(Node *n)=0
Removes the Node n from the mesh.

◆ 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 libMesh::UnstructuredMesh::contract(), prepare_for_use(), 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::DistributedMesh, and libMesh::ReplicatedMesh.

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

Referenced by libMesh::UnstructuredMesh::all_complete_order_range(), libMesh::UnstructuredMesh::all_second_order_range(), 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 1715 of file mesh_base.C.

References _count_lower_dim_elems_in_point_locator.

1716 {
1717  _count_lower_dim_elems_in_point_locator = count_lower_dim_elems;
1718 }
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:1917

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

References _default_mapping_data.

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

840  {
841  _default_mapping_data = data;
842  }
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:1897

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

References _default_mapping_type.

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

822  {
823  _default_mapping_type = type;
824  }
ElemMappingType _default_mapping_type
The default mapping type (typically Lagrange) between master and physical space to assign to newly ad...
Definition: mesh_base.h:1890

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

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

227  { libmesh_error(); }

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

References _elem_dims, and cache_elem_data().

382 {
383 #ifdef DEBUG
384  // In debug mode, we call cache_elem_data() and then make sure
385  // the result actually agrees with what the user specified.
386  parallel_object_only();
387 
388  this->cache_elem_data();
389  libmesh_assert_msg(_elem_dims == elem_dims, \
390  "Specified element dimensions does not match true element dimensions!");
391 #endif
392 
393  _elem_dims = std::move(elem_dims);
394 }
void cache_elem_data()
Definition: mesh_base.C:1770
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983

◆ set_interior_mesh()

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

Sets the interior mesh.

For advanced use only.

Definition at line 1813 of file mesh_base.h.

References _interior_mesh.

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

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

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

Definition at line 204 of file mesh_base.h.

References _is_prepared.

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

205  { _is_prepared = false; }
bool _is_prepared
Flag indicating if the mesh has been prepared for use.
Definition: mesh_base.h:1902

◆ set_mesh_dimension()

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

Resets the logical dimension of the mesh.

If the mesh has elements of multiple dimensions, this should be set to the largest dimension. E.g. if the mesh has 1D and 2D elements, this should be set to 2. If the mesh has 2D and 3D elements, this should be set to 3.

Definition at line 275 of file mesh_base.h.

References _elem_dims.

Referenced by libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::TriangleWrapper::copy_tri_to_mesh(), libMesh::AbaqusIO::read(), libMesh::GMVIO::read(), libMesh::STLIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::CheckpointIO::read_header(), libMesh::UCDIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), InfFERadialTest::testRefinement(), libMesh::TriangleInterface::triangulate(), and libMesh::Poly2TriTriangulator::triangulate().

276  { _elem_dims.clear(); _elem_dims.insert(d); }
std::set< unsigned char > _elem_dims
We cache the dimension of the elements present in the mesh.
Definition: mesh_base.h:1983

◆ set_n_partitions()

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

Definition at line 1871 of file mesh_base.h.

References _n_parts.

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

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

◆ 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(), and libMesh::XdrIO::read_serialized_nodes().

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

References _point_locator, and _point_locator_close_to_point_tol.

1957 {
1959  if (_point_locator)
1960  {
1961  if (val > 0.)
1962  _point_locator->set_close_to_point_tol(val);
1963  else
1964  _point_locator->unset_close_to_point_tol();
1965  }
1966 }
std::unique_ptr< PointLocatorBase > _point_locator
A PointLocator class for this mesh.
Definition: mesh_base.h:1911
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:2116

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

References _spatial_dimension.

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

551 {
552  // The user can set the _spatial_dimension however they wish,
553  // libMesh will only *increase* the spatial dimension, however,
554  // never decrease it.
555  _spatial_dimension = d;
556 }
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2033

◆ set_subdomain_name_map()

const DofMap& dof_map LIBMESH_COMMA unsigned int std::string& libMesh::MeshBase::set_subdomain_name_map ( )
inline

Definition at line 1698 of file mesh_base.h.

References _block_id_to_name.

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

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

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

References _elem_integer_default_values, and _elem_integer_names.

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

1978 {
1979  const std::size_t new_size = _elem_integer_names.size();
1980  for (auto elem : this->element_ptr_range())
1981  elem->add_extra_integers(new_size, _elem_integer_default_values);
1982 }
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:2039
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:2045

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

References _node_integer_default_values, and _node_integer_names.

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

1987 {
1988  const std::size_t new_size = _node_integer_names.size();
1989  for (auto node : this->node_ptr_range())
1990  node->add_extra_integers(new_size, _node_integer_default_values);
1991 }
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:2051
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:2057

◆ skip_noncritical_partitioning() [1/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 1236 of file mesh_base.h.

References _skip_noncritical_partitioning.

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

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

◆ skip_noncritical_partitioning() [2/2]

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

Definition at line 1239 of file mesh_base.h.

References _partitioner, _skip_all_partitioning, and _skip_noncritical_partitioning.

Referenced by partition().

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

◆ skip_partitioning() [1/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 1254 of file mesh_base.h.

References _skip_all_partitioning.

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

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

◆ skip_partitioning() [2/2]

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

Definition at line 1256 of file mesh_base.h.

References _skip_all_partitioning.

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

1256 { return _skip_all_partitioning; }
bool _skip_all_partitioning
If this is true then no partitioning should be done.
Definition: mesh_base.h:1949

◆ 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 prepare_for_use() based on the dimensions of the various elements present in the Mesh, but is never automatically decreased by this function.

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(). 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 543 of file mesh_base.C.

References _spatial_dimension.

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

544 {
545  return cast_int<unsigned int>(_spatial_dimension);
546 }
unsigned char _spatial_dimension
The "spatial dimension" of the Mesh.
Definition: mesh_base.h:2033

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

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::MeshFunction::init(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::OverlapCoupling::mesh_reinit(), libMesh::DefaultCoupling::mesh_reinit(), libMesh::PointNeighborCoupling::mesh_reinit(), ExodusTest< elem_type >::meshes_equal_enough(), libMesh::MeshRefinement::test_level_one(), PointLocatorTest::testLocator(), MeshInputTest::testMasterCenters(), PointLocatorTest::testPlanar(), SystemsTest::testProjectCube(), SystemsTest::testProjectLine(), and SystemsTest::testProjectSquare().

1676 {
1677  // If there's no master point locator, then we need one.
1678  if (_point_locator.get() == nullptr)
1679  {
1680  // PointLocator construction may not be safe within threads
1682 
1683  // And it may require parallel communication
1684  parallel_object_only();
1685 
1686 #ifdef LIBMESH_ENABLE_NANOFLANN_POINTLOCATOR
1688 #else
1690 #endif
1691 
1693  _point_locator->set_close_to_point_tol(_point_locator_close_to_point_tol);
1694  }
1695 
1696  // Otherwise there was a master point locator, and we can grab a
1697  // sub-locator easily.
1698  return
1699 #ifdef LIBMESH_ENABLE_NANOFLANN_POINTLOCATOR
1701 #else
1703 #endif
1704 }
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!Threadsin_thre...
Definition: threads.C:32
libmesh_assert(ctx)
std::unique_ptr< PointLocatorBase > _point_locator
A PointLocator class for this mesh.
Definition: mesh_base.h:1911
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:2116
static std::unique_ptr< PointLocatorBase > build(PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=nullptr)
Builds an PointLocator for the mesh mesh.

◆ subclass_locally_equals()

virtual bool libMesh::MeshBase::subclass_locally_equals ( const MeshBase other_mesh) const
protectedpure 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 996 of file mesh_base.C.

References libMesh::ParallelObject::comm(), and TIMPI::Communicator::set_union().

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

997 {
998  // This requires an inspection on every processor
999  if (global)
1000  parallel_object_only();
1001 
1002  ids.clear();
1003 
1004  for (const auto & elem : this->active_local_element_ptr_range())
1005  ids.insert(elem->subdomain_id());
1006 
1007  if (global)
1008  {
1009  // Only include the unpartitioned elements if the user requests the global IDs.
1010  // In the case of the local subdomain IDs, it doesn't make sense to include the
1011  // unpartitioned elements because said elements do not have a sense of locality.
1012  for (const auto & elem : this->active_unpartitioned_element_ptr_range())
1013  ids.insert(elem->subdomain_id());
1014 
1015  // Some subdomains may only live on other processors
1016  this->comm().set_union(ids);
1017  }
1018 }
const Parallel::Communicator & comm() const
void set_union(T &data, const unsigned int root_id) const

◆ subdomain_name() [1/2]

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

Definition at line 1729 of file mesh_base.C.

References _block_id_to_name.

Referenced by libMesh::AbaqusIO::assign_subdomain_ids(), DMlibMeshSetSystem_libMesh(), libMesh::UNVIO::groups_in(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::GmshIO::read_mesh(), libMesh::UnstructuredMesh::stitching_helper(), MeshStitchTest::testAmbiguousRemappingStitch(), MeshInputTest::testGmshBCIDOverlap(), MeshStitchTest::testRemappingStitch(), libMesh::TecplotIO::write_binary(), and libMesh::ExodusII_IO_Helper::write_elements().

1730 {
1731  return _block_id_to_name[id];
1732 }
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:1976

◆ subdomain_name() [2/2]

const std::string & libMesh::MeshBase::subdomain_name ( subdomain_id_type  id) const

Definition at line 1734 of file mesh_base.C.

References _block_id_to_name.

1735 {
1736  // An empty string to return when no matching subdomain name is found
1737  static const std::string empty;
1738 
1739  if (const auto iter = _block_id_to_name.find(id);
1740  iter == _block_id_to_name.end())
1741  return empty;
1742  else
1743  return iter->second;
1744 }
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:1976

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

References _supported_nodal_order.

Referenced by get_info().

298  { return _supported_nodal_order; }
Order _supported_nodal_order
We cache the maximum nodal order supported by all the mesh&#39;s elements (the minimum supported_nodal_or...
Definition: mesh_base.h:1996

◆ 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 libMesh::MeshRefinement::_coarsen_elements(), libMesh::MeshRefinement::_refine_elements(), and prepare_for_use().

◆ update_post_partitioning()

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

Recalculate any cached data after elements and nodes have been repartitioned.

Reimplemented in libMesh::DistributedMesh.

Definition at line 1177 of file mesh_base.h.

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

1177 {}

◆ write()

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

Friends And Related Function Documentation

◆ BoundaryInfo

friend class BoundaryInfo
friend

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

Definition at line 2134 of file mesh_base.h.

◆ MeshCommunication

friend class MeshCommunication
friend

◆ MeshInput< MeshBase >

friend class MeshInput< MeshBase >
friend

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

Definition at line 2128 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 1606 of file mesh_base.C.

1607 {
1608  m.print_info(os);
1609  return os;
1610 }

◆ Partitioner

friend class Partitioner
friend

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

Definition at line 2122 of file mesh_base.h.

Member Data Documentation

◆ _all_elemset_ids

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

◆ _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 1969 of file mesh_base.h.

Referenced by allow_remote_element_removal(), 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 1976 of file mesh_base.h.

Referenced by get_id_by_name(), get_subdomain_name_map(), locally_equals(), operator=(), set_subdomain_name_map(), and subdomain_name().

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _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 1917 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 2083 of file mesh_base.h.

Referenced by default_ghosting(), locally_equals(), 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 1897 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 1890 of file mesh_base.h.

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

◆ _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 1990 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 1983 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

◆ _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 2025 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 2092 of file mesh_base.h.

Referenced by add_ghosting_functor(), ghosting_functors_begin(), ghosting_functors_end(), locally_equals(), 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 1938 of file mesh_base.h.

Referenced by interior_mesh(), locally_equals(), operator=(), and set_interior_mesh().

◆ _is_prepared

bool libMesh::MeshBase::_is_prepared
protected

◆ _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 2001 of file mesh_base.h.

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

◆ _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 1884 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

◆ _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 1925 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 1911 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 2116 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().

◆ _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 2098 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 1949 of file mesh_base.h.

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

◆ _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 1961 of file mesh_base.h.

Referenced by allow_find_neighbors(), 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 1944 of file mesh_base.h.

Referenced by locally_equals(), operator=(), 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 1956 of file mesh_base.h.

Referenced by allow_renumbering(), locally_equals(), operator=(), prepare_for_use(), libMesh::ReplicatedMesh::renumber_nodes_and_elements(), and libMesh::DistributedMesh::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 2033 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 1996 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 1836 of file mesh_base.h.

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

◆ var_num

const DofMap& dof_map LIBMESH_COMMA unsigned int libMesh::MeshBase::var_num
Initial value:
ABSTRACT_ELEM_ITERATORS(multi_evaluable_,std::vector<const DofMap *> dof_maps)
#ifdef LIBMESH_ENABLE_AMR
ABSTRACT_ELEM_ITERATORS(flagged_,unsigned char rflag)
ABSTRACT_ELEM_ITERATORS(flagged_pid_,unsigned char rflag LIBMESH_COMMA processor_id_type pid)
#endif
ABSTRACT_NODE_ITERATORS(,)
ABSTRACT_NODE_ITERATORS(active_,)
ABSTRACT_NODE_ITERATORS(local_,)
ABSTRACT_NODE_ITERATORS(bnd_,)
ABSTRACT_NODE_ITERATORS(pid_,processor_id_type pid)
ABSTRACT_NODE_ITERATORS(bid_,boundary_id_type bid)
ABSTRACT_NODE_ITERATORS(evaluable_,const DofMap & dof_map LIBMESH_COMMA unsigned int var_num = libMesh::invalid_uint)
ABSTRACT_NODE_ITERATORS(multi_evaluable_,std::vector<const DofMap *> dof_maps)

Definition at line 1650 of file mesh_base.h.


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