libMesh
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
libMesh::BoundaryInfo Class Reference

The BoundaryInfo class contains information relevant to boundary conditions including storing faces, edges, and nodes on the boundary, along with ids that can be used to identify the type of boundary each entity is part of. More...

#include <boundary_info.h>

Inheritance diagram for libMesh::BoundaryInfo:
[legend]

Public Types

enum  NodeBCTupleSortBy { NodeBCTupleSortBy::NODE_ID, NodeBCTupleSortBy::BOUNDARY_ID, NodeBCTupleSortBy::UNSORTED }
 
enum  BCTupleSortBy { BCTupleSortBy::ELEM_ID, BCTupleSortBy::SIDE_ID, BCTupleSortBy::BOUNDARY_ID, BCTupleSortBy::UNSORTED }
 
typedef std::tuple< dof_id_type, boundary_id_typeNodeBCTuple
 Create a list of (node_id, boundary_id) tuples for all relevant nodes. More...
 
typedef std::tuple< dof_id_type, unsigned short int, boundary_id_typeBCTuple
 Create a list of (element_id, side_id, boundary_id) tuples for relevant sides. More...
 

Public Member Functions

BoundaryInfooperator= (const BoundaryInfo &other_boundary_info)
 Copy assignment operator. More...
 
bool operator== (const BoundaryInfo &other_boundary_info) const
 This tests for data equality via element ids. More...
 
bool operator!= (const BoundaryInfo &other_boundary_info) const
 
 ~BoundaryInfo ()
 Destructor. More...
 
void clear ()
 Clears the underlying data structures and restores the object to a pristine state with no data stored. More...
 
void regenerate_id_sets ()
 Clears and regenerates the cached sets of ids. More...
 
void synchronize_global_id_set ()
 Synchronizes the boundary_ids set on each processor to determine global_boundary_ids. More...
 
void sync (UnstructuredMesh &boundary_mesh)
 Generates boundary_mesh data structures corresponding to the mesh data structures. More...
 
void sync (const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh)
 Generates boundary_mesh data structures corresponding to the mesh data structures. More...
 
void sync (const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh, const std::set< subdomain_id_type > &subdomains_relative_to)
 Like the other sync() implementations, but specifically intended for building "boundary" meshes from internal sidesets. More...
 
void get_side_and_node_maps (UnstructuredMesh &boundary_mesh, std::map< dof_id_type, dof_id_type > &node_id_map, std::map< dof_id_type, unsigned char > &side_id_map, Real tolerance=1.e-6)
 Suppose we have used sync to create boundary_mesh. More...
 
void add_elements (const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh, bool store_parent_side_ids=false)
 Generates elements along the boundary of our _mesh, which use pre-existing nodes on the boundary_mesh, and which have interior_parent values properly defined. More...
 
void add_elements (const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh, const std::set< subdomain_id_type > &subdomains_relative_to, bool store_parent_side_ids=false)
 Same as the add_elements() function above, but takes a set of subdomains for which the sides must be relative to. More...
 
void add_node (const Node *node, const boundary_id_type id)
 Add Node node with boundary id id to the boundary information data structures. More...
 
void add_node (const dof_id_type node, const boundary_id_type id)
 Add node number node with boundary id id to the boundary information data structures. More...
 
void add_node (const Node *node, const std::vector< boundary_id_type > &ids)
 Add Node node with boundary ids ids to the boundary information data structure. More...
 
void clear_boundary_node_ids ()
 Clears all the boundary information from all of the nodes in the mesh. More...
 
void add_edge (const dof_id_type elem, const unsigned short int edge, const boundary_id_type id)
 Add edge edge of element number elem with boundary id id to the boundary information data structure. More...
 
void add_edge (const Elem *elem, const unsigned short int edge, const boundary_id_type id)
 Add edge edge of element elem with boundary id id to the boundary information data structure. More...
 
void add_edge (const Elem *elem, const unsigned short int edge, const std::vector< boundary_id_type > &ids)
 Add edge edge of element elem with boundary ids ids to the boundary information data structure. More...
 
void add_shellface (const dof_id_type elem, const unsigned short int shellface, const boundary_id_type id)
 Add shell face shellface of element number elem with boundary id id to the boundary information data structure. More...
 
void add_shellface (const Elem *elem, const unsigned short int shellface, const boundary_id_type id)
 Add shell face shellface of element elem with boundary id id to the boundary information data structure. More...
 
void add_shellface (const Elem *elem, const unsigned short int shellface, const std::vector< boundary_id_type > &ids)
 Add shell face shellface of element elem with boundary ids ids to the boundary information data structure. More...
 
void add_side (const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
 Add side side of element number elem with boundary id id to the boundary information data structure. More...
 
void add_side (const Elem *elem, const unsigned short int side, const boundary_id_type id)
 Add side side of element elem with boundary id id to the boundary information data structure. More...
 
void add_side (const Elem *elem, const unsigned short int side, const std::vector< boundary_id_type > &ids)
 Add side side of element elem with boundary ids ids to the boundary information data structure. More...
 
void remove (const Node *node)
 Removes the boundary conditions associated with node node, if any exist. More...
 
void remove (const Elem *elem)
 Removes the boundary conditions associated with element elem, if any exist. More...
 
void remove_node (const Node *node, const boundary_id_type id)
 Removes boundary id id from node node, if it exists. More...
 
void remove_edge (const Elem *elem, const unsigned short int edge)
 Removes all boundary conditions associated with edge edge of element elem, if any exist. More...
 
void remove_edge (const Elem *elem, const unsigned short int edge, const boundary_id_type id)
 Removes the boundary id id from edge edge of element elem, if it exists. More...
 
void remove_shellface (const Elem *elem, const unsigned short int shellface)
 Removes all boundary conditions associated with shell face shellface of element elem, if any exist. More...
 
void remove_shellface (const Elem *elem, const unsigned short int shellface, const boundary_id_type id)
 Removes all boundary conditions associated with shell face shellface of element elem, if any exist. More...
 
void remove_side (const Elem *elem, const unsigned short int side)
 Removes all boundary conditions associated with side side of element elem, if any exist. More...
 
void remove_side (const Elem *elem, const unsigned short int side, const boundary_id_type id)
 Removes the boundary id id from side side of element elem, if it exists. More...
 
void clear_stitched_boundary_side_ids (boundary_id_type sideset_id, boundary_id_type other_sideset_id, bool clear_nodeset_data=false)
 Clear sideset information along a stitched mesh interface. More...
 
void remove_id (boundary_id_type id, bool global=false)
 Removes all entities (nodes, sides, edges, shellfaces) with boundary id id from their respective containers and erases any record of id's existence from the BoundaryInfo object. More...
 
void remove_side_id (boundary_id_type id, bool global=false)
 Removes all sides with boundary id id from the BoundaryInfo object, removes it from the set of side boundary ids, and removes it from the set of boundary ids if no other boundary type uses it. More...
 
void remove_edge_id (boundary_id_type id, bool global=false)
 Removes all edges with boundary id id from the BoundaryInfo object, removes it from the set of edge boundary ids, and removes it from the set of boundary ids if no other boundary type uses it. More...
 
void remove_shellface_id (boundary_id_type id, bool global=false)
 Removes all shellfaces with boundary id id from the BoundaryInfo object, removes it from the set of shellface boundary ids, and removes it from the set of boundary ids if no other boundary type uses it. More...
 
void remove_node_id (boundary_id_type id, bool global=false)
 Removes all nodes with boundary id id from the BoundaryInfo object, removes it from the set of node boundary ids, and removes it from the set of boundary ids if no other boundary type uses it. More...
 
void renumber_id (boundary_id_type old_id, boundary_id_type new_id)
 Changes all entities (nodes, sides, edges, shellfaces) with boundary id old_id to instead be labeled by boundary id new_id. More...
 
void renumber_side_id (boundary_id_type old_id, boundary_id_type new_id)
 Changes all sides with boundary id old_id to instead be labeled by boundary id new_id. More...
 
void renumber_edge_id (boundary_id_type old_id, boundary_id_type new_id)
 Changes all edges with boundary id old_id to instead be labeled by boundary id new_id. More...
 
void renumber_shellface_id (boundary_id_type old_id, boundary_id_type new_id)
 Changes all shellfaces with boundary id old_id to instead be labeled by boundary id new_id. More...
 
void renumber_node_id (boundary_id_type old_id, boundary_id_type new_id)
 Changes all nodes with boundary id old_id to instead be labeled by boundary id new_id. More...
 
std::size_t n_boundary_ids () const
 
bool has_boundary_id (const Node *const node, const boundary_id_type id) const
 
void boundary_ids (const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
 Fills a user-provided std::vector with the boundary ids associated with Node node. More...
 
unsigned int n_boundary_ids (const Node *node) const
 
unsigned int n_edge_boundary_ids (const Elem *const elem, const unsigned short int edge) const
 
void edge_boundary_ids (const Elem *const elem, const unsigned short int edge, std::vector< boundary_id_type > &vec_to_fill) const
 
void raw_edge_boundary_ids (const Elem *const elem, const unsigned short int edge, std::vector< boundary_id_type > &vec_to_fill) const
 
unsigned int n_shellface_boundary_ids (const Elem *const elem, const unsigned short int shellface) const
 
void shellface_boundary_ids (const Elem *const elem, const unsigned short int shellface, std::vector< boundary_id_type > &vec_to_fill) const
 
void raw_shellface_boundary_ids (const Elem *const elem, const unsigned short int shellface, std::vector< boundary_id_type > &vec_to_fill) const
 
bool has_boundary_id (const Elem *const elem, const unsigned short int side, const boundary_id_type id) const
 
unsigned int n_boundary_ids (const Elem *const elem, const unsigned short int side) const
 
unsigned int n_raw_boundary_ids (const Elem *const elem, const unsigned short int side) const
 
void side_boundary_ids (const Elem *const elem, std::vector< std::vector< boundary_id_type >> &vec_to_fill) const
 
void boundary_ids (const Elem *const elem, const unsigned short int side, std::vector< boundary_id_type > &vec_to_fill) const
 
void raw_boundary_ids (const Elem *const elem, const unsigned short int side, std::vector< boundary_id_type > &vec_to_fill) const
 
void copy_boundary_ids (const BoundaryInfo &old_boundary_info, const Elem *const old_elem, const Elem *const new_elem)
 
unsigned int side_with_boundary_id (const Elem *const elem, const boundary_id_type boundary_id) const
 
std::vector< unsigned intsides_with_boundary_id (const Elem *const elem, const boundary_id_type boundary_id) const
 
void build_node_boundary_ids (std::vector< boundary_id_type > &b_ids) const
 Builds the list of unique node boundary ids. More...
 
void build_side_boundary_ids (std::vector< boundary_id_type > &b_ids) const
 Builds the list of unique side boundary ids. More...
 
void build_shellface_boundary_ids (std::vector< boundary_id_type > &b_ids) const
 Builds the list of unique shellface boundary ids. More...
 
void transfer_boundary_ids_from_children (const Elem *const parent)
 Update parent's boundary id list so that this information is consistent with its children. More...
 
std::size_t n_boundary_conds () const
 
std::size_t n_edge_conds () const
 
std::size_t n_shellface_conds () const
 
std::size_t n_nodeset_conds () const
 
std::vector< NodeBCTuplebuild_node_list (NodeBCTupleSortBy sort_by=NodeBCTupleSortBy::NODE_ID) const
 
void build_node_list_from_side_list (const std::set< boundary_id_type > &sideset_list={})
 Adds nodes with boundary ids based on the side's boundary ids they are connected to. More...
 
void build_side_list_from_node_list (const std::set< boundary_id_type > &nodeset_list={})
 Adds sides to a sideset if every node on that side are in the same sideset. More...
 
std::vector< BCTuplebuild_side_list (BCTupleSortBy sort_by=BCTupleSortBy::ELEM_ID) const
 
std::vector< BCTuplebuild_active_side_list () const
 Create a list of (element_id, side_id, boundary_id) tuples for all relevant active sides. More...
 
std::vector< BCTuplebuild_edge_list () const
 Create a list of (element_id, edge_id, boundary_id) tuples for all relevant edges. More...
 
std::vector< BCTuplebuild_shellface_list () const
 Create a list of (element_id, shellface_id, boundary_id) tuples for all relevant shellfaces. More...
 
void parallel_sync_side_ids ()
 Synchronize the boundary element side and node across processors. More...
 
void parallel_sync_node_ids ()
 
const std::set< boundary_id_type > & get_boundary_ids () const
 
const std::set< boundary_id_type > & get_global_boundary_ids () const
 
const std::set< boundary_id_type > & get_side_boundary_ids () const
 
const std::set< boundary_id_type > & get_edge_boundary_ids () const
 
const std::set< boundary_id_type > & get_shellface_boundary_ids () const
 
const std::set< boundary_id_type > & get_node_boundary_ids () const
 
void print_info (std::ostream &out_stream=libMesh::out) const
 Prints the boundary information data structure. More...
 
void print_summary (std::ostream &out_stream=libMesh::out) const
 Prints a summary of the boundary information. More...
 
const std::string & get_sideset_name (boundary_id_type id) const
 
std::string & sideset_name (boundary_id_type id)
 
const std::string & get_nodeset_name (boundary_id_type id) const
 
std::string & nodeset_name (boundary_id_type id)
 
const std::string & get_edgeset_name (boundary_id_type id) const
 
std::string & edgeset_name (boundary_id_type id)
 
boundary_id_type get_id_by_name (std::string_view name) const
 
std::map< boundary_id_type, std::string > & set_sideset_name_map ()
 
const std::map< boundary_id_type, std::string > & get_sideset_name_map () const
 
std::map< boundary_id_type, std::string > & set_nodeset_name_map ()
 
const std::map< boundary_id_type, std::string > & get_nodeset_name_map () const
 
std::map< boundary_id_type, std::string > & set_edgeset_name_map ()
 
const std::map< boundary_id_type, std::string > & get_edgeset_name_map () const
 
const std::multimap< const Node *, boundary_id_type > & get_nodeset_map () const
 
const std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > & get_edgeset_map () const
 
const std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > & get_sideset_map () const
 
bool is_children_on_boundary_side () const
 
void allow_children_on_boundary_side (const bool children_on_boundary)
 Whether or not to allow directly setting boundary sides on child elements. More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Attributes

static const boundary_id_type invalid_id = -123
 Number used for internal use. More...
 

Protected Member Functions

 BoundaryInfo (MeshBase &m)
 Constructor. More...
 
void set_mesh (MeshBase &m)
 

Protected Attributes

const Parallel::Communicator_communicator
 

Private Member Functions

void libmesh_assert_valid_multimaps () const
 Helper method for ensuring that our multimaps don't contain entries with duplicate keys and values. More...
 
void _find_id_maps (const std::set< boundary_id_type > &requested_boundary_ids, dof_id_type first_free_node_id, std::map< dof_id_type, dof_id_type > *node_id_map, dof_id_type first_free_elem_id, std::map< std::pair< dof_id_type, unsigned char >, dof_id_type > *side_id_map, const std::set< subdomain_id_type > &subdomains_relative_to)
 Helper method for finding consistent maps of interior to boundary dof_object ids. More...
 

Private Attributes

MeshBase_mesh
 A pointer to the Mesh this boundary info pertains to. More...
 
std::multimap< const Node *, boundary_id_type_boundary_node_id
 Data structure that maps nodes in the mesh to boundary ids. More...
 
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
 Data structure that maps edges of elements to boundary ids. More...
 
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
 Data structure that maps faces of shell elements to boundary ids. More...
 
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
 Data structure that maps sides of elements to boundary ids. More...
 
bool _children_on_boundary
 
std::set< boundary_id_type_boundary_ids
 A collection of user-specified boundary ids for sides, edges, nodes, and shell faces. More...
 
std::set< boundary_id_type_global_boundary_ids
 A collection of user-specified boundary ids for sides, edges, nodes, and shell faces. More...
 
std::set< boundary_id_type_side_boundary_ids
 Set of user-specified boundary IDs for sides only. More...
 
std::set< boundary_id_type_edge_boundary_ids
 Set of user-specified boundary IDs for edges only. More...
 
std::set< boundary_id_type_node_boundary_ids
 Set of user-specified boundary IDs for nodes only. More...
 
std::set< boundary_id_type_shellface_boundary_ids
 Set of user-specified boundary IDs for shellfaces only. More...
 
std::map< boundary_id_type, std::string > _ss_id_to_name
 This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support this. More...
 
std::map< boundary_id_type, std::string > _ns_id_to_name
 This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support this. More...
 
std::map< boundary_id_type, std::string > _es_id_to_name
 This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support this. More...
 

Friends

class MeshBase
 

Detailed Description

The BoundaryInfo class contains information relevant to boundary conditions including storing faces, edges, and nodes on the boundary, along with ids that can be used to identify the type of boundary each entity is part of.

It can also build a mesh that just includes boundary elements/faces.

Author
Benjamin S. Kirk
Date
2002 Used by the Mesh to keep track of boundary nodes and elements.

Definition at line 57 of file boundary_info.h.

Member Typedef Documentation

◆ BCTuple

typedef std::tuple<dof_id_type, unsigned short int, boundary_id_type> libMesh::BoundaryInfo::BCTuple

Create a list of (element_id, side_id, boundary_id) tuples for relevant sides.

On a ReplicatedMesh this will include all sides; on a DistributedMesh only sides of semilocal elements will be included.

The returned vector is sorted by element id by default, but this can be changed by passing SIDE_ID, BOUNDARY_ID, or UNSORTED to this function. Note: choosing UNSORTED is not recommended since the resulting list will potentially be in different orders on different processors when running in parallel.

Definition at line 749 of file boundary_info.h.

◆ NodeBCTuple

Create a list of (node_id, boundary_id) tuples for all relevant nodes.

On a ReplicatedMesh this will include all nodes; on a DistributedMesh only semilocal nodes will be included. Note: we could use std::pairs for this, but for consistency with the other build_XYZ_list functions, we're using tuples.

The "sort_by" parameter controls how the resulting list of tuples is sorted. It is possible (but not recommended) to choose UNSORTED, since in that case the resulting vectors will potentially be in different orders on different procs.

Definition at line 715 of file boundary_info.h.

Member Enumeration Documentation

◆ BCTupleSortBy

Enumerator
ELEM_ID 
SIDE_ID 
BOUNDARY_ID 
UNSORTED 

Definition at line 750 of file boundary_info.h.

750 {ELEM_ID, SIDE_ID, BOUNDARY_ID, UNSORTED};

◆ NodeBCTupleSortBy

Enumerator
NODE_ID 
BOUNDARY_ID 
UNSORTED 

Definition at line 716 of file boundary_info.h.

716 {NODE_ID, BOUNDARY_ID, UNSORTED};

Constructor & Destructor Documentation

◆ BoundaryInfo()

libMesh::BoundaryInfo::BoundaryInfo ( MeshBase m)
protected

Constructor.

Takes a reference to the mesh. The BoundaryInfo class is only used internally by the Mesh class. A user should never instantiate this class. Therefore the constructor is protected.

Definition at line 103 of file boundary_info.C.

103  :
104  ParallelObject(m.comm()),
105  _mesh (&m),
106  _children_on_boundary(false)
107 {
108 }
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.

◆ ~BoundaryInfo()

libMesh::BoundaryInfo::~BoundaryInfo ( )
default

Destructor.

Not much to do.

Member Function Documentation

◆ _find_id_maps()

void libMesh::BoundaryInfo::_find_id_maps ( const std::set< boundary_id_type > &  requested_boundary_ids,
dof_id_type  first_free_node_id,
std::map< dof_id_type, dof_id_type > *  node_id_map,
dof_id_type  first_free_elem_id,
std::map< std::pair< dof_id_type, unsigned char >, dof_id_type > *  side_id_map,
const std::set< subdomain_id_type > &  subdomains_relative_to 
)
private

Helper method for finding consistent maps of interior to boundary dof_object ids.

Either node_id_map or side_id_map can be nullptr, in which case it will not be filled.

Definition at line 3306 of file boundary_info.C.

References _mesh, boundary_ids(), libMesh::ParallelObject::comm(), libMesh::DofObject::id(), invalid_id, libMesh::DofObject::invalid_processor_id, libMesh::Elem::invalid_subdomain_id, libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::make_range(), TIMPI::Communicator::max(), libMesh::MeshTools::n_levels(), libMesh::ParallelObject::n_processors(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::node_index_range(), libMesh::Elem::node_ref(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), TIMPI::Communicator::set_union(), libMesh::Elem::side_index_range(), and libMesh::Elem::subdomain_id().

Referenced by add_elements(), and sync().

3312 {
3313  // We'll use the standard DistributedMesh trick of dividing up id
3314  // ranges by processor_id to avoid picking duplicate node ids.
3315  dof_id_type
3316  next_node_id = first_free_node_id + this->processor_id();
3317 
3318  // We have to be careful how we select different element ids on
3319  // different processors, because we may be adding sides of refined
3320  // elements and sides of their parents (which are thereby also
3321  // parents of their sides), but libMesh convention requires (and
3322  // some libMesh communication code assumes) that parent elements
3323  // have lower ids than their children.
3324  //
3325  // We'll start with temporary ids in a temporary map stratefied by
3326  // element level, so we can sort by element level after.
3327  // Make sure we're sorting by ids here, not anything that might
3328  // differ from processor to processor, so we can do an
3329  // embarrassingly parallel sort. This is a serialized data
3330  // structure, but it's at worst O(N^2/3) so we'll hold off on doing
3331  // this distributed until someone's benchmark screams at us.
3332  std::vector
3333  <std::set<std::pair<dof_id_type, unsigned char>>>
3334  side_id_set_by_level;
3335 
3336  // For avoiding extraneous element side construction
3337  ElemSideBuilder side_builder;
3338  // Pull objects out of the loop to reduce heap operations
3339  const Elem * side;
3340 
3341  // We'll pass through the mesh once first to build
3342  // the maps and count boundary nodes and elements.
3343  // To find local boundary nodes, we have to examine all elements
3344  // here rather than just local elements, because it's possible to
3345  // have a local boundary node that's not on a local boundary
3346  // element, e.g. at the tip of a triangle.
3347 
3348  // We'll loop through two different ranges here: first all elements,
3349  // looking for local nodes, and second through unpartitioned
3350  // elements, looking for all remaining nodes.
3351  const MeshBase::const_element_iterator end_el = _mesh->elements_end();
3352  bool hit_end_el = false;
3353  const MeshBase::const_element_iterator end_unpartitioned_el =
3354  _mesh->pid_elements_end(DofObject::invalid_processor_id);
3355 
3356  for (MeshBase::const_element_iterator el = _mesh->elements_begin();
3357  !hit_end_el || (el != end_unpartitioned_el); ++el)
3358  {
3359  if ((el == end_el) && !hit_end_el)
3360  {
3361  // Note that we're done with local nodes and just looking
3362  // for remaining unpartitioned nodes
3363  hit_end_el = true;
3364 
3365  // Join up the local results from other processors
3366  if (side_id_map)
3367  {
3368  std::size_t n_levels = side_id_set_by_level.size();
3369  this->comm().max(n_levels);
3370  side_id_set_by_level.resize(n_levels);
3371  for (auto l : make_range(n_levels))
3372  this->comm().set_union(side_id_set_by_level[l]);
3373  }
3374  if (node_id_map)
3375  this->comm().set_union(*node_id_map);
3376 
3377  // Finally we'll pass through any unpartitioned elements to add them
3378  // to the maps and counts.
3379  next_node_id = first_free_node_id + this->n_processors();
3380 
3381  el = _mesh->pid_elements_begin(DofObject::invalid_processor_id);
3382  if (el == end_unpartitioned_el)
3383  break;
3384  }
3385 
3386  const Elem * elem = *el;
3387 
3388  // If the subdomains_relative_to container has the
3389  // invalid_subdomain_id, we fall back on the "old" behavior of
3390  // adding sides regardless of this Elem's subdomain. Otherwise,
3391  // if the subdomains_relative_to container doesn't contain the
3392  // current Elem's subdomain_id(), we won't add any sides from
3393  // it.
3394  if (!subdomains_relative_to.count(Elem::invalid_subdomain_id) &&
3395  !subdomains_relative_to.count(elem->subdomain_id()))
3396  continue;
3397 
3398  for (auto s : elem->side_index_range())
3399  {
3400  bool add_this_side = false;
3401 
3402  // Find all the boundary side ids for this Elem side.
3403  std::vector<boundary_id_type> bcids;
3404  this->boundary_ids(elem, s, bcids);
3405 
3406  for (const boundary_id_type bcid : bcids)
3407  {
3408  // if the user wants this id, we want this side
3409  if (requested_boundary_ids.count(bcid))
3410  {
3411  add_this_side = true;
3412  break;
3413  }
3414  }
3415 
3416  // We may still want to add this side if the user called
3417  // sync() with no requested_boundary_ids. This corresponds
3418  // to the "old" style of calling sync() in which the entire
3419  // boundary was copied to the BoundaryMesh, and handles the
3420  // case where elements on the geometric boundary are not in
3421  // any sidesets.
3422  if (requested_boundary_ids.count(invalid_id) &&
3423  elem->neighbor_ptr(s) == nullptr)
3424  add_this_side = true;
3425 
3426  if (add_this_side)
3427  {
3428  // We only assign ids for our own and for
3429  // unpartitioned elements
3430  if (side_id_map &&
3431  ((elem->processor_id() == this->processor_id()) ||
3432  (elem->processor_id() ==
3434  {
3435  std::pair<dof_id_type, unsigned char> side_pair(elem->id(), s);
3436  auto level = elem->level();
3437  if (side_id_set_by_level.size() <= level)
3438  side_id_set_by_level.resize(level+1);
3439  auto & level_side_id_set = side_id_set_by_level[level];
3440  libmesh_assert (!level_side_id_set.count(side_pair));
3441  level_side_id_set.insert(side_pair);
3442  }
3443 
3444  side = &side_builder(*elem, s);
3445  for (auto n : side->node_index_range())
3446  {
3447  const Node & node = side->node_ref(n);
3448 
3449  // In parallel we don't know enough to number
3450  // others' nodes ourselves.
3451  if (!hit_end_el &&
3452  (node.processor_id() != this->processor_id()))
3453  continue;
3454 
3455  dof_id_type node_id = node.id();
3456  if (node_id_map && !node_id_map->count(node_id))
3457  {
3458  (*node_id_map)[node_id] = next_node_id;
3459  next_node_id += this->n_processors() + 1;
3460  }
3461  }
3462  }
3463  }
3464  }
3465 
3466  // FIXME: should we renumber node_id_map's image to be contiguous
3467  // here, rather than waiting for renumbering in mesh preparation to
3468  // do it later?
3469 
3470  // We do need to build up side_id_map here, to handle proper sorting
3471  // by level.
3472  if (side_id_map)
3473  {
3474  dof_id_type next_elem_id = first_free_elem_id;
3475  for (auto level : make_range(side_id_set_by_level.size()))
3476  {
3477  for (auto side_pair : side_id_set_by_level[level])
3478  (*side_id_map)[side_pair] = next_elem_id++;
3479  }
3480  }
3481 }
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:484
const Parallel::Communicator & comm() const
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
processor_id_type n_processors() const
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
Number used for internal use.
unsigned int n_levels(const MeshBase &mesh)
Definition: mesh_tools.C:826
libmesh_assert(ctx)
void max(const T &r, T &o, Request &req) const
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176
processor_id_type processor_id() const
static constexpr subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
Definition: elem.h:246
uint8_t dof_id_type
Definition: id_types.h:67
void set_union(T &data, const unsigned int root_id) const

◆ add_edge() [1/3]

void libMesh::BoundaryInfo::add_edge ( const dof_id_type  elem,
const unsigned short int  edge,
const boundary_id_type  id 
)

Add edge edge of element number elem with boundary id id to the boundary information data structure.

Edge-based boundary IDs should only be used in 3D.

Definition at line 1025 of file boundary_info.C.

References _mesh, and libMesh::MeshBase::elem_ptr().

Referenced by copy_boundary_ids(), main(), libMesh::ExodusII_IO_Helper::read_edge_blocks(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::UnstructuredMesh::stitching_helper(), libMesh::Elem::swap2boundaryedges(), SystemsTest::testBoundaryProjectCube(), BoundaryInfoTest::testEdgeBoundaryConditions(), BoundaryInfoTest::testSelectiveRenumber(), and WriteEdgesetData::testWriteImpl().

1028 {
1029  this->add_edge (_mesh->elem_ptr(e), edge, id);
1030 }
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
virtual const Elem * elem_ptr(const dof_id_type i) const =0
void add_edge(const dof_id_type elem, const unsigned short int edge, const boundary_id_type id)
Add edge edge of element number elem with boundary id id to the boundary information data structure...

◆ add_edge() [2/3]

void libMesh::BoundaryInfo::add_edge ( const Elem elem,
const unsigned short int  edge,
const boundary_id_type  id 
)

Add edge edge of element elem with boundary id id to the boundary information data structure.

Edge-based boundary IDs should only be used in 3D.

Definition at line 1034 of file boundary_info.C.

References _boundary_edge_id, _boundary_ids, _edge_boundary_ids, libMesh::as_range(), invalid_id, libMesh::Elem::level(), libMesh::libmesh_assert(), and libMesh::Elem::n_edges().

1037 {
1038  libmesh_assert(elem);
1039 
1040  // Only add BCs for level-0 elements.
1041  libmesh_assert_equal_to (elem->level(), 0);
1042 
1043  // Only add BCs for edges that exist.
1044  libmesh_assert_less (edge, elem->n_edges());
1045 
1046  libmesh_error_msg_if(id == invalid_id,
1047  "ERROR: You may not set a boundary ID of "
1048  << invalid_id
1049  << "\n That is reserved for internal use.");
1050 
1051  // Don't add the same ID twice
1052  for (const auto & pr : as_range(_boundary_edge_id.equal_range(elem)))
1053  if (pr.second.first == edge &&
1054  pr.second.second == id)
1055  return;
1056 
1057  _boundary_edge_id.emplace(elem, std::make_pair(edge, id));
1058  _boundary_ids.insert(id);
1059  _edge_boundary_ids.insert(id); // Also add this ID to the set of edge boundary IDs
1060 }
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
static const boundary_id_type invalid_id
Number used for internal use.
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
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ add_edge() [3/3]

void libMesh::BoundaryInfo::add_edge ( const Elem elem,
const unsigned short int  edge,
const std::vector< boundary_id_type > &  ids 
)

Add edge edge of element elem with boundary ids ids to the boundary information data structure.

Edge-based boundary IDs should only be used in 3D.

Definition at line 1064 of file boundary_info.C.

References _boundary_edge_id, _boundary_ids, _edge_boundary_ids, libMesh::as_range(), invalid_id, libMesh::Elem::level(), libMesh::libmesh_assert(), and libMesh::Elem::n_edges().

1067 {
1068  if (ids.empty())
1069  return;
1070 
1071  libmesh_assert(elem);
1072 
1073  // Only add BCs for level-0 elements.
1074  libmesh_assert_equal_to (elem->level(), 0);
1075 
1076  // Only add BCs for edges that exist.
1077  libmesh_assert_less (edge, elem->n_edges());
1078 
1079  // Don't add the same ID twice
1080  auto bounds = _boundary_edge_id.equal_range(elem);
1081 
1082  // The entries in the ids vector may be non-unique. If we expected
1083  // *lots* of ids, it might be fastest to construct a std::set from
1084  // the entries, but for a small number of entries, which is more
1085  // typical, it is probably faster to copy the vector and do sort+unique.
1086  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
1087  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
1088  std::sort(unique_ids.begin(), unique_ids.end());
1089  std::vector<boundary_id_type>::iterator new_end =
1090  std::unique(unique_ids.begin(), unique_ids.end());
1091 
1092  for (auto & id : as_range(unique_ids.begin(), new_end))
1093  {
1094  libmesh_error_msg_if(id == invalid_id,
1095  "ERROR: You may not set a boundary ID of "
1096  << invalid_id
1097  << "\n That is reserved for internal use.");
1098 
1099  bool already_inserted = false;
1100  for (const auto & pr : as_range(bounds))
1101  if (pr.second.first == edge &&
1102  pr.second.second == id)
1103  {
1104  already_inserted = true;
1105  break;
1106  }
1107  if (already_inserted)
1108  continue;
1109 
1110  _boundary_edge_id.emplace(elem, std::make_pair(edge, id));
1111  _boundary_ids.insert(id);
1112  _edge_boundary_ids.insert(id); // Also add this ID to the set of edge boundary IDs
1113  }
1114 }
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
static const boundary_id_type invalid_id
Number used for internal use.
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
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ add_elements() [1/2]

void libMesh::BoundaryInfo::add_elements ( const std::set< boundary_id_type > &  requested_boundary_ids,
UnstructuredMesh boundary_mesh,
bool  store_parent_side_ids = false 
)

Generates elements along the boundary of our _mesh, which use pre-existing nodes on the boundary_mesh, and which have interior_parent values properly defined.

The boundary_mesh may be the same as the interior mesh; this generates a mesh with elements of mixed dimension.

Only boundary elements with the specified ids are created.

Definition at line 655 of file boundary_info.C.

References libMesh::Elem::invalid_subdomain_id.

Referenced by main(), and sync().

658 {
659  // Call the 3 argument version of this function with a dummy value for the third arg.
660  std::set<subdomain_id_type> subdomains_relative_to;
661  subdomains_relative_to.insert(Elem::invalid_subdomain_id);
662 
663  this->add_elements(requested_boundary_ids,
664  boundary_mesh,
665  subdomains_relative_to,
666  store_parent_side_ids);
667 }
void add_elements(const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh, bool store_parent_side_ids=false)
Generates elements along the boundary of our _mesh, which use pre-existing nodes on the boundary_mesh...
static constexpr subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
Definition: elem.h:246

◆ add_elements() [2/2]

void libMesh::BoundaryInfo::add_elements ( const std::set< boundary_id_type > &  requested_boundary_ids,
UnstructuredMesh boundary_mesh,
const std::set< subdomain_id_type > &  subdomains_relative_to,
bool  store_parent_side_ids = false 
)

Same as the add_elements() function above, but takes a set of subdomains for which the sides must be relative to.

This is necessary to avoid double-adding sides of internal sidesets to the BoundaryMesh.

Definition at line 671 of file boundary_info.C.

References _find_id_maps(), _mesh, libMesh::Elem::add_child(), libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_elem_integer(), boundary_ids(), libMesh::Elem::build_side_ptr(), libMesh::Elem::child_ptr(), libMesh::MeshBase::elem_ptr(), libMesh::Elem::has_children(), libMesh::DofObject::id(), libMesh::MeshBase::interior_mesh(), invalid_id, libMesh::Elem::invalid_subdomain_id, libMesh::invalid_uint, libMesh::Elem::is_child_on_side(), libMesh::Elem::is_node_on_side(), libMesh::MeshBase::is_replicated(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_ids(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::make_range(), libMesh::MeshBase::max_elem_id(), libMesh::Elem::n_children(), n_nodes, libMesh::Elem::n_nodes(), libMesh::Elem::n_sides(), libMesh::Elem::n_vertices(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::node_ptr(), libMesh::Elem::p_refinement_flag(), libMesh::MeshBase::parallel_max_unique_id(), libMesh::Elem::parent(), libMesh::Elem::point(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::Elem::raw_child_ptr(), libMesh::Elem::refinement_flag(), libMesh::remote_elem, libMesh::DofObject::set_extra_integer(), libMesh::MeshBase::set_interior_mesh(), libMesh::Elem::set_interior_parent(), libMesh::Elem::set_neighbor(), libMesh::Elem::set_p_refinement_flag(), libMesh::Elem::set_parent(), libMesh::Elem::set_refinement_flag(), and libMesh::Elem::side_index_range().

675 {
676  LOG_SCOPE("add_elements()", "BoundaryInfo");
677 
678  // We're not prepared to mix serial and distributed meshes in this
679  // method, so make sure their statuses match from the start.
680  //
681  // Specifically test *is_serial* here - we can handle a mix of
682  // ReplicatedMesh and serialized DistributedMesh.
683  libmesh_assert_equal_to(_mesh->is_serial(),
684  boundary_mesh.is_serial());
685 
686  // If the boundary mesh already has interior pointers pointing at
687  // elements in a third mesh then we're in trouble
688  libmesh_assert(&boundary_mesh.interior_mesh() == &boundary_mesh ||
689  &boundary_mesh.interior_mesh() == _mesh);
690 
691  // And now we're going to add interior pointers to elements from
692  // this mesh
693  boundary_mesh.set_interior_mesh(*_mesh);
694 
695  std::map<std::pair<dof_id_type, unsigned char>, dof_id_type> side_id_map;
696  this->_find_id_maps(requested_boundary_ids,
697  0,
698  nullptr,
699  boundary_mesh.max_elem_id(),
700  &side_id_map,
701  subdomains_relative_to);
702 
703  // We have to add sides *outside* any element loop, because if
704  // boundary_mesh and _mesh are the same then those additions can
705  // invalidate our element iterators. So we just use the element
706  // loop to make a list of sides to add.
707  typedef std::vector<std::pair<dof_id_type, unsigned char>>
708  side_container;
709  side_container sides_to_add;
710 
711  for (const auto & elem : _mesh->element_ptr_range())
712  {
713  // If the subdomains_relative_to container has the
714  // invalid_subdomain_id, we fall back on the "old" behavior of
715  // adding sides regardless of this Elem's subdomain. Otherwise,
716  // if the subdomains_relative_to container doesn't contain the
717  // current Elem's subdomain_id(), we won't add any sides from
718  // it.
719  if (!subdomains_relative_to.count(Elem::invalid_subdomain_id) &&
720  !subdomains_relative_to.count(elem->subdomain_id()))
721  continue;
722 
723  for (auto s : elem->side_index_range())
724  {
725  bool add_this_side = false;
726 
727  // Find all the boundary side ids for this Elem side.
728  std::vector<boundary_id_type> bcids;
729  this->boundary_ids(elem, s, bcids);
730 
731  for (const boundary_id_type bcid : bcids)
732  {
733  // if the user wants this id, we want this side
734  if (requested_boundary_ids.count(bcid))
735  {
736  add_this_side = true;
737  break;
738  }
739  }
740 
741  // We may still want to add this side if the user called
742  // sync() with no requested_boundary_ids. This corresponds
743  // to the "old" style of calling sync() in which the entire
744  // boundary was copied to the BoundaryMesh, and handles the
745  // case where elements on the geometric boundary are not in
746  // any sidesets.
747  if (requested_boundary_ids.count(invalid_id) &&
748  elem->neighbor_ptr(s) == nullptr)
749  add_this_side = true;
750 
751  if (add_this_side)
752  sides_to_add.emplace_back(elem->id(), s);
753  }
754  }
755 
756 #ifdef LIBMESH_ENABLE_UNIQUE_ID
757  unique_id_type old_max_unique_id = boundary_mesh.parallel_max_unique_id();
758 #endif
759 
760  // Add an "extra" integer for storing the side index of the parent
761  // Elem which each boundary Elem corresponds to. We do this once
762  // before any Elems have been added.
763  unsigned int parent_side_index_tag = store_parent_side_ids ?
764  boundary_mesh.add_elem_integer("parent_side_index") : libMesh::invalid_uint;
765 
766  for (const auto & [elem_id, s] : sides_to_add)
767  {
768  Elem * elem = _mesh->elem_ptr(elem_id);
769 
770  std::unique_ptr<Elem> side = elem->build_side_ptr(s);
771 
772  side->processor_id() = elem->processor_id();
773 
774  const std::pair<dof_id_type, unsigned char> side_pair(elem_id, s);
775 
776  libmesh_assert(side_id_map.count(side_pair));
777 
778  const dof_id_type new_side_id = side_id_map[side_pair];
779 
780  side->set_id(new_side_id);
781 
782 #ifdef LIBMESH_ENABLE_UNIQUE_ID
783  side->set_unique_id(old_max_unique_id + new_side_id);
784 #endif
785 
786  // Add the side
787  Elem * new_elem = boundary_mesh.add_elem(std::move(side));
788 
789  // If requested, new_elem gets an "extra" integer equal to the
790  // side id "s" of the interior_parent it corresponds to.
791  if (store_parent_side_ids)
792  new_elem->set_extra_integer(parent_side_index_tag, s);
793 
794 #ifdef LIBMESH_ENABLE_AMR
795  new_elem->set_refinement_flag(elem->refinement_flag());
796  new_elem->set_p_refinement_flag(elem->p_refinement_flag());
797 
798  // Set parent links
799  if (elem->parent())
800  {
801  const std::pair<dof_id_type, unsigned char> parent_side_pair(elem->parent()->id(), s);
802 
803  libmesh_assert(side_id_map.count(parent_side_pair));
804 
805  Elem * side_parent = boundary_mesh.elem_ptr(side_id_map[parent_side_pair]);
806 
807  libmesh_assert(side_parent);
808 
809  new_elem->set_parent(side_parent);
810 
811  // Figuring out which child we are of our parent
812  // is a trick. Due to libMesh child numbering
813  // conventions, if we are an element on a vertex,
814  // then we share that vertex with our parent, with
815  // the same local index.
816  bool found_child = false;
817  for (auto v : make_range(new_elem->n_vertices()))
818  if (new_elem->node_ptr(v) == side_parent->node_ptr(v))
819  {
820  side_parent->add_child(new_elem, v);
821  found_child = true;
822  }
823 
824  // If we don't share any vertex with our parent,
825  // then we're the fourth child (index 3) of a
826  // triangle.
827  if (!found_child)
828  {
829  libmesh_assert_equal_to (new_elem->n_vertices(), 3);
830  side_parent->add_child(new_elem, 3);
831  }
832  }
833 
834  // Set remote_elem child links if necessary. Rather than
835  // worrying about which interior child corresponds to which side
836  // child we'll just set all null links to be remote and we'll
837  // rely on our detection of actual semilocal children to
838  // overwrite the links that shouldn't be remote.
839  if (elem->has_children())
840  for (auto c : make_range(elem->n_children()))
841  if (elem->child_ptr(c) == remote_elem &&
842  elem->is_child_on_side(c, s))
843  {
844  for (auto sc : make_range(new_elem->n_children()))
845  if (!new_elem->raw_child_ptr(sc))
846  new_elem->add_child
847  (const_cast<RemoteElem*>(remote_elem), sc);
848  }
849 #endif
850 
851  new_elem->set_interior_parent (elem);
852 
853  // On non-local elements on DistributedMesh we might have
854  // RemoteElem neighbor links to construct
855  if (!_mesh->is_serial() &&
856  (elem->processor_id() != this->processor_id()))
857  {
858  const unsigned short n_nodes = elem->n_nodes();
859 
860  const unsigned short bdy_n_sides = new_elem->n_sides();
861  const unsigned short bdy_n_nodes = new_elem->n_nodes();
862 
863  // Check every interior side for a RemoteElem
864  for (auto interior_side : elem->side_index_range())
865  {
866  // Might this interior side have a RemoteElem that
867  // needs a corresponding Remote on a boundary side?
868  if (elem->neighbor_ptr(interior_side) != remote_elem)
869  continue;
870 
871  // Which boundary side?
872  for (unsigned short boundary_side = 0;
873  boundary_side != bdy_n_sides; ++boundary_side)
874  {
875  // Look for matching node points. This is safe in
876  // *this* context.
877  bool found_all_nodes = true;
878  for (unsigned short boundary_node = 0;
879  boundary_node != bdy_n_nodes; ++boundary_node)
880  {
881  if (!new_elem->is_node_on_side(boundary_node,
882  boundary_side))
883  continue;
884 
885  bool found_this_node = false;
886  for (unsigned short interior_node = 0;
887  interior_node != n_nodes; ++interior_node)
888  {
889  if (!elem->is_node_on_side(interior_node,
890  interior_side))
891  continue;
892 
893  if (new_elem->point(boundary_node) ==
894  elem->point(interior_node))
895  {
896  found_this_node = true;
897  break;
898  }
899  }
900  if (!found_this_node)
901  {
902  found_all_nodes = false;
903  break;
904  }
905  }
906 
907  if (found_all_nodes)
908  {
909  new_elem->set_neighbor
910  (boundary_side,
911  const_cast<RemoteElem *>(remote_elem));
912  break;
913  }
914  }
915  }
916  }
917  }
918 
919  // We haven't been bothering to keep unique ids consistent on ghost
920  // elements or nodes, unless we're doing everything the same on
921  // every processor.
922  if (!boundary_mesh.is_replicated())
923  MeshCommunication().make_node_unique_ids_parallel_consistent(boundary_mesh);
924 
925  // Make sure we didn't add ids inconsistently
926 #ifdef DEBUG
927 # ifdef LIBMESH_HAVE_RTTI
928  DistributedMesh * parmesh = dynamic_cast<DistributedMesh *>(&boundary_mesh);
929  if (parmesh)
930  parmesh->libmesh_assert_valid_parallel_ids();
931 # endif
932 #endif
933 }
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:303
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i)=0
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
virtual bool is_serial() const
Definition: mesh_base.h:347
const dof_id_type n_nodes
Definition: tecplot_io.C:67
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
Number used for internal use.
libmesh_assert(ctx)
virtual const Elem * elem_ptr(const dof_id_type i) const =0
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176
void _find_id_maps(const std::set< boundary_id_type > &requested_boundary_ids, dof_id_type first_free_node_id, std::map< dof_id_type, dof_id_type > *node_id_map, dof_id_type first_free_elem_id, std::map< std::pair< dof_id_type, unsigned char >, dof_id_type > *side_id_map, const std::set< subdomain_id_type > &subdomains_relative_to)
Helper method for finding consistent maps of interior to boundary dof_object ids. ...
processor_id_type processor_id() const
static constexpr subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
Definition: elem.h:246
uint8_t unique_id_type
Definition: id_types.h:86
virtual bool is_child_on_side(const unsigned int, const unsigned int) const override
Definition: remote_elem.h:185
uint8_t dof_id_type
Definition: id_types.h:67
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ add_node() [1/3]

void libMesh::BoundaryInfo::add_node ( const Node node,
const boundary_id_type  id 
)

Add Node node with boundary id id to the boundary information data structures.

Definition at line 954 of file boundary_info.C.

References _boundary_ids, _boundary_node_id, _node_boundary_ids, libMesh::as_range(), and invalid_id.

Referenced by libMesh::MeshTools::Subdivision::add_boundary_ghosts(), add_node(), libMesh::AbaqusIO::assign_boundary_node_ids(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), build_node_list_from_side_list(), main(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::GmshIO::read_mesh(), libMesh::CheckpointIO::read_nodesets(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::UnstructuredMesh::stitching_helper(), sync(), and SystemsTest::testBoundaryProjectCube().

956 {
957  libmesh_error_msg_if(id == invalid_id,
958  "ERROR: You may not set a boundary ID of "
959  << invalid_id
960  << "\n That is reserved for internal use.");
961 
962  // Don't add the same ID twice
963  for (const auto & pr : as_range(_boundary_node_id.equal_range(node)))
964  if (pr.second == id)
965  return;
966 
967  _boundary_node_id.emplace(node, id);
968  _boundary_ids.insert(id);
969  _node_boundary_ids.insert(id); // Also add this ID to the set of node boundary IDs
970 }
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
static const boundary_id_type invalid_id
Number used for internal use.
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
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

◆ add_node() [2/3]

void libMesh::BoundaryInfo::add_node ( const dof_id_type  node,
const boundary_id_type  id 
)

Add node number node with boundary id id to the boundary information data structures.

Definition at line 937 of file boundary_info.C.

References _mesh, add_node(), and libMesh::MeshBase::query_node_ptr().

939 {
940  const Node * node_ptr = _mesh->query_node_ptr(node_id);
941 
942  // The user could easily ask for an invalid node id, so let's throw
943  // an easy-to-understand error message when this happens.
944  libmesh_error_msg_if(!node_ptr,
945  "BoundaryInfo::add_node(): Could not retrieve pointer for node "
946  << node_id
947  << ", no boundary id was added.");
948 
949  this->add_node (node_ptr, id);
950 }
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
void add_node(const Node *node, const boundary_id_type id)
Add Node node with boundary id id to the boundary information data structures.
virtual const Node * query_node_ptr(const dof_id_type i) const =0

◆ add_node() [3/3]

void libMesh::BoundaryInfo::add_node ( const Node node,
const std::vector< boundary_id_type > &  ids 
)

Add Node node with boundary ids ids to the boundary information data structure.

Definition at line 974 of file boundary_info.C.

References _boundary_ids, _boundary_node_id, _node_boundary_ids, libMesh::as_range(), invalid_id, and libMesh::libmesh_assert().

976 {
977  if (ids.empty())
978  return;
979 
980  libmesh_assert(node);
981 
982  // Don't add the same ID twice
983  auto bounds = _boundary_node_id.equal_range(node);
984 
985  // The entries in the ids vector may be non-unique. If we expected
986  // *lots* of ids, it might be fastest to construct a std::set from
987  // the entries, but for a small number of entries, which is more
988  // typical, it is probably faster to copy the vector and do sort+unique.
989  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
990  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
991  std::sort(unique_ids.begin(), unique_ids.end());
992  std::vector<boundary_id_type>::iterator new_end =
993  std::unique(unique_ids.begin(), unique_ids.end());
994 
995  for (auto & id : as_range(unique_ids.begin(), new_end))
996  {
997  libmesh_error_msg_if(id == invalid_id,
998  "ERROR: You may not set a boundary ID of "
999  << invalid_id
1000  << "\n That is reserved for internal use.");
1001 
1002  bool already_inserted = false;
1003  for (const auto & pr : as_range(bounds))
1004  if (pr.second == id)
1005  {
1006  already_inserted = true;
1007  break;
1008  }
1009  if (already_inserted)
1010  continue;
1011 
1012  _boundary_node_id.emplace(node, id);
1013  _boundary_ids.insert(id);
1014  _node_boundary_ids.insert(id); // Also add this ID to the set of node boundary IDs
1015  }
1016 }
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
static const boundary_id_type invalid_id
Number used for internal use.
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
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
libmesh_assert(ctx)

◆ add_shellface() [1/3]

void libMesh::BoundaryInfo::add_shellface ( const dof_id_type  elem,
const unsigned short int  shellface,
const boundary_id_type  id 
)

Add shell face shellface of element number elem with boundary id id to the boundary information data structure.

This is only relevant for shell elements.

Definition at line 1118 of file boundary_info.C.

References _mesh, and libMesh::MeshBase::elem_ptr().

Referenced by copy_boundary_ids(), libMesh::ExodusII_IO::read(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::UnstructuredMesh::stitching_helper(), and BoundaryInfoTest::testShellFaceConstraints().

1121 {
1122  this->add_shellface (_mesh->elem_ptr(e), shellface, id);
1123 }
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
virtual const Elem * elem_ptr(const dof_id_type i) const =0
void add_shellface(const dof_id_type elem, const unsigned short int shellface, const boundary_id_type id)
Add shell face shellface of element number elem with boundary id id to the boundary information data ...

◆ add_shellface() [2/3]

void libMesh::BoundaryInfo::add_shellface ( const Elem elem,
const unsigned short int  shellface,
const boundary_id_type  id 
)

Add shell face shellface of element elem with boundary id id to the boundary information data structure.

This is only relevant for shell elements.

Definition at line 1127 of file boundary_info.C.

References _boundary_ids, _boundary_shellface_id, _shellface_boundary_ids, libMesh::as_range(), invalid_id, libMesh::Elem::level(), and libMesh::libmesh_assert().

1130 {
1131  libmesh_assert(elem);
1132 
1133  // Only add BCs for level-0 elements.
1134  libmesh_assert_equal_to (elem->level(), 0);
1135 
1136  // Shells only have 2 faces
1137  libmesh_assert_less(shellface, 2);
1138 
1139  libmesh_error_msg_if(id == invalid_id,
1140  "ERROR: You may not set a boundary ID of "
1141  << invalid_id
1142  << "\n That is reserved for internal use.");
1143 
1144  // Don't add the same ID twice
1145  for (const auto & pr : as_range(_boundary_shellface_id.equal_range(elem)))
1146  if (pr.second.first == shellface &&
1147  pr.second.second == id)
1148  return;
1149 
1150  _boundary_shellface_id.emplace(elem, std::make_pair(shellface, id));
1151  _boundary_ids.insert(id);
1152  _shellface_boundary_ids.insert(id); // Also add this ID to the set of shellface boundary IDs
1153 }
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
static const boundary_id_type invalid_id
Number used for internal use.
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
libmesh_assert(ctx)
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.

◆ add_shellface() [3/3]

void libMesh::BoundaryInfo::add_shellface ( const Elem elem,
const unsigned short int  shellface,
const std::vector< boundary_id_type > &  ids 
)

Add shell face shellface of element elem with boundary ids ids to the boundary information data structure.

This is only relevant for shell elements.

Definition at line 1157 of file boundary_info.C.

References _boundary_ids, _boundary_shellface_id, _shellface_boundary_ids, libMesh::as_range(), invalid_id, libMesh::Elem::level(), and libMesh::libmesh_assert().

1160 {
1161  if (ids.empty())
1162  return;
1163 
1164  libmesh_assert(elem);
1165 
1166  // Only add BCs for level-0 elements.
1167  libmesh_assert_equal_to (elem->level(), 0);
1168 
1169  // Shells only have 2 faces
1170  libmesh_assert_less(shellface, 2);
1171 
1172  // Don't add the same ID twice
1173  auto bounds = _boundary_shellface_id.equal_range(elem);
1174 
1175  // The entries in the ids vector may be non-unique. If we expected
1176  // *lots* of ids, it might be fastest to construct a std::set from
1177  // the entries, but for a small number of entries, which is more
1178  // typical, it is probably faster to copy the vector and do sort+unique.
1179  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
1180  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
1181  std::sort(unique_ids.begin(), unique_ids.end());
1182  std::vector<boundary_id_type>::iterator new_end =
1183  std::unique(unique_ids.begin(), unique_ids.end());
1184 
1185  for (auto & id : as_range(unique_ids.begin(), new_end))
1186  {
1187  libmesh_error_msg_if(id == invalid_id,
1188  "ERROR: You may not set a boundary ID of "
1189  << invalid_id
1190  << "\n That is reserved for internal use.");
1191 
1192  bool already_inserted = false;
1193  for (const auto & pr : as_range(bounds))
1194  if (pr.second.first == shellface &&
1195  pr.second.second == id)
1196  {
1197  already_inserted = true;
1198  break;
1199  }
1200  if (already_inserted)
1201  continue;
1202 
1203  _boundary_shellface_id.emplace(elem, std::make_pair(shellface, id));
1204  _boundary_ids.insert(id);
1205  _shellface_boundary_ids.insert(id); // Also add this ID to the set of shellface boundary IDs
1206  }
1207 }
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
static const boundary_id_type invalid_id
Number used for internal use.
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
libmesh_assert(ctx)
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.

◆ add_side() [1/3]

void libMesh::BoundaryInfo::add_side ( const dof_id_type  elem,
const unsigned short int  side,
const boundary_id_type  id 
)

Add side side of element number elem with boundary id id to the boundary information data structure.

Definition at line 1210 of file boundary_info.C.

References _mesh, and libMesh::MeshBase::elem_ptr().

Referenced by libMesh::MeshTools::Subdivision::all_subdivision(), libMesh::MeshTools::Modification::all_tri(), libMesh::AbaqusIO::assign_sideset_ids(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::MeshTools::Generation::build_extrusion(), DisjointNeighborTest::build_four_disjoint_elems(), BoundaryMesh0DTest::build_mesh(), BoundaryMeshTest::build_mesh(), build_side_list_from_node_list(), DisjointNeighborTest::build_split_mesh_with_interface(), DisjointNeighborTest::build_two_disjoint_elems(), copy_boundary_ids(), libMesh::TriangleWrapper::copy_tri_to_mesh(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTools::Modification::flatten(), libMesh::UNVIO::groups_in(), libMesh::Poly2TriTriangulator::insert_refinement_points(), main(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_bcs(), libMesh::GmshIO::read_mesh(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::UnstructuredMesh::stitching_helper(), libMesh::Elem::swap2boundarysides(), AllTriTest::test_helper_c0polyhedron(), AllTriTest::testAllTriC0PolygonOctagon(), BoundaryInfoTest::testBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundarySides(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), DisjointNeighborTest::testDisjointNeighborConflictError(), BoundaryInfoTest::testInternalBoundary(), PeriodicBCTest::testPeriodicBC(), DisjointNeighborTest::testStitchCrossMesh(), transfer_boundary_ids_from_children(), libMesh::NetGenMeshInterface::triangulate(), and libMesh::Poly2TriTriangulator::triangulate_current_points().

1213 {
1214  this->add_side (_mesh->elem_ptr(e), side, id);
1215 }
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
virtual const Elem * elem_ptr(const dof_id_type i) const =0
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
Add side side of element number elem with boundary id id to the boundary information data structure...

◆ add_side() [2/3]

void libMesh::BoundaryInfo::add_side ( const Elem elem,
const unsigned short int  side,
const boundary_id_type  id 
)

Add side side of element elem with boundary id id to the boundary information data structure.

Definition at line 1219 of file boundary_info.C.

References _boundary_ids, _boundary_side_id, _children_on_boundary, _side_boundary_ids, libMesh::as_range(), boundary_ids(), invalid_id, libMesh::Elem::level(), libMesh::libmesh_assert(), and libMesh::Elem::n_sides().

1222 {
1223  libmesh_assert(elem);
1224 
1225  // Only add BCs for sides that exist.
1226  libmesh_assert_less (side, elem->n_sides());
1227 
1228  libmesh_error_msg_if(id == invalid_id, "ERROR: You may not set a boundary ID of "
1229  << invalid_id
1230  << "\n That is reserved for internal use.");
1231 
1232  // Don't add the same ID twice
1233  for (const auto & pr : as_range(_boundary_side_id.equal_range(elem)))
1234  if (pr.second.first == side &&
1235  pr.second.second == id)
1236  return;
1237 
1238 #ifdef LIBMESH_ENABLE_AMR
1239  // Users try to mark boundary on child elements
1240  // If this happens, we will allow users to remove
1241  // side from child elements as well
1242  if (elem->level())
1243  {
1244  _children_on_boundary = true;
1245 
1246  // Here we have to stop and check if we already have this boundary defined on the
1247  // parent (if yes, no need to add)
1248  std::vector<boundary_id_type> bd_ids;
1249  this->boundary_ids(elem,side,bd_ids);
1250 
1251  if(std::find(bd_ids.begin(), bd_ids.end(), id) != bd_ids.end())
1252  libmesh_not_implemented_msg("Trying to add boundary ID "
1253  + std::to_string(id)
1254  + " which already exists on the ancestors.");
1255  }
1256 #endif
1257 
1258  _boundary_side_id.emplace(elem, std::make_pair(side, id));
1259  _boundary_ids.insert(id);
1260  _side_boundary_ids.insert(id); // Also add this ID to the set of side boundary IDs
1261 }
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
static const boundary_id_type invalid_id
Number used for internal use.
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
libmesh_assert(ctx)

◆ add_side() [3/3]

void libMesh::BoundaryInfo::add_side ( const Elem elem,
const unsigned short int  side,
const std::vector< boundary_id_type > &  ids 
)

Add side side of element elem with boundary ids ids to the boundary information data structure.

Definition at line 1265 of file boundary_info.C.

References _boundary_ids, _boundary_side_id, _children_on_boundary, _side_boundary_ids, libMesh::as_range(), boundary_ids(), invalid_id, libMesh::Elem::level(), libMesh::libmesh_assert(), and libMesh::Elem::n_sides().

1268 {
1269  if (ids.empty())
1270  return;
1271 
1272  libmesh_assert(elem);
1273 
1274  // Only add BCs for sides that exist.
1275  libmesh_assert_less (side, elem->n_sides());
1276 
1277 #ifdef LIBMESH_ENABLE_AMR
1278  // Users try to mark boundary on child elements
1279  // If this happens, we will allow users to remove
1280  // side from child elements as well
1281  if (elem->level())
1282  {
1283  _children_on_boundary = true;
1284 
1285  // Here we have to stop and check if we already have this boundary defined on the
1286  // parent (if yes, no need to add)
1287  std::vector<boundary_id_type> bd_ids;
1288  this->boundary_ids(elem,side,bd_ids);
1289 
1290  for (const auto id : ids)
1291  if(std::find(bd_ids.begin(), bd_ids.end(), id) != bd_ids.end())
1292  libmesh_not_implemented_msg("Trying to add boundary ID "
1293  + std::to_string(id)
1294  + " which already exists on the ancestors.");
1295  }
1296 #endif
1297 
1298  // Don't add the same ID twice
1299  auto bounds = _boundary_side_id.equal_range(elem);
1300 
1301  // The entries in the ids vector may be non-unique. If we expected
1302  // *lots* of ids, it might be fastest to construct a std::set from
1303  // the entries, but for a small number of entries, which is more
1304  // typical, it is probably faster to copy the vector and do sort+unique.
1305  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
1306  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
1307  std::sort(unique_ids.begin(), unique_ids.end());
1308  std::vector<boundary_id_type>::iterator new_end =
1309  std::unique(unique_ids.begin(), unique_ids.end());
1310 
1311  for (auto & id : as_range(unique_ids.begin(), new_end))
1312  {
1313  libmesh_error_msg_if(id == invalid_id,
1314  "ERROR: You may not set a boundary ID of "
1315  << invalid_id
1316  << "\n That is reserved for internal use.");
1317 
1318  bool already_inserted = false;
1319  for (const auto & pr : as_range(bounds))
1320  if (pr.second.first == side && pr.second.second == id)
1321  {
1322  already_inserted = true;
1323  break;
1324  }
1325  if (already_inserted)
1326  continue;
1327 
1328  _boundary_side_id.emplace(elem, std::make_pair(side, id));
1329  _boundary_ids.insert(id);
1330  _side_boundary_ids.insert(id); // Also add this ID to the set of side boundary IDs
1331  }
1332 }
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
static const boundary_id_type invalid_id
Number used for internal use.
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
libmesh_assert(ctx)

◆ allow_children_on_boundary_side()

void libMesh::BoundaryInfo::allow_children_on_boundary_side ( const bool  children_on_boundary)
inline

Whether or not to allow directly setting boundary sides on child elements.

Definition at line 941 of file boundary_info.h.

References _children_on_boundary.

Referenced by BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs(), and BoundaryInfoTest::testBoundaryOnChildrenErrors().

942  { _children_on_boundary = children_on_boundary; }

◆ boundary_ids() [1/2]

void libMesh::BoundaryInfo::boundary_ids ( const Node node,
std::vector< boundary_id_type > &  vec_to_fill 
) const

Fills a user-provided std::vector with the boundary ids associated with Node node.

Definition at line 1348 of file boundary_info.C.

References _boundary_node_id, and libMesh::as_range().

Referenced by _find_id_maps(), add_elements(), add_side(), libMesh::MeshTools::Subdivision::all_subdivision(), libMesh::MeshTools::Modification::all_tri(), assemble_elasticity(), AssemblyA0::boundary_assembly(), AssemblyA1::boundary_assembly(), AssemblyA2::boundary_assembly(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), build_node_list_from_side_list(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_periodic_constraints(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTools::Modification::flatten(), has_boundary_id(), libMesh::Poly2TriTriangulator::insert_refinement_points(), libMesh::Poly2TriTriangulator::is_refine_boundary_allowed(), main(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), n_boundary_ids(), libMesh::VariationalSmootherConstraint::nodes_share_boundary_id(), libMesh::GhostPointNeighbors::operator()(), libMesh::BoundaryProjectSolution::operator()(), operator==(), libMesh::SimplexRefiner::refine_via_edges(), remove_side(), libMesh::FEMContext::side_boundary_ids(), libMesh::UnstructuredMesh::stitching_helper(), libMesh::Elem::swap2boundarysides(), sync(), ElemTest< elem_type >::test_flip(), ElemTest< elem_type >::test_orient(), ElemTest< elem_type >::test_orient_elements(), BoundaryInfoTest::testBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs(), SystemsTest::testBoundaryProjectCube(), MeshInputTest::testExodusIGASidesets(), libMesh::XdrIO::write_serialized_bcs_helper(), and libMesh::XdrIO::write_serialized_nodesets().

1350 {
1351  // Clear out any previous contents
1352  vec_to_fill.clear();
1353 
1354  for (const auto & pr : as_range(_boundary_node_id.equal_range(node)))
1355  vec_to_fill.push_back(pr.second);
1356 }
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
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

◆ boundary_ids() [2/2]

void libMesh::BoundaryInfo::boundary_ids ( const Elem *const  elem,
const unsigned short int  side,
std::vector< boundary_id_type > &  vec_to_fill 
) const
Returns
The list of boundary ids associated with the side side of element elem.

Definition at line 1637 of file boundary_info.C.

References _boundary_side_id, _children_on_boundary, libMesh::as_range(), libMesh::Elem::is_child_on_side(), libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), libMesh::Elem::top_parent(), and libMesh::Elem::which_child_am_i().

1640 {
1641  libmesh_assert(elem);
1642 
1643  // Only query BCs for sides that exist.
1644  libmesh_assert_less (side, elem->n_sides());
1645 
1646  // Clear out any previous contents
1647  vec_to_fill.clear();
1648 
1649  // In most cases only level-0 elements store BCs.
1650  // In certain applications (such as time-dependent domains), however, children
1651  // need to store BCs too. This case is covered with the _children_on_boundary
1652  // flag.
1653  const Elem * searched_elem = elem;
1654 
1655 #ifdef LIBMESH_ENABLE_AMR
1656 
1657  if (elem->level() != 0)
1658  {
1659  // If we have children on the boundaries, we need to search for boundary IDs on the
1660  // child and its ancestors too if they share the side.
1662  {
1663  // Loop over ancestors to check if they have boundary ids on the same side
1664  while (searched_elem)
1665  {
1666  for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
1667  // Here we need to check if the boundary id already exists
1668  if (pr.second.first == side &&
1669  std::find(vec_to_fill.begin(), vec_to_fill.end(), pr.second.second) ==
1670  vec_to_fill.end())
1671  vec_to_fill.push_back(pr.second.second);
1672 
1673 
1674  const Elem * parent = searched_elem->parent();
1675  // If the parent doesn't exist or if the child is not on the correct side of the
1676  // parent we are done checking the ancestors
1677  if (!parent || parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
1678  return;
1679 
1680  searched_elem = parent;
1681  }
1682 
1683  return;
1684  }
1685 
1686  // If we don't have children on boundaries and we are on an external boundary,
1687  // we just look for the top parent
1688  if (elem->neighbor_ptr(side) == nullptr)
1689  searched_elem = elem->top_parent();
1690  // Otherwise we loop over the ancestors and check if they have a different BC for us
1691  else
1692  while (searched_elem->parent() != nullptr)
1693  {
1694  const Elem * parent = searched_elem->parent();
1695  if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
1696  return;
1697 
1698  searched_elem = parent;
1699  }
1700  }
1701 
1702 #endif
1703 
1704  // Check each element in the range to see if its side matches the requested side.
1705  for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
1706  if (pr.second.first == side)
1707  vec_to_fill.push_back(pr.second.second);
1708 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
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
libmesh_assert(ctx)

◆ build_active_side_list()

std::vector< BoundaryInfo::BCTuple > libMesh::BoundaryInfo::build_active_side_list ( ) const

Create a list of (element_id, side_id, boundary_id) tuples for all relevant active sides.

On a ReplicatedMesh this will include all sides; on a DistributedMesh only sides of semilocal elements will be included.

Definition at line 3026 of file boundary_info.C.

References _boundary_side_id.

3027 {
3028  std::vector<BCTuple> bc_triples;
3029  bc_triples.reserve(_boundary_side_id.size());
3030 
3031  for (const auto & [elem, id_pair] : _boundary_side_id)
3032  {
3033  // Don't add remote sides
3034  if (elem->is_remote())
3035  continue;
3036 
3037  // Loop over the sides of possible children
3038  std::vector<const Elem *> family;
3039 #ifdef LIBMESH_ENABLE_AMR
3040  elem->active_family_tree_by_side(family, id_pair.first);
3041 #else
3042  family.push_back(elem);
3043 #endif
3044 
3045  // Populate the list items
3046  for (const auto & f : family)
3047  bc_triples.emplace_back(f->id(), id_pair.first, id_pair.second);
3048  }
3049 
3050  // This list is currently in memory address (arbitrary) order, so
3051  // sort to make it consistent on all procs.
3052  std::sort(bc_triples.begin(), bc_triples.end());
3053 
3054  return bc_triples;
3055 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.

◆ build_edge_list()

std::vector< BoundaryInfo::BCTuple > libMesh::BoundaryInfo::build_edge_list ( ) const

Create a list of (element_id, edge_id, boundary_id) tuples for all relevant edges.

On a ReplicatedMesh this will include all edges; on a DistributedMesh only edges of semilocal elements will be included.

Definition at line 3059 of file boundary_info.C.

References _boundary_edge_id.

Referenced by libMesh::UnstructuredMesh::stitching_helper(), MeshInputTest::testLowOrderEdgeBlocks(), WriteEdgesetData::testWriteImpl(), and libMesh::ExodusII_IO_Helper::write_elements().

3060 {
3061  std::vector<BCTuple> bc_triples;
3062  bc_triples.reserve(_boundary_edge_id.size());
3063 
3064  for (const auto & [elem, id_pair] : _boundary_edge_id)
3065  bc_triples.emplace_back(elem->id(), id_pair.first, id_pair.second);
3066 
3067  // This list is currently in memory address (arbitrary) order, so
3068  // sort to make it consistent on all procs.
3069  std::sort(bc_triples.begin(), bc_triples.end());
3070 
3071  return bc_triples;
3072 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ build_node_boundary_ids()

void libMesh::BoundaryInfo::build_node_boundary_ids ( std::vector< boundary_id_type > &  b_ids) const

Builds the list of unique node boundary ids.

On a ReplicatedMesh this will be all ids; on a DistributedMesh only ids on semilocal nodes will be included.

Definition at line 2502 of file boundary_info.C.

References _boundary_node_id.

Referenced by libMesh::ExodusII_IO_Helper::initialize(), and libMesh::ExodusII_IO_Helper::write_nodesets().

2503 {
2504  b_ids.clear();
2505 
2506  for (const auto & pr : _boundary_node_id)
2507  {
2508  boundary_id_type id = pr.second;
2509 
2510  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
2511  b_ids.push_back(id);
2512  }
2513 }
int8_t boundary_id_type
Definition: id_types.h:51
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.

◆ build_node_list()

std::vector< BoundaryInfo::NodeBCTuple > libMesh::BoundaryInfo::build_node_list ( NodeBCTupleSortBy  sort_by = NodeBCTupleSortBy::NODE_ID) const

Definition at line 2683 of file boundary_info.C.

References _boundary_node_id, BOUNDARY_ID, and NODE_ID.

Referenced by libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::UnstructuredMesh::stitching_helper(), BoundaryInfoTest::testBuildNodeListFromSideList(), WriteNodesetData::testWriteImpl(), libMesh::CheckpointIO::write(), and libMesh::ExodusII_IO_Helper::write_nodesets().

2684 {
2685  std::vector<NodeBCTuple> bc_tuples;
2686  bc_tuples.reserve(_boundary_node_id.size());
2687 
2688  for (const auto & [node, bid] : _boundary_node_id)
2689  bc_tuples.emplace_back(node->id(), bid);
2690 
2691  // This list is currently in memory address (arbitrary) order, so
2692  // sort, using the specified ordering, to make it consistent on all procs.
2693  if (sort_by == NodeBCTupleSortBy::NODE_ID)
2694  std::sort(bc_tuples.begin(), bc_tuples.end());
2695  else if (sort_by == NodeBCTupleSortBy::BOUNDARY_ID)
2696  std::sort(bc_tuples.begin(), bc_tuples.end(),
2697  [](const NodeBCTuple & left, const NodeBCTuple & right)
2698  {return std::get<1>(left) < std::get<1>(right);});
2699 
2700  return bc_tuples;
2701 }
std::tuple< dof_id_type, boundary_id_type > NodeBCTuple
Create a list of (node_id, boundary_id) tuples for all relevant nodes.
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.

◆ build_node_list_from_side_list()

void libMesh::BoundaryInfo::build_node_list_from_side_list ( const std::set< boundary_id_type > &  sideset_list = {})

Adds nodes with boundary ids based on the side's boundary ids they are connected to.

Parameters
sideset_listsidesets to build nodesets from. If empty (default), builds from all existing sidesets

Definition at line 2705 of file boundary_info.C.

References _boundary_side_id, _mesh, libMesh::Elem::active_family_tree_by_side(), add_node(), boundary_ids(), libMesh::ParallelObject::comm(), libMesh::index_range(), libMesh::MeshBase::is_serial(), libMesh::Elem::node_id(), libMesh::Elem::node_index_range(), libMesh::Elem::node_ptr(), libMesh::MeshBase::node_ptr(), libMesh::ParallelObject::processor_id(), and libMesh::DofObject::processor_id().

Referenced by BoundaryInfoTest::testBuildNodeListFromSideList(), and WriteNodesetData::testWriteImpl().

2706 {
2707  // If we're on a distributed mesh, even the owner of a node is not
2708  // guaranteed to be able to properly assign its new boundary id(s)!
2709  // Nodal neighbors are not always ghosted, and a nodal neighbor
2710  // might have a boundary side.
2711  const bool mesh_is_serial = _mesh->is_serial();
2712 
2713  typedef std::set<std::pair<dof_id_type, boundary_id_type>> set_type;
2714  typedef std::vector<std::pair<dof_id_type, boundary_id_type>> vec_type;
2715 
2716  const processor_id_type my_proc_id = this->processor_id();
2717  std::unordered_map<processor_id_type, set_type> nodes_to_push;
2718  std::unordered_map<processor_id_type, vec_type> node_vecs_to_push;
2719 
2720  // For avoiding extraneous element side construction
2721  ElemSideBuilder side_builder;
2722  // Pull objects out of the loop to reduce heap operations
2723  const Elem * side;
2724 
2725  // Loop over the side list
2726  for (const auto & [elem, id_pair] : _boundary_side_id)
2727  {
2728  // Don't add remote sides
2729  if (elem->is_remote())
2730  continue;
2731 
2732  auto [sidenum, bcid] = id_pair;
2733 
2734  if (!sideset_list.empty() && !sideset_list.count(bcid))
2735  continue;
2736 
2737  // Need to loop over the sides of any possible children
2738  std::vector<const Elem *> family;
2739 #ifdef LIBMESH_ENABLE_AMR
2740  elem->active_family_tree_by_side (family, sidenum);
2741 #else
2742  family.push_back(elem);
2743 #endif
2744 
2745  for (const auto & cur_elem : family)
2746  {
2747  side = &side_builder(*cur_elem, sidenum);
2748 
2749  // Add each node node on the side with the side's boundary id
2750  for (auto i : side->node_index_range())
2751  {
2752  this->add_node(side->node_ptr(i), bcid);
2753  if (!mesh_is_serial)
2754  {
2755  const processor_id_type proc_id =
2756  side->node_ptr(i)->processor_id();
2757  if (proc_id != my_proc_id)
2758  nodes_to_push[proc_id].emplace(side->node_id(i), bcid);
2759  }
2760  }
2761  }
2762  }
2763 
2764  // If we're on a serial mesh then we're done.
2765  if (mesh_is_serial)
2766  return;
2767 
2768  // Otherwise we need to push ghost node bcids to their owners, then
2769  // pull ghost node bcids from their owners.
2770 
2771  for (auto & [proc_id, s] : nodes_to_push)
2772  {
2773  node_vecs_to_push[proc_id].assign(s.begin(), s.end());
2774  s.clear();
2775  }
2776 
2777  auto nodes_action_functor =
2778  [this]
2780  const vec_type & received_nodes)
2781  {
2782  for (const auto & [dof_id, bndry_id] : received_nodes)
2783  this->add_node(_mesh->node_ptr(dof_id), bndry_id);
2784  };
2785 
2786  Parallel::push_parallel_vector_data
2787  (this->comm(), node_vecs_to_push, nodes_action_functor);
2788 
2789  // At this point we should know all the BCs for our own nodes; now
2790  // we need BCs for ghost nodes.
2791  std::unordered_map<processor_id_type, std::vector<dof_id_type>>
2792  node_ids_requested;
2793 
2794  // Determine what nodes we need to request
2795  for (const auto & node : _mesh->node_ptr_range())
2796  {
2797  const processor_id_type pid = node->processor_id();
2798  if (pid != my_proc_id)
2799  node_ids_requested[pid].push_back(node->id());
2800  }
2801 
2802  typedef std::vector<boundary_id_type> datum_type;
2803 
2804  auto node_bcid_gather_functor =
2805  [this]
2807  const std::vector<dof_id_type> & ids,
2808  std::vector<datum_type> & data)
2809  {
2810  const std::size_t query_size = ids.size();
2811  data.resize(query_size);
2812 
2813  for (std::size_t i=0; i != query_size; ++i)
2814  this->boundary_ids(_mesh->node_ptr(ids[i]), data[i]);
2815  };
2816 
2817  auto node_bcid_action_functor =
2818  [this]
2820  const std::vector<dof_id_type> & ids,
2821  const std::vector<datum_type> & data)
2822  {
2823  for (auto i : index_range(ids))
2824  this->add_node(_mesh->node_ptr(ids[i]), data[i]);
2825  };
2826 
2827  datum_type * datum_type_ex = nullptr;
2828  Parallel::pull_parallel_vector_data
2829  (this->comm(), node_ids_requested, node_bcid_gather_functor,
2830  node_bcid_action_functor, datum_type_ex);
2831 }
const Parallel::Communicator & comm() const
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
uint8_t processor_id_type
Definition: id_types.h:104
uint8_t processor_id_type
virtual bool is_serial() const
Definition: mesh_base.h:347
void add_node(const Node *node, const boundary_id_type id)
Add Node node with boundary id id to the boundary information data structures.
virtual const Node * node_ptr(const dof_id_type i) const =0
processor_id_type processor_id() const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153

◆ build_shellface_boundary_ids()

void libMesh::BoundaryInfo::build_shellface_boundary_ids ( std::vector< boundary_id_type > &  b_ids) const

Builds the list of unique shellface boundary ids.

On a ReplicatedMesh this will be all ids; on a DistributedMesh only ids on shellfaces of semilocal elements will be included.

Definition at line 2530 of file boundary_info.C.

References _boundary_shellface_id.

Referenced by libMesh::ExodusII_IO_Helper::initialize(), and libMesh::ExodusII_IO_Helper::write_sidesets().

2531 {
2532  b_ids.clear();
2533 
2534  for (const auto & pr :_boundary_shellface_id)
2535  {
2536  boundary_id_type id = pr.second.second;
2537 
2538  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
2539  b_ids.push_back(id);
2540  }
2541 }
int8_t boundary_id_type
Definition: id_types.h:51
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.

◆ build_shellface_list()

std::vector< BoundaryInfo::BCTuple > libMesh::BoundaryInfo::build_shellface_list ( ) const

Create a list of (element_id, shellface_id, boundary_id) tuples for all relevant shellfaces.

On a ReplicatedMesh this will include all shellfaces; on a DistributedMesh only shellfaces of semilocal elements will be included.

Definition at line 3076 of file boundary_info.C.

References _boundary_shellface_id.

Referenced by libMesh::UnstructuredMesh::stitching_helper(), and libMesh::ExodusII_IO_Helper::write_sidesets().

3077 {
3078  std::vector<BCTuple> bc_triples;
3079  bc_triples.reserve(_boundary_shellface_id.size());
3080 
3081  for (const auto & [elem, id_pair] : _boundary_shellface_id)
3082  bc_triples.emplace_back(elem->id(), id_pair.first, id_pair.second);
3083 
3084  // This list is currently in memory address (arbitrary) order, so
3085  // sort to make it consistent on all procs.
3086  std::sort(bc_triples.begin(), bc_triples.end());
3087 
3088  return bc_triples;
3089 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.

◆ build_side_boundary_ids()

void libMesh::BoundaryInfo::build_side_boundary_ids ( std::vector< boundary_id_type > &  b_ids) const

Builds the list of unique side boundary ids.

On a ReplicatedMesh this will be all ids; on a DistributedMesh only ids on sides of semilocal elements will be included.

Definition at line 2516 of file boundary_info.C.

References _boundary_side_id.

Referenced by libMesh::ExodusII_IO_Helper::initialize(), and libMesh::ExodusII_IO_Helper::write_sidesets().

2517 {
2518  b_ids.clear();
2519 
2520  for (const auto & pr : _boundary_side_id)
2521  {
2522  boundary_id_type id = pr.second.second;
2523 
2524  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
2525  b_ids.push_back(id);
2526  }
2527 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
int8_t boundary_id_type
Definition: id_types.h:51

◆ build_side_list()

std::vector< BoundaryInfo::BCTuple > libMesh::BoundaryInfo::build_side_list ( BCTupleSortBy  sort_by = BCTupleSortBy::ELEM_ID) const

Definition at line 2997 of file boundary_info.C.

References _boundary_side_id, BOUNDARY_ID, ELEM_ID, and SIDE_ID.

Referenced by libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::UnstructuredMesh::stitching_helper(), BoundaryInfoTest::testBuildSideListFromNodeList(), BoundaryInfoTest::testMesh(), MeshTriangulationTest::testPoly2TriHolesInteriorRefinedBase(), BoundaryInfoTest::testRenumber(), WriteEdgesetData::testWriteImpl(), WriteSidesetData::testWriteImpl(), libMesh::FroIO::write(), libMesh::CheckpointIO::write(), libMesh::GmshIO::write_mesh(), and libMesh::ExodusII_IO_Helper::write_sidesets().

2998 {
2999  std::vector<BCTuple> bc_triples;
3000  bc_triples.reserve(_boundary_side_id.size());
3001 
3002  for (const auto & [elem, id_pair] : _boundary_side_id)
3003  bc_triples.emplace_back(elem->id(), id_pair.first, id_pair.second);
3004 
3005  // bc_triples is currently in whatever order the Elem pointers in
3006  // the _boundary_side_id multimap are in, and in particular might be
3007  // in different orders on different processors. To avoid this
3008  // inconsistency, we'll sort using the default operator< for tuples.
3009  if (sort_by == BCTupleSortBy::ELEM_ID)
3010  std::sort(bc_triples.begin(), bc_triples.end());
3011  else if (sort_by == BCTupleSortBy::SIDE_ID)
3012  std::sort(bc_triples.begin(), bc_triples.end(),
3013  [](const BCTuple & left, const BCTuple & right)
3014  {return std::get<1>(left) < std::get<1>(right);});
3015  else if (sort_by == BCTupleSortBy::BOUNDARY_ID)
3016  std::sort(bc_triples.begin(), bc_triples.end(),
3017  [](const BCTuple & left, const BCTuple & right)
3018  {return std::get<2>(left) < std::get<2>(right);});
3019 
3020  return bc_triples;
3021 }
std::tuple< dof_id_type, unsigned short int, boundary_id_type > BCTuple
Create a list of (element_id, side_id, boundary_id) tuples for relevant sides.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.

◆ build_side_list_from_node_list()

void libMesh::BoundaryInfo::build_side_list_from_node_list ( const std::set< boundary_id_type > &  nodeset_list = {})

Adds sides to a sideset if every node on that side are in the same sideset.

Parameters
nodeset_listnodesets to build sidesets from. If empty (default), builds from all existing sidesets

Definition at line 2946 of file boundary_info.C.

References _boundary_node_id, _mesh, add_side(), libMesh::as_range(), libMesh::Elem::n_nodes(), libMesh::Elem::node_ref_range(), nodeset_name(), libMesh::out, and sideset_name().

Referenced by libMesh::AbaqusIO::read(), and BoundaryInfoTest::testBuildSideListFromNodeList().

2947 {
2948  // Check for early return
2949  if (_boundary_node_id.empty())
2950  {
2951  libMesh::out << "No boundary node IDs have been added: cannot build side list!" << std::endl;
2952  return;
2953  }
2954 
2955  // For avoiding extraneous element side construction
2956  ElemSideBuilder side_builder;
2957  // Pull objects out of the loop to reduce heap operations
2958  const Elem * side_elem;
2959 
2960  for (const auto & elem : _mesh->active_element_ptr_range())
2961  for (auto side : elem->side_index_range())
2962  {
2963  side_elem = &side_builder(*elem, side);
2964 
2965  // map from nodeset_id to count for that ID
2966  std::map<boundary_id_type, unsigned> nodesets_node_count;
2967 
2968  // For each nodeset that this node is a member of, increment the associated
2969  // nodeset ID count
2970  for (const auto & node : side_elem->node_ref_range())
2971  for (const auto & pr : as_range(_boundary_node_id.equal_range(&node)))
2972  if (nodeset_list.empty() || nodeset_list.count(pr.second))
2973  nodesets_node_count[pr.second]++;
2974 
2975  // Now check to see what nodeset_counts have the correct
2976  // number of nodes in them. For any that do, add this side to
2977  // the sideset, making sure the sideset inherits the
2978  // nodeset's name, if there is one.
2979  for (const auto & pr : nodesets_node_count)
2980  if (pr.second == side_elem->n_nodes())
2981  {
2982  add_side(elem, side, pr.first);
2983 
2984  // Let the sideset inherit any non-empty name from the nodeset
2985  std::string & nset_name = nodeset_name(pr.first);
2986 
2987  if (nset_name != "")
2988  sideset_name(pr.first) = nset_name;
2989  }
2990  } // end for side
2991 }
std::string & nodeset_name(boundary_id_type id)
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
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
std::string & sideset_name(boundary_id_type id)
OStreamProxy out
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
Add side side of element number elem with boundary id id to the boundary information data structure...

◆ clear()

void libMesh::BoundaryInfo::clear ( )

Clears the underlying data structures and restores the object to a pristine state with no data stored.

Definition at line 345 of file boundary_info.C.

References _boundary_edge_id, _boundary_ids, _boundary_node_id, _boundary_shellface_id, _boundary_side_id, _edge_boundary_ids, _es_id_to_name, _node_boundary_ids, _ns_id_to_name, _shellface_boundary_ids, _side_boundary_ids, and _ss_id_to_name.

Referenced by operator=(), and libMesh::Poly2TriTriangulator::triangulate_current_points().

346 {
347  _boundary_node_id.clear();
348  _boundary_side_id.clear();
349  _boundary_edge_id.clear();
350  _boundary_shellface_id.clear();
351  _boundary_ids.clear();
352  _side_boundary_ids.clear();
353  _node_boundary_ids.clear();
354  _edge_boundary_ids.clear();
355  _shellface_boundary_ids.clear();
356  _ss_id_to_name.clear();
357  _ns_id_to_name.clear();
358  _es_id_to_name.clear();
359 }
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
std::map< boundary_id_type, std::string > _ss_id_to_name
This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support ...
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ clear_boundary_node_ids()

void libMesh::BoundaryInfo::clear_boundary_node_ids ( )

Clears all the boundary information from all of the nodes in the mesh.

Definition at line 1020 of file boundary_info.C.

References _boundary_node_id.

1021 {
1022  _boundary_node_id.clear();
1023 }
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.

◆ clear_stitched_boundary_side_ids()

void libMesh::BoundaryInfo::clear_stitched_boundary_side_ids ( boundary_id_type  sideset_id,
boundary_id_type  other_sideset_id,
bool  clear_nodeset_data = false 
)

Clear sideset information along a stitched mesh interface.

Parameters
sideset_idA sideset on one side of the stitched mesh interface
other_sideset_idThe sideset on the other side of the stitched mesh interface
clear_nodeset_dataWhether to clear boundary information for the nodes along the stitched mesh interface

Definition at line 3483 of file boundary_info.C.

References _boundary_side_id, invalid_id, libmesh_assert_valid_multimaps(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::node_ptr(), libMesh::Elem::nodes_on_side(), regenerate_id_sets(), remove_node(), and libMesh::Elem::which_neighbor_am_i().

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

3486 {
3487  auto end_it = _boundary_side_id.end();
3488  auto it = _boundary_side_id.begin();
3489 
3490  // This predicate checks to see whether the pred_pr triplet's boundary ID matches sideset_id
3491  // (other_sideset_id) *and* whether there is a boundary information triplet on the other side of
3492  // the face whose boundary ID matches the other_sideset_id (sideset_id). We return a pair where
3493  // first is a boolean indicating our condition is true or false, and second is an iterator to the
3494  // neighboring triplet if our condition is true
3495  auto predicate =
3496  [sideset_id, other_sideset_id](
3497  const std::pair<const Elem *, std::pair<unsigned short int, boundary_id_type>> & pred_pr,
3498  const std::multimap<const Elem *, std::pair<unsigned short int, boundary_id_type>> &
3499  pred_container) {
3500  const Elem & elem = *pred_pr.first;
3501  const auto elem_side = pred_pr.second.first;
3502  const Elem * const other_elem = elem.neighbor_ptr(elem_side);
3503  if (!other_elem)
3504  return std::make_pair(false, pred_container.end());
3505 
3506  const auto elem_side_bnd_id = pred_pr.second.second;
3507  auto other_elem_side_bnd_id = BoundaryInfo::invalid_id;
3508  if (elem_side_bnd_id == sideset_id)
3509  other_elem_side_bnd_id = other_sideset_id;
3510  else if (elem_side_bnd_id == other_sideset_id)
3511  other_elem_side_bnd_id = sideset_id;
3512  else
3513  return std::make_pair(false, pred_container.end());
3514 
3515  const auto other_elem_side = other_elem->which_neighbor_am_i(&elem);
3516  const typename std::decay<decltype(pred_container)>::type::value_type other_sideset_info(
3517  other_elem, std::make_pair(other_elem_side, other_elem_side_bnd_id));
3518  auto other_range = pred_container.equal_range(other_elem);
3519  libmesh_assert_msg(
3520  other_range.first != other_range.second,
3521  "No matching sideset information for other element in boundary information");
3522  auto other_it = std::find(other_range.first, other_range.second, other_sideset_info);
3523  libmesh_assert_msg(
3524  other_it != pred_container.end(),
3525  "No matching sideset information for other element in boundary information");
3526  return std::make_pair(true, other_it);
3527  };
3528 
3529  for (; it != end_it;)
3530  {
3531  auto pred_result = predicate(*it, _boundary_side_id);
3532  if (pred_result.first)
3533  {
3534  // First erase associated nodeset information. Do it from both
3535  // sides, so we get any higher-order nodes if we're looking at
3536  // them from a lower-order side, and so we only remove the two
3537  // boundary ids used for stitching.
3538  if (clear_nodeset_data)
3539  {
3540  const Elem & elem = *it->first;
3541  const Elem & neigh = *pred_result.second->first;
3542  const auto elem_side = it->second.first;
3543  const boundary_id_type neigh_side = pred_result.second->second.first;
3544  const auto elem_bcid = it->second.second;
3545  const boundary_id_type neigh_bcid = pred_result.second->second.second;
3546 
3547  for (const auto local_node_num : elem.nodes_on_side(elem_side))
3548  this->remove_node(elem.node_ptr(local_node_num), elem_bcid);
3549 
3550  for (const auto local_node_num : neigh.nodes_on_side(neigh_side))
3551  this->remove_node(neigh.node_ptr(local_node_num), neigh_bcid);
3552  }
3553 
3554  // Now erase the sideset information for our element and its
3555  // neighbor, together. This is safe since a multimap doesn't
3556  // invalidate iterators.
3557  _boundary_side_id.erase(pred_result.second);
3558  it = _boundary_side_id.erase(it);
3559  }
3560  else
3561  ++it;
3562  }
3563 
3564  // Removing stitched-away boundary ids might have removed an id
3565  // *entirely*, so we need to recompute boundary id sets to check
3566  // for that.
3567  this->regenerate_id_sets();
3569 }
void libmesh_assert_valid_multimaps() const
Helper method for ensuring that our multimaps don&#39;t contain entries with duplicate keys and values...
void remove_node(const Node *node, const boundary_id_type id)
Removes boundary id id from node node, if it exists.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
Number used for internal use.
void regenerate_id_sets()
Clears and regenerates the cached sets of ids.

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

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

◆ copy_boundary_ids()

void libMesh::BoundaryInfo::copy_boundary_ids ( const BoundaryInfo old_boundary_info,
const Elem *const  old_elem,
const Elem *const  new_elem 
)

Definition at line 1756 of file boundary_info.C.

References add_edge(), add_shellface(), add_side(), libMesh::Elem::edge_index_range(), libMesh::Elem::n_edges(), libMesh::Elem::n_sides(), raw_boundary_ids(), raw_edge_boundary_ids(), raw_shellface_boundary_ids(), and libMesh::Elem::side_index_range().

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

1759 {
1760  libmesh_assert_equal_to (old_elem->n_sides(), new_elem->n_sides());
1761  libmesh_assert_equal_to (old_elem->n_edges(), new_elem->n_edges());
1762 
1763  std::vector<boundary_id_type> bndry_ids;
1764 
1765  for (auto s : old_elem->side_index_range())
1766  {
1767  old_boundary_info.raw_boundary_ids (old_elem, s, bndry_ids);
1768  this->add_side (new_elem, s, bndry_ids);
1769  }
1770 
1771  for (auto e : old_elem->edge_index_range())
1772  {
1773  old_boundary_info.raw_edge_boundary_ids (old_elem, e, bndry_ids);
1774  this->add_edge (new_elem, e, bndry_ids);
1775  }
1776 
1777  for (unsigned short sf=0; sf != 2; sf++)
1778  {
1779  old_boundary_info.raw_shellface_boundary_ids (old_elem, sf, bndry_ids);
1780  this->add_shellface (new_elem, sf, bndry_ids);
1781  }
1782 }
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
Add side side of element number elem with boundary id id to the boundary information data structure...
void add_shellface(const dof_id_type elem, const unsigned short int shellface, const boundary_id_type id)
Add shell face shellface of element number elem with boundary id id to the boundary information data ...
void add_edge(const dof_id_type elem, const unsigned short int edge, const boundary_id_type id)
Add edge edge of element number elem with boundary id id to the boundary information data structure...

◆ edge_boundary_ids()

void libMesh::BoundaryInfo::edge_boundary_ids ( const Elem *const  elem,
const unsigned short int  edge,
std::vector< boundary_id_type > &  vec_to_fill 
) const
Returns
The list of boundary ids associated with the edge edge of element elem.
Note
Edge-based boundary IDs should only be used in 3D.

Definition at line 1368 of file boundary_info.C.

References _boundary_edge_id, libMesh::as_range(), libMesh::Elem::is_child_on_edge(), libMesh::Elem::is_edge_on_side(), libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::Elem::n_edges(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), libMesh::Elem::side_index_range(), libMesh::Elem::top_parent(), and libMesh::Elem::which_child_am_i().

Referenced by n_edge_boundary_ids(), libMesh::BoundaryProjectSolution::operator()(), operator==(), libMesh::UnstructuredMesh::stitching_helper(), libMesh::Elem::swap2boundaryedges(), and libMesh::XdrIO::write_serialized_bcs_helper().

1371 {
1372  libmesh_assert(elem);
1373 
1374  // Clear out any previous contents
1375  vec_to_fill.clear();
1376 
1377  // Only query BCs for edges that exist.
1378  libmesh_assert_less (edge, elem->n_edges());
1379 
1380  // Only level-0 elements store BCs. If this is not a level-0
1381  // element get its level-0 parent and infer the BCs.
1382  const Elem * searched_elem = elem;
1383 #ifdef LIBMESH_ENABLE_AMR
1384  if (elem->level() != 0)
1385  {
1386  // Find all the sides that contain edge. If one of those is a boundary
1387  // side, then this must be a boundary edge. In that case, we just use the
1388  // top-level parent.
1389  bool found_boundary_edge = false;
1390  for (auto side : elem->side_index_range())
1391  {
1392  if (elem->is_edge_on_side(edge,side))
1393  {
1394  if (elem->neighbor_ptr(side) == nullptr)
1395  {
1396  searched_elem = elem->top_parent ();
1397  found_boundary_edge = true;
1398  break;
1399  }
1400  }
1401  }
1402 
1403  if (!found_boundary_edge)
1404  {
1405  // Child element is not on external edge, but it may have internal
1406  // "boundary" IDs. We will walk up the tree, at each level checking that
1407  // the current child is actually on the same edge of the parent that is
1408  // currently being searched for (i.e. that was passed in as "edge").
1409  while (searched_elem->parent() != nullptr)
1410  {
1411  const Elem * parent = searched_elem->parent();
1412  if (parent->is_child_on_edge(parent->which_child_am_i(searched_elem), edge) == false)
1413  return;
1414  searched_elem = parent;
1415  }
1416  }
1417  }
1418 #endif
1419 
1420  // Check each element in the range to see if its edge matches the requested edge.
1421  for (const auto & pr : as_range(_boundary_edge_id.equal_range(searched_elem)))
1422  if (pr.second.first == edge)
1423  vec_to_fill.push_back(pr.second.second);
1424 }
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
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ edgeset_name()

std::string & libMesh::BoundaryInfo::edgeset_name ( boundary_id_type  id)
Returns
A writable reference to an optional edgeset name.

Definition at line 3277 of file boundary_info.C.

References _es_id_to_name.

Referenced by libMesh::ExodusII_IO_Helper::read_edge_blocks(), BoundaryInfoTest::testSelectiveRenumber(), and WriteEdgesetData::testWriteImpl().

3278 {
3279  return _es_id_to_name[id];
3280 }
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...

◆ get_boundary_ids()

const std::set<boundary_id_type>& libMesh::BoundaryInfo::get_boundary_ids ( ) const
inline
Returns
A set of the boundary ids which exist on semilocal parts of the mesh.

Code that wishes to access boundary ids on all parts of the mesh, including non-local parts, should call get_global_boundary_ids

Definition at line 794 of file boundary_info.h.

References _boundary_ids.

Referenced by libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::UnstructuredMesh::stitching_helper(), MeshInputTest::testExodusIGASidesets(), BoundaryInfoTest::testMesh(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testSelectiveRenumber(), and libMesh::FroIO::write().

795  { return _boundary_ids; }
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.

◆ get_edge_boundary_ids()

const std::set<boundary_id_type>& libMesh::BoundaryInfo::get_edge_boundary_ids ( ) const
inline
Returns
A reference to the set of all boundary IDs specified on edges of semilocal mesh elements.
Note
Edge-based boundary IDs should only be used in 3D.

Definition at line 816 of file boundary_info.h.

References _edge_boundary_ids.

Referenced by libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::MeshBase::get_info(), libMesh::ExodusII_IO_Helper::initialize(), BoundaryInfoTest::testSelectiveRenumber(), and WriteEdgesetData::testWriteImpl().

817  { return _edge_boundary_ids; }
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.

◆ get_edgeset_map()

const std::multimap<const Elem *, std::pair<unsigned short int, boundary_id_type> >& libMesh::BoundaryInfo::get_edgeset_map ( ) const
inline
Returns
A const reference to the edgeset map.

Definition at line 923 of file boundary_info.h.

References _boundary_edge_id.

924  { return _boundary_edge_id; }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ get_edgeset_name()

const std::string & libMesh::BoundaryInfo::get_edgeset_name ( boundary_id_type  id) const
Returns
A const reference to an optional edgeset name.

Definition at line 3266 of file boundary_info.C.

References _es_id_to_name.

Referenced by libMesh::ExodusII_IO_Helper::write_elements().

3267 {
3268  static const std::string empty_string;
3269  if (const auto it = _es_id_to_name.find(id);
3270  it == _es_id_to_name.end())
3271  return empty_string;
3272  else
3273  return it->second;
3274 }
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...

◆ get_edgeset_name_map()

const std::map<boundary_id_type, std::string>& libMesh::BoundaryInfo::get_edgeset_name_map ( ) const
inline

Definition at line 905 of file boundary_info.h.

References _es_id_to_name.

Referenced by libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshBase::get_info(), and libMesh::UnstructuredMesh::stitching_helper().

906  { return _es_id_to_name; }
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...

◆ get_global_boundary_ids()

const std::set< boundary_id_type > & libMesh::BoundaryInfo::get_global_boundary_ids ( ) const
Returns
A set of the boundary ids which exist globally on the mesh. Relies on the mesh being prepared

Definition at line 3572 of file boundary_info.C.

References _global_boundary_ids, _mesh, libMesh::MeshBase::is_prepared(), and libMesh::libmesh_assert().

Referenced by MeshStitchTest::renameAndShift().

3573 {
3575  return _global_boundary_ids;
3576 }
bool is_prepared() const
Definition: mesh_base.C:1057
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
std::set< boundary_id_type > _global_boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
libmesh_assert(ctx)

◆ get_id_by_name()

boundary_id_type libMesh::BoundaryInfo::get_id_by_name ( std::string_view  name) const
Returns
The id of the named boundary if it exists, invalid_id otherwise.

Definition at line 3282 of file boundary_info.C.

References _es_id_to_name, _ns_id_to_name, _ss_id_to_name, invalid_id, and libMesh::Quality::name().

3283 {
3284  // Search sidesets
3285  for (const auto & [ss_id, ss_name] : _ss_id_to_name)
3286  if (ss_name == name)
3287  return ss_id;
3288 
3289  // Search nodesets
3290  for (const auto & [ns_id, ns_name] : _ns_id_to_name)
3291  if (ns_name == name)
3292  return ns_id;
3293 
3294  // Search edgesets
3295  for (const auto & [es_id, es_name] : _es_id_to_name)
3296  if (es_name == name)
3297  return es_id;
3298 
3299  // If we made it here without returning, we don't have a sideset,
3300  // nodeset, or edgeset by the requested name, so return invalid_id
3301  return invalid_id;
3302 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...
std::map< boundary_id_type, std::string > _ss_id_to_name
This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support ...
static const boundary_id_type invalid_id
Number used for internal use.
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...

◆ get_node_boundary_ids()

const std::set<boundary_id_type>& libMesh::BoundaryInfo::get_node_boundary_ids ( ) const
inline
Returns
A reference to the set of all boundary IDs specified on semilocal mesh nodes.

Definition at line 832 of file boundary_info.h.

References _node_boundary_ids.

Referenced by libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::MeshBase::get_info(), MeshStitchTest::testBoundaryInfo(), and BoundaryInfoTest::testSelectiveRenumber().

833  { return _node_boundary_ids; }
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.

◆ get_nodeset_map()

const std::multimap<const Node *, boundary_id_type>& libMesh::BoundaryInfo::get_nodeset_map ( ) const
inline
Returns
A const reference to the nodeset map.

Definition at line 917 of file boundary_info.h.

References _boundary_node_id.

918  { return _boundary_node_id; }
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.

◆ get_nodeset_name()

const std::string & libMesh::BoundaryInfo::get_nodeset_name ( boundary_id_type  id) const
Returns
A reference for getting an optional name for a nodeset.

Definition at line 3251 of file boundary_info.C.

References _ns_id_to_name.

Referenced by libMesh::ExodusII_IO_Helper::write_nodesets().

3252 {
3253  static const std::string empty_string;
3254  if (const auto it = _ns_id_to_name.find(id);
3255  it == _ns_id_to_name.end())
3256  return empty_string;
3257  else
3258  return it->second;
3259 }
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...

◆ get_nodeset_name_map()

const std::map<boundary_id_type, std::string>& libMesh::BoundaryInfo::get_nodeset_name_map ( ) const
inline

Definition at line 897 of file boundary_info.h.

References _ns_id_to_name.

Referenced by libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshBase::get_info(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::UnstructuredMesh::stitching_helper(), MeshStitchTest::testBoundaryInfo(), and libMesh::ExodusII_IO_Helper::write_nodesets().

898  { return _ns_id_to_name; }
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...

◆ get_shellface_boundary_ids()

const std::set<boundary_id_type>& libMesh::BoundaryInfo::get_shellface_boundary_ids ( ) const
inline
Returns
A reference to the set of all boundary IDs specified on shell faces.
Note
This is only relevant on shell elements.

Definition at line 825 of file boundary_info.h.

References _shellface_boundary_ids.

826  { return _shellface_boundary_ids; }
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.

◆ get_side_and_node_maps()

void libMesh::BoundaryInfo::get_side_and_node_maps ( UnstructuredMesh boundary_mesh,
std::map< dof_id_type, dof_id_type > &  node_id_map,
std::map< dof_id_type, unsigned char > &  side_id_map,
Real  tolerance = 1.e-6 
)

Suppose we have used sync to create boundary_mesh.

Then each element in boundary_mesh will have interior_parent defined. This method gets extra data for us:

  • node_id_map stores a map from the node ids on the interior mesh to the corresponding node ids of boundary_mesh.
  • side_id_map stores a map from the element ids of the boundary mesh to the side index of the interior_parent that the boundary element corresponds to. tolerance is used to identify when we have matching elements.

Definition at line 603 of file boundary_info.C.

References libMesh::Elem::interior_parent(), libMesh::Elem::node_id(), libMesh::TensorTools::norm(), libMesh::Real, libMesh::Elem::side_index_range(), and libMesh::Elem::vertex_average().

607 {
608  LOG_SCOPE("get_side_and_node_maps()", "BoundaryInfo");
609 
610  node_id_map.clear();
611  side_id_map.clear();
612 
613  // For building element sides without extraneous allocation
614  ElemSideBuilder side_builder;
615  // Pull objects out of the loop to reduce heap operations
616  const Elem * interior_parent_side;
617 
618  for (const auto & boundary_elem : boundary_mesh.active_element_ptr_range())
619  {
620  const Elem * interior_parent = boundary_elem->interior_parent();
621 
622  // Find out which side of interior_parent boundary_elem corresponds to.
623  // Use distance between average vertex location as a way to check.
624  unsigned char interior_parent_side_index = 0;
625  bool found_matching_sides = false;
626  for (auto side : interior_parent->side_index_range())
627  {
628  interior_parent_side = &side_builder(*interior_parent, side);
629  Real va_distance = (boundary_elem->vertex_average() - interior_parent_side->vertex_average()).norm();
630 
631  if (va_distance < (tolerance * boundary_elem->hmin()))
632  {
633  interior_parent_side_index = cast_int<unsigned char>(side);
634  found_matching_sides = true;
635  break;
636  }
637  }
638 
639  libmesh_error_msg_if(!found_matching_sides, "No matching side found within the specified tolerance");
640 
641  side_id_map[boundary_elem->id()] = interior_parent_side_index;
642 
643  for (auto local_node_index : boundary_elem->node_index_range())
644  {
645  dof_id_type boundary_node_id = boundary_elem->node_id(local_node_index);
646  dof_id_type interior_node_id = interior_parent_side->node_id(local_node_index);
647 
648  node_id_map[interior_node_id] = boundary_node_id;
649  }
650  }
651 }
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
auto norm(const T &a)
Definition: tensor_tools.h:74
uint8_t dof_id_type
Definition: id_types.h:67

◆ get_side_boundary_ids()

const std::set<boundary_id_type>& libMesh::BoundaryInfo::get_side_boundary_ids ( ) const
inline
Returns
A reference to the set of the boundary IDs specified on sides of semilocal mesh elements.

Definition at line 807 of file boundary_info.h.

References _side_boundary_ids.

Referenced by libMesh::MeshTools::Generation::build_extrusion(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::MeshBase::get_info(), MeshStitchTest::testBoundaryInfo(), and BoundaryInfoTest::testSelectiveRenumber().

808  { return _side_boundary_ids; }
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.

◆ get_sideset_map()

const std::multimap<const Elem *, std::pair<unsigned short int, boundary_id_type> >& libMesh::BoundaryInfo::get_sideset_map ( ) const
inline
Returns
A const reference to the sideset map.

Definition at line 929 of file boundary_info.h.

References _boundary_side_id.

930  { return _boundary_side_id; }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.

◆ get_sideset_name()

const std::string & libMesh::BoundaryInfo::get_sideset_name ( boundary_id_type  id) const
Returns
A reference for getting an optional name for a sideset.

Definition at line 3235 of file boundary_info.C.

References _ss_id_to_name.

Referenced by libMesh::UnstructuredMesh::stitching_helper(), and libMesh::ExodusII_IO_Helper::write_sidesets().

3236 {
3237  static const std::string empty_string;
3238  if (const auto it = _ss_id_to_name.find(id);
3239  it == _ss_id_to_name.end())
3240  return empty_string;
3241  else
3242  return it->second;
3243 }
std::map< boundary_id_type, std::string > _ss_id_to_name
This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support ...

◆ get_sideset_name_map()

const std::map<boundary_id_type, std::string>& libMesh::BoundaryInfo::get_sideset_name_map ( ) const
inline

Definition at line 889 of file boundary_info.h.

References _ss_id_to_name.

Referenced by libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshBase::get_info(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::UnstructuredMesh::stitching_helper(), MeshStitchTest::testBoundaryInfo(), MeshInputTest::testGmshBCIDOverlap(), and libMesh::ExodusII_IO_Helper::write_sidesets().

890  { return _ss_id_to_name; }
std::map< boundary_id_type, std::string > _ss_id_to_name
This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support ...

◆ has_boundary_id() [1/2]

bool libMesh::BoundaryInfo::has_boundary_id ( const Node *const  node,
const boundary_id_type  id 
) const
Returns
true if node is associated with boundary id.

Definition at line 1336 of file boundary_info.C.

References _boundary_node_id, and libMesh::as_range().

Referenced by LinearElasticity::assemble(), assemble_elasticity(), assemble_poisson(), AssemblyF0::boundary_assembly(), AssemblyF1::boundary_assembly(), AssemblyF2::boundary_assembly(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::FEMContext::has_side_boundary_id(), LinearElasticityWithContact::initialize_contact_load_paths(), main(), AugmentSparsityOnInterface::mesh_reinit(), operator==(), SolidSystem::side_time_derivative(), libMesh::UnstructuredMesh::stitching_helper(), AllTriTest::test_helper_c0polyhedron(), MeshTetTest::testBcids(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), SystemsTest::testBoundaryProjectCube(), BoundaryInfoTest::testBuildNodeListFromSideList(), BoundaryInfoTest::testBuildSideListFromNodeList(), and BoundaryInfoTest::testEdgeBoundaryConditions().

1338 {
1339  for (const auto & pr : as_range(_boundary_node_id.equal_range(node)))
1340  if (pr.second == id)
1341  return true;
1342 
1343  return false;
1344 }
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
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

◆ has_boundary_id() [2/2]

bool libMesh::BoundaryInfo::has_boundary_id ( const Elem *const  elem,
const unsigned short int  side,
const boundary_id_type  id 
) const
Returns
true if side side of Elem elem is associated with id.

Definition at line 1530 of file boundary_info.C.

References boundary_ids().

1533 {
1534  std::vector<boundary_id_type> ids;
1535  this->boundary_ids(elem, side, ids);
1536  return (std::find(ids.begin(), ids.end(), id) != ids.end());
1537 }
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.

◆ is_children_on_boundary_side()

bool libMesh::BoundaryInfo::is_children_on_boundary_side ( ) const
inline
Returns
Whether or not there may be child elements directly assigned boundary sides

Definition at line 935 of file boundary_info.h.

References _children_on_boundary.

Referenced by libMesh::MeshRefinement::_coarsen_elements(), libMesh::PetscDiffSolver::solve(), and BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen().

936  { return _children_on_boundary; }

◆ libmesh_assert_valid_multimaps()

void libMesh::BoundaryInfo::libmesh_assert_valid_multimaps ( ) const
private

Helper method for ensuring that our multimaps don't contain entries with duplicate keys and values.

Probably should have picked a different data structure there, and also not given users an accessor with raw access to it...

Definition at line 3579 of file boundary_info.C.

References _boundary_edge_id, _boundary_node_id, _boundary_shellface_id, _boundary_side_id, and libMesh::libmesh_assert().

Referenced by clear_stitched_boundary_side_ids(), renumber_edge_id(), renumber_id(), renumber_node_id(), renumber_shellface_id(), and renumber_side_id().

3580 {
3581 #ifndef NDEBUG
3582  auto verify_multimap = [](const auto & themap) {
3583  for (const auto & [key, val] : themap)
3584  {
3585  auto range = themap.equal_range(key);
3586 
3587  int count = 0;
3588  for (auto it = range.first; it != range.second; ++it)
3589  if (it->second == val)
3590  ++count;
3591 
3592  libmesh_assert(count == 1);
3593  }
3594  };
3595 
3596  verify_multimap(this->_boundary_node_id);
3597  verify_multimap(this->_boundary_edge_id);
3598  verify_multimap(this->_boundary_shellface_id);
3599  verify_multimap(this->_boundary_side_id);
3600 #else
3601  return;
3602 #endif
3603 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ n_boundary_conds()

std::size_t libMesh::BoundaryInfo::n_boundary_conds ( ) const
Returns
The number of element-side-based boundary conditions.

This will be the correct global count even on a distributed mesh.

Definition at line 2594 of file boundary_info.C.

References _boundary_side_id, _mesh, libMesh::ParallelObject::comm(), libMesh::MeshBase::is_serial(), libMesh::ParallelObject::processor_id(), and TIMPI::Communicator::sum().

Referenced by libMesh::MeshTools::Modification::all_tri(), libMesh::MeshTools::Modification::flatten(), libMesh::AbaqusIO::read(), libMesh::Nemesis_IO::read(), AllTriTest::test_helper_2D(), AllTriTest::test_helper_3D(), AllTriTest::test_helper_c0polyhedron(), AllTriTest::testAllTriC0Polygon(), AllTriTest::testAllTriC0PolygonOctagon(), libMesh::XdrIO::write(), and libMesh::GmshIO::write_mesh().

2595 {
2596  // in serial we know the number of bcs from the
2597  // size of the container
2598  if (_mesh->is_serial())
2599  return _boundary_side_id.size();
2600 
2601  // in parallel we need to sum the number of local bcs
2602  parallel_object_only();
2603 
2604  std::size_t nbcs=0;
2605 
2606  for (const auto & pr : _boundary_side_id)
2607  if (pr.first->processor_id() == this->processor_id())
2608  nbcs++;
2609 
2610  this->comm().sum (nbcs);
2611 
2612  return nbcs;
2613 }
void sum(T &r) const
const Parallel::Communicator & comm() const
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
virtual bool is_serial() const
Definition: mesh_base.h:347
processor_id_type processor_id() const

◆ n_boundary_ids() [1/3]

std::size_t libMesh::BoundaryInfo::n_boundary_ids ( ) const
inline
Returns
The number of user-specified boundary ids on the semilocal part of the mesh.
Note
DistributedMesh users may need to compare boundary_ids sets via inter-processor communication.

Definition at line 475 of file boundary_info.h.

References _boundary_ids.

Referenced by libMesh::MeshTools::Subdivision::all_subdivision(), MeshTetTest::testBcids(), BoundaryInfoTest::testBuildSideListFromNodeList(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testLowOrderEdgeBlocks(), BoundaryInfoTest::testMesh(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testSelectiveRenumber(), and libMesh::FroIO::write().

475 { return _boundary_ids.size(); }
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.

◆ n_boundary_ids() [2/3]

unsigned int libMesh::BoundaryInfo::n_boundary_ids ( const Node node) const
Returns
The number of boundary ids associated with Node node.

Definition at line 1360 of file boundary_info.C.

References _boundary_node_id, and distance().

1361 {
1362  auto pos = _boundary_node_id.equal_range(node);
1363  return cast_int<unsigned int>(std::distance(pos.first, pos.second));
1364 }
Real distance(const Point &p)
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.

◆ n_boundary_ids() [3/3]

unsigned int libMesh::BoundaryInfo::n_boundary_ids ( const Elem *const  elem,
const unsigned short int  side 
) const
Returns
The number of boundary ids associated with the side side of element elem.

Definition at line 1713 of file boundary_info.C.

References boundary_ids().

1715 {
1716  std::vector<boundary_id_type> ids;
1717  this->boundary_ids(elem, side, ids);
1718  return cast_int<unsigned int>(ids.size());
1719 }
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.

◆ n_edge_boundary_ids()

unsigned int libMesh::BoundaryInfo::n_edge_boundary_ids ( const Elem *const  elem,
const unsigned short int  edge 
) const
Returns
The number of boundary ids associated with the edge edge of element elem.
Note
Edge-based boundary IDs should only be used in 3D.

Definition at line 1428 of file boundary_info.C.

References edge_boundary_ids().

1430 {
1431  std::vector<boundary_id_type> ids;
1432  this->edge_boundary_ids(elem, edge, ids);
1433  return cast_int<unsigned int>(ids.size());
1434 }
void edge_boundary_ids(const Elem *const elem, const unsigned short int edge, std::vector< boundary_id_type > &vec_to_fill) const

◆ n_edge_conds()

std::size_t libMesh::BoundaryInfo::n_edge_conds ( ) const
Returns
The number of edge-based boundary conditions. Edge-based boundary IDs should only be used in 3D.

This will be the correct global count even on a distributed mesh.

Definition at line 2615 of file boundary_info.C.

References _boundary_edge_id, _mesh, libMesh::ParallelObject::comm(), libMesh::MeshBase::is_serial(), libMesh::ParallelObject::processor_id(), and TIMPI::Communicator::sum().

Referenced by libMesh::ExodusII_IO_Helper::initialize(), libMesh::Nemesis_IO::prepare_to_write_nodal_data(), BoundaryInfoTest::testEdgeBoundaryConditions(), WriteEdgesetData::testWriteImpl(), libMesh::Nemesis_IO::write(), libMesh::XdrIO::write(), and libMesh::ExodusII_IO::write().

2616 {
2617  // in serial we know the number of nodesets from the
2618  // size of the container
2619  if (_mesh->is_serial())
2620  return _boundary_edge_id.size();
2621 
2622  // in parallel we need to sum the number of local nodesets
2623  parallel_object_only();
2624 
2625  std::size_t n_edge_bcs=0;
2626 
2627  for (const auto & pr : _boundary_edge_id)
2628  if (pr.first->processor_id() == this->processor_id())
2629  n_edge_bcs++;
2630 
2631  this->comm().sum (n_edge_bcs);
2632 
2633  return n_edge_bcs;
2634 }
void sum(T &r) const
const Parallel::Communicator & comm() const
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
virtual bool is_serial() const
Definition: mesh_base.h:347
processor_id_type processor_id() const
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ n_nodeset_conds()

std::size_t libMesh::BoundaryInfo::n_nodeset_conds ( ) const
Returns
The number of node-based boundary conditions.

This will be the correct global count even on a distributed mesh.

Definition at line 2659 of file boundary_info.C.

References _boundary_node_id, _mesh, libMesh::ParallelObject::comm(), libMesh::MeshBase::is_serial(), libMesh::ParallelObject::processor_id(), and TIMPI::Communicator::sum().

Referenced by libMesh::XdrIO::write().

2660 {
2661  // in serial we know the number of nodesets from the
2662  // size of the container
2663  if (_mesh->is_serial())
2664  return _boundary_node_id.size();
2665 
2666  // in parallel we need to sum the number of local nodesets
2667  parallel_object_only();
2668 
2669  std::size_t n_nodesets=0;
2670 
2671  for (const auto & pr : _boundary_node_id)
2672  if (pr.first->processor_id() == this->processor_id())
2673  n_nodesets++;
2674 
2675  this->comm().sum (n_nodesets);
2676 
2677  return n_nodesets;
2678 }
void sum(T &r) const
const Parallel::Communicator & comm() const
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
virtual bool is_serial() const
Definition: mesh_base.h:347
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
processor_id_type processor_id() const

◆ 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(), _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::Nemesis_IO::copy_scalar_solution(), libMesh::ExodusII_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(), libMesh::MeshBase::get_info(), libMesh::StaticCondensation::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::NumericVector< Number >::is_effectively_ghosted(), libMesh::NumericVector< Number >::is_effectively_serial(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::DofMap::n_dofs_per_processor(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::prepare_send_list(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), OverlappingFunctorTest::run_partitioner_test(), libMesh::DofMap::scatter_constraints(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), WriteVecAndScalar::setupTests(), libMesh::RBEIMEvaluation::side_gather_bfs(), DistributedMeshTest::testRemoteElemError(), CheckpointIOTest::testSplitter(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

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

◆ n_raw_boundary_ids()

unsigned int libMesh::BoundaryInfo::n_raw_boundary_ids ( const Elem *const  elem,
const unsigned short int  side 
) const
Returns
The number of raw (excludes ancestors) boundary ids associated with the side side of element elem.

Definition at line 1722 of file boundary_info.C.

References raw_boundary_ids().

1724 {
1725  std::vector<boundary_id_type> ids;
1726  this->raw_boundary_ids(elem, side, ids);
1727  return cast_int<unsigned int>(ids.size());
1728 }
void raw_boundary_ids(const Elem *const elem, const unsigned short int side, std::vector< boundary_id_type > &vec_to_fill) const

◆ n_shellface_boundary_ids()

unsigned int libMesh::BoundaryInfo::n_shellface_boundary_ids ( const Elem *const  elem,
const unsigned short int  shellface 
) const
Returns
The number of boundary ids associated with the specified shell face of element elem.
Note
This is only relevant for shell elements.

Definition at line 1496 of file boundary_info.C.

References shellface_boundary_ids().

1498 {
1499  std::vector<boundary_id_type> ids;
1500  this->shellface_boundary_ids(elem, shellface, ids);
1501  return cast_int<unsigned int>(ids.size());
1502 }
void shellface_boundary_ids(const Elem *const elem, const unsigned short int shellface, std::vector< boundary_id_type > &vec_to_fill) const

◆ n_shellface_conds()

std::size_t libMesh::BoundaryInfo::n_shellface_conds ( ) const
Returns
The number of shellface-based boundary conditions. This is only relevant on shell elements.

This will be the correct global count even on a distributed mesh.

Definition at line 2637 of file boundary_info.C.

References _boundary_shellface_id, _mesh, libMesh::ParallelObject::comm(), libMesh::MeshBase::is_serial(), libMesh::ParallelObject::processor_id(), and TIMPI::Communicator::sum().

Referenced by BoundaryInfoTest::testShellFaceConstraints(), and libMesh::XdrIO::write().

2638 {
2639  // in serial we know the number of nodesets from the
2640  // size of the container
2641  if (_mesh->is_serial())
2642  return _boundary_shellface_id.size();
2643 
2644  // in parallel we need to sum the number of local nodesets
2645  parallel_object_only();
2646 
2647  std::size_t n_shellface_bcs=0;
2648 
2649  for (const auto & pr : _boundary_shellface_id)
2650  if (pr.first->processor_id() == this->processor_id())
2651  n_shellface_bcs++;
2652 
2653  this->comm().sum (n_shellface_bcs);
2654 
2655  return n_shellface_bcs;
2656 }
void sum(T &r) const
const Parallel::Communicator & comm() const
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
virtual bool is_serial() const
Definition: mesh_base.h:347
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.
processor_id_type processor_id() const

◆ nodeset_name()

std::string & libMesh::BoundaryInfo::nodeset_name ( boundary_id_type  id)
Returns
A writable reference for setting an optional name for a nodeset.

Definition at line 3261 of file boundary_info.C.

References _ns_id_to_name.

Referenced by libMesh::AbaqusIO::assign_boundary_node_ids(), libMesh::MeshTools::Generation::build_cube(), build_side_list_from_node_list(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::GmshIO::read_mesh(), MeshStitchTest::renameAndShift(), BoundaryInfoTest::testNameCopying(), BoundaryInfoTest::testSelectiveRenumber(), and WriteNodesetData::testWriteImpl().

3262 {
3263  return _ns_id_to_name[id];
3264 }
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...

◆ operator!=()

bool libMesh::BoundaryInfo::operator!= ( const BoundaryInfo other_boundary_info) const
inline

Definition at line 88 of file boundary_info.h.

89  {
90  return !(*this == other_boundary_info);
91  }

◆ operator=()

BoundaryInfo & libMesh::BoundaryInfo::operator= ( const BoundaryInfo other_boundary_info)

Copy assignment operator.

Note
this will still reference the same MeshBase it was constructed with. Boundary data copied from other_boundary_info will refer to objects in this mesh which have the same DofObject::id() as the corresponding objects in the other mesh.

We're going to attempt to pull new pointers out of the mesh assigned to this boundary info.

This will only work if the mesh assigned to this BoundaryInfo is the same mesh object as other_boundary_info or was constructed in exactly the same way (or constructed as a copy, or a refined copy without renumbering, etc.).

Definition at line 110 of file boundary_info.C.

References _boundary_edge_id, _boundary_ids, _boundary_node_id, _boundary_shellface_id, _boundary_side_id, _children_on_boundary, _edge_boundary_ids, _es_id_to_name, _global_boundary_ids, _mesh, _node_boundary_ids, _ns_id_to_name, _shellface_boundary_ids, _side_boundary_ids, _ss_id_to_name, clear(), libMesh::MeshBase::elem_ptr(), and libMesh::MeshBase::node_ptr().

111 {
112  // Overwrite any preexisting boundary info
113  this->clear();
114 
125  // Copy node boundary info
126  for (const auto & [node, bid] : other_boundary_info._boundary_node_id)
127  _boundary_node_id.emplace(_mesh->node_ptr(node->id()), bid);
128 
129  // Copy edge boundary info
130  for (const auto & [elem, id_pair] : other_boundary_info._boundary_edge_id)
131  _boundary_edge_id.emplace(_mesh->elem_ptr(elem->id()), id_pair);
132 
133  // Copy shellface boundary info
134  for (const auto & [elem, id_pair] : other_boundary_info._boundary_shellface_id)
135  _boundary_shellface_id.emplace(_mesh->elem_ptr(elem->id()), id_pair);
136 
137  // Copy side boundary info
138  for (const auto & [elem, id_pair] : other_boundary_info._boundary_side_id)
139  _boundary_side_id.emplace(_mesh->elem_ptr(elem->id()), id_pair);
140 
141  _children_on_boundary = other_boundary_info._children_on_boundary;
142 
143  _boundary_ids = other_boundary_info._boundary_ids;
144  _global_boundary_ids = other_boundary_info._global_boundary_ids;
145  _side_boundary_ids = other_boundary_info._side_boundary_ids;
146  _node_boundary_ids = other_boundary_info._node_boundary_ids;
147  _edge_boundary_ids = other_boundary_info._edge_boundary_ids;
148  _shellface_boundary_ids = other_boundary_info._shellface_boundary_ids;
149 
150  _ss_id_to_name = other_boundary_info._ss_id_to_name;
151  _ns_id_to_name = other_boundary_info._ns_id_to_name;
152  _es_id_to_name = other_boundary_info._es_id_to_name;
153 
154  return *this;
155 }
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
std::set< boundary_id_type > _global_boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::map< boundary_id_type, std::string > _ss_id_to_name
This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support ...
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
void clear()
Clears the underlying data structures and restores the object to a pristine state with no data stored...
virtual const Elem * elem_ptr(const dof_id_type i) const =0
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.
virtual const Node * node_ptr(const dof_id_type i) const =0
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ operator==()

bool libMesh::BoundaryInfo::operator== ( const BoundaryInfo other_boundary_info) const

This tests for data equality via element ids.

Definition at line 158 of file boundary_info.C.

References _boundary_edge_id, _boundary_ids, _boundary_node_id, _boundary_shellface_id, _boundary_side_id, _children_on_boundary, _edge_boundary_ids, _es_id_to_name, _global_boundary_ids, _mesh, _node_boundary_ids, _ns_id_to_name, _shellface_boundary_ids, _side_boundary_ids, _ss_id_to_name, boundary_ids(), edge_boundary_ids(), has_boundary_id(), libMesh::DofObject::id(), libMesh::index_range(), libMesh::MeshBase::query_elem_ptr(), libMesh::MeshBase::query_node_ptr(), and shellface_boundary_ids().

159 {
160  for (const auto & [other_node, bid] : other_boundary_info._boundary_node_id)
161  {
162  const Node * node = this->_mesh->query_node_ptr(other_node->id());
163  if (!node)
164  return false;
165  if (!this->has_boundary_id(node, bid))
166  return false;
167  }
168  for (const auto & [node, bid] : this->_boundary_node_id)
169  {
170  const Node * other_node =
171  other_boundary_info._mesh->query_node_ptr(node->id());
172  if (!other_node)
173  return false;
174  if (!other_boundary_info.has_boundary_id(other_node, bid))
175  return false;
176  }
177 
178  auto compare_edges = [&](const Elem * elem,
179  const Elem * other_elem,
180  unsigned short int edge)
181  {
182  if (!elem)
183  return false;
184  if (!other_elem)
185  return false;
186 
187  std::vector<boundary_id_type> our_edges, other_edges;
188  this->edge_boundary_ids(elem, edge, our_edges);
189  other_boundary_info.edge_boundary_ids(other_elem, edge, other_edges);
190  if (our_edges.size() != other_edges.size())
191  return false;
192 
193  std::sort(our_edges.begin(), our_edges.end());
194  std::sort(other_edges.begin(), other_edges.end());
195  for (auto i : index_range(our_edges))
196  if (our_edges[i] != other_edges[i])
197  return false;
198  return true;
199  };
200 
201  for (const auto & [other_elem, edge_id_pair] : other_boundary_info._boundary_edge_id)
202  {
203  const Elem * elem = this->_mesh->query_elem_ptr(other_elem->id());
204  if (!compare_edges(elem, other_elem, edge_id_pair.first))
205  return false;
206  }
207 
208  for (const auto & [elem, edge_id_pair] : this->_boundary_edge_id)
209  {
210  const Elem * other_elem = other_boundary_info._mesh->query_elem_ptr(elem->id());
211  if (!compare_edges(elem, other_elem, edge_id_pair.first))
212  return false;
213  }
214 
215  auto compare_sides = [&](const Elem * elem,
216  const Elem * other_elem,
217  unsigned short int side)
218  {
219  if (!elem)
220  return false;
221  if (!other_elem)
222  return false;
223 
224  std::vector<boundary_id_type> our_sides, other_sides;
225  this->boundary_ids(elem, side, our_sides);
226  other_boundary_info.boundary_ids(other_elem, side, other_sides);
227  if (our_sides.size() != other_sides.size())
228  return false;
229 
230  std::sort(our_sides.begin(), our_sides.end());
231  std::sort(other_sides.begin(), other_sides.end());
232  for (auto i : index_range(our_sides))
233  if (our_sides[i] != other_sides[i])
234  return false;
235  return true;
236  };
237 
238  for (const auto & [other_elem, side_id_pair] : other_boundary_info._boundary_side_id)
239  {
240  const Elem * elem = this->_mesh->query_elem_ptr(other_elem->id());
241  if (!compare_sides(elem, other_elem, side_id_pair.first))
242  return false;
243  }
244 
245  for (const auto & [elem, side_id_pair] : this->_boundary_side_id)
246  {
247  const Elem * other_elem = other_boundary_info._mesh->query_elem_ptr(elem->id());
248  if (!compare_sides(elem, other_elem, side_id_pair.first))
249  return false;
250  }
251 
252  auto compare_shellfaces = [&](const Elem * elem,
253  const Elem * other_elem,
254  unsigned short int shellface)
255  {
256  if (!elem)
257  return false;
258  if (!other_elem)
259  return false;
260 
261  std::vector<boundary_id_type> our_shellfaces, other_shellfaces;
262  this->shellface_boundary_ids(elem, shellface, our_shellfaces);
263  other_boundary_info.shellface_boundary_ids(other_elem, shellface, other_shellfaces);
264  if (our_shellfaces.size() != other_shellfaces.size())
265  return false;
266 
267  std::sort(our_shellfaces.begin(), our_shellfaces.end());
268  std::sort(other_shellfaces.begin(), other_shellfaces.end());
269  for (auto i : index_range(our_shellfaces))
270  if (our_shellfaces[i] != other_shellfaces[i])
271  return false;
272  return true;
273  };
274 
275  for (const auto & [other_elem, shellface_id_pair] : other_boundary_info._boundary_shellface_id)
276  {
277  const Elem * elem = this->_mesh->query_elem_ptr(other_elem->id());
278  if (!compare_shellfaces(elem, other_elem, shellface_id_pair.first))
279  return false;
280  }
281 
282  for (const auto & [elem, shellface_id_pair] : this->_boundary_shellface_id)
283  {
284  const Elem * other_elem = other_boundary_info._mesh->query_elem_ptr(elem->id());
285  if (!compare_shellfaces(elem, other_elem, shellface_id_pair.first))
286  return false;
287  }
288 
289  if (_children_on_boundary != other_boundary_info._children_on_boundary)
290  return false;
291 
292  auto compare_sets = [](const auto & set1, const auto & set2)
293  {
294  if (set1.size() != set2.size())
295  return false;
296  for (boundary_id_type bid : set1)
297  if (!set2.count(bid))
298  return false;
299 
300  return true;
301  };
302 
303  if (!compare_sets(_boundary_ids,
304  other_boundary_info._boundary_ids) ||
305  !compare_sets(_global_boundary_ids,
306  other_boundary_info._global_boundary_ids) ||
307  !compare_sets(_edge_boundary_ids,
308  other_boundary_info._edge_boundary_ids) ||
309  !compare_sets(_node_boundary_ids,
310  other_boundary_info._node_boundary_ids) ||
311  !compare_sets(_shellface_boundary_ids,
312  other_boundary_info._shellface_boundary_ids) ||
313  !compare_sets(_side_boundary_ids,
314  other_boundary_info._side_boundary_ids))
315  return false;
316 
317  auto compare_maps = [](const auto & map1, const auto & map2)
318  {
319  if (map1.size() != map2.size())
320  return false;
321  for (const auto & pair : map1)
322  if (!map2.count(pair.first) ||
323  map2.at(pair.first) != pair.second)
324  return false;
325 
326  return true;
327  };
328 
329  if (!compare_maps(_ss_id_to_name,
330  other_boundary_info._ss_id_to_name) ||
331  !compare_maps(_ns_id_to_name,
332  other_boundary_info._ns_id_to_name) ||
333  !compare_maps(_es_id_to_name,
334  other_boundary_info._es_id_to_name))
335  return false;
336 
337  return true;
338 }
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
void shellface_boundary_ids(const Elem *const elem, const unsigned short int shellface, std::vector< boundary_id_type > &vec_to_fill) const
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
std::set< boundary_id_type > _global_boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::map< boundary_id_type, std::string > _ss_id_to_name
This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support ...
int8_t boundary_id_type
Definition: id_types.h:51
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
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
void edge_boundary_ids(const Elem *const elem, const unsigned short int edge, std::vector< boundary_id_type > &vec_to_fill) const
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ parallel_sync_node_ids()

void libMesh::BoundaryInfo::parallel_sync_node_ids ( )

Definition at line 2889 of file boundary_info.C.

References _boundary_node_id, _mesh, libMesh::as_range(), libMesh::ParallelObject::comm(), libMesh::index_range(), libMesh::MeshBase::node_ptr(), and libMesh::ParallelObject::processor_id().

2890 {
2891  // we need BCs for ghost nodes.
2892  std::unordered_map<processor_id_type, std::vector<dof_id_type>>
2893  node_ids_requested;
2894 
2895  // Determine what nodes we need to request
2896  for (const auto & node : _mesh->node_ptr_range())
2897  {
2898  const processor_id_type pid = node->processor_id();
2899  if (pid != this->processor_id())
2900  node_ids_requested[pid].push_back(node->id());
2901  }
2902 
2903  typedef std::vector<boundary_id_type> datum_type;
2904 
2905  // gather the node ID and boundary_id_type for the ghost nodes
2906  auto node_id_gather_functor =
2907  [this]
2909  const std::vector<dof_id_type> & ids,
2910  std::vector<datum_type> & data)
2911  {
2912  data.resize(ids.size());
2913  for (auto i : index_range(ids))
2914  {
2915  Node * node = _mesh->node_ptr(ids[i]);
2916  for (const auto & pr : as_range(_boundary_node_id.equal_range(node)))
2917  data[i].push_back(pr.second);
2918  }
2919  };
2920 
2921  // update the _boundary_node_id on this processor
2922  auto node_id_action_functor =
2923  [this]
2925  const std::vector<dof_id_type> & ids,
2926  std::vector<datum_type> & data)
2927  {
2928  for (auto i : index_range(ids))
2929  {
2930  Node * node = _mesh->node_ptr(ids[i]);
2931  //clear boundary node
2932  _boundary_node_id.erase(node);
2933  // update boundary node
2934  for (const auto & pr : data[i])
2935  _boundary_node_id.insert(std::make_pair(node, pr));
2936  }
2937  };
2938 
2939 
2940  datum_type * datum_type_ex = nullptr;
2941  Parallel::pull_parallel_vector_data
2942  (this->comm(), node_ids_requested, node_id_gather_functor,
2943  node_id_action_functor, datum_type_ex);
2944 }
const Parallel::Communicator & comm() const
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
uint8_t processor_id_type
Definition: id_types.h:104
uint8_t processor_id_type
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
Definition: simple_range.h:57
virtual const Node * node_ptr(const dof_id_type i) const =0
processor_id_type processor_id() const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153

◆ parallel_sync_side_ids()

void libMesh::BoundaryInfo::parallel_sync_side_ids ( )

Synchronize the boundary element side and node across processors.

This function is needed when boundary info is changed by adding or removing sides on the fly. Note: if the side of a ghost element is changed, then you would need to do do parallel push (see e.g., timpi/parallel_sync.h) and then sync.

Definition at line 2833 of file boundary_info.C.

References _boundary_side_id, _mesh, libMesh::as_range(), libMesh::ParallelObject::comm(), libMesh::MeshBase::elem_ptr(), libMesh::index_range(), libMesh::ParallelObject::processor_id(), and side_id.

2834 {
2835  // we need BCs for ghost elements.
2836  std::unordered_map<processor_id_type, std::vector<dof_id_type>>
2837  elem_ids_requested;
2838 
2839  // Determine what elements we need to request
2840  for (const auto & elem : _mesh->element_ptr_range())
2841  {
2842  const processor_id_type pid = elem->processor_id();
2843  if (pid != this->processor_id())
2844  elem_ids_requested[pid].push_back(elem->id());
2845  }
2846 
2847  typedef std::vector<std::pair<unsigned short int, boundary_id_type>> datum_type;
2848 
2849  // gather the element ID, side, and boundary_id_type for the ghost elements
2850  auto elem_id_gather_functor =
2851  [this]
2853  const std::vector<dof_id_type> & ids,
2854  std::vector<datum_type> & data)
2855  {
2856  data.resize(ids.size());
2857  for (auto i : index_range(ids))
2858  {
2859  Elem * elem = _mesh->elem_ptr(ids[i]);
2860  for (const auto & pr : as_range(_boundary_side_id.equal_range(elem)))
2861  data[i].push_back(std::make_pair(pr.second.first, pr.second.second));
2862  }
2863  };
2864  // update the _boundary_side_id on this processor
2865  auto elem_id_action_functor =
2866  [this]
2868  const std::vector<dof_id_type> & ids,
2869  std::vector<datum_type> & data)
2870  {
2871  for (auto i : index_range(ids))
2872  {
2873  Elem * elem = _mesh->elem_ptr(ids[i]);
2874  //clear boundary sides for this element
2875  _boundary_side_id.erase(elem);
2876  // update boundary sides for it
2877  for (const auto & [side_id, bndry_id] : data[i])
2878  _boundary_side_id.insert(std::make_pair(elem, std::make_pair(side_id, bndry_id)));
2879  }
2880  };
2881 
2882 
2883  datum_type * datum_type_ex = nullptr;
2884  Parallel::pull_parallel_vector_data
2885  (this->comm(), elem_ids_requested, elem_id_gather_functor,
2886  elem_id_action_functor, datum_type_ex);
2887 }
const boundary_id_type side_id
const Parallel::Communicator & comm() const
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
uint8_t processor_id_type
Definition: id_types.h:104
uint8_t processor_id_type
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
Definition: simple_range.h:57
virtual const Elem * elem_ptr(const dof_id_type i) const =0
processor_id_type processor_id() const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:153

◆ print_info()

void libMesh::BoundaryInfo::print_info ( std::ostream &  out_stream = libMesh::out) const

Prints the boundary information data structure.

Definition at line 3092 of file boundary_info.C.

References _boundary_edge_id, _boundary_node_id, _boundary_shellface_id, and _boundary_side_id.

3093 {
3094  // Print out the nodal BCs
3095  if (!_boundary_node_id.empty())
3096  {
3097  out_stream << "Nodal Boundary conditions:" << std::endl
3098  << "--------------------------" << std::endl
3099  << " (Node No., ID) " << std::endl;
3100 
3101  for (const auto & [node, bndry_id] : _boundary_node_id)
3102  out_stream << " (" << node->id()
3103  << ", " << bndry_id
3104  << ")" << std::endl;
3105  }
3106 
3107  // Print out the element edge BCs
3108  if (!_boundary_edge_id.empty())
3109  {
3110  out_stream << std::endl
3111  << "Edge Boundary conditions:" << std::endl
3112  << "-------------------------" << std::endl
3113  << " (Elem No., Edge No., ID) " << std::endl;
3114 
3115  for (const auto & [elem, id_pair] : _boundary_edge_id)
3116  out_stream << " (" << elem->id()
3117  << ", " << id_pair.first
3118  << ", " << id_pair.second
3119  << ")" << std::endl;
3120  }
3121 
3122  // Print out the element shellface BCs
3123  if (!_boundary_shellface_id.empty())
3124  {
3125  out_stream << std::endl
3126  << "Shell-face Boundary conditions:" << std::endl
3127  << "-------------------------" << std::endl
3128  << " (Elem No., Shell-face No., ID) " << std::endl;
3129 
3130  for (const auto & [elem, id_pair] : _boundary_shellface_id)
3131  out_stream << " (" << elem->id()
3132  << ", " << id_pair.first
3133  << ", " << id_pair.second
3134  << ")" << std::endl;
3135  }
3136 
3137  // Print out the element side BCs
3138  if (!_boundary_side_id.empty())
3139  {
3140  out_stream << std::endl
3141  << "Side Boundary conditions:" << std::endl
3142  << "-------------------------" << std::endl
3143  << " (Elem No., Side No., ID) " << std::endl;
3144 
3145  for (const auto & [elem, id_pair] : _boundary_side_id)
3146  out_stream << " (" << elem->id()
3147  << ", " << id_pair.first
3148  << ", " << id_pair.second
3149  << ")" << std::endl;
3150  }
3151 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ print_summary()

void libMesh::BoundaryInfo::print_summary ( std::ostream &  out_stream = libMesh::out) const

Prints a summary of the boundary information.

Definition at line 3155 of file boundary_info.C.

References _boundary_edge_id, _boundary_node_id, _boundary_shellface_id, and _boundary_side_id.

Referenced by main().

3156 {
3157  // Print out the nodal BCs
3158  if (!_boundary_node_id.empty())
3159  {
3160  out_stream << "Nodal Boundary conditions:" << std::endl
3161  << "--------------------------" << std::endl
3162  << " (ID, number of nodes) " << std::endl;
3163 
3164  std::map<boundary_id_type, std::size_t> ID_counts;
3165 
3166  for (const auto & pr : _boundary_node_id)
3167  ID_counts[pr.second]++;
3168 
3169  for (const auto & [bndry_id, cnt] : ID_counts)
3170  out_stream << " (" << bndry_id
3171  << ", " << cnt
3172  << ")" << std::endl;
3173  }
3174 
3175  // Print out the element edge BCs
3176  if (!_boundary_edge_id.empty())
3177  {
3178  out_stream << std::endl
3179  << "Edge Boundary conditions:" << std::endl
3180  << "-------------------------" << std::endl
3181  << " (ID, number of edges) " << std::endl;
3182 
3183  std::map<boundary_id_type, std::size_t> ID_counts;
3184 
3185  for (const auto & pr : _boundary_edge_id)
3186  ID_counts[pr.second.second]++;
3187 
3188  for (const auto & [bndry_id, cnt] : ID_counts)
3189  out_stream << " (" << bndry_id
3190  << ", " << cnt
3191  << ")" << std::endl;
3192  }
3193 
3194 
3195  // Print out the element edge BCs
3196  if (!_boundary_shellface_id.empty())
3197  {
3198  out_stream << std::endl
3199  << "Shell-face Boundary conditions:" << std::endl
3200  << "-------------------------" << std::endl
3201  << " (ID, number of shellfaces) " << std::endl;
3202 
3203  std::map<boundary_id_type, std::size_t> ID_counts;
3204 
3205  for (const auto & pr : _boundary_shellface_id)
3206  ID_counts[pr.second.second]++;
3207 
3208  for (const auto & [bndry_id, cnt] : ID_counts)
3209  out_stream << " (" << bndry_id
3210  << ", " << cnt
3211  << ")" << std::endl;
3212  }
3213 
3214  // Print out the element side BCs
3215  if (!_boundary_side_id.empty())
3216  {
3217  out_stream << std::endl
3218  << "Side Boundary conditions:" << std::endl
3219  << "-------------------------" << std::endl
3220  << " (ID, number of sides) " << std::endl;
3221 
3222  std::map<boundary_id_type, std::size_t> ID_counts;
3223 
3224  for (const auto & pr : _boundary_side_id)
3225  ID_counts[pr.second.second]++;
3226 
3227  for (const auto & [bndry_id, cnt] : ID_counts)
3228  out_stream << " (" << bndry_id
3229  << ", " << cnt
3230  << ")" << std::endl;
3231  }
3232 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

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

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

◆ raw_boundary_ids()

void libMesh::BoundaryInfo::raw_boundary_ids ( const Elem *const  elem,
const unsigned short int  side,
std::vector< boundary_id_type > &  vec_to_fill 
) const
Returns
The list of raw boundary ids associated with the side side of element elem.

These ids are "raw" because they exclude ids which are implicit, such as a child's inheritance of its ancestors' boundary id.

Definition at line 1732 of file boundary_info.C.

References _boundary_side_id, _children_on_boundary, libMesh::as_range(), libMesh::libmesh_assert(), libMesh::Elem::n_sides(), and libMesh::Elem::parent().

Referenced by copy_boundary_ids(), n_raw_boundary_ids(), and remove_side().

1735 {
1736  libmesh_assert(elem);
1737 
1738  // Only query BCs for sides that exist.
1739  libmesh_assert_less (side, elem->n_sides());
1740 
1741  // Clear out any previous contents
1742  vec_to_fill.clear();
1743 
1744  // Only level-0 elements store BCs.
1745  if (elem->parent() && !_children_on_boundary)
1746  return;
1747 
1748  // Check each element in the range to see if its side matches the requested side.
1749  for (const auto & pr : as_range(_boundary_side_id.equal_range(elem)))
1750  if (pr.second.first == side)
1751  vec_to_fill.push_back(pr.second.second);
1752 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
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
libmesh_assert(ctx)

◆ raw_edge_boundary_ids()

void libMesh::BoundaryInfo::raw_edge_boundary_ids ( const Elem *const  elem,
const unsigned short int  edge,
std::vector< boundary_id_type > &  vec_to_fill 
) const
Returns
The list of raw boundary ids associated with the edge edge of element elem.

These ids are "raw" because they exclude ids which are implicit, such as a child's inheritance of its ancestors' boundary id.

Note
Edge-based boundary IDs should only be used in 3D.

Definition at line 1438 of file boundary_info.C.

References _boundary_edge_id, libMesh::as_range(), libMesh::libmesh_assert(), libMesh::Elem::n_edges(), and libMesh::Elem::parent().

Referenced by copy_boundary_ids().

1441 {
1442  libmesh_assert(elem);
1443 
1444  // Only query BCs for edges that exist.
1445  libmesh_assert_less (edge, elem->n_edges());
1446 
1447  // Clear out any previous contents
1448  vec_to_fill.clear();
1449 
1450  // Only level-0 elements store BCs.
1451  if (elem->parent())
1452  return;
1453 
1454  // Check each element in the range to see if its edge matches the requested edge.
1455  for (const auto & pr : as_range(_boundary_edge_id.equal_range(elem)))
1456  if (pr.second.first == edge)
1457  vec_to_fill.push_back(pr.second.second);
1458 }
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
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ raw_shellface_boundary_ids()

void libMesh::BoundaryInfo::raw_shellface_boundary_ids ( const Elem *const  elem,
const unsigned short int  shellface,
std::vector< boundary_id_type > &  vec_to_fill 
) const
Returns
The list of raw boundary ids associated with the specified shell face of element elem.

These ids are "raw" because they exclude ids which are implicit, such as a child's inheritance of its ancestors' boundary id.

Note
This is only relevant for shell elements.

Definition at line 1506 of file boundary_info.C.

References _boundary_shellface_id, libMesh::as_range(), libMesh::libmesh_assert(), and libMesh::Elem::parent().

Referenced by copy_boundary_ids().

1509 {
1510  libmesh_assert(elem);
1511 
1512  // Shells only have 2 faces
1513  libmesh_assert_less(shellface, 2);
1514 
1515  // Clear out any previous contents
1516  vec_to_fill.clear();
1517 
1518  // Only level-0 elements store BCs.
1519  if (elem->parent())
1520  return;
1521 
1522  // Check each element in the range to see if its shellface matches the requested shellface.
1523  for (const auto & pr : as_range(_boundary_shellface_id.equal_range(elem)))
1524  if (pr.second.first == shellface)
1525  vec_to_fill.push_back(pr.second.second);
1526 }
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
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.

◆ regenerate_id_sets()

void libMesh::BoundaryInfo::regenerate_id_sets ( )

Clears and regenerates the cached sets of ids.

This is in general necessary after use of remove_*() functions, which remove individual id associations (an O(1) process) without checking to see whether that is the last association with the id (an O(N) process).

Definition at line 363 of file boundary_info.C.

References _boundary_edge_id, _boundary_ids, _boundary_node_id, _boundary_shellface_id, _boundary_side_id, libMesh::ParallelObject::_communicator, _edge_boundary_ids, _es_id_to_name, _mesh, _node_boundary_ids, _ns_id_to_name, _shellface_boundary_ids, _side_boundary_ids, _ss_id_to_name, libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), TIMPI::Communicator::set_union(), and synchronize_global_id_set().

Referenced by libMesh::UnstructuredMesh::all_first_order(), clear_stitched_boundary_side_ids(), libMesh::MeshBase::complete_preparation(), libMesh::MeshTetInterface::delete_2D_hull_elements(), libMesh::DistributedMesh::delete_remote_elements(), main(), and libMesh::TetGenMeshInterface::pointset_convexhull().

364 {
365  const auto old_ss_id_to_name = _ss_id_to_name;
366  const auto old_ns_id_to_name = _ns_id_to_name;
367  const auto old_es_id_to_name = _es_id_to_name;
368 
369  // Clear the old caches
370  _boundary_ids.clear();
371  _side_boundary_ids.clear();
372  _node_boundary_ids.clear();
373  _edge_boundary_ids.clear();
374  _shellface_boundary_ids.clear();
375  _ss_id_to_name.clear();
376  _ns_id_to_name.clear();
377  _es_id_to_name.clear();
378 
379  // Loop over id maps to regenerate each set.
380  for (const auto & pr : _boundary_node_id)
381  {
382  const boundary_id_type id = pr.second;
383  _boundary_ids.insert(id);
384  _node_boundary_ids.insert(id);
385  if (const auto it = old_ns_id_to_name.find(id);
386  it != old_ns_id_to_name.end())
387  _ns_id_to_name.emplace(id, it->second);
388  }
389 
390  for (const auto & pr : _boundary_edge_id)
391  {
392  const boundary_id_type id = pr.second.second;
393  _boundary_ids.insert(id);
394  _edge_boundary_ids.insert(id);
395  if (const auto it = old_es_id_to_name.find(id);
396  it != old_es_id_to_name.end())
397  _es_id_to_name.emplace(id, it->second);
398  }
399 
400  for (const auto & pr : _boundary_side_id)
401  {
402  const boundary_id_type id = pr.second.second;
403  _boundary_ids.insert(id);
404  _side_boundary_ids.insert(id);
405  if (const auto it = old_ss_id_to_name.find(id);
406  it != old_ss_id_to_name.end())
407  _ss_id_to_name.emplace(id, it->second);
408  }
409 
410  for (const auto & pr : _boundary_shellface_id)
411  {
412  const boundary_id_type id = pr.second.second;
413  _boundary_ids.insert(id);
414  _shellface_boundary_ids.insert(id);
415  }
416 
417  // Handle global data
419  if (!_mesh->is_serial())
420  {
424  }
425 
427 }
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
void synchronize_global_id_set()
Synchronizes the boundary_ids set on each processor to determine global_boundary_ids.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
const Parallel::Communicator & _communicator
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
std::map< boundary_id_type, std::string > _ss_id_to_name
This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support ...
virtual bool is_serial() const
Definition: mesh_base.h:347
int8_t boundary_id_type
Definition: id_types.h:51
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
libmesh_assert(ctx)
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.
void set_union(T &data, const unsigned int root_id) const

◆ remove() [1/2]

void libMesh::BoundaryInfo::remove ( const Node node)

◆ remove() [2/2]

void libMesh::BoundaryInfo::remove ( const Elem elem)

Removes the boundary conditions associated with element elem, if any exist.

Definition at line 1809 of file boundary_info.C.

References _boundary_edge_id, _boundary_shellface_id, _boundary_side_id, and libMesh::libmesh_assert().

1810 {
1811  libmesh_assert(elem);
1812 
1813  // Erase everything associated with elem
1814  _boundary_edge_id.erase (elem);
1815  _boundary_side_id.erase (elem);
1816  _boundary_shellface_id.erase (elem);
1817 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ remove_edge() [1/2]

void libMesh::BoundaryInfo::remove_edge ( const Elem elem,
const unsigned short int  edge 
)

Removes all boundary conditions associated with edge edge of element elem, if any exist.

Definition at line 1821 of file boundary_info.C.

References _boundary_edge_id, libMesh::Elem::level(), libMesh::libmesh_assert(), and libMesh::Elem::n_edges().

Referenced by renumber_edge_id(), renumber_id(), and libMesh::Elem::swap2boundaryedges().

1823 {
1824  libmesh_assert(elem);
1825 
1826  // Only touch BCs for edges that exist.
1827  libmesh_assert_less (edge, elem->n_edges());
1828 
1829  // Only level 0 elements are stored in BoundaryInfo.
1830  libmesh_assert_equal_to (elem->level(), 0);
1831 
1832  // Erase (elem, edge, *) entries from map.
1833  erase_if(_boundary_edge_id, elem,
1834  [edge](decltype(_boundary_edge_id)::mapped_type & pr)
1835  {return pr.first == edge;});
1836 }
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ remove_edge() [2/2]

void libMesh::BoundaryInfo::remove_edge ( const Elem elem,
const unsigned short int  edge,
const boundary_id_type  id 
)

Removes the boundary id id from edge edge of element elem, if it exists.

Definition at line 1840 of file boundary_info.C.

References _boundary_edge_id, libMesh::Elem::level(), libMesh::libmesh_assert(), and libMesh::Elem::n_edges().

1843 {
1844  libmesh_assert(elem);
1845 
1846  // Only touch BCs for edges that exist.
1847  libmesh_assert_less (edge, elem->n_edges());
1848 
1849  // Only level 0 elements are stored in BoundaryInfo.
1850  libmesh_assert_equal_to (elem->level(), 0);
1851 
1852  // Erase (elem, edge, id) entries from map.
1853  erase_if(_boundary_edge_id, elem,
1854  [edge, id](decltype(_boundary_edge_id)::mapped_type & pr)
1855  {return pr.first == edge && pr.second == id;});
1856 }
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ remove_edge_id()

void libMesh::BoundaryInfo::remove_edge_id ( boundary_id_type  id,
bool  global = false 
)

Removes all edges with boundary id id from the BoundaryInfo object, removes it from the set of edge boundary ids, and removes it from the set of boundary ids if no other boundary type uses it.

Set the global parameter to true if this is being called for all processes in the object's communicator, in which case we will remove the id from the global boundary ID container

Definition at line 1990 of file boundary_info.C.

References _boundary_edge_id, _boundary_ids, _edge_boundary_ids, _es_id_to_name, _global_boundary_ids, _node_boundary_ids, _shellface_boundary_ids, _side_boundary_ids, libMesh::ParallelObject::comm(), and TIMPI::Communicator::max().

Referenced by remove_id().

1991 {
1992  // Erase id from ids containers
1993  _edge_boundary_ids.erase(id);
1994 
1995  if (!_side_boundary_ids.count(id) &&
1996  !_shellface_boundary_ids.count(id) &&
1997  !_node_boundary_ids.count(id))
1998  _boundary_ids.erase(id);
1999 
2000  _es_id_to_name.erase(id);
2001  if (global)
2002  {
2003  bool someone_has_it = _boundary_ids.count(id);
2004  this->comm().max(someone_has_it);
2005  if (!someone_has_it)
2006  _global_boundary_ids.erase(id);
2007  }
2008 
2009  // Erase (*, *, id) entries from map.
2010  erase_if(_boundary_edge_id,
2011  [id](decltype(_boundary_edge_id)::mapped_type & pr)
2012  {return pr.second == id;});
2013 }
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
const Parallel::Communicator & comm() const
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
std::set< boundary_id_type > _global_boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...
void max(const T &r, T &o, Request &req) const
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ remove_id()

void libMesh::BoundaryInfo::remove_id ( boundary_id_type  id,
bool  global = false 
)

Removes all entities (nodes, sides, edges, shellfaces) with boundary id id from their respective containers and erases any record of id's existence from the BoundaryInfo object.

That is, after calling remove_id(), id will no longer be in the sets returned by get_boundary_ids(), get_side_boundary_ids(), etc., and will not be in the bc_id_list vector returned by build_side_list(), etc.

Set the global parameter to true if this is being called for all processes in the object's communicator, in which case we will remove the id from the global boundary ID container

Definition at line 1948 of file boundary_info.C.

References _global_boundary_ids, remove_edge_id(), remove_node_id(), remove_shellface_id(), and remove_side_id().

Referenced by BoundaryInfoTest::testMesh(), and BoundaryInfoTest::testRenumber().

1949 {
1950  // Pass global==false to the sub-methods here, so we can avoid
1951  // unnecessary communications
1952  this->remove_side_id(id, false);
1953  this->remove_edge_id(id, false);
1954  this->remove_shellface_id(id, false);
1955  this->remove_node_id(id, false);
1956 
1957  if (global)
1958  _global_boundary_ids.erase(id);
1959 }
void remove_shellface_id(boundary_id_type id, bool global=false)
Removes all shellfaces with boundary id id from the BoundaryInfo object, removes it from the set of s...
void remove_side_id(boundary_id_type id, bool global=false)
Removes all sides with boundary id id from the BoundaryInfo object, removes it from the set of side b...
std::set< boundary_id_type > _global_boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
void remove_edge_id(boundary_id_type id, bool global=false)
Removes all edges with boundary id id from the BoundaryInfo object, removes it from the set of edge b...
void remove_node_id(boundary_id_type id, bool global=false)
Removes all nodes with boundary id id from the BoundaryInfo object, removes it from the set of node b...

◆ remove_node()

void libMesh::BoundaryInfo::remove_node ( const Node node,
const boundary_id_type  id 
)

Removes boundary id id from node node, if it exists.

Definition at line 1796 of file boundary_info.C.

References _boundary_node_id, and libMesh::libmesh_assert().

Referenced by clear_stitched_boundary_side_ids(), renumber_id(), and renumber_node_id().

1798 {
1799  libmesh_assert(node);
1800 
1801  // Erase (node, id) entry from map.
1802  erase_if(_boundary_node_id, node,
1803  [id](decltype(_boundary_node_id)::mapped_type & val)
1804  {return val == id;});
1805 }
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
libmesh_assert(ctx)

◆ remove_node_id()

void libMesh::BoundaryInfo::remove_node_id ( boundary_id_type  id,
bool  global = false 
)

Removes all nodes with boundary id id from the BoundaryInfo object, removes it from the set of node boundary ids, and removes it from the set of boundary ids if no other boundary type uses it.

Set the global parameter to true if this is being called for all processes in the object's communicator, in which case we will remove the id from the global boundary ID container

Definition at line 2043 of file boundary_info.C.

References _boundary_ids, _boundary_node_id, _edge_boundary_ids, _global_boundary_ids, _node_boundary_ids, _ns_id_to_name, _shellface_boundary_ids, _side_boundary_ids, libMesh::ParallelObject::comm(), and TIMPI::Communicator::max().

Referenced by remove_id(), and BoundaryInfoTest::testBuildNodeListFromSideList().

2044 {
2045  // Erase id from ids containers
2046  _node_boundary_ids.erase(id);
2047 
2048  if (!_side_boundary_ids.count(id) &&
2049  !_edge_boundary_ids.count(id) &&
2050  !_shellface_boundary_ids.count(id))
2051  _boundary_ids.erase(id);
2052 
2053  _ns_id_to_name.erase(id);
2054  if (global)
2055  {
2056  bool someone_has_it = _boundary_ids.count(id);
2057  this->comm().max(someone_has_it);
2058  if (!someone_has_it)
2059  _global_boundary_ids.erase(id);
2060  }
2061 
2062  // Erase (*, id) entries from map.
2063  erase_if(_boundary_node_id,
2064  [id](decltype(_boundary_node_id)::mapped_type & val)
2065  {return val == id;});
2066 }
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
const Parallel::Communicator & comm() const
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
std::set< boundary_id_type > _global_boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
void max(const T &r, T &o, Request &req) const
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.

◆ remove_shellface() [1/2]

void libMesh::BoundaryInfo::remove_shellface ( const Elem elem,
const unsigned short int  shellface 
)

Removes all boundary conditions associated with shell face shellface of element elem, if any exist.

Definition at line 1859 of file boundary_info.C.

References _boundary_shellface_id, libMesh::Elem::level(), and libMesh::libmesh_assert().

Referenced by renumber_id(), and renumber_shellface_id().

1861 {
1862  libmesh_assert(elem);
1863 
1864  // Only level 0 elements are stored in BoundaryInfo.
1865  libmesh_assert_equal_to (elem->level(), 0);
1866 
1867  // Shells only have 2 faces
1868  libmesh_assert_less(shellface, 2);
1869 
1870  // Erase (elem, shellface, *) entries from map.
1871  erase_if(_boundary_shellface_id, elem,
1872  [shellface](decltype(_boundary_shellface_id)::mapped_type & pr)
1873  {return pr.first == shellface;});
1874 }
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.

◆ remove_shellface() [2/2]

void libMesh::BoundaryInfo::remove_shellface ( const Elem elem,
const unsigned short int  shellface,
const boundary_id_type  id 
)

Removes all boundary conditions associated with shell face shellface of element elem, if any exist.

Definition at line 1878 of file boundary_info.C.

References _boundary_shellface_id, libMesh::Elem::level(), and libMesh::libmesh_assert().

1881 {
1882  libmesh_assert(elem);
1883 
1884  // Only level 0 elements are stored in BoundaryInfo.
1885  libmesh_assert_equal_to (elem->level(), 0);
1886 
1887  // Shells only have 2 faces
1888  libmesh_assert_less(shellface, 2);
1889 
1890  // Erase (elem, shellface, id) entries from map.
1891  erase_if(_boundary_shellface_id, elem,
1892  [shellface, id](decltype(_boundary_shellface_id)::mapped_type & pr)
1893  {return pr.first == shellface && pr.second == id;});
1894 }
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.

◆ remove_shellface_id()

void libMesh::BoundaryInfo::remove_shellface_id ( boundary_id_type  id,
bool  global = false 
)

Removes all shellfaces with boundary id id from the BoundaryInfo object, removes it from the set of shellface boundary ids, and removes it from the set of boundary ids if no other boundary type uses it.

Set the global parameter to true if this is being called for all processes in the object's communicator, in which case we will remove the id from the global boundary ID container

Definition at line 2017 of file boundary_info.C.

References _boundary_ids, _boundary_shellface_id, _edge_boundary_ids, _global_boundary_ids, _node_boundary_ids, _shellface_boundary_ids, _side_boundary_ids, libMesh::ParallelObject::comm(), and TIMPI::Communicator::max().

Referenced by remove_id().

2018 {
2019  // Erase id from ids containers
2020  _shellface_boundary_ids.erase(id);
2021 
2022  if (!_side_boundary_ids.count(id) &&
2023  !_edge_boundary_ids.count(id) &&
2024  !_node_boundary_ids.count(id))
2025  _boundary_ids.erase(id);
2026 
2027  if (global)
2028  {
2029  bool someone_has_it = _boundary_ids.count(id);
2030  this->comm().max(someone_has_it);
2031  if (!someone_has_it)
2032  _global_boundary_ids.erase(id);
2033  }
2034 
2035  // Erase (*, *, id) entries from map.
2036  erase_if(_boundary_shellface_id,
2037  [id](decltype(_boundary_shellface_id)::mapped_type & pr)
2038  {return pr.second == id;});
2039 }
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
const Parallel::Communicator & comm() const
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
std::set< boundary_id_type > _global_boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
void max(const T &r, T &o, Request &req) const
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.

◆ remove_side() [1/2]

void libMesh::BoundaryInfo::remove_side ( const Elem elem,
const unsigned short int  side 
)

Removes all boundary conditions associated with side side of element elem, if any exist.

Definition at line 1896 of file boundary_info.C.

References _boundary_side_id, libMesh::libmesh_assert(), and libMesh::Elem::n_sides().

Referenced by main(), renumber_id(), renumber_side_id(), libMesh::Elem::swap2boundarysides(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), and BoundaryInfoTest::testBoundaryOnChildrenErrors().

1898 {
1899  libmesh_assert(elem);
1900 
1901  // Only touch BCs for sides that exist.
1902  libmesh_assert_less (side, elem->n_sides());
1903 
1904  // Erase (elem, side, *) entries from map.
1905  erase_if(_boundary_side_id, elem,
1906  [side](decltype(_boundary_side_id)::mapped_type & pr)
1907  {return pr.first == side;});
1908 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
libmesh_assert(ctx)

◆ remove_side() [2/2]

void libMesh::BoundaryInfo::remove_side ( const Elem elem,
const unsigned short int  side,
const boundary_id_type  id 
)

Removes the boundary id id from side side of element elem, if it exists.

Definition at line 1912 of file boundary_info.C.

References _boundary_side_id, boundary_ids(), libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::Elem::n_sides(), and raw_boundary_ids().

1915 {
1916  libmesh_assert(elem);
1917 
1918  // Only touch BCs for sides that exist.
1919  libmesh_assert_less (side, elem->n_sides());
1920 
1921 #ifdef LIBMESH_ENABLE_AMR
1922  // Here we have to stop and check if somebody tries to remove an ancestor's boundary ID
1923  // through a child
1924  if (elem->level())
1925  {
1926  std::vector<boundary_id_type> bd_ids;
1927  this->boundary_ids(elem,side,bd_ids);
1928  if(std::find(bd_ids.begin(), bd_ids.end(), id) != bd_ids.end())
1929  {
1930  std::vector<boundary_id_type> raw_bd_ids;
1931  this->raw_boundary_ids(elem, side, raw_bd_ids);
1932  if(std::find(raw_bd_ids.begin(), raw_bd_ids.end(), id) == raw_bd_ids.end())
1933  libmesh_not_implemented_msg("We cannot delete boundary ID "
1934  + std::to_string(id) +
1935  " using a child because it is inherited from an ancestor.");
1936  }
1937  }
1938 #endif
1939 
1940  // Erase (elem, side, id) entries from map.
1941  erase_if(_boundary_side_id, elem,
1942  [side, id](decltype(_boundary_side_id)::mapped_type & pr)
1943  {return pr.first == side && pr.second == id;});
1944 }
void raw_boundary_ids(const Elem *const elem, const unsigned short int side, std::vector< boundary_id_type > &vec_to_fill) const
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
libmesh_assert(ctx)

◆ remove_side_id()

void libMesh::BoundaryInfo::remove_side_id ( boundary_id_type  id,
bool  global = false 
)

Removes all sides with boundary id id from the BoundaryInfo object, removes it from the set of side boundary ids, and removes it from the set of boundary ids if no other boundary type uses it.

Set the global parameter to true if this is being called for all processes in the object's communicator, in which case we will remove the id from the global boundary ID container

Definition at line 1963 of file boundary_info.C.

References _boundary_ids, _boundary_side_id, _edge_boundary_ids, _global_boundary_ids, _node_boundary_ids, _shellface_boundary_ids, _side_boundary_ids, _ss_id_to_name, libMesh::ParallelObject::comm(), and TIMPI::Communicator::max().

Referenced by remove_id(), and BoundaryInfoTest::testBuildSideListFromNodeList().

1964 {
1965  // Erase id from ids containers
1966  _side_boundary_ids.erase(id);
1967 
1968  if (!_edge_boundary_ids.count(id) &&
1969  !_shellface_boundary_ids.count(id) &&
1970  !_node_boundary_ids.count(id))
1971  _boundary_ids.erase(id);
1972 
1973  _ss_id_to_name.erase(id);
1974  if (global)
1975  {
1976  bool someone_has_it = _boundary_ids.count(id);
1977  this->comm().max(someone_has_it);
1978  if (!someone_has_it)
1979  _global_boundary_ids.erase(id);
1980  }
1981 
1982  // Erase (*, *, id) entries from map.
1983  erase_if(_boundary_side_id,
1984  [id](decltype(_boundary_side_id)::mapped_type & pr)
1985  {return pr.second == id;});
1986 }
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
const Parallel::Communicator & comm() const
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
std::set< boundary_id_type > _global_boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::map< boundary_id_type, std::string > _ss_id_to_name
This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support ...
void max(const T &r, T &o, Request &req) const
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.

◆ renumber_edge_id()

void libMesh::BoundaryInfo::renumber_edge_id ( boundary_id_type  old_id,
boundary_id_type  new_id 
)

Changes all edges with boundary id old_id to instead be labeled by boundary id new_id.

Definition at line 2197 of file boundary_info.C.

References _boundary_edge_id, _boundary_ids, _edge_boundary_ids, _es_id_to_name, _node_boundary_ids, _shellface_boundary_ids, _side_boundary_ids, libmesh_assert_valid_multimaps(), and remove_edge().

Referenced by BoundaryInfoTest::testSelectiveRenumber().

2199 {
2200  // If the IDs are the same, this is a no-op.
2201  if (old_id == new_id)
2202  return;
2203 
2204  bool found_edge = false;
2205  for (auto & p : _boundary_edge_id)
2206  if (p.second.second == old_id)
2207  {
2208  // If we already have this id on this edge, we don't want to
2209  // create a duplicate in our multimap
2210  this->remove_edge(p.first, p.second.first, new_id);
2211  p.second.second = new_id;
2212  found_edge = true;
2213  }
2214  _edge_boundary_ids.erase(old_id);
2215 
2216  if (found_edge)
2217  {
2218  _edge_boundary_ids.insert(new_id);
2219 
2220  if (!_shellface_boundary_ids.count(old_id) &&
2221  !_side_boundary_ids.count(old_id) &&
2222  !_node_boundary_ids.count(old_id))
2223  {
2224  _boundary_ids.erase(old_id);
2225  }
2226  _boundary_ids.insert(new_id);
2227  }
2228 
2229  renumber_name(_es_id_to_name, old_id, new_id);
2230 
2232 }
void libmesh_assert_valid_multimaps() const
Helper method for ensuring that our multimaps don&#39;t contain entries with duplicate keys and values...
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
void remove_edge(const Elem *elem, const unsigned short int edge)
Removes all boundary conditions associated with edge edge of element elem, if any exist...
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ renumber_id()

void libMesh::BoundaryInfo::renumber_id ( boundary_id_type  old_id,
boundary_id_type  new_id 
)

Changes all entities (nodes, sides, edges, shellfaces) with boundary id old_id to instead be labeled by boundary id new_id.

Definition at line 2070 of file boundary_info.C.

References _boundary_edge_id, _boundary_ids, _boundary_node_id, _boundary_shellface_id, _boundary_side_id, _edge_boundary_ids, _es_id_to_name, _node_boundary_ids, _ns_id_to_name, _shellface_boundary_ids, _side_boundary_ids, _ss_id_to_name, libmesh_assert_valid_multimaps(), remove_edge(), remove_node(), remove_shellface(), and remove_side().

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), and BoundaryInfoTest::testRenumber().

2072 {
2073  if (old_id == new_id)
2074  {
2075  // If the IDs are the same, this is a no-op.
2076  return;
2077  }
2078 
2079  bool found_node = false;
2080  for (auto & p : _boundary_node_id)
2081  if (p.second == old_id)
2082  {
2083  // If we already have this id on this node, we don't want to
2084  // create a duplicate in our multimap
2085  this->remove_node(p.first, new_id);
2086  p.second = new_id;
2087  found_node = true;
2088  }
2089  if (found_node)
2090  {
2091  _node_boundary_ids.erase(old_id);
2092  _node_boundary_ids.insert(new_id);
2093  }
2094 
2095  bool found_edge = false;
2096  for (auto & p : _boundary_edge_id)
2097  if (p.second.second == old_id)
2098  {
2099  // If we already have this id on this edge, we don't want to
2100  // create a duplicate in our multimap
2101  this->remove_edge(p.first, p.second.first, new_id);
2102  p.second.second = new_id;
2103  found_edge = true;
2104  }
2105  if (found_edge)
2106  {
2107  _edge_boundary_ids.erase(old_id);
2108  _edge_boundary_ids.insert(new_id);
2109  }
2110 
2111  bool found_shellface = false;
2112  for (auto & p : _boundary_shellface_id)
2113  if (p.second.second == old_id)
2114  {
2115  // If we already have this id on this shellface, we don't want
2116  // to create a duplicate in our multimap
2117  this->remove_shellface(p.first, p.second.first, new_id);
2118  p.second.second = new_id;
2119  found_shellface = true;
2120  }
2121  if (found_shellface)
2122  {
2123  _shellface_boundary_ids.erase(old_id);
2124  _shellface_boundary_ids.insert(new_id);
2125  }
2126 
2127  bool found_side = false;
2128  for (auto & p : _boundary_side_id)
2129  if (p.second.second == old_id)
2130  {
2131  // If we already have this id on this side, we don't want to
2132  // create a duplicate in our multimap
2133  this->remove_side(p.first, p.second.first, new_id);
2134  p.second.second = new_id;
2135  found_side = true;
2136  }
2137  if (found_side)
2138  {
2139  _side_boundary_ids.erase(old_id);
2140  _side_boundary_ids.insert(new_id);
2141  }
2142 
2143  if (found_node || found_edge || found_shellface || found_side)
2144  {
2145  _boundary_ids.erase(old_id);
2146  _boundary_ids.insert(new_id);
2147  }
2148 
2149  renumber_name(_ss_id_to_name, old_id, new_id);
2150  renumber_name(_ns_id_to_name, old_id, new_id);
2151  renumber_name(_es_id_to_name, old_id, new_id);
2152 
2154 }
void libmesh_assert_valid_multimaps() const
Helper method for ensuring that our multimaps don&#39;t contain entries with duplicate keys and values...
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
void remove_edge(const Elem *elem, const unsigned short int edge)
Removes all boundary conditions associated with edge edge of element elem, if any exist...
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
void remove_node(const Node *node, const boundary_id_type id)
Removes boundary id id from node node, if it exists.
void remove_shellface(const Elem *elem, const unsigned short int shellface)
Removes all boundary conditions associated with shell face shellface of element elem, if any exist.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
std::map< boundary_id_type, std::string > _ss_id_to_name
This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support ...
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
void remove_side(const Elem *elem, const unsigned short int side)
Removes all boundary conditions associated with side side of element elem, if any exist...
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
Data structure that maps edges of elements to boundary ids.

◆ renumber_node_id()

void libMesh::BoundaryInfo::renumber_node_id ( boundary_id_type  old_id,
boundary_id_type  new_id 
)

Changes all nodes with boundary id old_id to instead be labeled by boundary id new_id.

Definition at line 2273 of file boundary_info.C.

References _boundary_ids, _boundary_node_id, _edge_boundary_ids, _node_boundary_ids, _ns_id_to_name, _shellface_boundary_ids, _side_boundary_ids, libmesh_assert_valid_multimaps(), and remove_node().

Referenced by BoundaryInfoTest::testSelectiveRenumber().

2275 {
2276  // If the IDs are the same, this is a no-op.
2277  if (old_id == new_id)
2278  return;
2279 
2280  bool found_node = false;
2281  for (auto & p : _boundary_node_id)
2282  if (p.second == old_id)
2283  {
2284  // If we already have this id on this node, we don't want to
2285  // create a duplicate in our multimap
2286  this->remove_node(p.first, new_id);
2287  p.second = new_id;
2288  found_node = true;
2289  }
2290  _node_boundary_ids.erase(old_id);
2291 
2292  if (found_node)
2293  {
2294  _node_boundary_ids.insert(new_id);
2295 
2296  if (!_shellface_boundary_ids.count(old_id) &&
2297  !_side_boundary_ids.count(old_id) &&
2298  !_edge_boundary_ids.count(old_id))
2299  {
2300  _boundary_ids.erase(old_id);
2301  }
2302  _boundary_ids.insert(new_id);
2303  }
2304 
2305  renumber_name(_ns_id_to_name, old_id, new_id);
2306 
2308 }
void libmesh_assert_valid_multimaps() const
Helper method for ensuring that our multimaps don&#39;t contain entries with duplicate keys and values...
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
void remove_node(const Node *node, const boundary_id_type id)
Removes boundary id id from node node, if it exists.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
std::multimap< const Node *, boundary_id_type > _boundary_node_id
Data structure that maps nodes in the mesh to boundary ids.
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.

◆ renumber_shellface_id()

void libMesh::BoundaryInfo::renumber_shellface_id ( boundary_id_type  old_id,
boundary_id_type  new_id 
)

Changes all shellfaces with boundary id old_id to instead be labeled by boundary id new_id.

Definition at line 2236 of file boundary_info.C.

References _boundary_ids, _boundary_shellface_id, _edge_boundary_ids, _node_boundary_ids, _shellface_boundary_ids, _side_boundary_ids, libmesh_assert_valid_multimaps(), and remove_shellface().

2238 {
2239  // If the IDs are the same, this is a no-op.
2240  if (old_id == new_id)
2241  return;
2242 
2243  bool found_shellface = false;
2244  for (auto & p : _boundary_shellface_id)
2245  if (p.second.second == old_id)
2246  {
2247  // If we already have this id on this shellface, we don't want
2248  // to create a duplicate in our multimap
2249  this->remove_shellface(p.first, p.second.first, new_id);
2250  p.second.second = new_id;
2251  found_shellface = true;
2252  }
2253  _shellface_boundary_ids.erase(old_id);
2254 
2255  if (found_shellface)
2256  {
2257  _shellface_boundary_ids.insert(new_id);
2258 
2259  if (!_edge_boundary_ids.count(old_id) &&
2260  !_side_boundary_ids.count(old_id) &&
2261  !_node_boundary_ids.count(old_id))
2262  {
2263  _boundary_ids.erase(old_id);
2264  }
2265  _boundary_ids.insert(new_id);
2266  }
2267 
2269 }
void libmesh_assert_valid_multimaps() const
Helper method for ensuring that our multimaps don&#39;t contain entries with duplicate keys and values...
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
void remove_shellface(const Elem *elem, const unsigned short int shellface)
Removes all boundary conditions associated with shell face shellface of element elem, if any exist.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.

◆ renumber_side_id()

void libMesh::BoundaryInfo::renumber_side_id ( boundary_id_type  old_id,
boundary_id_type  new_id 
)

Changes all sides with boundary id old_id to instead be labeled by boundary id new_id.

Definition at line 2158 of file boundary_info.C.

References _boundary_ids, _boundary_side_id, _edge_boundary_ids, _node_boundary_ids, _shellface_boundary_ids, _side_boundary_ids, _ss_id_to_name, libmesh_assert_valid_multimaps(), and remove_side().

Referenced by BoundaryInfoTest::testSelectiveRenumber().

2160 {
2161  // If the IDs are the same, this is a no-op.
2162  if (old_id == new_id)
2163  return;
2164 
2165  bool found_side = false;
2166  for (auto & p : _boundary_side_id)
2167  if (p.second.second == old_id)
2168  {
2169  // If we already have this id on this side, we don't want to
2170  // create a duplicate in our multimap
2171  this->remove_side(p.first, p.second.first, new_id);
2172  p.second.second = new_id;
2173  found_side = true;
2174  }
2175  _side_boundary_ids.erase(old_id);
2176 
2177  if (found_side)
2178  {
2179  _side_boundary_ids.insert(new_id);
2180 
2181  if (!_shellface_boundary_ids.count(old_id) &&
2182  !_edge_boundary_ids.count(old_id) &&
2183  !_node_boundary_ids.count(old_id))
2184  {
2185  _boundary_ids.erase(old_id);
2186  }
2187  _boundary_ids.insert(new_id);
2188  }
2189 
2190  renumber_name(_ss_id_to_name, old_id, new_id);
2191 
2193 }
void libmesh_assert_valid_multimaps() const
Helper method for ensuring that our multimaps don&#39;t contain entries with duplicate keys and values...
std::set< boundary_id_type > _node_boundary_ids
Set of user-specified boundary IDs for nodes only.
std::set< boundary_id_type > _edge_boundary_ids
Set of user-specified boundary IDs for edges only.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
std::set< boundary_id_type > _side_boundary_ids
Set of user-specified boundary IDs for sides only.
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
std::map< boundary_id_type, std::string > _ss_id_to_name
This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support ...
void remove_side(const Elem *elem, const unsigned short int side)
Removes all boundary conditions associated with side side of element elem, if any exist...
std::set< boundary_id_type > _shellface_boundary_ids
Set of user-specified boundary IDs for shellfaces only.

◆ set_edgeset_name_map()

std::map<boundary_id_type, std::string>& libMesh::BoundaryInfo::set_edgeset_name_map ( )
inline
Returns
Writable/const reference to the edgeset name map.

Definition at line 903 of file boundary_info.h.

References _es_id_to_name.

Referenced by libMesh::MeshTools::Generation::build_extrusion(), and libMesh::UnstructuredMesh::stitching_helper().

904  { return _es_id_to_name; }
std::map< boundary_id_type, std::string > _es_id_to_name
This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support ...

◆ set_mesh()

void libMesh::BoundaryInfo::set_mesh ( MeshBase m)
inlineprotected

Definition at line 70 of file boundary_info.h.

References _mesh.

70 { _mesh = &m; }
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.

◆ set_nodeset_name_map()

std::map<boundary_id_type, std::string>& libMesh::BoundaryInfo::set_nodeset_name_map ( )
inline
Returns
A writable reference to the nodeset name map.

Definition at line 895 of file boundary_info.h.

References _ns_id_to_name.

Referenced by libMesh::MeshTools::Generation::build_extrusion(), libMesh::CheckpointIO::read_header(), and libMesh::UnstructuredMesh::stitching_helper().

896  { return _ns_id_to_name; }
std::map< boundary_id_type, std::string > _ns_id_to_name
This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support ...

◆ set_sideset_name_map()

std::map<boundary_id_type, std::string>& libMesh::BoundaryInfo::set_sideset_name_map ( )
inline
Returns
A writable reference to the sideset name map.

Definition at line 887 of file boundary_info.h.

References _ss_id_to_name.

Referenced by libMesh::MeshTools::Generation::build_extrusion(), libMesh::CheckpointIO::read_header(), and libMesh::UnstructuredMesh::stitching_helper().

888  { return _ss_id_to_name; }
std::map< boundary_id_type, std::string > _ss_id_to_name
This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support ...

◆ shellface_boundary_ids()

void libMesh::BoundaryInfo::shellface_boundary_ids ( const Elem *const  elem,
const unsigned short int  shellface,
std::vector< boundary_id_type > &  vec_to_fill 
) const
Returns
The list of boundary ids associated with the specified shell face of element elem.
Note
This is only relevant for shell elements.

Definition at line 1462 of file boundary_info.C.

References _boundary_shellface_id, libMesh::as_range(), libMesh::Elem::level(), libMesh::libmesh_assert(), and libMesh::Elem::parent().

Referenced by assemble_shell(), n_shellface_boundary_ids(), operator==(), and libMesh::XdrIO::write_serialized_bcs_helper().

1465 {
1466  libmesh_assert(elem);
1467 
1468  // Shells only have 2 faces
1469  libmesh_assert_less(shellface, 2);
1470 
1471  // Clear out any previous contents
1472  vec_to_fill.clear();
1473 
1474  // Only level-0 elements store BCs. If this is not a level-0
1475  // element get its level-0 parent and infer the BCs.
1476  const Elem * searched_elem = elem;
1477 #ifdef LIBMESH_ENABLE_AMR
1478  if (elem->level() != 0)
1479  {
1480  while (searched_elem->parent() != nullptr)
1481  {
1482  const Elem * parent = searched_elem->parent();
1483  searched_elem = parent;
1484  }
1485  }
1486 #endif
1487 
1488  // Check each element in the range to see if its shellface matches the requested shellface.
1489  for (const auto & pr : as_range(_boundary_shellface_id.equal_range(searched_elem)))
1490  if (pr.second.first == shellface)
1491  vec_to_fill.push_back(pr.second.second);
1492 }
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
libmesh_assert(ctx)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
Data structure that maps faces of shell elements to boundary ids.

◆ side_boundary_ids()

void libMesh::BoundaryInfo::side_boundary_ids ( const Elem *const  elem,
std::vector< std::vector< boundary_id_type >> &  vec_to_fill 
) const
Returns
The list of boundary ids associated with any of the sides of element elem. Indexed by sides.

Definition at line 1540 of file boundary_info.C.

References _boundary_side_id, _children_on_boundary, libMesh::as_range(), libMesh::invalid_uint, libMesh::Elem::is_child_on_side(), libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), libMesh::Elem::top_parent(), and libMesh::Elem::which_child_am_i().

Referenced by BoundaryInfoTest::testBoundaryIDs(), and BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs().

1542 {
1543  libmesh_assert(elem);
1544 
1545  // Clear out any previous contents
1546  vec_to_fill.clear();
1547  auto num_sides = elem->n_sides();
1548 
1549  // No sides, no boundary ids
1550  if (!num_sides)
1551  return;
1552 
1553  // We are going to gather boundary ids for each side
1554  vec_to_fill.resize(num_sides);
1555  // In most cases only level-0 elements store BCs.
1556  // In certain applications (such as time-dependent domains), however, children
1557  // need to store BCs too. This case is covered with the _children_on_boundary
1558  // flag.
1559  const Elem * searched_elem = elem;
1560 
1561 #ifdef LIBMESH_ENABLE_AMR
1562  if (elem->level() != 0)
1563  {
1564  // If we have children on the boundaries, we need to search for boundary IDs on the
1565  // child and its ancestors too if they share the side.
1567  {
1568  // Loop over ancestors to check if they have boundary ids on the same side
1569  std::vector<bool> search_on_side(elem->n_sides(), true);
1570  bool keep_searching = true;
1571  while (searched_elem && keep_searching)
1572  {
1573  for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
1574  {
1575  for (const auto side : make_range(elem->n_sides()))
1576  // Here we need to check if the boundary id already exists
1577  if (search_on_side[side] && pr.second.first == side &&
1578  std::find(vec_to_fill[side].begin(), vec_to_fill[side].end(), pr.second.second) ==
1579  vec_to_fill[side].end())
1580  vec_to_fill[side].push_back(pr.second.second);
1581  }
1582 
1583  const Elem * parent = searched_elem->parent();
1584  const auto child_index = parent ? parent->which_child_am_i(searched_elem) : libMesh::invalid_uint;
1585  for (const auto side : make_range(elem->n_sides()))
1586  // If the parent doesn't exist or if the child is not on the correct side of the
1587  // parent we are done checking the ancestors
1588  if (search_on_side[side] &&
1589  (!parent || parent->is_child_on_side(child_index, side) == false))
1590  search_on_side[side] = false;
1591 
1592  searched_elem = parent;
1593  // if found what we needed on all sides, exit
1594  keep_searching = *std::max_element(search_on_side.begin(), search_on_side.end());
1595  }
1596 
1597  return;
1598  }
1599 
1600  // Children not on boundaries case.
1601  // It could be that a children is interior to the parent (search_on_side = false will handle that)
1602  // However, since no children on boundaries, we know that it's either the top parent or nothing
1603  std::vector<bool> search_on_side(elem->n_sides(), true);
1604  for (const auto side : make_range(elem->n_sides()))
1605  {
1606  // Reset the search level for each side
1607  const Elem * searched_elem_for_side = elem;
1608 
1609  // If we don't have children on boundaries and we are on an external boundary,
1610  // we will just use the top parent. search_on_side[side] = true works
1611  if (elem->neighbor_ptr(side) == nullptr)
1612  continue;
1613  // Otherwise we loop over the ancestors and check if they have a different BC for us
1614  else
1615  while (searched_elem_for_side->parent() != nullptr)
1616  {
1617  const Elem * parent = searched_elem_for_side->parent();
1618  if (search_on_side[side] && parent->is_child_on_side(parent->which_child_am_i(searched_elem_for_side), side) == false)
1619  search_on_side[side] = false;
1620  searched_elem_for_side = parent;
1621  }
1622  }
1623  // Now search on the top parent, only if we need to (element is not deep inside the top parent)
1624  if (*std::max_element(search_on_side.begin(), search_on_side.end()))
1625  for (const auto & pr : as_range(_boundary_side_id.equal_range(elem->top_parent())))
1626  if (search_on_side[pr.second.first])
1627  vec_to_fill[pr.second.first].push_back(pr.second.second);
1628  return;
1629  }
1630 #endif
1631 
1632  // Check each element in the range to see if its side matches the requested side.
1633  for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
1634  vec_to_fill[pr.second.first].push_back(pr.second.second);
1635 }
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:303
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
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
libmesh_assert(ctx)
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176

◆ side_with_boundary_id()

unsigned int libMesh::BoundaryInfo::side_with_boundary_id ( const Elem *const  elem,
const boundary_id_type  boundary_id 
) const
Returns
A side of element elem whose associated boundary id is boundary_id if such a side exists, and invalid_uint otherwise.
Note
If multiple sides of elem have the same id, only the lowest numbered such side is returned.

Definition at line 2312 of file boundary_info.C.

References _boundary_side_id, _children_on_boundary, libMesh::as_range(), libMesh::invalid_uint, libMesh::Elem::is_child_on_side(), libMesh::Elem::level(), libMesh::make_range(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), libMesh::Elem::top_parent(), and libMesh::Elem::which_child_am_i().

Referenced by assemble_temperature_jump(), BoundaryInfoTest::testBoundaryOnChildrenBoundarySides(), and BoundaryInfoTest::testInternalBoundary().

2314 {
2315  const Elem * searched_elem = elem;
2316 
2317  // If we don't have a time-dependent domain, we can just go ahead and use the top parent
2318  // (since only those contain boundary conditions). Otherwise, we keep the element
2319  if (elem->level() != 0 && !_children_on_boundary)
2320  searched_elem = elem->top_parent();
2321 
2322  // elem may have zero or multiple occurrences
2323  for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
2324  {
2325  // if this is true we found the requested boundary_id
2326  // of the element and want to return the side
2327  if (pr.second.second == boundary_id_in)
2328  {
2329  unsigned int side = pr.second.first;
2330 
2331  // Here we branch out. If we don't allow time-dependent boundary domains,
2332  // we need to check if our parents are consistent.
2333  if (!_children_on_boundary)
2334  {
2335 #ifdef LIBMESH_ENABLE_AMR
2336  // If we're on this external boundary then we share this
2337  // external boundary id
2338  if (elem->neighbor_ptr(side) == nullptr)
2339  return side;
2340 
2341  // Internal boundary case
2342  const Elem * p = elem;
2343 
2344  // If we're on an internal boundary then we need to be sure
2345  // it's the same internal boundary as our top_parent
2346  while (p != nullptr)
2347  {
2348  const Elem * parent = p->parent();
2349  if (parent && !parent->is_child_on_side(parent->which_child_am_i(p), side))
2350  break;
2351  p = parent;
2352  }
2353 
2354  // We're on that side of our top_parent; return it
2355  if (!p)
2356  return side;
2357 #else
2358  // do not forget to return the internal boundary when AMR is disabled
2359  return side;
2360 #endif
2361  }
2362  // Otherwise we need to check if the child's ancestors have something on
2363  // the side of the child
2364  else
2365  return side;
2366  }
2367  }
2368 
2369 #ifdef LIBMESH_ENABLE_AMR
2370  // We might have instances (especially with moving boundary domains) when we
2371  // query the paren't boundary ID on a child. We only do this till we find the
2372  // the first side, for multiple sides see above.
2373  if (_children_on_boundary && elem->level() != 0)
2374  {
2375  for (auto side : make_range(elem->n_sides()))
2376  {
2377  const Elem * p = elem;
2378  while (p->parent() != nullptr)
2379  {
2380  const Elem * parent = p->parent();
2381 
2382  // First we make sure the parent shares this side
2383  if (parent->is_child_on_side(parent->which_child_am_i(p), side))
2384  {
2385  // parent may have multiple boundary ids
2386  for (const auto & pr : as_range(_boundary_side_id.equal_range(parent)))
2387  // if this is true we found the requested boundary_id
2388  // of the element and want to return the side
2389  if (pr.second.first == side && pr.second.second == boundary_id_in)
2390  return side;
2391 
2392  p = parent;
2393  }
2394  // If the parent is not on the same side, other ancestors won't be on the same side either
2395  else
2396  break;
2397  }
2398  }
2399  }
2400 #endif
2401 
2402  // if we get here, we found elem in the data structure but not
2403  // the requested boundary id, so return the default value
2404  return libMesh::invalid_uint;
2405 }
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:303
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
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
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176

◆ sides_with_boundary_id()

std::vector< unsigned int > libMesh::BoundaryInfo::sides_with_boundary_id ( const Elem *const  elem,
const boundary_id_type  boundary_id 
) const
Returns
All sides of element elem whose associated boundary id is boundary_id

Definition at line 2409 of file boundary_info.C.

References _boundary_side_id, _children_on_boundary, libMesh::as_range(), libMesh::Elem::is_child_on_side(), libMesh::Elem::level(), libMesh::make_range(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), libMesh::Elem::top_parent(), and libMesh::Elem::which_child_am_i().

Referenced by BoundaryInfoTest::testBoundaryOnChildrenBoundarySides().

2411 {
2412  std::vector<unsigned int> returnval;
2413 
2414  const Elem * searched_elem = elem;
2415  if (elem->level() != 0 && !_children_on_boundary)
2416  searched_elem = elem->top_parent();
2417 
2418  // elem may have zero or multiple occurrences
2419  for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
2420  {
2421  // if this is true we found the requested boundary_id
2422  // of the element and want to return the side
2423  if (pr.second.second == boundary_id_in)
2424  {
2425  unsigned int side = pr.second.first;
2426 
2427  // Here we branch out. If we don't allow time-dependent boundary domains,
2428  // we need to check if our parents are consistent.
2429  if (!_children_on_boundary)
2430  {
2431  // If we're on this external boundary then we share this
2432  // external boundary id
2433  if (elem->neighbor_ptr(side) == nullptr)
2434  {
2435  returnval.push_back(side);
2436  continue;
2437  }
2438 
2439  // If we're on an internal boundary then we need to be sure
2440  // it's the same internal boundary as our top_parent
2441  const Elem * p = elem;
2442 
2443 #ifdef LIBMESH_ENABLE_AMR
2444 
2445  while (p != nullptr)
2446  {
2447  const Elem * parent = p->parent();
2448  if (parent && !parent->is_child_on_side(parent->which_child_am_i(p), side))
2449  break;
2450  p = parent;
2451  }
2452 #endif
2453  // We're on that side of our top_parent; return it
2454  if (!p)
2455  returnval.push_back(side);
2456  }
2457  // Otherwise we trust what we got and return the side
2458  else
2459  returnval.push_back(side);
2460  }
2461  }
2462 
2463 #ifdef LIBMESH_ENABLE_AMR
2464  // We might have instances (especially with moving boundary domains) when we
2465  // query the parent boundary ID on a child.
2466  if (_children_on_boundary && elem->level() != 0)
2467  {
2468  for (auto side : make_range(elem->n_sides()))
2469  {
2470  const Elem * p = elem;
2471  while (p->parent() != nullptr)
2472  {
2473  const Elem * parent = p->parent();
2474  // First we make sure the parent shares this side
2475  if (parent->is_child_on_side(parent->which_child_am_i(p), side))
2476  {
2477  // parent may have multiple boundary ids
2478  for (const auto & pr : as_range(_boundary_side_id.equal_range(parent)))
2479  {
2480  // if this is true we found the requested boundary_id
2481  // of the element and want to add the side to the vector. We
2482  // also need to check if the side is already in the vector. This might
2483  // happen if the child inherits the boundary from the parent.
2484  if (pr.second.first == side && pr.second.second == boundary_id_in &&
2485  std::find(returnval.begin(), returnval.end(), side) == returnval.end())
2486  returnval.push_back(side);
2487  }
2488  }
2489  // If the parent is not on the same side, other ancestors won't be on the same side either
2490  else
2491  break;
2492  p = parent;
2493  }
2494  }
2495  }
2496 #endif
2497 
2498  return returnval;
2499 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
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
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176

◆ sideset_name()

std::string & libMesh::BoundaryInfo::sideset_name ( boundary_id_type  id)

◆ sync() [1/3]

void libMesh::BoundaryInfo::sync ( UnstructuredMesh boundary_mesh)

Generates boundary_mesh data structures corresponding to the mesh data structures.

Allows the boundary_mesh to be used like any other mesh, except with interior_parent() values defined for algorithms which couple boundary and interior mesh information. Any pre-existing boundary_mesh data is cleared.

Definition at line 444 of file boundary_info.C.

References _boundary_ids, _mesh, libMesh::ParallelObject::comm(), invalid_id, libMesh::MeshBase::is_serial(), and TIMPI::Communicator::set_union().

Referenced by main(), and sync().

445 {
446  std::set<boundary_id_type> request_boundary_ids(_boundary_ids);
447  request_boundary_ids.insert(invalid_id);
448  if (!_mesh->is_serial())
449  this->comm().set_union(request_boundary_ids);
450 
451  this->sync(request_boundary_ids,
452  boundary_mesh);
453 }
void sync(UnstructuredMesh &boundary_mesh)
Generates boundary_mesh data structures corresponding to the mesh data structures.
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
const Parallel::Communicator & comm() const
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
virtual bool is_serial() const
Definition: mesh_base.h:347
static const boundary_id_type invalid_id
Number used for internal use.
void set_union(T &data, const unsigned int root_id) const

◆ sync() [2/3]

void libMesh::BoundaryInfo::sync ( const std::set< boundary_id_type > &  requested_boundary_ids,
UnstructuredMesh boundary_mesh 
)

Generates boundary_mesh data structures corresponding to the mesh data structures.

Allows the boundary_mesh to be used like any other mesh, except with interior_parent() values defined for algorithms which couple boundary and interior mesh information. Any pre-existing boundary_mesh data is cleared. Only boundary elements with the specified ids are extracted. Boundary IDs for the nodes on requested_boundary_ids will also be copied over to boundary_mesh. We do not currently copy edge boundary IDs over to boundary_mesh.

Definition at line 457 of file boundary_info.C.

References libMesh::Elem::invalid_subdomain_id, and sync().

459 {
460  // Call the 3 argument version of this function with a dummy value for the third set.
461  std::set<subdomain_id_type> subdomains_relative_to;
462  subdomains_relative_to.insert(Elem::invalid_subdomain_id);
463 
464  this->sync(requested_boundary_ids,
465  boundary_mesh,
466  subdomains_relative_to);
467 }
void sync(UnstructuredMesh &boundary_mesh)
Generates boundary_mesh data structures corresponding to the mesh data structures.
static constexpr subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
Definition: elem.h:246

◆ sync() [3/3]

void libMesh::BoundaryInfo::sync ( const std::set< boundary_id_type > &  requested_boundary_ids,
UnstructuredMesh boundary_mesh,
const std::set< subdomain_id_type > &  subdomains_relative_to 
)

Like the other sync() implementations, but specifically intended for building "boundary" meshes from internal sidesets.

In the case of an internal sideset, each side may belong to 2 higher-dimensional parent elements, and typically we do not want to add the same side to the boundary mesh twice. The std::set<subdomain_id_type> passed into this function specifies which subdomain the sides in question should relative to, so that they are only added once.

Deleting 0 elements seems weird, but it's better encapsulating than exposing a set_is_serial(false) capability that might be easily misused.

If the boundary_mesh is still serial, that means we can't parallelize it, so to make sure we can construct it in full on every processor we'll serialize the interior mesh.

We'll use a temporary MeshSerializer here, but as soon as we unserialize we'll be turning a bunch of interior_parent() links into dangling pointers, and it won't be easy to tell which. So we'll keep around a distributed copy for that case, and query it to fix up interior_parent() links as necessary.

We'll also need to make sure to unserialize the mesh before we prepare the boundary mesh for use, or the prepare_for_use() call on a refined boundary mesh will happily notice that it can find and restore some refined elements' interior_parent pointers, not knowing that those interior parents are about to go remote.

Re-create the boundary mesh.

Definition at line 471 of file boundary_info.C.

References _find_id_maps(), _mesh, add_elements(), add_node(), libMesh::MeshBase::add_point(), boundary_ids(), libMesh::MeshBase::clear(), libMesh::MeshBase::clone(), libMesh::MeshBase::delete_remote_elements(), libMesh::MeshBase::get_boundary_info(), libMesh::DofObject::id(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::MeshBase::n_partitions(), libMesh::MeshBase::node_ptr(), libMesh::MeshBase::partitioner(), libMesh::MeshBase::prepare_for_use(), libMesh::remote_elem, libMesh::MeshBase::set_n_partitions(), and libMesh::Partitioner::set_node_processor_ids().

474 {
475  LOG_SCOPE("sync()", "BoundaryInfo");
476 
477  boundary_mesh.clear();
478 
484  if (!_mesh->is_serial())
485  boundary_mesh.delete_remote_elements();
486 
504  std::unique_ptr<MeshBase> mesh_copy;
505  if (boundary_mesh.is_serial() && !_mesh->is_serial())
506  mesh_copy = _mesh->clone();
507 
508  auto serializer = std::make_unique<MeshSerializer>
509  (const_cast<MeshBase &>(*_mesh), boundary_mesh.is_serial());
510 
515  boundary_mesh.set_n_partitions() = _mesh->n_partitions();
516 
517  std::map<dof_id_type, dof_id_type> node_id_map;
518 
519  this->_find_id_maps(requested_boundary_ids, 0, &node_id_map, 0, nullptr, subdomains_relative_to);
520 
521  // Let's add all the boundary nodes we found to the boundary mesh
522  for (const auto & node : _mesh->node_ptr_range())
523  {
524  dof_id_type node_id = node->id();
525  if (node_id_map.count(node_id))
526  {
527  boundary_mesh.add_point(*node, node_id_map[node_id], node->processor_id());
528 
529  // Copy over all the node's boundary IDs to boundary_mesh
530  std::vector<boundary_id_type> node_boundary_ids;
531  this->boundary_ids(node, node_boundary_ids);
532  for (const auto & node_bid : node_boundary_ids)
533  boundary_mesh.get_boundary_info().add_node(node_id_map[node_id], node_bid);
534  }
535  }
536 
537  // Add the elements. When syncing a boundary mesh, we also store the
538  // parent side ids in addition to the interior_parent pointers,
539  // since this information is frequently needed on boundary meshes.
540  this->add_elements(requested_boundary_ids,
541  boundary_mesh,
542  subdomains_relative_to,
543  /*store_parent_side_ids=*/true);
544 
545  // The new elements are currently using the interior mesh's nodes;
546  // we want them to use the boundary mesh's nodes instead.
547 
548  // This side's Node pointers still point to the nodes of the original mesh.
549  // We need to re-point them to the boundary mesh's nodes! Since we copied *ALL* of
550  // the original mesh's nodes over, we should be guaranteed to have the same ordering.
551  for (auto & new_elem : boundary_mesh.element_ptr_range())
552  {
553  for (auto nn : new_elem->node_index_range())
554  {
555  // Get the correct node pointer, based on the id()
556  Node * new_node =
557  boundary_mesh.node_ptr(node_id_map[new_elem->node_id(nn)]);
558 
559  // sanity check: be sure that the new Node exists and its
560  // global id really matches
561  libmesh_assert (new_node);
562  libmesh_assert_equal_to (new_node->id(),
563  node_id_map[new_elem->node_id(nn)]);
564 
565  // Assign the new node pointer
566  new_elem->set_node(nn, new_node);
567  }
568  }
569 
570  // The new elements might have interior parent pointers aimed at
571  // _mesh elements which are about to go remote, and we don't to
572  // leave those pointers dangling. Fix them up if needed.
573  if (mesh_copy.get())
574  {
575  for (auto & new_elem : boundary_mesh.element_ptr_range())
576  {
577  const dof_id_type interior_parent_id =
578  new_elem->interior_parent()->id();
579 
580  if (!mesh_copy->query_elem_ptr(interior_parent_id))
581  new_elem->set_interior_parent
582  (const_cast<RemoteElem *>(remote_elem));
583  }
584  }
585 
586  // Don't repartition this mesh; we want it to stay in sync with the
587  // interior partitioning.
588  boundary_mesh.partitioner().reset(nullptr);
589 
590  // Deserialize the interior mesh before the boundary mesh
591  // prepare_for_use() can come to erroneous conclusions about which
592  // of its elements are semilocal
593  serializer.reset();
594 
595  // Make boundary_mesh nodes and elements contiguous
596  boundary_mesh.prepare_for_use();
597 
598  // and finally distribute element partitioning to the nodes
600 }
void add_elements(const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh, bool store_parent_side_ids=false)
Generates elements along the boundary of our _mesh, which use pre-existing nodes on the boundary_mesh...
static void set_node_processor_ids(MeshBase &mesh)
This function is called after partitioning to set the processor IDs for the nodes.
Definition: partitioner.C:852
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
virtual std::unique_ptr< MeshBase > clone() const =0
Virtual "copy constructor".
virtual bool is_serial() const
Definition: mesh_base.h:347
libmesh_assert(ctx)
unsigned int n_partitions() const
Definition: mesh_base.h:1516
void _find_id_maps(const std::set< boundary_id_type > &requested_boundary_ids, dof_id_type first_free_node_id, std::map< dof_id_type, dof_id_type > *node_id_map, dof_id_type first_free_elem_id, std::map< std::pair< dof_id_type, unsigned char >, dof_id_type > *side_id_map, const std::set< subdomain_id_type > &subdomains_relative_to)
Helper method for finding consistent maps of interior to boundary dof_object ids. ...
uint8_t dof_id_type
Definition: id_types.h:67
friend class MeshBase
Definition: boundary_info.h:60
const RemoteElem * remote_elem
Definition: remote_elem.C:57

◆ synchronize_global_id_set()

void libMesh::BoundaryInfo::synchronize_global_id_set ( )

Synchronizes the boundary_ids set on each processor to determine global_boundary_ids.

This may be necessary after use of renumber_*() functions, which perform only local operations, if get_global_boundary_ids() is to be used without a full regenerate_id_sets() call first.

Definition at line 431 of file boundary_info.C.

References _boundary_ids, libMesh::ParallelObject::_communicator, _global_boundary_ids, _mesh, libMesh::MeshBase::_preparation, libMesh::MeshBase::Preparation::has_boundary_id_sets, libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), and TIMPI::Communicator::set_union().

Referenced by regenerate_id_sets(), and BoundaryInfoTest::testSelectiveRenumber().

432 {
433  // Handle global data
436  if (!_mesh->is_serial())
438 
440 }
std::set< boundary_id_type > _boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
const Parallel::Communicator & _communicator
MeshBase * _mesh
A pointer to the Mesh this boundary info pertains to.
std::set< boundary_id_type > _global_boundary_ids
A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.
virtual bool is_serial() const
Definition: mesh_base.h:347
libmesh_assert(ctx)
Preparation _preparation
Flags indicating in what ways this mesh has been prepared.
Definition: mesh_base.h:2162
void set_union(T &data, const unsigned int root_id) const

◆ transfer_boundary_ids_from_children()

void libMesh::BoundaryInfo::transfer_boundary_ids_from_children ( const Elem *const  parent)

Update parent's boundary id list so that this information is consistent with its children.

This is useful when _children_on_boundary = true, and is used when the element is about to get coarsened i.e., in MeshRefinement::_coarsen_elements()

Specifically, when we coarsen an element whose children have different boundary ids. In such scenarios, the parent will inherit the children's boundaries if at least 50% them own a boundary while sharing the side of the parent.

Definition at line 2545 of file boundary_info.C.

References _boundary_side_id, _children_on_boundary, libMesh::Elem::active(), add_side(), libMesh::as_range(), libMesh::Elem::child_ptr(), libMesh::Elem::COARSEN_INACTIVE, libMesh::Elem::dim(), libMesh::Elem::is_child_on_side(), libMesh::make_range(), libMesh::Elem::n_children(), libMesh::Elem::n_sides(), libMesh::Utility::pow(), and libMesh::Elem::refinement_flag().

Referenced by libMesh::MeshRefinement::_coarsen_elements().

2546 {
2547  // this is only needed when we allow boundary to be associated with children elements
2548  // also, we only transfer the parent's boundary ids when we are actually coarsen the child element
2549  if (!_children_on_boundary ||
2550  !(!parent->active() && parent->refinement_flag() == Elem::COARSEN_INACTIVE))
2551  return;
2552 
2553  // We assume that edges can be divided ito two pieces, while triangles and
2554  // quads can be divided into four smaller areas. This is double because we'll need
2555  // to convert the ratio of the children with given boundary id to a double.
2556  const double number_of_sides_on_children = std::pow(2, parent->dim()-1);
2557 
2558  // In this case the input argument elem is the parent element. We need to check all of its sides
2559  // to grab any potential boundary ids.
2560  for (unsigned int side_i = 0; side_i < parent->n_sides(); ++side_i)
2561  {
2562  // An temporary storage to count how many times the children's boundaries occur. the general
2563  // consensus is that if the boundary occurs more than once we propagate upon coarsening. Otherwise,
2564  // it will get deleted.
2565  std::map<unsigned short int, unsigned short int> boundary_counts;
2566 
2567  for (const auto & child_i : make_range(parent->n_children()))
2568  {
2569  // We only need to check the children which share the side
2570  if (parent->is_child_on_side(child_i, side_i))
2571  {
2572  // Fetching the boundary tags on the child's side
2573  for (const auto & pr : as_range(_boundary_side_id.equal_range(parent->child_ptr(child_i))))
2574  {
2575  // Making sure we are on the same boundary
2576  if (pr.second.first == side_i)
2577  ++boundary_counts[pr.second.second];
2578  }
2579  }
2580  }
2581 
2582  // This is where the decision is made. If 50% of the children have the tags,
2583  // we propagate them upwards upon coarsening. Otherwise, they are deleted.
2584  for (const auto & boundary : boundary_counts)
2585  if (boundary.second / number_of_sides_on_children > 0.5)
2586  this->add_side(parent, side_i, boundary.first);
2587  }
2588 
2589  for (const auto & child_i : make_range(parent->n_children()))
2590  this->remove(parent->child_ptr(child_i));
2591 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
Data structure that maps sides of elements to boundary ids.
T pow(const T &x)
Definition: utility.h:296
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
Definition: simple_range.h:57
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
Add side side of element number elem with boundary id id to the boundary information data structure...
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176

Friends And Related Function Documentation

◆ MeshBase

friend class MeshBase
friend

Definition at line 60 of file boundary_info.h.

Member Data Documentation

◆ _boundary_edge_id

std::multimap<const Elem *, std::pair<unsigned short int, boundary_id_type> > libMesh::BoundaryInfo::_boundary_edge_id
private

◆ _boundary_ids

std::set<boundary_id_type> libMesh::BoundaryInfo::_boundary_ids
private

A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.

See _side_boundary_ids, _edge_boundary_ids, _node_boundary_ids, and _shellface_boundary_ids for sets containing IDs for only sides, edges, nodes, and shell faces, respectively.

This only contains information related to this process's local and ghosted elements

Definition at line 1018 of file boundary_info.h.

Referenced by add_edge(), add_node(), add_shellface(), add_side(), clear(), get_boundary_ids(), n_boundary_ids(), operator=(), operator==(), regenerate_id_sets(), remove_edge_id(), remove_node_id(), remove_shellface_id(), remove_side_id(), renumber_edge_id(), renumber_id(), renumber_node_id(), renumber_shellface_id(), renumber_side_id(), sync(), and synchronize_global_id_set().

◆ _boundary_node_id

std::multimap<const Node *, boundary_id_type> libMesh::BoundaryInfo::_boundary_node_id
private

◆ _boundary_shellface_id

std::multimap<const Elem *, std::pair<unsigned short int, boundary_id_type> > libMesh::BoundaryInfo::_boundary_shellface_id
private

◆ _boundary_side_id

std::multimap<const Elem *, std::pair<unsigned short int, boundary_id_type> > libMesh::BoundaryInfo::_boundary_side_id
private

◆ _children_on_boundary

bool libMesh::BoundaryInfo::_children_on_boundary
private

◆ _communicator

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

◆ _edge_boundary_ids

std::set<boundary_id_type> libMesh::BoundaryInfo::_edge_boundary_ids
private

Set of user-specified boundary IDs for edges only.

This is only relevant in 3D.

Note
_boundary_ids is the union of this set, _side_boundary_ids, _node_boundary_ids, and _shellface_boundary_ids.

This only contains information related to this process's local and ghosted elements

Definition at line 1052 of file boundary_info.h.

Referenced by add_edge(), clear(), get_edge_boundary_ids(), operator=(), operator==(), regenerate_id_sets(), remove_edge_id(), remove_node_id(), remove_shellface_id(), remove_side_id(), renumber_edge_id(), renumber_id(), renumber_node_id(), renumber_shellface_id(), and renumber_side_id().

◆ _es_id_to_name

std::map<boundary_id_type, std::string> libMesh::BoundaryInfo::_es_id_to_name
private

This structure maintains the mapping of named edge sets for file formats (Exodus, Gmsh) that support this.

This data is global in nature, meaning it should be an aggregate of information across processors

Definition at line 1102 of file boundary_info.h.

Referenced by clear(), edgeset_name(), get_edgeset_name(), get_edgeset_name_map(), get_id_by_name(), operator=(), operator==(), regenerate_id_sets(), remove_edge_id(), renumber_edge_id(), renumber_id(), and set_edgeset_name_map().

◆ _global_boundary_ids

std::set<boundary_id_type> libMesh::BoundaryInfo::_global_boundary_ids
private

A collection of user-specified boundary ids for sides, edges, nodes, and shell faces.

See _side_boundary_ids, _edge_boundary_ids, _node_boundary_ids, and _shellface_boundary_ids for sets containing IDs for only sides, edges, nodes, and shell faces, respectively.

Unlike _boundary_ids, this member should contain boundary ids from across all processors after the mesh is prepared

Definition at line 1030 of file boundary_info.h.

Referenced by get_global_boundary_ids(), operator=(), operator==(), remove_edge_id(), remove_id(), remove_node_id(), remove_shellface_id(), remove_side_id(), and synchronize_global_id_set().

◆ _mesh

MeshBase* libMesh::BoundaryInfo::_mesh
private

◆ _node_boundary_ids

std::set<boundary_id_type> libMesh::BoundaryInfo::_node_boundary_ids
private

Set of user-specified boundary IDs for nodes only.

Note
_boundary_ids is the union of this set, _edge_boundary_ids, _side_boundary_ids, and _shellface_boundary_ids.

This only contains information related to this process's local and ghosted elements

Definition at line 1063 of file boundary_info.h.

Referenced by add_node(), clear(), get_node_boundary_ids(), operator=(), operator==(), regenerate_id_sets(), remove_edge_id(), remove_node_id(), remove_shellface_id(), remove_side_id(), renumber_edge_id(), renumber_id(), renumber_node_id(), renumber_shellface_id(), and renumber_side_id().

◆ _ns_id_to_name

std::map<boundary_id_type, std::string> libMesh::BoundaryInfo::_ns_id_to_name
private

This structure maintains the mapping of named node sets for file formats (Exodus, Gmsh) that support this.

This data is global in nature, meaning it should be an aggregate of information across processors

Definition at line 1093 of file boundary_info.h.

Referenced by clear(), get_id_by_name(), get_nodeset_name(), get_nodeset_name_map(), nodeset_name(), operator=(), operator==(), regenerate_id_sets(), remove_node_id(), renumber_id(), renumber_node_id(), and set_nodeset_name_map().

◆ _shellface_boundary_ids

std::set<boundary_id_type> libMesh::BoundaryInfo::_shellface_boundary_ids
private

Set of user-specified boundary IDs for shellfaces only.

This is only relevant for shell elements.

Note
_boundary_ids is the union of this set, _side_boundary_ids, _edge_boundary_ids, and _node_boundary_ids.

This only contains information related to this process's local and ghosted elements

Definition at line 1075 of file boundary_info.h.

Referenced by add_shellface(), clear(), get_shellface_boundary_ids(), operator=(), operator==(), regenerate_id_sets(), remove_edge_id(), remove_node_id(), remove_shellface_id(), remove_side_id(), renumber_edge_id(), renumber_id(), renumber_node_id(), renumber_shellface_id(), and renumber_side_id().

◆ _side_boundary_ids

std::set<boundary_id_type> libMesh::BoundaryInfo::_side_boundary_ids
private

Set of user-specified boundary IDs for sides only.

Note
_boundary_ids is the union of this set, _edge_boundary_ids, _node_boundary_ids, and _shellface_boundary_ids.

This only contains information related to this process's local and ghosted elements

Definition at line 1041 of file boundary_info.h.

Referenced by add_side(), clear(), get_side_boundary_ids(), operator=(), operator==(), regenerate_id_sets(), remove_edge_id(), remove_node_id(), remove_shellface_id(), remove_side_id(), renumber_edge_id(), renumber_id(), renumber_node_id(), renumber_shellface_id(), and renumber_side_id().

◆ _ss_id_to_name

std::map<boundary_id_type, std::string> libMesh::BoundaryInfo::_ss_id_to_name
private

This structure maintains the mapping of named side sets for file formats (Exodus, Gmsh) that support this.

This data is global in nature, meaning it should be an aggregate of information across processors

Definition at line 1084 of file boundary_info.h.

Referenced by clear(), get_id_by_name(), get_sideset_name(), get_sideset_name_map(), operator=(), operator==(), regenerate_id_sets(), remove_side_id(), renumber_id(), renumber_side_id(), set_sideset_name_map(), and sideset_name().

◆ invalid_id

const boundary_id_type libMesh::BoundaryInfo::invalid_id = -123
static

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