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
 As above, but the library creates and fills in a vector of (node-id, bc-id) pairs and returns it to the user, taking advantage of guaranteed RVO. More...
 
typedef std::tuple< dof_id_type, unsigned short int, boundary_id_typeBCTuple
 As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and returns it to the user, taking advantage of guaranteed RVO. 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 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 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...
 
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 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
 
void build_node_list (std::vector< dof_id_type > &node_id_list, std::vector< boundary_id_type > &bc_id_list) const
 Creates a list of nodes and ids for those nodes. More...
 
std::vector< NodeBCTuplebuild_node_list (NodeBCTupleSortBy sort_by=NodeBCTupleSortBy::NODE_ID) const
 
void build_node_list_from_side_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 ()
 Adds sides to a sideset if every node on that side are in the same sideset. More...
 
void build_side_list (std::vector< dof_id_type > &element_id_list, std::vector< unsigned short int > &side_list, std::vector< boundary_id_type > &bc_id_list) const
 Creates a list of element numbers, sides, and ids for those sides. More...
 
std::vector< BCTuplebuild_side_list (BCTupleSortBy sort_by=BCTupleSortBy::ELEM_ID) const
 
void build_active_side_list (std::vector< dof_id_type > &element_id_list, std::vector< unsigned short int > &side_list, std::vector< boundary_id_type > &bc_id_list) const
 Creates a list of active element numbers, sides, and ids for those sides. More...
 
std::vector< BCTuplebuild_active_side_list () const
 As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and returns it to the user, taking advantage of guaranteed RVO. More...
 
void build_edge_list (std::vector< dof_id_type > &element_id_list, std::vector< unsigned short int > &edge_list, std::vector< boundary_id_type > &bc_id_list) const
 Creates a list of element numbers, edges, and boundary ids for those edges. More...
 
std::vector< BCTuplebuild_edge_list () const
 As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and returns it to the user, taking advantage of guaranteed RVO. More...
 
void build_shellface_list (std::vector< dof_id_type > &element_id_list, std::vector< unsigned short int > &shellface_list, std::vector< boundary_id_type > &bc_id_list) const
 Creates a list of element numbers, shellfaces, and boundary ids for those shellfaces. More...
 
std::vector< BCTuplebuild_shellface_list () const
 As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and returns it to the user, taking advantage of guaranteed RVO. 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

As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and returns it to the user, taking advantage of guaranteed RVO.

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 686 of file boundary_info.h.

◆ NodeBCTuple

As above, but the library creates and fills in a vector of (node-id, bc-id) pairs and returns it to the user, taking advantage of guaranteed RVO.

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 643 of file boundary_info.h.

Member Enumeration Documentation

◆ BCTupleSortBy

Enumerator
ELEM_ID 
SIDE_ID 
BOUNDARY_ID 
UNSORTED 

Definition at line 687 of file boundary_info.h.

687 {ELEM_ID, SIDE_ID, BOUNDARY_ID, UNSORTED};

◆ NodeBCTupleSortBy

Enumerator
NODE_ID 
BOUNDARY_ID 
UNSORTED 

Definition at line 644 of file boundary_info.h.

644 {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 102 of file boundary_info.C.

102  :
103  ParallelObject(m.comm()),
104  _mesh (&m),
105  _children_on_boundary(false)
106 {
107 }
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 3098 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::libmesh_assert(), 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().

3104 {
3105  // We'll do the same modulus trick that DistributedMesh uses to avoid
3106  // id conflicts between different processors
3107  dof_id_type
3108  next_node_id = first_free_node_id + this->processor_id(),
3109  next_elem_id = first_free_elem_id + this->processor_id();
3110 
3111  // For avoiding extraneous element side construction
3112  ElemSideBuilder side_builder;
3113  // Pull objects out of the loop to reduce heap operations
3114  const Elem * side;
3115 
3116  // We'll pass through the mesh once first to build
3117  // the maps and count boundary nodes and elements.
3118  // To find local boundary nodes, we have to examine all elements
3119  // here rather than just local elements, because it's possible to
3120  // have a local boundary node that's not on a local boundary
3121  // element, e.g. at the tip of a triangle.
3122 
3123  // We'll loop through two different ranges here: first all elements,
3124  // looking for local nodes, and second through unpartitioned
3125  // elements, looking for all remaining nodes.
3126  const MeshBase::const_element_iterator end_el = _mesh->elements_end();
3127  bool hit_end_el = false;
3128  const MeshBase::const_element_iterator end_unpartitioned_el =
3129  _mesh->pid_elements_end(DofObject::invalid_processor_id);
3130 
3131  for (MeshBase::const_element_iterator el = _mesh->elements_begin();
3132  !hit_end_el || (el != end_unpartitioned_el); ++el)
3133  {
3134  if ((el == end_el) && !hit_end_el)
3135  {
3136  // Note that we're done with local nodes and just looking
3137  // for remaining unpartitioned nodes
3138  hit_end_el = true;
3139 
3140  // Join up the local results from other processors
3141  if (side_id_map)
3142  this->comm().set_union(*side_id_map);
3143  if (node_id_map)
3144  this->comm().set_union(*node_id_map);
3145 
3146  // Finally we'll pass through any unpartitioned elements to add them
3147  // to the maps and counts.
3148  next_node_id = first_free_node_id + this->n_processors();
3149  next_elem_id = first_free_elem_id + this->n_processors();
3150 
3151  el = _mesh->pid_elements_begin(DofObject::invalid_processor_id);
3152  if (el == end_unpartitioned_el)
3153  break;
3154  }
3155 
3156  const Elem * elem = *el;
3157 
3158  // If the subdomains_relative_to container has the
3159  // invalid_subdomain_id, we fall back on the "old" behavior of
3160  // adding sides regardless of this Elem's subdomain. Otherwise,
3161  // if the subdomains_relative_to container doesn't contain the
3162  // current Elem's subdomain_id(), we won't add any sides from
3163  // it.
3164  if (!subdomains_relative_to.count(Elem::invalid_subdomain_id) &&
3165  !subdomains_relative_to.count(elem->subdomain_id()))
3166  continue;
3167 
3168  for (auto s : elem->side_index_range())
3169  {
3170  bool add_this_side = false;
3171 
3172  // Find all the boundary side ids for this Elem side.
3173  std::vector<boundary_id_type> bcids;
3174  this->boundary_ids(elem, s, bcids);
3175 
3176  for (const boundary_id_type bcid : bcids)
3177  {
3178  // if the user wants this id, we want this side
3179  if (requested_boundary_ids.count(bcid))
3180  {
3181  add_this_side = true;
3182  break;
3183  }
3184  }
3185 
3186  // We may still want to add this side if the user called
3187  // sync() with no requested_boundary_ids. This corresponds
3188  // to the "old" style of calling sync() in which the entire
3189  // boundary was copied to the BoundaryMesh, and handles the
3190  // case where elements on the geometric boundary are not in
3191  // any sidesets.
3192  if (requested_boundary_ids.count(invalid_id) &&
3193  elem->neighbor_ptr(s) == nullptr)
3194  add_this_side = true;
3195 
3196  if (add_this_side)
3197  {
3198  // We only assign ids for our own and for
3199  // unpartitioned elements
3200  if (side_id_map &&
3201  ((elem->processor_id() == this->processor_id()) ||
3202  (elem->processor_id() ==
3204  {
3205  std::pair<dof_id_type, unsigned char> side_pair(elem->id(), s);
3206  libmesh_assert (!side_id_map->count(side_pair));
3207  (*side_id_map)[side_pair] = next_elem_id;
3208  next_elem_id += this->n_processors() + 1;
3209  }
3210 
3211  side = &side_builder(*elem, s);
3212  for (auto n : side->node_index_range())
3213  {
3214  const Node & node = side->node_ref(n);
3215 
3216  // In parallel we don't know enough to number
3217  // others' nodes ourselves.
3218  if (!hit_end_el &&
3219  (node.processor_id() != this->processor_id()))
3220  continue;
3221 
3222  dof_id_type node_id = node.id();
3223  if (node_id_map && !node_id_map->count(node_id))
3224  {
3225  (*node_id_map)[node_id] = next_node_id;
3226  next_node_id += this->n_processors() + 1;
3227  }
3228  }
3229  }
3230  }
3231  }
3232 
3233  // FIXME: ought to renumber side/node_id_map image to be contiguous
3234  // to save memory, also ought to reserve memory
3235 }
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
static const subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
Definition: elem.h:251
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
Number used for internal use.
static const processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:493
libmesh_assert(ctx)
processor_id_type processor_id() const
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 1010 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(), and WriteEdgesetData::testWriteImpl().

1013 {
1014  this->add_edge (_mesh->elem_ptr(e), edge, id);
1015 }
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 1019 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().

1022 {
1023  libmesh_assert(elem);
1024 
1025  // Only add BCs for level-0 elements.
1026  libmesh_assert_equal_to (elem->level(), 0);
1027 
1028  // Only add BCs for edges that exist.
1029  libmesh_assert_less (edge, elem->n_edges());
1030 
1031  libmesh_error_msg_if(id == invalid_id,
1032  "ERROR: You may not set a boundary ID of "
1033  << invalid_id
1034  << "\n That is reserved for internal use.");
1035 
1036  // Don't add the same ID twice
1037  for (const auto & pr : as_range(_boundary_edge_id.equal_range(elem)))
1038  if (pr.second.first == edge &&
1039  pr.second.second == id)
1040  return;
1041 
1042  _boundary_edge_id.emplace(elem, std::make_pair(edge, id));
1043  _boundary_ids.insert(id);
1044  _edge_boundary_ids.insert(id); // Also add this ID to the set of edge boundary IDs
1045 }
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 1049 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().

1052 {
1053  if (ids.empty())
1054  return;
1055 
1056  libmesh_assert(elem);
1057 
1058  // Only add BCs for level-0 elements.
1059  libmesh_assert_equal_to (elem->level(), 0);
1060 
1061  // Only add BCs for edges that exist.
1062  libmesh_assert_less (edge, elem->n_edges());
1063 
1064  // Don't add the same ID twice
1065  auto bounds = _boundary_edge_id.equal_range(elem);
1066 
1067  // The entries in the ids vector may be non-unique. If we expected
1068  // *lots* of ids, it might be fastest to construct a std::set from
1069  // the entries, but for a small number of entries, which is more
1070  // typical, it is probably faster to copy the vector and do sort+unique.
1071  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
1072  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
1073  std::sort(unique_ids.begin(), unique_ids.end());
1074  std::vector<boundary_id_type>::iterator new_end =
1075  std::unique(unique_ids.begin(), unique_ids.end());
1076 
1077  for (auto & id : as_range(unique_ids.begin(), new_end))
1078  {
1079  libmesh_error_msg_if(id == invalid_id,
1080  "ERROR: You may not set a boundary ID of "
1081  << invalid_id
1082  << "\n That is reserved for internal use.");
1083 
1084  bool already_inserted = false;
1085  for (const auto & pr : as_range(bounds))
1086  if (pr.second.first == edge &&
1087  pr.second.second == id)
1088  {
1089  already_inserted = true;
1090  break;
1091  }
1092  if (already_inserted)
1093  continue;
1094 
1095  _boundary_edge_id.emplace(elem, std::make_pair(edge, id));
1096  _boundary_ids.insert(id);
1097  _edge_boundary_ids.insert(id); // Also add this ID to the set of edge boundary IDs
1098  }
1099 }
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 640 of file boundary_info.C.

References libMesh::Elem::invalid_subdomain_id.

Referenced by main(), and sync().

643 {
644  // Call the 3 argument version of this function with a dummy value for the third arg.
645  std::set<subdomain_id_type> subdomains_relative_to;
646  subdomains_relative_to.insert(Elem::invalid_subdomain_id);
647 
648  this->add_elements(requested_boundary_ids,
649  boundary_mesh,
650  subdomains_relative_to,
651  store_parent_side_ids);
652 }
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 const subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
Definition: elem.h:251

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

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

941 {
942  libmesh_error_msg_if(id == invalid_id,
943  "ERROR: You may not set a boundary ID of "
944  << invalid_id
945  << "\n That is reserved for internal use.");
946 
947  // Don't add the same ID twice
948  for (const auto & pr : as_range(_boundary_node_id.equal_range(node)))
949  if (pr.second == id)
950  return;
951 
952  _boundary_node_id.emplace(node, id);
953  _boundary_ids.insert(id);
954  _node_boundary_ids.insert(id); // Also add this ID to the set of node boundary IDs
955 }
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 922 of file boundary_info.C.

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

924 {
925  const Node * node_ptr = _mesh->query_node_ptr(node_id);
926 
927  // The user could easily ask for an invalid node id, so let's throw
928  // an easy-to-understand error message when this happens.
929  libmesh_error_msg_if(!node_ptr,
930  "BoundaryInfo::add_node(): Could not retrieve pointer for node "
931  << node_id
932  << ", no boundary id was added.");
933 
934  this->add_node (node_ptr, id);
935 }
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 959 of file boundary_info.C.

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

961 {
962  if (ids.empty())
963  return;
964 
965  libmesh_assert(node);
966 
967  // Don't add the same ID twice
968  auto bounds = _boundary_node_id.equal_range(node);
969 
970  // The entries in the ids vector may be non-unique. If we expected
971  // *lots* of ids, it might be fastest to construct a std::set from
972  // the entries, but for a small number of entries, which is more
973  // typical, it is probably faster to copy the vector and do sort+unique.
974  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
975  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
976  std::sort(unique_ids.begin(), unique_ids.end());
977  std::vector<boundary_id_type>::iterator new_end =
978  std::unique(unique_ids.begin(), unique_ids.end());
979 
980  for (auto & id : as_range(unique_ids.begin(), new_end))
981  {
982  libmesh_error_msg_if(id == invalid_id,
983  "ERROR: You may not set a boundary ID of "
984  << invalid_id
985  << "\n That is reserved for internal use.");
986 
987  bool already_inserted = false;
988  for (const auto & pr : as_range(bounds))
989  if (pr.second == id)
990  {
991  already_inserted = true;
992  break;
993  }
994  if (already_inserted)
995  continue;
996 
997  _boundary_node_id.emplace(node, id);
998  _boundary_ids.insert(id);
999  _node_boundary_ids.insert(id); // Also add this ID to the set of node boundary IDs
1000  }
1001 }
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 1103 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().

1106 {
1107  this->add_shellface (_mesh->elem_ptr(e), shellface, id);
1108 }
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 1112 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().

1115 {
1116  libmesh_assert(elem);
1117 
1118  // Only add BCs for level-0 elements.
1119  libmesh_assert_equal_to (elem->level(), 0);
1120 
1121  // Shells only have 2 faces
1122  libmesh_assert_less(shellface, 2);
1123 
1124  libmesh_error_msg_if(id == invalid_id,
1125  "ERROR: You may not set a boundary ID of "
1126  << invalid_id
1127  << "\n That is reserved for internal use.");
1128 
1129  // Don't add the same ID twice
1130  for (const auto & pr : as_range(_boundary_shellface_id.equal_range(elem)))
1131  if (pr.second.first == shellface &&
1132  pr.second.second == id)
1133  return;
1134 
1135  _boundary_shellface_id.emplace(elem, std::make_pair(shellface, id));
1136  _boundary_ids.insert(id);
1137  _shellface_boundary_ids.insert(id); // Also add this ID to the set of shellface boundary IDs
1138 }
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 1142 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().

1145 {
1146  if (ids.empty())
1147  return;
1148 
1149  libmesh_assert(elem);
1150 
1151  // Only add BCs for level-0 elements.
1152  libmesh_assert_equal_to (elem->level(), 0);
1153 
1154  // Shells only have 2 faces
1155  libmesh_assert_less(shellface, 2);
1156 
1157  // Don't add the same ID twice
1158  auto bounds = _boundary_shellface_id.equal_range(elem);
1159 
1160  // The entries in the ids vector may be non-unique. If we expected
1161  // *lots* of ids, it might be fastest to construct a std::set from
1162  // the entries, but for a small number of entries, which is more
1163  // typical, it is probably faster to copy the vector and do sort+unique.
1164  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
1165  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
1166  std::sort(unique_ids.begin(), unique_ids.end());
1167  std::vector<boundary_id_type>::iterator new_end =
1168  std::unique(unique_ids.begin(), unique_ids.end());
1169 
1170  for (auto & id : as_range(unique_ids.begin(), new_end))
1171  {
1172  libmesh_error_msg_if(id == invalid_id,
1173  "ERROR: You may not set a boundary ID of "
1174  << invalid_id
1175  << "\n That is reserved for internal use.");
1176 
1177  bool already_inserted = false;
1178  for (const auto & pr : as_range(bounds))
1179  if (pr.second.first == shellface &&
1180  pr.second.second == id)
1181  {
1182  already_inserted = true;
1183  break;
1184  }
1185  if (already_inserted)
1186  continue;
1187 
1188  _boundary_shellface_id.emplace(elem, std::make_pair(shellface, id));
1189  _boundary_ids.insert(id);
1190  _shellface_boundary_ids.insert(id); // Also add this ID to the set of shellface boundary IDs
1191  }
1192 }
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 1195 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(), BoundaryMesh0DTest::build_mesh(), BoundaryMeshTest::build_mesh(), build_side_list_from_node_list(), 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(), BoundaryInfoTest::testBoundaryOnChildrenBoundaryIDs(), BoundaryInfoTest::testBoundaryOnChildrenBoundarySides(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), PeriodicBCTest::testPeriodicBC(), transfer_boundary_ids_from_children(), and libMesh::Poly2TriTriangulator::triangulate_current_points().

1198 {
1199  this->add_side (_mesh->elem_ptr(e), side, id);
1200 }
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 1204 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().

1207 {
1208  libmesh_assert(elem);
1209 
1210  // Only add BCs for sides that exist.
1211  libmesh_assert_less (side, elem->n_sides());
1212 
1213  libmesh_error_msg_if(id == invalid_id, "ERROR: You may not set a boundary ID of "
1214  << invalid_id
1215  << "\n That is reserved for internal use.");
1216 
1217  // Don't add the same ID twice
1218  for (const auto & pr : as_range(_boundary_side_id.equal_range(elem)))
1219  if (pr.second.first == side &&
1220  pr.second.second == id)
1221  return;
1222 
1223 #ifdef LIBMESH_ENABLE_AMR
1224  // Users try to mark boundary on child elements
1225  // If this happens, we will allow users to remove
1226  // side from child elements as well
1227  if (elem->level())
1228  {
1229  _children_on_boundary = true;
1230 
1231  // Here we have to stop and check if we already have this boundary defined on the
1232  // parent (if yes, no need to add)
1233  std::vector<boundary_id_type> bd_ids;
1234  this->boundary_ids(elem,side,bd_ids);
1235 
1236  if(std::find(bd_ids.begin(), bd_ids.end(), id) != bd_ids.end())
1237  libmesh_not_implemented_msg("Trying to add boundary ID "
1238  + std::to_string(id)
1239  + " which already exists on the ancestors.");
1240  }
1241 #endif
1242 
1243  _boundary_side_id.emplace(elem, std::make_pair(side, id));
1244  _boundary_ids.insert(id);
1245  _side_boundary_ids.insert(id); // Also add this ID to the set of side boundary IDs
1246 }
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 1250 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().

1253 {
1254  if (ids.empty())
1255  return;
1256 
1257  libmesh_assert(elem);
1258 
1259  // Only add BCs for sides that exist.
1260  libmesh_assert_less (side, elem->n_sides());
1261 
1262 #ifdef LIBMESH_ENABLE_AMR
1263  // Users try to mark boundary on child elements
1264  // If this happens, we will allow users to remove
1265  // side from child elements as well
1266  if (elem->level())
1267  {
1268  _children_on_boundary = true;
1269 
1270  // Here we have to stop and check if we already have this boundary defined on the
1271  // parent (if yes, no need to add)
1272  std::vector<boundary_id_type> bd_ids;
1273  this->boundary_ids(elem,side,bd_ids);
1274 
1275  for (const auto id : ids)
1276  if(std::find(bd_ids.begin(), bd_ids.end(), id) != bd_ids.end())
1277  libmesh_not_implemented_msg("Trying to add boundary ID "
1278  + std::to_string(id)
1279  + " which already exists on the ancestors.");
1280  }
1281 #endif
1282 
1283  // Don't add the same ID twice
1284  auto bounds = _boundary_side_id.equal_range(elem);
1285 
1286  // The entries in the ids vector may be non-unique. If we expected
1287  // *lots* of ids, it might be fastest to construct a std::set from
1288  // the entries, but for a small number of entries, which is more
1289  // typical, it is probably faster to copy the vector and do sort+unique.
1290  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
1291  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
1292  std::sort(unique_ids.begin(), unique_ids.end());
1293  std::vector<boundary_id_type>::iterator new_end =
1294  std::unique(unique_ids.begin(), unique_ids.end());
1295 
1296  for (auto & id : as_range(unique_ids.begin(), new_end))
1297  {
1298  libmesh_error_msg_if(id == invalid_id,
1299  "ERROR: You may not set a boundary ID of "
1300  << invalid_id
1301  << "\n That is reserved for internal use.");
1302 
1303  bool already_inserted = false;
1304  for (const auto & pr : as_range(bounds))
1305  if (pr.second.first == side && pr.second.second == id)
1306  {
1307  already_inserted = true;
1308  break;
1309  }
1310  if (already_inserted)
1311  continue;
1312 
1313  _boundary_side_id.emplace(elem, std::make_pair(side, id));
1314  _boundary_ids.insert(id);
1315  _side_boundary_ids.insert(id); // Also add this ID to the set of side boundary IDs
1316  }
1317 }
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 923 of file boundary_info.h.

References _children_on_boundary.

Referenced by BoundaryInfoTest::testBoundaryOnChildrenErrors().

924  { _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 1333 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::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::testBoundaryOnChildrenBoundaryIDs(), SystemsTest::testBoundaryProjectCube(), MeshInputTest::testExodusIGASidesets(), libMesh::XdrIO::write_serialized_bcs_helper(), and libMesh::XdrIO::write_serialized_nodesets().

1335 {
1336  // Clear out any previous contents
1337  vec_to_fill.clear();
1338 
1339  for (const auto & pr : as_range(_boundary_node_id.equal_range(node)))
1340  vec_to_fill.push_back(pr.second);
1341 }
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 1526 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().

1529 {
1530  libmesh_assert(elem);
1531 
1532  // Only query BCs for sides that exist.
1533  libmesh_assert_less (side, elem->n_sides());
1534 
1535  // Clear out any previous contents
1536  vec_to_fill.clear();
1537 
1538  // In most cases only level-0 elements store BCs.
1539  // In certain application (such as time-dependent domains), however, children
1540  // need to store BCs too. This case is covered with the _children_on_boundary
1541  // flag.
1542  const Elem * searched_elem = elem;
1543 
1544 #ifdef LIBMESH_ENABLE_AMR
1545 
1546  if (elem->level() != 0)
1547  {
1548  // If we have children on the boundaries, we need to search for boundary IDs on the
1549  // child and its ancestors too if they share the side.
1551  {
1552  // Loop over ancestors to check if they have boundary ids on the same side
1553  while (searched_elem)
1554  {
1555  for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
1556  // Here we need to check if the boundary id already exists
1557  if (pr.second.first == side &&
1558  std::find(vec_to_fill.begin(), vec_to_fill.end(), pr.second.second) ==
1559  vec_to_fill.end())
1560  vec_to_fill.push_back(pr.second.second);
1561 
1562 
1563  const Elem * parent = searched_elem->parent();
1564  // If the parent doesn't exist or if the child is not on the correct side of the
1565  // parent we are done checking the ancestors
1566  if (!parent || parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
1567  return;
1568 
1569  searched_elem = parent;
1570  }
1571 
1572  return;
1573  }
1574 
1575  // If we don't have children on boundaries and we are on an external boundary,
1576  // we just look for the top parent
1577  if (elem->neighbor_ptr(side) == nullptr)
1578  searched_elem = elem->top_parent();
1579  // Otherwise we loop over the ancestors and check if they have a different BC for us
1580  else
1581  while (searched_elem->parent() != nullptr)
1582  {
1583  const Elem * parent = searched_elem->parent();
1584  if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
1585  return;
1586 
1587  searched_elem = parent;
1588  }
1589  }
1590 
1591 #endif
1592 
1593  // Check each element in the range to see if its side matches the requested side.
1594  for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
1595  if (pr.second.first == side)
1596  vec_to_fill.push_back(pr.second.second);
1597 }
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() [1/2]

void libMesh::BoundaryInfo::build_active_side_list ( std::vector< dof_id_type > &  element_id_list,
std::vector< unsigned short int > &  side_list,
std::vector< boundary_id_type > &  bc_id_list 
) const

Creates a list of active element numbers, sides, and ids for those sides.

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

Deprecated:
Use the version of build_active_side_list() below that returns a std::vector of tuples instead.

Definition at line 2725 of file boundary_info.C.

References build_active_side_list().

2728 {
2729  libmesh_deprecated();
2730 
2731  // Call the non-deprecated version of this function.
2732  auto bc_tuples = this->build_active_side_list();
2733 
2734  // Clear the input vectors, just in case they were used for
2735  // something else recently...
2736  el.clear();
2737  sl.clear();
2738  il.clear();
2739 
2740  // Reserve the size, then use push_back
2741  el.reserve (bc_tuples.size());
2742  sl.reserve (bc_tuples.size());
2743  il.reserve (bc_tuples.size());
2744 
2745  for (const auto & t : bc_tuples)
2746  {
2747  el.push_back(std::get<0>(t));
2748  sl.push_back(std::get<1>(t));
2749  il.push_back(std::get<2>(t));
2750  }
2751 }
std::vector< BCTuple > build_active_side_list() const
As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and ret...

◆ build_active_side_list() [2/2]

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

As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and returns it to the user, taking advantage of guaranteed RVO.

Definition at line 2756 of file boundary_info.C.

References _boundary_side_id.

Referenced by build_active_side_list().

2757 {
2758  std::vector<BCTuple> bc_triples;
2759  bc_triples.reserve(_boundary_side_id.size());
2760 
2761  for (const auto & [elem, id_pair] : _boundary_side_id)
2762  {
2763  // Don't add remote sides
2764  if (elem->is_remote())
2765  continue;
2766 
2767  // Loop over the sides of possible children
2768  std::vector<const Elem *> family;
2769 #ifdef LIBMESH_ENABLE_AMR
2770  elem->active_family_tree_by_side(family, id_pair.first);
2771 #else
2772  family.push_back(elem);
2773 #endif
2774 
2775  // Populate the list items
2776  for (const auto & f : family)
2777  bc_triples.emplace_back(f->id(), id_pair.first, id_pair.second);
2778  }
2779 
2780  // This list is currently in memory address (arbitrary) order, so
2781  // sort to make it consistent on all procs.
2782  std::sort(bc_triples.begin(), bc_triples.end());
2783 
2784  return bc_triples;
2785 }
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() [1/2]

void libMesh::BoundaryInfo::build_edge_list ( std::vector< dof_id_type > &  element_id_list,
std::vector< unsigned short int > &  edge_list,
std::vector< boundary_id_type > &  bc_id_list 
) const

Creates a list of element numbers, edges, and boundary ids for those edges.

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

Deprecated:
Use the version of build_edge_list() below that returns a std::vector of tuples instead.

Definition at line 2789 of file boundary_info.C.

References build_edge_list().

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

2792 {
2793  libmesh_deprecated();
2794 
2795  // Call the non-deprecated version of this function.
2796  auto bc_tuples = this->build_edge_list();
2797 
2798  // Clear the input vectors, just in case they were used for
2799  // something else recently...
2800  el.clear();
2801  sl.clear();
2802  il.clear();
2803 
2804  // Reserve the size, then use push_back
2805  el.reserve (bc_tuples.size());
2806  sl.reserve (bc_tuples.size());
2807  il.reserve (bc_tuples.size());
2808 
2809  for (const auto & t : bc_tuples)
2810  {
2811  el.push_back(std::get<0>(t));
2812  sl.push_back(std::get<1>(t));
2813  il.push_back(std::get<2>(t));
2814  }
2815 }
std::vector< BCTuple > build_edge_list() const
As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and ret...

◆ build_edge_list() [2/2]

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

As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and returns it to the user, taking advantage of guaranteed RVO.

Definition at line 2820 of file boundary_info.C.

References _boundary_edge_id.

Referenced by build_edge_list().

2821 {
2822  std::vector<BCTuple> bc_triples;
2823  bc_triples.reserve(_boundary_edge_id.size());
2824 
2825  for (const auto & [elem, id_pair] : _boundary_edge_id)
2826  bc_triples.emplace_back(elem->id(), id_pair.first, id_pair.second);
2827 
2828  // This list is currently in memory address (arbitrary) order, so
2829  // sort to make it consistent on all procs.
2830  std::sort(bc_triples.begin(), bc_triples.end());
2831 
2832  return bc_triples;
2833 }
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 2148 of file boundary_info.C.

References _boundary_node_id.

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

2149 {
2150  b_ids.clear();
2151 
2152  for (const auto & pr : _boundary_node_id)
2153  {
2154  boundary_id_type id = pr.second;
2155 
2156  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
2157  b_ids.push_back(id);
2158  }
2159 }
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() [1/2]

void libMesh::BoundaryInfo::build_node_list ( std::vector< dof_id_type > &  node_id_list,
std::vector< boundary_id_type > &  bc_id_list 
) const

Creates a list of nodes and ids for those nodes.

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

Deprecated:
Use the version of build_node_list() below that returns a std::vector of tuples instead.

Definition at line 2329 of file boundary_info.C.

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

2331 {
2332  libmesh_deprecated();
2333 
2334  // Call the non-deprecated version of this function.
2335  auto bc_tuples = this->build_node_list();
2336 
2337  // Clear the input vectors, just in case they were used for
2338  // something else recently...
2339  nl.clear();
2340  il.clear();
2341 
2342  // Reserve the size, then use push_back
2343  nl.reserve (bc_tuples.size());
2344  il.reserve (bc_tuples.size());
2345 
2346  for (const auto & t : bc_tuples)
2347  {
2348  nl.push_back(std::get<0>(t));
2349  il.push_back(std::get<1>(t));
2350  }
2351 }
void build_node_list(std::vector< dof_id_type > &node_id_list, std::vector< boundary_id_type > &bc_id_list) const
Creates a list of nodes and ids for those nodes.

◆ build_node_list() [2/2]

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

Definition at line 2356 of file boundary_info.C.

References _boundary_node_id, BOUNDARY_ID, and NODE_ID.

2357 {
2358  std::vector<NodeBCTuple> bc_tuples;
2359  bc_tuples.reserve(_boundary_node_id.size());
2360 
2361  for (const auto & [node, bid] : _boundary_node_id)
2362  bc_tuples.emplace_back(node->id(), bid);
2363 
2364  // This list is currently in memory address (arbitrary) order, so
2365  // sort, using the specified ordering, to make it consistent on all procs.
2366  if (sort_by == NodeBCTupleSortBy::NODE_ID)
2367  std::sort(bc_tuples.begin(), bc_tuples.end());
2368  else if (sort_by == NodeBCTupleSortBy::BOUNDARY_ID)
2369  std::sort(bc_tuples.begin(), bc_tuples.end(),
2370  [](const NodeBCTuple & left, const NodeBCTuple & right)
2371  {return std::get<1>(left) < std::get<1>(right);});
2372 
2373  return bc_tuples;
2374 }
std::tuple< dof_id_type, boundary_id_type > NodeBCTuple
As above, but the library creates and fills in a vector of (node-id, bc-id) pairs and returns it to t...
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 ( )

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

Definition at line 2378 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 WriteNodesetData::testWriteImpl().

2379 {
2380  // If we're on a distributed mesh, even the owner of a node is not
2381  // guaranteed to be able to properly assign its new boundary id(s)!
2382  // Nodal neighbors are not always ghosted, and a nodal neighbor
2383  // might have a boundary side.
2384  const bool mesh_is_serial = _mesh->is_serial();
2385 
2386  typedef std::set<std::pair<dof_id_type, boundary_id_type>> set_type;
2387  typedef std::vector<std::pair<dof_id_type, boundary_id_type>> vec_type;
2388 
2389  const processor_id_type my_proc_id = this->processor_id();
2390  std::unordered_map<processor_id_type, set_type> nodes_to_push;
2391  std::unordered_map<processor_id_type, vec_type> node_vecs_to_push;
2392 
2393  // For avoiding extraneous element side construction
2394  ElemSideBuilder side_builder;
2395  // Pull objects out of the loop to reduce heap operations
2396  const Elem * side;
2397 
2398  // Loop over the side list
2399  for (const auto & [elem, id_pair] : _boundary_side_id)
2400  {
2401  // Don't add remote sides
2402  if (elem->is_remote())
2403  continue;
2404 
2405  // Need to loop over the sides of any possible children
2406  std::vector<const Elem *> family;
2407 #ifdef LIBMESH_ENABLE_AMR
2408  elem->active_family_tree_by_side (family, id_pair.first);
2409 #else
2410  family.push_back(elem);
2411 #endif
2412 
2413  for (const auto & cur_elem : family)
2414  {
2415  side = &side_builder(*cur_elem, id_pair.first);
2416 
2417  // Add each node node on the side with the side's boundary id
2418  for (auto i : side->node_index_range())
2419  {
2420  const boundary_id_type bcid = id_pair.second;
2421  this->add_node(side->node_ptr(i), bcid);
2422  if (!mesh_is_serial)
2423  {
2424  const processor_id_type proc_id =
2425  side->node_ptr(i)->processor_id();
2426  if (proc_id != my_proc_id)
2427  nodes_to_push[proc_id].emplace(side->node_id(i), bcid);
2428  }
2429  }
2430  }
2431  }
2432 
2433  // If we're on a serial mesh then we're done.
2434  if (mesh_is_serial)
2435  return;
2436 
2437  // Otherwise we need to push ghost node bcids to their owners, then
2438  // pull ghost node bcids from their owners.
2439 
2440  for (auto & [proc_id, s] : nodes_to_push)
2441  {
2442  node_vecs_to_push[proc_id].assign(s.begin(), s.end());
2443  s.clear();
2444  }
2445 
2446  auto nodes_action_functor =
2447  [this]
2449  const vec_type & received_nodes)
2450  {
2451  for (const auto & [dof_id, bndry_id] : received_nodes)
2452  this->add_node(_mesh->node_ptr(dof_id), bndry_id);
2453  };
2454 
2455  Parallel::push_parallel_vector_data
2456  (this->comm(), node_vecs_to_push, nodes_action_functor);
2457 
2458  // At this point we should know all the BCs for our own nodes; now
2459  // we need BCs for ghost nodes.
2460  std::unordered_map<processor_id_type, std::vector<dof_id_type>>
2461  node_ids_requested;
2462 
2463  // Determine what nodes we need to request
2464  for (const auto & node : _mesh->node_ptr_range())
2465  {
2466  const processor_id_type pid = node->processor_id();
2467  if (pid != my_proc_id)
2468  node_ids_requested[pid].push_back(node->id());
2469  }
2470 
2471  typedef std::vector<boundary_id_type> datum_type;
2472 
2473  auto node_bcid_gather_functor =
2474  [this]
2476  const std::vector<dof_id_type> & ids,
2477  std::vector<datum_type> & data)
2478  {
2479  const std::size_t query_size = ids.size();
2480  data.resize(query_size);
2481 
2482  for (std::size_t i=0; i != query_size; ++i)
2483  this->boundary_ids(_mesh->node_ptr(ids[i]), data[i]);
2484  };
2485 
2486  auto node_bcid_action_functor =
2487  [this]
2489  const std::vector<dof_id_type> & ids,
2490  const std::vector<datum_type> & data)
2491  {
2492  for (auto i : index_range(ids))
2493  this->add_node(_mesh->node_ptr(ids[i]), data[i]);
2494  };
2495 
2496  datum_type * datum_type_ex = nullptr;
2497  Parallel::pull_parallel_vector_data
2498  (this->comm(), node_ids_requested, node_bcid_gather_functor,
2499  node_bcid_action_functor, datum_type_ex);
2500 }
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:211
void add_node(const Node *node, const boundary_id_type id)
Add Node node with boundary id id to the boundary information data structures.
int8_t boundary_id_type
Definition: id_types.h:51
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:117

◆ 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 2176 of file boundary_info.C.

References _boundary_shellface_id.

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

2177 {
2178  b_ids.clear();
2179 
2180  for (const auto & pr :_boundary_shellface_id)
2181  {
2182  boundary_id_type id = pr.second.second;
2183 
2184  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
2185  b_ids.push_back(id);
2186  }
2187 }
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() [1/2]

void libMesh::BoundaryInfo::build_shellface_list ( std::vector< dof_id_type > &  element_id_list,
std::vector< unsigned short int > &  shellface_list,
std::vector< boundary_id_type > &  bc_id_list 
) const

Creates a list of element numbers, shellfaces, and boundary ids for those shellfaces.

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

Deprecated:
Use the version of build_shellface_list() below that returns a std::vector of tuples instead.

Definition at line 2837 of file boundary_info.C.

References build_shellface_list().

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

2840 {
2841  libmesh_deprecated();
2842 
2843  // Call the non-deprecated version of this function.
2844  auto bc_tuples = this->build_shellface_list();
2845 
2846  // Clear the input vectors, just in case they were used for
2847  // something else recently...
2848  el.clear();
2849  sl.clear();
2850  il.clear();
2851 
2852  // Reserve the size, then use push_back
2853  el.reserve (bc_tuples.size());
2854  sl.reserve (bc_tuples.size());
2855  il.reserve (bc_tuples.size());
2856 
2857  for (const auto & t : bc_tuples)
2858  {
2859  el.push_back(std::get<0>(t));
2860  sl.push_back(std::get<1>(t));
2861  il.push_back(std::get<2>(t));
2862  }
2863 }
std::vector< BCTuple > build_shellface_list() const
As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and ret...

◆ build_shellface_list() [2/2]

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

As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and returns it to the user, taking advantage of guaranteed RVO.

Definition at line 2868 of file boundary_info.C.

References _boundary_shellface_id.

Referenced by build_shellface_list().

2869 {
2870  std::vector<BCTuple> bc_triples;
2871  bc_triples.reserve(_boundary_shellface_id.size());
2872 
2873  for (const auto & [elem, id_pair] : _boundary_shellface_id)
2874  bc_triples.emplace_back(elem->id(), id_pair.first, id_pair.second);
2875 
2876  // This list is currently in memory address (arbitrary) order, so
2877  // sort to make it consistent on all procs.
2878  std::sort(bc_triples.begin(), bc_triples.end());
2879 
2880  return bc_triples;
2881 }
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 2162 of file boundary_info.C.

References _boundary_side_id.

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

2163 {
2164  b_ids.clear();
2165 
2166  for (const auto & pr : _boundary_side_id)
2167  {
2168  boundary_id_type id = pr.second.second;
2169 
2170  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
2171  b_ids.push_back(id);
2172  }
2173 }
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() [1/2]

void libMesh::BoundaryInfo::build_side_list ( std::vector< dof_id_type > &  element_id_list,
std::vector< unsigned short int > &  side_list,
std::vector< boundary_id_type > &  bc_id_list 
) const

Creates a list of element numbers, sides, and ids for those sides.

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

Deprecated:
Use the version of build_side_list() below that returns a std::vector of tuples instead.

Definition at line 2665 of file boundary_info.C.

Referenced by libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::UnstructuredMesh::stitching_helper(), 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().

2668 {
2669  libmesh_deprecated();
2670 
2671  // Call the non-deprecated version of this function.
2672  auto bc_tuples = this->build_side_list();
2673 
2674  // Clear the input vectors, just in case they were used for
2675  // something else recently...
2676  el.clear();
2677  sl.clear();
2678  il.clear();
2679 
2680  // Reserve the size, then use push_back
2681  el.reserve (bc_tuples.size());
2682  sl.reserve (bc_tuples.size());
2683  il.reserve (bc_tuples.size());
2684 
2685  for (const auto & t : bc_tuples)
2686  {
2687  el.push_back(std::get<0>(t));
2688  sl.push_back(std::get<1>(t));
2689  il.push_back(std::get<2>(t));
2690  }
2691 }
void build_side_list(std::vector< dof_id_type > &element_id_list, std::vector< unsigned short int > &side_list, std::vector< boundary_id_type > &bc_id_list) const
Creates a list of element numbers, sides, and ids for those sides.

◆ build_side_list() [2/2]

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

Definition at line 2696 of file boundary_info.C.

References _boundary_side_id, BOUNDARY_ID, ELEM_ID, and SIDE_ID.

2697 {
2698  std::vector<BCTuple> bc_triples;
2699  bc_triples.reserve(_boundary_side_id.size());
2700 
2701  for (const auto & [elem, id_pair] : _boundary_side_id)
2702  bc_triples.emplace_back(elem->id(), id_pair.first, id_pair.second);
2703 
2704  // bc_triples is currently in whatever order the Elem pointers in
2705  // the _boundary_side_id multimap are in, and in particular might be
2706  // in different orders on different processors. To avoid this
2707  // inconsistency, we'll sort using the default operator< for tuples.
2708  if (sort_by == BCTupleSortBy::ELEM_ID)
2709  std::sort(bc_triples.begin(), bc_triples.end());
2710  else if (sort_by == BCTupleSortBy::SIDE_ID)
2711  std::sort(bc_triples.begin(), bc_triples.end(),
2712  [](const BCTuple & left, const BCTuple & right)
2713  {return std::get<1>(left) < std::get<1>(right);});
2714  else if (sort_by == BCTupleSortBy::BOUNDARY_ID)
2715  std::sort(bc_triples.begin(), bc_triples.end(),
2716  [](const BCTuple & left, const BCTuple & right)
2717  {return std::get<2>(left) < std::get<2>(right);});
2718 
2719  return bc_triples;
2720 }
std::tuple< dof_id_type, unsigned short int, boundary_id_type > BCTuple
As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and ret...
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 ( )

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

Definition at line 2615 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().

2616 {
2617  // Check for early return
2618  if (_boundary_node_id.empty())
2619  {
2620  libMesh::out << "No boundary node IDs have been added: cannot build side list!" << std::endl;
2621  return;
2622  }
2623 
2624  // For avoiding extraneous element side construction
2625  ElemSideBuilder side_builder;
2626  // Pull objects out of the loop to reduce heap operations
2627  const Elem * side_elem;
2628 
2629  for (const auto & elem : _mesh->active_element_ptr_range())
2630  for (auto side : elem->side_index_range())
2631  {
2632  side_elem = &side_builder(*elem, side);
2633 
2634  // map from nodeset_id to count for that ID
2635  std::map<boundary_id_type, unsigned> nodesets_node_count;
2636 
2637  // For each nodeset that this node is a member of, increment the associated
2638  // nodeset ID count
2639  for (const auto & node : side_elem->node_ref_range())
2640  for (const auto & pr : as_range(_boundary_node_id.equal_range(&node)))
2641  nodesets_node_count[pr.second]++;
2642 
2643  // Now check to see what nodeset_counts have the correct
2644  // number of nodes in them. For any that do, add this side to
2645  // the sideset, making sure the sideset inherits the
2646  // nodeset's name, if there is one.
2647  for (const auto & pr : nodesets_node_count)
2648  if (pr.second == side_elem->n_nodes())
2649  {
2650  add_side(elem, side, pr.first);
2651 
2652  // Let the sideset inherit any non-empty name from the nodeset
2653  std::string & nset_name = nodeset_name(pr.first);
2654 
2655  if (nset_name != "")
2656  sideset_name(pr.first) = nset_name;
2657  }
2658  } // end for side
2659 }
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 342 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().

343 {
344  _boundary_node_id.clear();
345  _boundary_side_id.clear();
346  _boundary_edge_id.clear();
347  _boundary_shellface_id.clear();
348  _boundary_ids.clear();
349  _side_boundary_ids.clear();
350  _node_boundary_ids.clear();
351  _edge_boundary_ids.clear();
352  _shellface_boundary_ids.clear();
353  _ss_id_to_name.clear();
354  _ns_id_to_name.clear();
355  _es_id_to_name.clear();
356 }
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 1005 of file boundary_info.C.

References _boundary_node_id.

1006 {
1007  _boundary_node_id.clear();
1008 }
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 3237 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().

3240 {
3241  auto end_it = _boundary_side_id.end();
3242  auto it = _boundary_side_id.begin();
3243 
3244  // This predicate checks to see whether the pred_pr triplet's boundary ID matches sideset_id
3245  // (other_sideset_id) *and* whether there is a boundary information triplet on the other side of
3246  // the face whose boundary ID matches the other_sideset_id (sideset_id). We return a pair where
3247  // first is a boolean indicating our condition is true or false, and second is an iterator to the
3248  // neighboring triplet if our condition is true
3249  auto predicate =
3250  [sideset_id, other_sideset_id](
3251  const std::pair<const Elem *, std::pair<unsigned short int, boundary_id_type>> & pred_pr,
3252  const std::multimap<const Elem *, std::pair<unsigned short int, boundary_id_type>> &
3253  pred_container) {
3254  const Elem & elem = *pred_pr.first;
3255  const auto elem_side = pred_pr.second.first;
3256  const Elem * const other_elem = elem.neighbor_ptr(elem_side);
3257  if (!other_elem)
3258  return std::make_pair(false, pred_container.end());
3259 
3260  const auto elem_side_bnd_id = pred_pr.second.second;
3261  auto other_elem_side_bnd_id = BoundaryInfo::invalid_id;
3262  if (elem_side_bnd_id == sideset_id)
3263  other_elem_side_bnd_id = other_sideset_id;
3264  else if (elem_side_bnd_id == other_sideset_id)
3265  other_elem_side_bnd_id = sideset_id;
3266  else
3267  return std::make_pair(false, pred_container.end());
3268 
3269  const auto other_elem_side = other_elem->which_neighbor_am_i(&elem);
3270  const typename std::decay<decltype(pred_container)>::type::value_type other_sideset_info(
3271  other_elem, std::make_pair(other_elem_side, other_elem_side_bnd_id));
3272  auto other_range = pred_container.equal_range(other_elem);
3273  libmesh_assert_msg(
3274  other_range.first != other_range.second,
3275  "No matching sideset information for other element in boundary information");
3276  auto other_it = std::find(other_range.first, other_range.second, other_sideset_info);
3277  libmesh_assert_msg(
3278  other_it != pred_container.end(),
3279  "No matching sideset information for other element in boundary information");
3280  return std::make_pair(true, other_it);
3281  };
3282 
3283  for (; it != end_it;)
3284  {
3285  auto pred_result = predicate(*it, _boundary_side_id);
3286  if (pred_result.first)
3287  {
3288  // First erase associated nodeset information. Do it from both
3289  // sides, so we get any higher-order nodes if we're looking at
3290  // them from a lower-order side, and so we only remove the two
3291  // boundary ids used for stitching.
3292  if (clear_nodeset_data)
3293  {
3294  const Elem & elem = *it->first;
3295  const Elem & neigh = *pred_result.second->first;
3296  const auto elem_side = it->second.first;
3297  const boundary_id_type neigh_side = pred_result.second->second.first;
3298  const auto elem_bcid = it->second.second;
3299  const boundary_id_type neigh_bcid = pred_result.second->second.second;
3300 
3301  for (const auto local_node_num : elem.nodes_on_side(elem_side))
3302  this->remove_node(elem.node_ptr(local_node_num), elem_bcid);
3303 
3304  for (const auto local_node_num : neigh.nodes_on_side(neigh_side))
3305  this->remove_node(neigh.node_ptr(local_node_num), neigh_bcid);
3306  }
3307 
3308  // Now erase the sideset information for our element and its
3309  // neighbor, together. This is safe since a multimap doesn't
3310  // invalidate iterators.
3311  _boundary_side_id.erase(pred_result.second);
3312  it = _boundary_side_id.erase(it);
3313  }
3314  else
3315  ++it;
3316  }
3317 
3318  // Removing stitched-away boundary ids might have removed an id
3319  // *entirely*, so we need to recompute boundary id sets to check
3320  // for that.
3321  this->regenerate_id_sets();
3323 }
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::System::add_variable(), libMesh::System::add_variables(), libMesh::System::add_vector(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::AdvectionSystem::assemble_claw_rhs(), libMesh::FEMSystem::assemble_qoi(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::MeshCommunication::assign_global_indices(), libMesh::Partitioner::assign_partitioning(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::Partitioner::build_graph(), 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::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::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::MeshBase::get_info(), libMesh::System::get_info(), libMesh::DofMap::get_info(), libMesh::RBEIMEvaluation::get_interior_basis_functions_as_vecs(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::RBEIMConstruction::get_max_abs_value(), libMesh::RBEIMConstruction::get_node_max_abs_value(), libMesh::RBEIMEvaluation::get_parametrized_function_node_value(), libMesh::RBEIMEvaluation::get_parametrized_function_side_value(), libMesh::RBEIMEvaluation::get_parametrized_function_value(), libMesh::RBEIMConstruction::get_random_point(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::StaticCondensation::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::AdvectionSystem::init_data(), libMesh::ClawSystem::init_data(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBEIMConstruction::inner_product(), integrate_function(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_equal_connectivity(), libMesh::MeshTools::libmesh_assert_equal_points(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_constraint_rows(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::libmesh_petsc_linesearch_shellfunc(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_recalculate_monitor(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_interface(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_precheck(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::LinearImplicitSystem::LinearImplicitSystem(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_node_bcids_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::FEMSystem::mesh_position_set(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), 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::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::prepare_for_use(), 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::System::read_legacy_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), scale_mesh_and_plot(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::send_and_insert_dof_values(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_linear(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::RBEIMEvaluation::side_distribute_bfs(), libMesh::RBEIMEvaluation::side_gather_bfs(), libMesh::RBEIMConstruction::side_inner_product(), libMesh::Partitioner::single_partition(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::VariationalMeshSmoother::smooth(), libMesh::ClawSystem::solve_conservation_law(), libMesh::split_mesh(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), libMesh::MeshBase::subdomain_ids(), sync(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), libMesh::MeshRefinement::test_unflagged(), DofMapTest::testBadElemFECombo(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), VolumeTest::testC0PolygonMethods(), VolumeTest::testC0PolyhedronMethods(), ConstraintOperatorTest::testCoreform(), ConnectedComponentsTest::testEdge(), MeshInputTest::testExodusIGASidesets(), MeshTriangulationTest::testFoundCenters(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), PointLocatorTest::testPlanar(), MeshTriangulationTest::testPoly2TriRefinementBase(), SystemsTest::testProjectCubeWithMeshFunction(), BoundaryInfoTest::testRenumber(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), libMesh::MeshTools::total_weight(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::Poly2TriTriangulator::triangulate(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), update_current_local_solution(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::VTKIO::write_nodal_data(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), libMesh::RBEvaluation::write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::TransientRBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::RBEIMEvaluationSerialization::write_to_file(), and libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file().

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

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

1648 {
1649  libmesh_assert_equal_to (old_elem->n_sides(), new_elem->n_sides());
1650  libmesh_assert_equal_to (old_elem->n_edges(), new_elem->n_edges());
1651 
1652  std::vector<boundary_id_type> bndry_ids;
1653 
1654  for (auto s : old_elem->side_index_range())
1655  {
1656  old_boundary_info.raw_boundary_ids (old_elem, s, bndry_ids);
1657  this->add_side (new_elem, s, bndry_ids);
1658  }
1659 
1660  for (auto e : old_elem->edge_index_range())
1661  {
1662  old_boundary_info.raw_edge_boundary_ids (old_elem, e, bndry_ids);
1663  this->add_edge (new_elem, e, bndry_ids);
1664  }
1665 
1666  for (unsigned short sf=0; sf != 2; sf++)
1667  {
1668  old_boundary_info.raw_shellface_boundary_ids (old_elem, sf, bndry_ids);
1669  this->add_shellface (new_elem, sf, bndry_ids);
1670  }
1671 }
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 1353 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().

1356 {
1357  libmesh_assert(elem);
1358 
1359  // Clear out any previous contents
1360  vec_to_fill.clear();
1361 
1362  // Only query BCs for edges that exist.
1363  libmesh_assert_less (edge, elem->n_edges());
1364 
1365  // Only level-0 elements store BCs. If this is not a level-0
1366  // element get its level-0 parent and infer the BCs.
1367  const Elem * searched_elem = elem;
1368 #ifdef LIBMESH_ENABLE_AMR
1369  if (elem->level() != 0)
1370  {
1371  // Find all the sides that contain edge. If one of those is a boundary
1372  // side, then this must be a boundary edge. In that case, we just use the
1373  // top-level parent.
1374  bool found_boundary_edge = false;
1375  for (auto side : elem->side_index_range())
1376  {
1377  if (elem->is_edge_on_side(edge,side))
1378  {
1379  if (elem->neighbor_ptr(side) == nullptr)
1380  {
1381  searched_elem = elem->top_parent ();
1382  found_boundary_edge = true;
1383  break;
1384  }
1385  }
1386  }
1387 
1388  if (!found_boundary_edge)
1389  {
1390  // Child element is not on external edge, but it may have internal
1391  // "boundary" IDs. We will walk up the tree, at each level checking that
1392  // the current child is actually on the same edge of the parent that is
1393  // currently being searched for (i.e. that was passed in as "edge").
1394  while (searched_elem->parent() != nullptr)
1395  {
1396  const Elem * parent = searched_elem->parent();
1397  if (parent->is_child_on_edge(parent->which_child_am_i(searched_elem), edge) == false)
1398  return;
1399  searched_elem = parent;
1400  }
1401  }
1402  }
1403 #endif
1404 
1405  // Check each element in the range to see if its edge matches the requested edge.
1406  for (const auto & pr : as_range(_boundary_edge_id.equal_range(searched_elem)))
1407  if (pr.second.first == edge)
1408  vec_to_fill.push_back(pr.second.second);
1409 }
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 3069 of file boundary_info.C.

References _es_id_to_name.

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

3070 {
3071  return _es_id_to_name[id];
3072 }
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 776 of file boundary_info.h.

References _boundary_ids.

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

777  { 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 798 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(), and WriteEdgesetData::testWriteImpl().

799  { 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 905 of file boundary_info.h.

References _boundary_edge_id.

906  { 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 3058 of file boundary_info.C.

References _es_id_to_name.

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

3059 {
3060  static const std::string empty_string;
3061  if (const auto it = _es_id_to_name.find(id);
3062  it == _es_id_to_name.end())
3063  return empty_string;
3064  else
3065  return it->second;
3066 }
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 887 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().

888  { 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 3326 of file boundary_info.C.

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

Referenced by MeshStitchTest::renameAndShift().

3327 {
3329  return _global_boundary_ids;
3330 }
bool is_prepared() const
Definition: mesh_base.h:198
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 3074 of file boundary_info.C.

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

3075 {
3076  // Search sidesets
3077  for (const auto & [ss_id, ss_name] : _ss_id_to_name)
3078  if (ss_name == name)
3079  return ss_id;
3080 
3081  // Search nodesets
3082  for (const auto & [ns_id, ns_name] : _ns_id_to_name)
3083  if (ns_name == name)
3084  return ns_id;
3085 
3086  // Search edgesets
3087  for (const auto & [es_id, es_name] : _es_id_to_name)
3088  if (es_name == name)
3089  return es_id;
3090 
3091  // If we made it here without returning, we don't have a sideset,
3092  // nodeset, or edgeset by the requested name, so return invalid_id
3093  return invalid_id;
3094 }
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 814 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(), and MeshStitchTest::testBoundaryInfo().

815  { 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 899 of file boundary_info.h.

References _boundary_node_id.

900  { 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 3043 of file boundary_info.C.

References _ns_id_to_name.

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

3044 {
3045  static const std::string empty_string;
3046  if (const auto it = _ns_id_to_name.find(id);
3047  it == _ns_id_to_name.end())
3048  return empty_string;
3049  else
3050  return it->second;
3051 }
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 879 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().

880  { 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 807 of file boundary_info.h.

References _shellface_boundary_ids.

808  { 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 588 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().

592 {
593  LOG_SCOPE("get_side_and_node_maps()", "BoundaryInfo");
594 
595  node_id_map.clear();
596  side_id_map.clear();
597 
598  // For building element sides without extraneous allocation
599  ElemSideBuilder side_builder;
600  // Pull objects out of the loop to reduce heap operations
601  const Elem * interior_parent_side;
602 
603  for (const auto & boundary_elem : boundary_mesh.active_element_ptr_range())
604  {
605  const Elem * interior_parent = boundary_elem->interior_parent();
606 
607  // Find out which side of interior_parent boundary_elem corresponds to.
608  // Use distance between average vertex location as a way to check.
609  unsigned char interior_parent_side_index = 0;
610  bool found_matching_sides = false;
611  for (auto side : interior_parent->side_index_range())
612  {
613  interior_parent_side = &side_builder(*interior_parent, side);
614  Real va_distance = (boundary_elem->vertex_average() - interior_parent_side->vertex_average()).norm();
615 
616  if (va_distance < (tolerance * boundary_elem->hmin()))
617  {
618  interior_parent_side_index = cast_int<unsigned char>(side);
619  found_matching_sides = true;
620  break;
621  }
622  }
623 
624  libmesh_error_msg_if(!found_matching_sides, "No matching side found within the specified tolerance");
625 
626  side_id_map[boundary_elem->id()] = interior_parent_side_index;
627 
628  for (auto local_node_index : boundary_elem->node_index_range())
629  {
630  dof_id_type boundary_node_id = boundary_elem->node_id(local_node_index);
631  dof_id_type interior_node_id = interior_parent_side->node_id(local_node_index);
632 
633  node_id_map[interior_node_id] = boundary_node_id;
634  }
635  }
636 }
auto norm(const T &a) -> decltype(std::abs(a))
Definition: tensor_tools.h:74
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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 789 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(), and MeshStitchTest::testBoundaryInfo().

790  { 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 911 of file boundary_info.h.

References _boundary_side_id.

912  { 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 3027 of file boundary_info.C.

References _ss_id_to_name.

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

3028 {
3029  static const std::string empty_string;
3030  if (const auto it = _ss_id_to_name.find(id);
3031  it == _ss_id_to_name.end())
3032  return empty_string;
3033  else
3034  return it->second;
3035 }
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 871 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().

872  { 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 1321 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::FEMContext::has_side_boundary_id(), LinearElasticityWithContact::initialize_contact_load_paths(), main(), AugmentSparsityOnInterface::mesh_reinit(), operator==(), SolidSystem::side_time_derivative(), BoundaryInfoTest::testBoundaryOnChildrenElementsRefineCoarsen(), SystemsTest::testBoundaryProjectCube(), and BoundaryInfoTest::testEdgeBoundaryConditions().

1323 {
1324  for (const auto & pr : as_range(_boundary_node_id.equal_range(node)))
1325  if (pr.second == id)
1326  return true;
1327 
1328  return false;
1329 }
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 1515 of file boundary_info.C.

References boundary_ids().

1518 {
1519  std::vector<boundary_id_type> ids;
1520  this->boundary_ids(elem, side, ids);
1521  return (std::find(ids.begin(), ids.end(), id) != ids.end());
1522 }
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 917 of file boundary_info.h.

References _children_on_boundary.

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

918  { 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 3333 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(), and renumber_id().

3334 {
3335 #ifndef NDEBUG
3336  auto verify_multimap = [](const auto & themap) {
3337  for (const auto & [key, val] : themap)
3338  {
3339  auto range = themap.equal_range(key);
3340 
3341  int count = 0;
3342  for (auto it = range.first; it != range.second; ++it)
3343  if (it->second == val)
3344  ++count;
3345 
3346  libmesh_assert(count == 1);
3347  }
3348  };
3349 
3350  verify_multimap(this->_boundary_node_id);
3351  verify_multimap(this->_boundary_edge_id);
3352  verify_multimap(this->_boundary_shellface_id);
3353  verify_multimap(this->_boundary_side_id);
3354 #else
3355  return;
3356 #endif
3357 }
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 2240 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(), libMesh::XdrIO::write(), and libMesh::GmshIO::write_mesh().

2241 {
2242  // in serial we know the number of bcs from the
2243  // size of the container
2244  if (_mesh->is_serial())
2245  return _boundary_side_id.size();
2246 
2247  // in parallel we need to sum the number of local bcs
2248  parallel_object_only();
2249 
2250  std::size_t nbcs=0;
2251 
2252  for (const auto & pr : _boundary_side_id)
2253  if (pr.first->processor_id() == this->processor_id())
2254  nbcs++;
2255 
2256  this->comm().sum (nbcs);
2257 
2258  return nbcs;
2259 }
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:211
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 396 of file boundary_info.h.

References _boundary_ids.

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

396 { 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 1345 of file boundary_info.C.

References _boundary_node_id, and distance().

1346 {
1347  auto pos = _boundary_node_id.equal_range(node);
1348  return cast_int<unsigned int>(std::distance(pos.first, pos.second));
1349 }
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 1602 of file boundary_info.C.

References boundary_ids().

1604 {
1605  std::vector<boundary_id_type> ids;
1606  this->boundary_ids(elem, side, ids);
1607  return cast_int<unsigned int>(ids.size());
1608 }
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 1413 of file boundary_info.C.

References edge_boundary_ids().

1415 {
1416  std::vector<boundary_id_type> ids;
1417  this->edge_boundary_ids(elem, edge, ids);
1418  return cast_int<unsigned int>(ids.size());
1419 }
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 2261 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().

2262 {
2263  // in serial we know the number of nodesets from the
2264  // size of the container
2265  if (_mesh->is_serial())
2266  return _boundary_edge_id.size();
2267 
2268  // in parallel we need to sum the number of local nodesets
2269  parallel_object_only();
2270 
2271  std::size_t n_edge_bcs=0;
2272 
2273  for (const auto & pr : _boundary_edge_id)
2274  if (pr.first->processor_id() == this->processor_id())
2275  n_edge_bcs++;
2276 
2277  this->comm().sum (n_edge_bcs);
2278 
2279  return n_edge_bcs;
2280 }
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:211
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 2305 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().

2306 {
2307  // in serial we know the number of nodesets from the
2308  // size of the container
2309  if (_mesh->is_serial())
2310  return _boundary_node_id.size();
2311 
2312  // in parallel we need to sum the number of local nodesets
2313  parallel_object_only();
2314 
2315  std::size_t n_nodesets=0;
2316 
2317  for (const auto & pr : _boundary_node_id)
2318  if (pr.first->processor_id() == this->processor_id())
2319  n_nodesets++;
2320 
2321  this->comm().sum (n_nodesets);
2322 
2323  return n_nodesets;
2324 }
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:211
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::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMEvaluation::gather_bfs(), 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::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 1611 of file boundary_info.C.

References raw_boundary_ids().

1613 {
1614  std::vector<boundary_id_type> ids;
1615  this->raw_boundary_ids(elem, side, ids);
1616  return cast_int<unsigned int>(ids.size());
1617 }
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 1481 of file boundary_info.C.

References shellface_boundary_ids().

1483 {
1484  std::vector<boundary_id_type> ids;
1485  this->shellface_boundary_ids(elem, shellface, ids);
1486  return cast_int<unsigned int>(ids.size());
1487 }
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 2283 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().

2284 {
2285  // in serial we know the number of nodesets from the
2286  // size of the container
2287  if (_mesh->is_serial())
2288  return _boundary_shellface_id.size();
2289 
2290  // in parallel we need to sum the number of local nodesets
2291  parallel_object_only();
2292 
2293  std::size_t n_shellface_bcs=0;
2294 
2295  for (const auto & pr : _boundary_shellface_id)
2296  if (pr.first->processor_id() == this->processor_id())
2297  n_shellface_bcs++;
2298 
2299  this->comm().sum (n_shellface_bcs);
2300 
2301  return n_shellface_bcs;
2302 }
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:211
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 3053 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(), and WriteNodesetData::testWriteImpl().

3054 {
3055  return _ns_id_to_name[id];
3056 }
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 109 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, _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().

110 {
111  // Overwrite any preexisting boundary info
112  this->clear();
113 
124  // Copy node boundary info
125  for (const auto & [node, bid] : other_boundary_info._boundary_node_id)
126  _boundary_node_id.emplace(_mesh->node_ptr(node->id()), bid);
127 
128  // Copy edge boundary info
129  for (const auto & [elem, id_pair] : other_boundary_info._boundary_edge_id)
130  _boundary_edge_id.emplace(_mesh->elem_ptr(elem->id()), id_pair);
131 
132  // Copy shellface boundary info
133  for (const auto & [elem, id_pair] : other_boundary_info._boundary_shellface_id)
134  _boundary_shellface_id.emplace(_mesh->elem_ptr(elem->id()), id_pair);
135 
136  // Copy side boundary info
137  for (const auto & [elem, id_pair] : other_boundary_info._boundary_side_id)
138  _boundary_side_id.emplace(_mesh->elem_ptr(elem->id()), id_pair);
139 
140  _boundary_ids = other_boundary_info._boundary_ids;
141  _global_boundary_ids = other_boundary_info._global_boundary_ids;
142  _side_boundary_ids = other_boundary_info._side_boundary_ids;
143  _node_boundary_ids = other_boundary_info._node_boundary_ids;
144  _edge_boundary_ids = other_boundary_info._edge_boundary_ids;
145  _shellface_boundary_ids = other_boundary_info._shellface_boundary_ids;
146 
147  _ss_id_to_name = other_boundary_info._ss_id_to_name;
148  _ns_id_to_name = other_boundary_info._ns_id_to_name;
149  _es_id_to_name = other_boundary_info._es_id_to_name;
150 
151  return *this;
152 }
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 155 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().

156 {
157  for (const auto & [other_node, bid] : other_boundary_info._boundary_node_id)
158  {
159  const Node * node = this->_mesh->query_node_ptr(other_node->id());
160  if (!node)
161  return false;
162  if (!this->has_boundary_id(node, bid))
163  return false;
164  }
165  for (const auto & [node, bid] : this->_boundary_node_id)
166  {
167  const Node * other_node =
168  other_boundary_info._mesh->query_node_ptr(node->id());
169  if (!other_node)
170  return false;
171  if (!other_boundary_info.has_boundary_id(other_node, bid))
172  return false;
173  }
174 
175  auto compare_edges = [&](const Elem * elem,
176  const Elem * other_elem,
177  unsigned short int edge)
178  {
179  if (!elem)
180  return false;
181  if (!other_elem)
182  return false;
183 
184  std::vector<boundary_id_type> our_edges, other_edges;
185  this->edge_boundary_ids(elem, edge, our_edges);
186  other_boundary_info.edge_boundary_ids(other_elem, edge, other_edges);
187  if (our_edges.size() != other_edges.size())
188  return false;
189 
190  std::sort(our_edges.begin(), our_edges.end());
191  std::sort(other_edges.begin(), other_edges.end());
192  for (auto i : index_range(our_edges))
193  if (our_edges[i] != other_edges[i])
194  return false;
195  return true;
196  };
197 
198  for (const auto & [other_elem, edge_id_pair] : other_boundary_info._boundary_edge_id)
199  {
200  const Elem * elem = this->_mesh->query_elem_ptr(other_elem->id());
201  if (!compare_edges(elem, other_elem, edge_id_pair.first))
202  return false;
203  }
204 
205  for (const auto & [elem, edge_id_pair] : this->_boundary_edge_id)
206  {
207  const Elem * other_elem = other_boundary_info._mesh->query_elem_ptr(elem->id());
208  if (!compare_edges(elem, other_elem, edge_id_pair.first))
209  return false;
210  }
211 
212  auto compare_sides = [&](const Elem * elem,
213  const Elem * other_elem,
214  unsigned short int side)
215  {
216  if (!elem)
217  return false;
218  if (!other_elem)
219  return false;
220 
221  std::vector<boundary_id_type> our_sides, other_sides;
222  this->boundary_ids(elem, side, our_sides);
223  other_boundary_info.boundary_ids(other_elem, side, other_sides);
224  if (our_sides.size() != other_sides.size())
225  return false;
226 
227  std::sort(our_sides.begin(), our_sides.end());
228  std::sort(other_sides.begin(), other_sides.end());
229  for (auto i : index_range(our_sides))
230  if (our_sides[i] != other_sides[i])
231  return false;
232  return true;
233  };
234 
235  for (const auto & [other_elem, side_id_pair] : other_boundary_info._boundary_side_id)
236  {
237  const Elem * elem = this->_mesh->query_elem_ptr(other_elem->id());
238  if (!compare_sides(elem, other_elem, side_id_pair.first))
239  return false;
240  }
241 
242  for (const auto & [elem, side_id_pair] : this->_boundary_side_id)
243  {
244  const Elem * other_elem = other_boundary_info._mesh->query_elem_ptr(elem->id());
245  if (!compare_sides(elem, other_elem, side_id_pair.first))
246  return false;
247  }
248 
249  auto compare_shellfaces = [&](const Elem * elem,
250  const Elem * other_elem,
251  unsigned short int shellface)
252  {
253  if (!elem)
254  return false;
255  if (!other_elem)
256  return false;
257 
258  std::vector<boundary_id_type> our_shellfaces, other_shellfaces;
259  this->shellface_boundary_ids(elem, shellface, our_shellfaces);
260  other_boundary_info.shellface_boundary_ids(other_elem, shellface, other_shellfaces);
261  if (our_shellfaces.size() != other_shellfaces.size())
262  return false;
263 
264  std::sort(our_shellfaces.begin(), our_shellfaces.end());
265  std::sort(other_shellfaces.begin(), other_shellfaces.end());
266  for (auto i : index_range(our_shellfaces))
267  if (our_shellfaces[i] != other_shellfaces[i])
268  return false;
269  return true;
270  };
271 
272  for (const auto & [other_elem, shellface_id_pair] : other_boundary_info._boundary_shellface_id)
273  {
274  const Elem * elem = this->_mesh->query_elem_ptr(other_elem->id());
275  if (!compare_shellfaces(elem, other_elem, shellface_id_pair.first))
276  return false;
277  }
278 
279  for (const auto & [elem, shellface_id_pair] : this->_boundary_shellface_id)
280  {
281  const Elem * other_elem = other_boundary_info._mesh->query_elem_ptr(elem->id());
282  if (!compare_shellfaces(elem, other_elem, shellface_id_pair.first))
283  return false;
284  }
285 
286  if (_children_on_boundary != other_boundary_info._children_on_boundary)
287  return false;
288 
289  auto compare_sets = [](const auto & set1, const auto & set2)
290  {
291  if (set1.size() != set2.size())
292  return false;
293  for (boundary_id_type bid : set1)
294  if (!set2.count(bid))
295  return false;
296 
297  return true;
298  };
299 
300  if (!compare_sets(_boundary_ids,
301  other_boundary_info._boundary_ids) ||
302  !compare_sets(_global_boundary_ids,
303  other_boundary_info._global_boundary_ids) ||
304  !compare_sets(_edge_boundary_ids,
305  other_boundary_info._edge_boundary_ids) ||
306  !compare_sets(_node_boundary_ids,
307  other_boundary_info._node_boundary_ids) ||
308  !compare_sets(_shellface_boundary_ids,
309  other_boundary_info._shellface_boundary_ids) ||
310  !compare_sets(_side_boundary_ids,
311  other_boundary_info._side_boundary_ids))
312  return false;
313 
314  auto compare_maps = [](const auto & map1, const auto & map2)
315  {
316  if (map1.size() != map2.size())
317  return false;
318  for (const auto & pair : map1)
319  if (!map2.count(pair.first) ||
320  map2.at(pair.first) != pair.second)
321  return false;
322 
323  return true;
324  };
325 
326  if (!compare_maps(_ss_id_to_name,
327  other_boundary_info._ss_id_to_name) ||
328  !compare_maps(_ns_id_to_name,
329  other_boundary_info._ns_id_to_name) ||
330  !compare_maps(_es_id_to_name,
331  other_boundary_info._es_id_to_name))
332  return false;
333 
334  return true;
335 }
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:117
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 2558 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().

2559 {
2560  // we need BCs for ghost nodes.
2561  std::unordered_map<processor_id_type, std::vector<dof_id_type>>
2562  node_ids_requested;
2563 
2564  // Determine what nodes we need to request
2565  for (const auto & node : _mesh->node_ptr_range())
2566  {
2567  const processor_id_type pid = node->processor_id();
2568  if (pid != this->processor_id())
2569  node_ids_requested[pid].push_back(node->id());
2570  }
2571 
2572  typedef std::vector<boundary_id_type> datum_type;
2573 
2574  // gather the node ID and boundary_id_type for the ghost nodes
2575  auto node_id_gather_functor =
2576  [this]
2578  const std::vector<dof_id_type> & ids,
2579  std::vector<datum_type> & data)
2580  {
2581  data.resize(ids.size());
2582  for (auto i : index_range(ids))
2583  {
2584  Node * node = _mesh->node_ptr(ids[i]);
2585  for (const auto & pr : as_range(_boundary_node_id.equal_range(node)))
2586  data[i].push_back(pr.second);
2587  }
2588  };
2589 
2590  // update the _boundary_node_id on this processor
2591  auto node_id_action_functor =
2592  [this]
2594  const std::vector<dof_id_type> & ids,
2595  std::vector<datum_type> & data)
2596  {
2597  for (auto i : index_range(ids))
2598  {
2599  Node * node = _mesh->node_ptr(ids[i]);
2600  //clear boundary node
2601  _boundary_node_id.erase(node);
2602  // update boundary node
2603  for (const auto & pr : data[i])
2604  _boundary_node_id.insert(std::make_pair(node, pr));
2605  }
2606  };
2607 
2608 
2609  datum_type * datum_type_ex = nullptr;
2610  Parallel::pull_parallel_vector_data
2611  (this->comm(), node_ids_requested, node_id_gather_functor,
2612  node_id_action_functor, datum_type_ex);
2613 }
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:117

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

2503 {
2504  // we need BCs for ghost elements.
2505  std::unordered_map<processor_id_type, std::vector<dof_id_type>>
2506  elem_ids_requested;
2507 
2508  // Determine what elements we need to request
2509  for (const auto & elem : _mesh->element_ptr_range())
2510  {
2511  const processor_id_type pid = elem->processor_id();
2512  if (pid != this->processor_id())
2513  elem_ids_requested[pid].push_back(elem->id());
2514  }
2515 
2516  typedef std::vector<std::pair<unsigned short int, boundary_id_type>> datum_type;
2517 
2518  // gather the element ID, side, and boundary_id_type for the ghost elements
2519  auto elem_id_gather_functor =
2520  [this]
2522  const std::vector<dof_id_type> & ids,
2523  std::vector<datum_type> & data)
2524  {
2525  data.resize(ids.size());
2526  for (auto i : index_range(ids))
2527  {
2528  Elem * elem = _mesh->elem_ptr(ids[i]);
2529  for (const auto & pr : as_range(_boundary_side_id.equal_range(elem)))
2530  data[i].push_back(std::make_pair(pr.second.first, pr.second.second));
2531  }
2532  };
2533  // update the _boundary_side_id on this processor
2534  auto elem_id_action_functor =
2535  [this]
2537  const std::vector<dof_id_type> & ids,
2538  std::vector<datum_type> & data)
2539  {
2540  for (auto i : index_range(ids))
2541  {
2542  Elem * elem = _mesh->elem_ptr(ids[i]);
2543  //clear boundary sides for this element
2544  _boundary_side_id.erase(elem);
2545  // update boundary sides for it
2546  for (const auto & [side_id, bndry_id] : data[i])
2547  _boundary_side_id.insert(std::make_pair(elem, std::make_pair(side_id, bndry_id)));
2548  }
2549  };
2550 
2551 
2552  datum_type * datum_type_ex = nullptr;
2553  Parallel::pull_parallel_vector_data
2554  (this->comm(), elem_ids_requested, elem_id_gather_functor,
2555  elem_id_action_functor, datum_type_ex);
2556 }
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:117

◆ print_info()

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

Prints the boundary information data structure.

Definition at line 2884 of file boundary_info.C.

References _boundary_edge_id, _boundary_node_id, _boundary_shellface_id, and _boundary_side_id.

2885 {
2886  // Print out the nodal BCs
2887  if (!_boundary_node_id.empty())
2888  {
2889  out_stream << "Nodal Boundary conditions:" << std::endl
2890  << "--------------------------" << std::endl
2891  << " (Node No., ID) " << std::endl;
2892 
2893  for (const auto & [node, bndry_id] : _boundary_node_id)
2894  out_stream << " (" << node->id()
2895  << ", " << bndry_id
2896  << ")" << std::endl;
2897  }
2898 
2899  // Print out the element edge BCs
2900  if (!_boundary_edge_id.empty())
2901  {
2902  out_stream << std::endl
2903  << "Edge Boundary conditions:" << std::endl
2904  << "-------------------------" << std::endl
2905  << " (Elem No., Edge No., ID) " << std::endl;
2906 
2907  for (const auto & [elem, id_pair] : _boundary_edge_id)
2908  out_stream << " (" << elem->id()
2909  << ", " << id_pair.first
2910  << ", " << id_pair.second
2911  << ")" << std::endl;
2912  }
2913 
2914  // Print out the element shellface BCs
2915  if (!_boundary_shellface_id.empty())
2916  {
2917  out_stream << std::endl
2918  << "Shell-face Boundary conditions:" << std::endl
2919  << "-------------------------" << std::endl
2920  << " (Elem No., Shell-face No., ID) " << std::endl;
2921 
2922  for (const auto & [elem, id_pair] : _boundary_shellface_id)
2923  out_stream << " (" << elem->id()
2924  << ", " << id_pair.first
2925  << ", " << id_pair.second
2926  << ")" << std::endl;
2927  }
2928 
2929  // Print out the element side BCs
2930  if (!_boundary_side_id.empty())
2931  {
2932  out_stream << std::endl
2933  << "Side Boundary conditions:" << std::endl
2934  << "-------------------------" << std::endl
2935  << " (Elem No., Side No., ID) " << std::endl;
2936 
2937  for (const auto & [elem, id_pair] : _boundary_side_id)
2938  out_stream << " (" << elem->id()
2939  << ", " << id_pair.first
2940  << ", " << id_pair.second
2941  << ")" << std::endl;
2942  }
2943 }
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 2947 of file boundary_info.C.

References _boundary_edge_id, _boundary_node_id, _boundary_shellface_id, and _boundary_side_id.

Referenced by main().

2948 {
2949  // Print out the nodal BCs
2950  if (!_boundary_node_id.empty())
2951  {
2952  out_stream << "Nodal Boundary conditions:" << std::endl
2953  << "--------------------------" << std::endl
2954  << " (ID, number of nodes) " << std::endl;
2955 
2956  std::map<boundary_id_type, std::size_t> ID_counts;
2957 
2958  for (const auto & pr : _boundary_node_id)
2959  ID_counts[pr.second]++;
2960 
2961  for (const auto & [bndry_id, cnt] : ID_counts)
2962  out_stream << " (" << bndry_id
2963  << ", " << cnt
2964  << ")" << std::endl;
2965  }
2966 
2967  // Print out the element edge BCs
2968  if (!_boundary_edge_id.empty())
2969  {
2970  out_stream << std::endl
2971  << "Edge Boundary conditions:" << std::endl
2972  << "-------------------------" << std::endl
2973  << " (ID, number of edges) " << std::endl;
2974 
2975  std::map<boundary_id_type, std::size_t> ID_counts;
2976 
2977  for (const auto & pr : _boundary_edge_id)
2978  ID_counts[pr.second.second]++;
2979 
2980  for (const auto & [bndry_id, cnt] : ID_counts)
2981  out_stream << " (" << bndry_id
2982  << ", " << cnt
2983  << ")" << std::endl;
2984  }
2985 
2986 
2987  // Print out the element edge BCs
2988  if (!_boundary_shellface_id.empty())
2989  {
2990  out_stream << std::endl
2991  << "Shell-face Boundary conditions:" << std::endl
2992  << "-------------------------" << std::endl
2993  << " (ID, number of shellfaces) " << std::endl;
2994 
2995  std::map<boundary_id_type, std::size_t> ID_counts;
2996 
2997  for (const auto & pr : _boundary_shellface_id)
2998  ID_counts[pr.second.second]++;
2999 
3000  for (const auto & [bndry_id, cnt] : ID_counts)
3001  out_stream << " (" << bndry_id
3002  << ", " << cnt
3003  << ")" << std::endl;
3004  }
3005 
3006  // Print out the element side BCs
3007  if (!_boundary_side_id.empty())
3008  {
3009  out_stream << std::endl
3010  << "Side Boundary conditions:" << std::endl
3011  << "-------------------------" << std::endl
3012  << " (ID, number of sides) " << std::endl;
3013 
3014  std::map<boundary_id_type, std::size_t> ID_counts;
3015 
3016  for (const auto & pr : _boundary_side_id)
3017  ID_counts[pr.second.second]++;
3018 
3019  for (const auto & [bndry_id, cnt] : ID_counts)
3020  out_stream << " (" << bndry_id
3021  << ", " << cnt
3022  << ")" << std::endl;
3023  }
3024 }
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::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMapBase::end_dof(), libMesh::DofMapBase::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMapBase::first_dof(), libMesh::DofMapBase::first_old_dof(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), 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::System::read_legacy_data(), libMesh::DynaIO::read_mesh(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::RBEIMEvaluation::side_gather_bfs(), ExodusTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), MeshInputTest::testAbaqusRead(), MeshInputTest::testBadGmsh(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaFileMappings(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusFileMappings(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), MeshInputTest::testGmshBCIDOverlap(), MeshInputTest::testGoodGmsh(), MeshInputTest::testGoodSTL(), MeshInputTest::testGoodSTLBinary(), MeshInputTest::testLowOrderEdgeBlocks(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), WriteVecAndScalar::testSolution(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), libMesh::MeshTools::total_weight(), libMesh::NetGenMeshInterface::triangulate(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elemset_data(), libMesh::ExodusII_IO_Helper::write_elemsets(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodal_data(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodeset_data(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), write_output_solvedata(), libMesh::System::write_parallel_data(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

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

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

1624 {
1625  libmesh_assert(elem);
1626 
1627  // Only query BCs for sides that exist.
1628  libmesh_assert_less (side, elem->n_sides());
1629 
1630  // Clear out any previous contents
1631  vec_to_fill.clear();
1632 
1633  // Only level-0 elements store BCs.
1634  if (elem->parent() && !_children_on_boundary)
1635  return;
1636 
1637  // Check each element in the range to see if its side matches the requested side.
1638  for (const auto & pr : as_range(_boundary_side_id.equal_range(elem)))
1639  if (pr.second.first == side)
1640  vec_to_fill.push_back(pr.second.second);
1641 }
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 1423 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().

1426 {
1427  libmesh_assert(elem);
1428 
1429  // Only query BCs for edges that exist.
1430  libmesh_assert_less (edge, elem->n_edges());
1431 
1432  // Clear out any previous contents
1433  vec_to_fill.clear();
1434 
1435  // Only level-0 elements store BCs.
1436  if (elem->parent())
1437  return;
1438 
1439  // Check each element in the range to see if its edge matches the requested edge.
1440  for (const auto & pr : as_range(_boundary_edge_id.equal_range(elem)))
1441  if (pr.second.first == edge)
1442  vec_to_fill.push_back(pr.second.second);
1443 }
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 1491 of file boundary_info.C.

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

Referenced by copy_boundary_ids().

1494 {
1495  libmesh_assert(elem);
1496 
1497  // Shells only have 2 faces
1498  libmesh_assert_less(shellface, 2);
1499 
1500  // Clear out any previous contents
1501  vec_to_fill.clear();
1502 
1503  // Only level-0 elements store BCs.
1504  if (elem->parent())
1505  return;
1506 
1507  // Check each element in the range to see if its shellface matches the requested shellface.
1508  for (const auto & pr : as_range(_boundary_shellface_id.equal_range(elem)))
1509  if (pr.second.first == shellface)
1510  vec_to_fill.push_back(pr.second.second);
1511 }
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 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 360 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, _global_boundary_ids, _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(), and TIMPI::Communicator::set_union().

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

361 {
362  const auto old_ss_id_to_name = _ss_id_to_name;
363  const auto old_ns_id_to_name = _ns_id_to_name;
364  const auto old_es_id_to_name = _es_id_to_name;
365 
366  // Clear the old caches
367  _boundary_ids.clear();
368  _side_boundary_ids.clear();
369  _node_boundary_ids.clear();
370  _edge_boundary_ids.clear();
371  _shellface_boundary_ids.clear();
372  _ss_id_to_name.clear();
373  _ns_id_to_name.clear();
374  _es_id_to_name.clear();
375 
376  // Loop over id maps to regenerate each set.
377  for (const auto & pr : _boundary_node_id)
378  {
379  const boundary_id_type id = pr.second;
380  _boundary_ids.insert(id);
381  _node_boundary_ids.insert(id);
382  if (const auto it = old_ns_id_to_name.find(id);
383  it != old_ns_id_to_name.end())
384  _ns_id_to_name.emplace(id, it->second);
385  }
386 
387  for (const auto & pr : _boundary_edge_id)
388  {
389  const boundary_id_type id = pr.second.second;
390  _boundary_ids.insert(id);
391  _edge_boundary_ids.insert(id);
392  if (const auto it = old_es_id_to_name.find(id);
393  it != old_es_id_to_name.end())
394  _es_id_to_name.emplace(id, it->second);
395  }
396 
397  for (const auto & pr : _boundary_side_id)
398  {
399  const boundary_id_type id = pr.second.second;
400  _boundary_ids.insert(id);
401  _side_boundary_ids.insert(id);
402  if (const auto it = old_ss_id_to_name.find(id);
403  it != old_ss_id_to_name.end())
404  _ss_id_to_name.emplace(id, it->second);
405  }
406 
407  for (const auto & pr : _boundary_shellface_id)
408  {
409  const boundary_id_type id = pr.second.second;
410  _boundary_ids.insert(id);
411  _shellface_boundary_ids.insert(id);
412  }
413 
414  // Handle global data
417  if (!_mesh->is_serial())
418  {
423  }
424 }
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.
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::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 ...
virtual bool is_serial() const
Definition: mesh_base.h:211
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 1698 of file boundary_info.C.

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

1699 {
1700  libmesh_assert(elem);
1701 
1702  // Erase everything associated with elem
1703  _boundary_edge_id.erase (elem);
1704  _boundary_side_id.erase (elem);
1705  _boundary_shellface_id.erase (elem);
1706 }
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 1710 of file boundary_info.C.

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

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

1712 {
1713  libmesh_assert(elem);
1714 
1715  // Only touch BCs for edges that exist.
1716  libmesh_assert_less (edge, elem->n_edges());
1717 
1718  // Only level 0 elements are stored in BoundaryInfo.
1719  libmesh_assert_equal_to (elem->level(), 0);
1720 
1721  // Erase (elem, edge, *) entries from map.
1722  erase_if(_boundary_edge_id, elem,
1723  [edge](decltype(_boundary_edge_id)::mapped_type & pr)
1724  {return pr.first == edge;});
1725 }
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 1729 of file boundary_info.C.

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

1732 {
1733  libmesh_assert(elem);
1734 
1735  // Only touch BCs for edges that exist.
1736  libmesh_assert_less (edge, elem->n_edges());
1737 
1738  // Only level 0 elements are stored in BoundaryInfo.
1739  libmesh_assert_equal_to (elem->level(), 0);
1740 
1741  // Erase (elem, edge, id) entries from map.
1742  erase_if(_boundary_edge_id, elem,
1743  [edge, id](decltype(_boundary_edge_id)::mapped_type & pr)
1744  {return pr.first == edge && pr.second == id;});
1745 }
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_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 1837 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, _global_boundary_ids, _node_boundary_ids, _ns_id_to_name, _shellface_boundary_ids, _side_boundary_ids, and _ss_id_to_name.

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

1838 {
1839  // Erase id from ids containers
1840  _boundary_ids.erase(id);
1841  _side_boundary_ids.erase(id);
1842  _edge_boundary_ids.erase(id);
1843  _shellface_boundary_ids.erase(id);
1844  _node_boundary_ids.erase(id);
1845  _ss_id_to_name.erase(id);
1846  _ns_id_to_name.erase(id);
1847  _es_id_to_name.erase(id);
1848  if (global)
1849  _global_boundary_ids.erase(id);
1850 
1851  // Erase (*, id) entries from map.
1852  erase_if(_boundary_node_id,
1853  [id](decltype(_boundary_node_id)::mapped_type & val)
1854  {return val == id;});
1855 
1856  // Erase (*, *, id) entries from map.
1857  erase_if(_boundary_edge_id,
1858  [id](decltype(_boundary_edge_id)::mapped_type & pr)
1859  {return pr.second == id;});
1860 
1861  // Erase (*, *, id) entries from map.
1862  erase_if(_boundary_shellface_id,
1863  [id](decltype(_boundary_shellface_id)::mapped_type & pr)
1864  {return pr.second == id;});
1865 
1866  // Erase (*, *, id) entries from map.
1867  erase_if(_boundary_side_id,
1868  [id](decltype(_boundary_side_id)::mapped_type & pr)
1869  {return pr.second == id;});
1870 }
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::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.
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.

◆ 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 1685 of file boundary_info.C.

References _boundary_node_id, and libMesh::libmesh_assert().

Referenced by clear_stitched_boundary_side_ids(), and renumber_id().

1687 {
1688  libmesh_assert(node);
1689 
1690  // Erase (node, id) entry from map.
1691  erase_if(_boundary_node_id, node,
1692  [id](decltype(_boundary_node_id)::mapped_type & val)
1693  {return val == id;});
1694 }
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_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 1748 of file boundary_info.C.

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

Referenced by renumber_id().

1750 {
1751  libmesh_assert(elem);
1752 
1753  // Only level 0 elements are stored in BoundaryInfo.
1754  libmesh_assert_equal_to (elem->level(), 0);
1755 
1756  // Shells only have 2 faces
1757  libmesh_assert_less(shellface, 2);
1758 
1759  // Erase (elem, shellface, *) entries from map.
1760  erase_if(_boundary_shellface_id, elem,
1761  [shellface](decltype(_boundary_shellface_id)::mapped_type & pr)
1762  {return pr.first == shellface;});
1763 }
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 1767 of file boundary_info.C.

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

1770 {
1771  libmesh_assert(elem);
1772 
1773  // Only level 0 elements are stored in BoundaryInfo.
1774  libmesh_assert_equal_to (elem->level(), 0);
1775 
1776  // Shells only have 2 faces
1777  libmesh_assert_less(shellface, 2);
1778 
1779  // Erase (elem, shellface, id) entries from map.
1780  erase_if(_boundary_shellface_id, elem,
1781  [shellface, id](decltype(_boundary_shellface_id)::mapped_type & pr)
1782  {return pr.first == shellface && pr.second == id;});
1783 }
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_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 1785 of file boundary_info.C.

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

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

1787 {
1788  libmesh_assert(elem);
1789 
1790  // Only touch BCs for sides that exist.
1791  libmesh_assert_less (side, elem->n_sides());
1792 
1793  // Erase (elem, side, *) entries from map.
1794  erase_if(_boundary_side_id, elem,
1795  [side](decltype(_boundary_side_id)::mapped_type & pr)
1796  {return pr.first == side;});
1797 }
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 1801 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().

1804 {
1805  libmesh_assert(elem);
1806 
1807  // Only touch BCs for sides that exist.
1808  libmesh_assert_less (side, elem->n_sides());
1809 
1810 #ifdef LIBMESH_ENABLE_AMR
1811  // Here we have to stop and check if somebody tries to remove an ancestor's boundary ID
1812  // through a child
1813  if (elem->level())
1814  {
1815  std::vector<boundary_id_type> bd_ids;
1816  this->boundary_ids(elem,side,bd_ids);
1817  if(std::find(bd_ids.begin(), bd_ids.end(), id) != bd_ids.end())
1818  {
1819  std::vector<boundary_id_type> raw_bd_ids;
1820  this->raw_boundary_ids(elem, side, raw_bd_ids);
1821  if(std::find(raw_bd_ids.begin(), raw_bd_ids.end(), id) == raw_bd_ids.end())
1822  libmesh_not_implemented_msg("We cannot delete boundary ID "
1823  + std::to_string(id) +
1824  " using a child because it is inherited from an ancestor.");
1825  }
1826  }
1827 #endif
1828 
1829  // Erase (elem, side, id) entries from map.
1830  erase_if(_boundary_side_id, elem,
1831  [side, id](decltype(_boundary_side_id)::mapped_type & pr)
1832  {return pr.first == side && pr.second == id;});
1833 }
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)

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

1876 {
1877  if (old_id == new_id)
1878  {
1879  // If the IDs are the same, this is a no-op.
1880  return;
1881  }
1882 
1883  bool found_node = false;
1884  for (auto & p : _boundary_node_id)
1885  if (p.second == old_id)
1886  {
1887  // If we already have this id on this node, we don't want to
1888  // create a duplicate in our multimap
1889  this->remove_node(p.first, new_id);
1890  p.second = new_id;
1891  found_node = true;
1892  }
1893  if (found_node)
1894  {
1895  _node_boundary_ids.erase(old_id);
1896  _node_boundary_ids.insert(new_id);
1897  }
1898 
1899  bool found_edge = false;
1900  for (auto & p : _boundary_edge_id)
1901  if (p.second.second == old_id)
1902  {
1903  // If we already have this id on this edge, we don't want to
1904  // create a duplicate in our multimap
1905  this->remove_edge(p.first, p.second.first, new_id);
1906  p.second.second = new_id;
1907  found_edge = true;
1908  }
1909  if (found_edge)
1910  {
1911  _edge_boundary_ids.erase(old_id);
1912  _edge_boundary_ids.insert(new_id);
1913  }
1914 
1915  bool found_shellface = false;
1916  for (auto & p : _boundary_shellface_id)
1917  if (p.second.second == old_id)
1918  {
1919  // If we already have this id on this shellface, we don't want
1920  // to create a duplicate in our multimap
1921  this->remove_shellface(p.first, p.second.first, new_id);
1922  p.second.second = new_id;
1923  found_shellface = true;
1924  }
1925  if (found_shellface)
1926  {
1927  _shellface_boundary_ids.erase(old_id);
1928  _shellface_boundary_ids.insert(new_id);
1929  }
1930 
1931  bool found_side = false;
1932  for (auto & p : _boundary_side_id)
1933  if (p.second.second == old_id)
1934  {
1935  // If we already have this id on this side, we don't want to
1936  // create a duplicate in our multimap
1937  this->remove_side(p.first, p.second.first, new_id);
1938  p.second.second = new_id;
1939  found_side = true;
1940  }
1941  if (found_side)
1942  {
1943  _side_boundary_ids.erase(old_id);
1944  _side_boundary_ids.insert(new_id);
1945  }
1946 
1947  if (found_node || found_edge || found_shellface || found_side)
1948  {
1949  _boundary_ids.erase(old_id);
1950  _boundary_ids.insert(new_id);
1951  }
1952 
1953  renumber_name(_ss_id_to_name, old_id, new_id);
1954  renumber_name(_ns_id_to_name, old_id, new_id);
1955  renumber_name(_es_id_to_name, old_id, new_id);
1956 
1958 }
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.

◆ 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 885 of file boundary_info.h.

References _es_id_to_name.

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

886  { 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 877 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().

878  { 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 869 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().

870  { 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 1447 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().

1450 {
1451  libmesh_assert(elem);
1452 
1453  // Shells only have 2 faces
1454  libmesh_assert_less(shellface, 2);
1455 
1456  // Clear out any previous contents
1457  vec_to_fill.clear();
1458 
1459  // Only level-0 elements store BCs. If this is not a level-0
1460  // element get its level-0 parent and infer the BCs.
1461  const Elem * searched_elem = elem;
1462 #ifdef LIBMESH_ENABLE_AMR
1463  if (elem->level() != 0)
1464  {
1465  while (searched_elem->parent() != nullptr)
1466  {
1467  const Elem * parent = searched_elem->parent();
1468  searched_elem = parent;
1469  }
1470  }
1471 #endif
1472 
1473  // Check each element in the range to see if its shellface matches the requested shellface.
1474  for (const auto & pr : as_range(_boundary_shellface_id.equal_range(searched_elem)))
1475  if (pr.second.first == shellface)
1476  vec_to_fill.push_back(pr.second.second);
1477 }
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_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 1962 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 BoundaryInfoTest::testBoundaryOnChildrenBoundarySides().

1964 {
1965  const Elem * searched_elem = elem;
1966 
1967  // If we don't have a time-dependent domain, we can just go ahead and use the top parent
1968  // (since only those contain boundary conditions). Otherwise, we keep the element
1969  if (elem->level() != 0 && !_children_on_boundary)
1970  searched_elem = elem->top_parent();
1971 
1972  // elem may have zero or multiple occurrences
1973  for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
1974  {
1975  // if this is true we found the requested boundary_id
1976  // of the element and want to return the side
1977  if (pr.second.second == boundary_id_in)
1978  {
1979  unsigned int side = pr.second.first;
1980 
1981  // Here we branch out. If we don't allow time-dependent boundary domains,
1982  // we need to check if our parents are consistent.
1983  if (!_children_on_boundary)
1984  {
1985  // If we're on this external boundary then we share this
1986  // external boundary id
1987  if (elem->neighbor_ptr(side) == nullptr)
1988  return side;
1989 
1990  // If we're on an internal boundary then we need to be sure
1991  // it's the same internal boundary as our top_parent
1992  const Elem * p = elem;
1993 
1994 #ifdef LIBMESH_ENABLE_AMR
1995 
1996  while (p != nullptr)
1997  {
1998  const Elem * parent = p->parent();
1999  if (parent && !parent->is_child_on_side(parent->which_child_am_i(p), side))
2000  break;
2001  p = parent;
2002  }
2003 #endif
2004  // We're on that side of our top_parent; return it
2005  if (!p)
2006  return side;
2007  }
2008  // Otherwise we need to check if the child's ancestors have something on
2009  // the side of the child
2010  else
2011  return side;
2012  }
2013  }
2014 
2015 #ifdef LIBMESH_ENABLE_AMR
2016  // We might have instances (especially with moving boundary domains) when we
2017  // query the paren't boundary ID on a child. We only do this till we find the
2018  // the first side, for multiple sides see above.
2019  if (_children_on_boundary && elem->level() != 0)
2020  {
2021  for (auto side : make_range(elem->n_sides()))
2022  {
2023  const Elem * p = elem;
2024  while (p->parent() != nullptr)
2025  {
2026  const Elem * parent = p->parent();
2027 
2028  // First we make sure the parent shares this side
2029  if (parent->is_child_on_side(parent->which_child_am_i(p), side))
2030  {
2031  // parent may have multiple boundary ids
2032  for (const auto & pr : as_range(_boundary_side_id.equal_range(parent)))
2033  // if this is true we found the requested boundary_id
2034  // of the element and want to return the side
2035  if (pr.second.first == side && pr.second.second == boundary_id_in)
2036  return side;
2037 
2038  p = parent;
2039  }
2040  // If the parent is not on the same side, other ancestors won't be on the same side either
2041  else
2042  break;
2043  }
2044  }
2045  }
2046 #endif
2047 
2048  // if we get here, we found elem in the data structure but not
2049  // the requested boundary id, so return the default value
2050  return libMesh::invalid_uint;
2051 }
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:310
std::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:140

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

2057 {
2058  std::vector<unsigned int> returnval;
2059 
2060  const Elem * searched_elem = elem;
2061  if (elem->level() != 0 && !_children_on_boundary)
2062  searched_elem = elem->top_parent();
2063 
2064  // elem may have zero or multiple occurrences
2065  for (const auto & pr : as_range(_boundary_side_id.equal_range(searched_elem)))
2066  {
2067  // if this is true we found the requested boundary_id
2068  // of the element and want to return the side
2069  if (pr.second.second == boundary_id_in)
2070  {
2071  unsigned int side = pr.second.first;
2072 
2073  // Here we branch out. If we don't allow time-dependent boundary domains,
2074  // we need to check if our parents are consistent.
2075  if (!_children_on_boundary)
2076  {
2077  // If we're on this external boundary then we share this
2078  // external boundary id
2079  if (elem->neighbor_ptr(side) == nullptr)
2080  {
2081  returnval.push_back(side);
2082  continue;
2083  }
2084 
2085  // If we're on an internal boundary then we need to be sure
2086  // it's the same internal boundary as our top_parent
2087  const Elem * p = elem;
2088 
2089 #ifdef LIBMESH_ENABLE_AMR
2090 
2091  while (p != nullptr)
2092  {
2093  const Elem * parent = p->parent();
2094  if (parent && !parent->is_child_on_side(parent->which_child_am_i(p), side))
2095  break;
2096  p = parent;
2097  }
2098 #endif
2099  // We're on that side of our top_parent; return it
2100  if (!p)
2101  returnval.push_back(side);
2102  }
2103  // Otherwise we trust what we got and return the side
2104  else
2105  returnval.push_back(side);
2106  }
2107  }
2108 
2109 #ifdef LIBMESH_ENABLE_AMR
2110  // We might have instances (especially with moving boundary domains) when we
2111  // query the parent boundary ID on a child.
2112  if (_children_on_boundary && elem->level() != 0)
2113  {
2114  for (auto side : make_range(elem->n_sides()))
2115  {
2116  const Elem * p = elem;
2117  while (p->parent() != nullptr)
2118  {
2119  const Elem * parent = p->parent();
2120  // First we make sure the parent shares this side
2121  if (parent->is_child_on_side(parent->which_child_am_i(p), side))
2122  {
2123  // parent may have multiple boundary ids
2124  for (const auto & pr : as_range(_boundary_side_id.equal_range(parent)))
2125  {
2126  // if this is true we found the requested boundary_id
2127  // of the element and want to add the side to the vector. We
2128  // also need to check if the side is already in the vector. This might
2129  // happen if the child inherits the boundary from the parent.
2130  if (pr.second.first == side && pr.second.second == boundary_id_in &&
2131  std::find(returnval.begin(), returnval.end(), side) == returnval.end())
2132  returnval.push_back(side);
2133  }
2134  }
2135  // If the parent is not on the same side, other ancestors won't be on the same side either
2136  else
2137  break;
2138  p = parent;
2139  }
2140  }
2141  }
2142 #endif
2143 
2144  return returnval;
2145 }
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:140

◆ sideset_name()

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

Definition at line 3038 of file boundary_info.C.

References _ss_id_to_name.

Referenced by libMesh::AbaqusIO::assign_sideset_ids(), libMesh::MeshTools::Generation::build_cube(), build_side_list_from_node_list(), libMesh::UNVIO::groups_in(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::GmshIO::read_mesh(), MeshStitchTest::renameAndShift(), MeshInputTest::testGmshBCIDOverlap(), BoundaryInfoTest::testNameCopying(), BoundaryInfoTest::testRenumber(), and WriteSidesetData::testWriteImpl().

3039 {
3040  return _ss_id_to_name[id];
3041 }
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 ...

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

429 {
430  std::set<boundary_id_type> request_boundary_ids(_boundary_ids);
431  request_boundary_ids.insert(invalid_id);
432  if (!_mesh->is_serial())
433  this->comm().set_union(request_boundary_ids);
434 
435  this->sync(request_boundary_ids,
436  boundary_mesh);
437 }
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:211
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 441 of file boundary_info.C.

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

443 {
444  // Call the 3 argument version of this function with a dummy value for the third set.
445  std::set<subdomain_id_type> subdomains_relative_to;
446  subdomains_relative_to.insert(Elem::invalid_subdomain_id);
447 
448  this->sync(requested_boundary_ids,
449  boundary_mesh,
450  subdomains_relative_to);
451 }
void sync(UnstructuredMesh &boundary_mesh)
Generates boundary_mesh data structures corresponding to the mesh data structures.
static const subdomain_id_type invalid_subdomain_id
A static integral constant representing an invalid subdomain id.
Definition: elem.h:251

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

458 {
459  LOG_SCOPE("sync()", "BoundaryInfo");
460 
461  boundary_mesh.clear();
462 
468  if (!_mesh->is_serial())
469  boundary_mesh.delete_remote_elements();
470 
488  std::unique_ptr<MeshBase> mesh_copy;
489  if (boundary_mesh.is_serial() && !_mesh->is_serial())
490  mesh_copy = _mesh->clone();
491 
492  auto serializer = std::make_unique<MeshSerializer>
493  (const_cast<MeshBase &>(*_mesh), boundary_mesh.is_serial());
494 
499  boundary_mesh.set_n_partitions() = _mesh->n_partitions();
500 
501  std::map<dof_id_type, dof_id_type> node_id_map;
502  std::map<std::pair<dof_id_type, unsigned char>, dof_id_type> side_id_map;
503 
504  this->_find_id_maps(requested_boundary_ids, 0, &node_id_map, 0, &side_id_map, subdomains_relative_to);
505 
506  // Let's add all the boundary nodes we found to the boundary mesh
507  for (const auto & node : _mesh->node_ptr_range())
508  {
509  dof_id_type node_id = node->id();
510  if (node_id_map.count(node_id))
511  {
512  boundary_mesh.add_point(*node, node_id_map[node_id], node->processor_id());
513 
514  // Copy over all the node's boundary IDs to boundary_mesh
515  std::vector<boundary_id_type> node_boundary_ids;
516  this->boundary_ids(node, node_boundary_ids);
517  for (const auto & node_bid : node_boundary_ids)
518  boundary_mesh.get_boundary_info().add_node(node_id_map[node_id], node_bid);
519  }
520  }
521 
522  // Add the elements. When syncing a boundary mesh, we also store the
523  // parent side ids in addition to the interior_parent pointers,
524  // since this information is frequently needed on boundary meshes.
525  this->add_elements(requested_boundary_ids,
526  boundary_mesh,
527  subdomains_relative_to,
528  /*store_parent_side_ids=*/true);
529 
530  // The new elements are currently using the interior mesh's nodes;
531  // we want them to use the boundary mesh's nodes instead.
532 
533  // This side's Node pointers still point to the nodes of the original mesh.
534  // We need to re-point them to the boundary mesh's nodes! Since we copied *ALL* of
535  // the original mesh's nodes over, we should be guaranteed to have the same ordering.
536  for (auto & new_elem : boundary_mesh.element_ptr_range())
537  {
538  for (auto nn : new_elem->node_index_range())
539  {
540  // Get the correct node pointer, based on the id()
541  Node * new_node =
542  boundary_mesh.node_ptr(node_id_map[new_elem->node_id(nn)]);
543 
544  // sanity check: be sure that the new Node exists and its
545  // global id really matches
546  libmesh_assert (new_node);
547  libmesh_assert_equal_to (new_node->id(),
548  node_id_map[new_elem->node_id(nn)]);
549 
550  // Assign the new node pointer
551  new_elem->set_node(nn, new_node);
552  }
553  }
554 
555  // The new elements might have interior parent pointers aimed at
556  // _mesh elements which are about to go remote, and we don't to
557  // leave those pointers dangling. Fix them up if needed.
558  if (mesh_copy.get())
559  {
560  for (auto & new_elem : boundary_mesh.element_ptr_range())
561  {
562  const dof_id_type interior_parent_id =
563  new_elem->interior_parent()->id();
564 
565  if (!mesh_copy->query_elem_ptr(interior_parent_id))
566  new_elem->set_interior_parent
567  (const_cast<RemoteElem *>(remote_elem));
568  }
569  }
570 
571  // Don't repartition this mesh; we want it to stay in sync with the
572  // interior partitioning.
573  boundary_mesh.partitioner().reset(nullptr);
574 
575  // Deserialize the interior mesh before the boundary mesh
576  // prepare_for_use() can come to erroneous conclusions about which
577  // of its elements are semilocal
578  serializer.reset();
579 
580  // Make boundary_mesh nodes and elements contiguous
581  boundary_mesh.prepare_for_use();
582 
583  // and finally distribute element partitioning to the nodes
585 }
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:211
libmesh_assert(ctx)
unsigned int n_partitions() const
Definition: mesh_base.h:1345
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

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

2192 {
2193  // this is only needed when we allow boundary to be associated with children elements
2194  // also, we only transfer the parent's boundary ids when we are actually coarsen the child element
2195  if (!_children_on_boundary ||
2196  !(!parent->active() && parent->refinement_flag() == Elem::COARSEN_INACTIVE))
2197  return;
2198 
2199  // We assume that edges can be divided ito two pieces, while triangles and
2200  // quads can be divided into four smaller areas. This is double because we'll need
2201  // to convert the ratio of the children with given boundary id to a double.
2202  const double number_of_sides_on_children = std::pow(2, parent->dim()-1);
2203 
2204  // In this case the input argument elem is the parent element. We need to check all of its sides
2205  // to grab any potential boundary ids.
2206  for (unsigned int side_i = 0; side_i < parent->n_sides(); ++side_i)
2207  {
2208  // An temporary storage to count how many times the children's boundaries occur. the general
2209  // consensus is that if the boundary occurs more than once we propagate upon coarsening. Otherwise,
2210  // it will get deleted.
2211  std::map<unsigned short int, unsigned short int> boundary_counts;
2212 
2213  for (const auto & child_i : make_range(parent->n_children()))
2214  {
2215  // We only need to check the children which share the side
2216  if (parent->is_child_on_side(child_i, side_i))
2217  {
2218  // Fetching the boundary tags on the child's side
2219  for (const auto & pr : as_range(_boundary_side_id.equal_range(parent->child_ptr(child_i))))
2220  {
2221  // Making sure we are on the same boundary
2222  if (pr.second.first == side_i)
2223  ++boundary_counts[pr.second.second];
2224  }
2225  }
2226  }
2227 
2228  // This is where the decision is made. If 50% of the children have the tags,
2229  // we propagate them upwards upon coarsening. Otherwise, they are deleted.
2230  for (const auto & boundary : boundary_counts)
2231  if (boundary.second / number_of_sides_on_children > 0.5)
2232  this->add_side(parent, side_i, boundary.first);
2233  }
2234 
2235  for (const auto & child_i : make_range(parent->n_children()))
2236  this->remove(parent->child_ptr(child_i));
2237 }
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:328
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:140

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 1000 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_id(), renumber_id(), and sync().

◆ _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 1034 of file boundary_info.h.

Referenced by add_edge(), clear(), get_edge_boundary_ids(), operator=(), operator==(), regenerate_id_sets(), remove_id(), and renumber_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 1084 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_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 1012 of file boundary_info.h.

Referenced by get_global_boundary_ids(), operator=(), operator==(), regenerate_id_sets(), and remove_id().

◆ _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 1045 of file boundary_info.h.

Referenced by add_node(), clear(), get_node_boundary_ids(), operator=(), operator==(), regenerate_id_sets(), remove_id(), and renumber_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 1075 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_id(), renumber_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 1057 of file boundary_info.h.

Referenced by add_shellface(), clear(), get_shellface_boundary_ids(), operator=(), operator==(), regenerate_id_sets(), remove_id(), and renumber_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 1023 of file boundary_info.h.

Referenced by add_side(), clear(), get_side_boundary_ids(), operator=(), operator==(), regenerate_id_sets(), remove_id(), and renumber_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 1066 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_id(), renumber_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: