libMesh::BoundaryInfo Class Reference

Used by the Mesh to keep track of boundary nodes and elements. More...

#include <boundary_info.h>

Inheritance diagram for libMesh::BoundaryInfo:

Public Member Functions

BoundaryInfooperator= (const BoundaryInfo &other_boundary_info)
 
 ~BoundaryInfo ()
 
void clear ()
 
void regenerate_id_sets ()
 
void sync (UnstructuredMesh &boundary_mesh)
 
void sync (const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh)
 
void sync (const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh, const std::set< subdomain_id_type > &subdomains_relative_to)
 
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)
 
void add_elements (const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh)
 
void add_elements (const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh, const std::set< subdomain_id_type > &subdomains_relative_to)
 
void add_node (const Node *node, const boundary_id_type id)
 
void add_node (const dof_id_type node, const boundary_id_type id)
 
void add_node (const Node *node, const std::vector< boundary_id_type > &ids)
 
void clear_boundary_node_ids ()
 
void add_edge (const dof_id_type elem, const unsigned short int edge, const boundary_id_type id)
 
void add_edge (const Elem *elem, const unsigned short int edge, const boundary_id_type id)
 
void add_edge (const Elem *elem, const unsigned short int edge, const std::vector< boundary_id_type > &ids)
 
void add_shellface (const dof_id_type elem, const unsigned short int shellface, const boundary_id_type id)
 
void add_shellface (const Elem *elem, const unsigned short int shellface, const boundary_id_type id)
 
void add_shellface (const Elem *elem, const unsigned short int shellface, const std::vector< boundary_id_type > &ids)
 
void add_side (const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
 
void add_side (const Elem *elem, const unsigned short int side, const boundary_id_type id)
 
void add_side (const Elem *elem, const unsigned short int side, const std::vector< boundary_id_type > &ids)
 
void remove (const Node *node)
 
void remove (const Elem *elem)
 
void remove_edge (const Elem *elem, const unsigned short int edge)
 
void remove_edge (const Elem *elem, const unsigned short int edge, const boundary_id_type id)
 
void remove_shellface (const Elem *elem, const unsigned short int shellface)
 
void remove_shellface (const Elem *elem, const unsigned short int shellface, const boundary_id_type id)
 
void remove_side (const Elem *elem, const unsigned short int side)
 
void remove_side (const Elem *elem, const unsigned short int side, const boundary_id_type id)
 
void remove_id (boundary_id_type id)
 
std::size_t n_boundary_ids () const
 
bool has_boundary_id (const Node *const node, const boundary_id_type id) const
 
std::vector< boundary_id_typeboundary_ids (const Node *node) const
 
void boundary_ids (const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
 
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
 
std::vector< boundary_id_typeedge_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
 
std::vector< boundary_id_typeraw_edge_boundary_ids (const Elem *const elem, const unsigned short int edge) 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
 
boundary_id_type boundary_id (const Elem *const elem, const unsigned short int side) const
 
unsigned int n_boundary_ids (const Elem *const elem, const unsigned short int side) const
 
std::vector< boundary_id_typeboundary_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
 
std::vector< boundary_id_typeraw_boundary_ids (const Elem *const elem, const unsigned short int side) 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
 
void build_node_boundary_ids (std::vector< boundary_id_type > &b_ids) const
 
void build_side_boundary_ids (std::vector< boundary_id_type > &b_ids) const
 
void build_shellface_boundary_ids (std::vector< boundary_id_type > &b_ids) const
 
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
 
void build_node_list_from_side_list ()
 
void build_side_list_from_node_list ()
 
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
 
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
 
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
 
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
 
const std::set< boundary_id_type > & get_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=libMesh::out) const
 
void print_summary (std::ostream &out=libMesh::out) const
 
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)
 
boundary_id_type get_id_by_name (const std::string &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
 
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
 

Protected Member Functions

 BoundaryInfo (MeshBase &m)
 

Protected Attributes

const Parallel::Communicator_communicator
 

Private Types

typedef std::multimap< const Node *, boundary_id_type >::const_iterator boundary_node_iter
 
typedef std::multimap< const Node *, boundary_id_type >::iterator boundary_node_erase_iter
 
typedef std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_edge_iter
 
typedef std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_shellface_iter
 
typedef std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
 
typedef std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::iterator erase_iter
 

Private Member Functions

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)
 

Private Attributes

MeshBase_mesh
 
std::multimap< const Node *, boundary_id_type_boundary_node_id
 
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
 
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
 
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
 
std::set< boundary_id_type_boundary_ids
 
std::set< boundary_id_type_side_boundary_ids
 
std::set< boundary_id_type_edge_boundary_ids
 
std::set< boundary_id_type_node_boundary_ids
 
std::set< boundary_id_type_shellface_boundary_ids
 
std::map< boundary_id_type, std::string > _ss_id_to_name
 
std::map< boundary_id_type, std::string > _ns_id_to_name
 

Friends

class MeshBase
 

Detailed Description

Used by the Mesh to keep track of boundary nodes and elements.

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

Definition at line 56 of file boundary_info.h.

Member Typedef Documentation

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

Typedef for iterators into the _boundary_edge_id container.

Definition at line 847 of file boundary_info.h.

typedef std::multimap<const Node *, boundary_id_type>::iterator libMesh::BoundaryInfo::boundary_node_erase_iter
private

Some older compilers don't support erasing from a map with const_iterators, so we need to use a non-const iterator in those situations.

Definition at line 833 of file boundary_info.h.

typedef std::multimap<const Node *, boundary_id_type>::const_iterator libMesh::BoundaryInfo::boundary_node_iter
private

Typedef for iterators into the _boundary_node_id container.

Definition at line 826 of file boundary_info.h.

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

Typedef for iterators into the _boundary_shellface_id container.

Definition at line 861 of file boundary_info.h.

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

Typedef for iterators into the _boundary_side_id container.

Definition at line 876 of file boundary_info.h.

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

Some older compilers don't support erasing from a map with const_iterators, so we need to use a non-const iterator in those situations.

Definition at line 884 of file boundary_info.h.

Constructor & Destructor Documentation

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

49  :
50  ParallelObject(m.comm()),
51  _mesh (m)
52 {
53 }
ParallelObject(const Parallel::Communicator &comm_in)
libMesh::BoundaryInfo::~BoundaryInfo ( )

Destructor. Not much to do.

Definition at line 132 of file boundary_info.C.

References clear().

133 {
134  this->clear();
135 }

Member Function Documentation

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 NULL, in which case it will not be filled.

Definition at line 2478 of file boundary_info.C.

References _boundary_side_id, _mesh, libMesh::Elem::build_side_ptr(), libMesh::ParallelObject::comm(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::DofObject::id(), invalid_id, libMesh::DofObject::invalid_processor_id, libMesh::Elem::invalid_subdomain_id, libMesh::libmesh_assert(), libmesh_nullptr, libMesh::ParallelObject::n_processors(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), libMesh::MeshBase::pid_elements_begin(), libMesh::MeshBase::pid_elements_end(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::Parallel::Communicator::set_union(), side, libMesh::Elem::subdomain_id(), and libMesh::Elem::top_parent().

Referenced by add_elements(), and sync().

2484 {
2485  // We'll do the same modulus trick that DistributedMesh uses to avoid
2486  // id conflicts between different processors
2487  dof_id_type
2488  next_node_id = first_free_node_id + this->processor_id(),
2489  next_elem_id = first_free_elem_id + this->processor_id();
2490 
2491  // We'll pass through the mesh once first to build
2492  // the maps and count boundary nodes and elements.
2493  // To find local boundary nodes, we have to examine all elements
2494  // here rather than just local elements, because it's possible to
2495  // have a local boundary node that's not on a local boundary
2496  // element, e.g. at the tip of a triangle.
2497 
2498  // We'll loop through two different ranges here: first all elements,
2499  // looking for local nodes, and second through unpartitioned
2500  // elements, looking for all remaining nodes.
2501  const MeshBase::const_element_iterator end_el = _mesh.elements_end();
2502  bool hit_end_el = false;
2503  const MeshBase::const_element_iterator end_unpartitioned_el =
2505 
2506  for (MeshBase::const_element_iterator el = _mesh.elements_begin();
2507  !hit_end_el || (el != end_unpartitioned_el); ++el)
2508  {
2509  if ((el == end_el) && !hit_end_el)
2510  {
2511  // Note that we're done with local nodes and just looking
2512  // for remaining unpartitioned nodes
2513  hit_end_el = true;
2514 
2515  // Join up the local results from other processors
2516  if (side_id_map)
2517  this->comm().set_union(*side_id_map);
2518  if (node_id_map)
2519  this->comm().set_union(*node_id_map);
2520 
2521  // Finally we'll pass through any unpartitioned elements to add them
2522  // to the maps and counts.
2523  next_node_id = first_free_node_id + this->n_processors();
2524  next_elem_id = first_free_elem_id + this->n_processors();
2525 
2527  if (el == end_unpartitioned_el)
2528  break;
2529  }
2530 
2531  const Elem * elem = *el;
2532 
2533  // If the subdomains_relative_to container has the
2534  // invalid_subdomain_id, we fall back on the "old" behavior of
2535  // adding sides regardless of this Elem's subdomain. Otherwise,
2536  // if the subdomains_relative_to container doesn't contain the
2537  // current Elem's subdomain_id(), we won't add any sides from
2538  // it.
2539  if (!subdomains_relative_to.count(Elem::invalid_subdomain_id) &&
2540  !subdomains_relative_to.count(elem->subdomain_id()))
2541  continue;
2542 
2543  // Get the top-level parent for this element. This is used for
2544  // searching for boundary sides on this element.
2545  const Elem * top_parent = elem->top_parent();
2546 
2547  // Find all the boundary side ids for this Elem.
2548  const std::pair<boundary_side_iter, boundary_side_iter>
2549  range = _boundary_side_id.equal_range(top_parent);
2550 
2551  for (unsigned char s=0; s<elem->n_sides(); s++)
2552  {
2553  bool add_this_side = false;
2554  boundary_id_type this_bcid = invalid_id;
2555 
2556  for (boundary_side_iter bsi = range.first; bsi != range.second; ++bsi)
2557  {
2558  this_bcid = bsi->second.second;
2559 
2560  // if this side is flagged with a boundary condition
2561  // and the user wants this id
2562  if ((bsi->second.first == s) &&
2563  (requested_boundary_ids.count(this_bcid)))
2564  {
2565  add_this_side = true;
2566  break;
2567  }
2568  }
2569 
2570  // We may still want to add this side if the user called
2571  // sync() with no requested_boundary_ids. This corresponds
2572  // to the "old" style of calling sync() in which the entire
2573  // boundary was copied to the BoundaryMesh, and handles the
2574  // case where elements on the geometric boundary are not in
2575  // any sidesets.
2576  if (range.first == range.second &&
2577  requested_boundary_ids.count(invalid_id) &&
2578  elem->neighbor_ptr(s) == libmesh_nullptr)
2579  add_this_side = true;
2580 
2581  if (add_this_side)
2582  {
2583  // We only assign ids for our own and for
2584  // unpartitioned elements
2585  if (side_id_map &&
2586  ((elem->processor_id() == this->processor_id()) ||
2587  (elem->processor_id() ==
2589  {
2590  std::pair<dof_id_type, unsigned char> side_pair(elem->id(), s);
2591  libmesh_assert (!side_id_map->count(side_pair));
2592  (*side_id_map)[side_pair] = next_elem_id;
2593  next_elem_id += this->n_processors() + 1;
2594  }
2595 
2596  // Use a proxy element for the side to query nodes
2597  UniquePtr<const Elem> side (elem->build_side_ptr(s));
2598  for (unsigned int n = 0; n != side->n_nodes(); ++n)
2599  {
2600  const Node & node = side->node_ref(n);
2601 
2602  // In parallel we don't know enough to number
2603  // others' nodes ourselves.
2604  if (!hit_end_el &&
2605  (node.processor_id() != this->processor_id()))
2606  continue;
2607 
2608  dof_id_type node_id = node.id();
2609  if (node_id_map && !node_id_map->count(node_id))
2610  {
2611  (*node_id_map)[node_id] = next_node_id;
2612  next_node_id += this->n_processors() + 1;
2613  }
2614  }
2615  }
2616  }
2617  }
2618 
2619  // FIXME: ought to renumber side/node_id_map image to be contiguous
2620  // to save memory, also ought to reserve memory
2621 }
unsigned short int side
Definition: xdr_io.C:49
processor_id_type n_processors() const
const class libmesh_nullptr_t libmesh_nullptr
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
libmesh_assert(j)
virtual element_iterator elements_begin()=0
static const subdomain_id_type invalid_subdomain_id
Definition: elem.h:213
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
static const processor_id_type invalid_processor_id
Definition: dof_object.h:345
virtual element_iterator elements_end()=0
virtual element_iterator pid_elements_begin(processor_id_type proc_id)=0
const Parallel::Communicator & comm() const
processor_id_type processor_id() const
uint8_t dof_id_type
Definition: id_types.h:64
void set_union(T &data, const unsigned int root_id) const
virtual element_iterator pid_elements_end(processor_id_type proc_id)=0
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 736 of file boundary_info.C.

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

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), copy_boundary_ids(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::ReplicatedMesh::stitching_helper(), and libMesh::Parallel::Packing< Elem * >::unpack().

739 {
740  this->add_edge (_mesh.elem_ptr(e), edge, id);
741 }
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)
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 745 of file boundary_info.C.

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

748 {
749  libmesh_assert(elem);
750 
751  // Only add BCs for level-0 elements.
752  libmesh_assert_equal_to (elem->level(), 0);
753 
754  if (id == invalid_id)
755  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
756  << invalid_id \
757  << "\n That is reserved for internal use.");
758 
759  // Don't add the same ID twice
760  std::pair<boundary_edge_iter, boundary_edge_iter> pos = _boundary_edge_id.equal_range(elem);
761 
762  for (; pos.first != pos.second; ++pos.first)
763  if (pos.first->second.first == edge &&
764  pos.first->second.second == id)
765  return;
766 
767  _boundary_edge_id.insert(std::make_pair(elem, std::make_pair(edge, id)));
768  _boundary_ids.insert(id);
769  _edge_boundary_ids.insert(id); // Also add this ID to the set of edge boundary IDs
770 }
std::set< boundary_id_type > _edge_boundary_ids
std::set< boundary_id_type > _boundary_ids
libmesh_assert(j)
static const boundary_id_type invalid_id
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
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 774 of file boundary_info.C.

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

777 {
778  if (ids.empty())
779  return;
780 
781  libmesh_assert(elem);
782 
783  // Only add BCs for level-0 elements.
784  libmesh_assert_equal_to (elem->level(), 0);
785 
786  // Don't add the same ID twice
787  std::pair<boundary_edge_iter, boundary_edge_iter> pos = _boundary_edge_id.equal_range(elem);
788 
789  // The entries in the ids vector may be non-unique. If we expected
790  // *lots* of ids, it might be fastest to construct a std::set from
791  // the entries, but for a small number of entries, which is more
792  // typical, it is probably faster to copy the vector and do sort+unique.
793  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
794  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
795  std::sort(unique_ids.begin(), unique_ids.end());
796  std::vector<boundary_id_type>::iterator new_end =
797  std::unique(unique_ids.begin(), unique_ids.end());
798 
799  std::vector<boundary_id_type>::iterator it = unique_ids.begin();
800  for (; it != new_end; ++it)
801  {
802  boundary_id_type id = *it;
803 
804  if (id == invalid_id)
805  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
806  << invalid_id \
807  << "\n That is reserved for internal use.");
808 
809  bool already_inserted = false;
810  for (boundary_edge_iter p = pos.first; p != pos.second; ++p)
811  if (p->second.first == edge &&
812  p->second.second == id)
813  {
814  already_inserted = true;
815  break;
816  }
817  if (already_inserted)
818  continue;
819 
820  _boundary_edge_id.insert(std::make_pair(elem, std::make_pair(edge, id)));
821  _boundary_ids.insert(id);
822  _edge_boundary_ids.insert(id); // Also add this ID to the set of edge boundary IDs
823  }
824 }
std::set< boundary_id_type > _edge_boundary_ids
std::set< boundary_id_type > _boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_edge_iter
libmesh_assert(j)
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
void libMesh::BoundaryInfo::add_elements ( const std::set< boundary_id_type > &  requested_boundary_ids,
UnstructuredMesh boundary_mesh 
)

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

References libMesh::Elem::invalid_subdomain_id.

Referenced by sync().

397 {
398  // Call the 3 argument version of this function with a dummy value for the third arg.
399  std::set<subdomain_id_type> subdomains_relative_to;
400  subdomains_relative_to.insert(Elem::invalid_subdomain_id);
401 
402  this->add_elements(requested_boundary_ids,
403  boundary_mesh,
404  subdomains_relative_to);
405 }
void add_elements(const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh)
static const subdomain_id_type invalid_subdomain_id
Definition: elem.h:213
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 
)

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

References _boundary_side_id, _find_id_maps(), _mesh, libMesh::MeshBase::add_elem(), libMesh::Elem::build_side_ptr(), libMesh::MeshBase::elem_ptr(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::DofObject::id(), libMesh::Elem::INACTIVE, invalid_id, libMesh::Elem::invalid_subdomain_id, libMesh::Elem::is_node_on_side(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_ids(), libmesh_nullptr, libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshBase::max_elem_id(), libMesh::Elem::n_nodes(), libMesh::Elem::n_sides(), libMesh::Elem::n_vertices(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::node_ptr(), libMesh::MeshBase::parallel_max_unique_id(), libMesh::Elem::parent(), libMesh::Elem::point(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::remote_elem, libMesh::Elem::set_interior_parent(), libMesh::Elem::set_neighbor(), libMesh::Elem::set_parent(), side, libMesh::Elem::subdomain_id(), and libMesh::Elem::top_parent().

412 {
413  LOG_SCOPE("add_elements()", "BoundaryInfo");
414 
415  // We're not prepared to mix serial and distributed meshes in this
416  // method, so make sure they match from the start.
417  libmesh_assert_equal_to(_mesh.is_serial(),
418  boundary_mesh.is_serial());
419 
420  std::map<std::pair<dof_id_type, unsigned char>, dof_id_type> side_id_map;
421  this->_find_id_maps(requested_boundary_ids,
422  0,
424  boundary_mesh.max_elem_id(),
425  &side_id_map,
426  subdomains_relative_to);
427 
428  // We have to add sides *outside* any element loop, because if
429  // boundary_mesh and _mesh are the same then those additions can
430  // invalidate our element iterators. So we just use the element
431  // loop to make a list of sides to add.
432  typedef std::vector<std::pair<dof_id_type, unsigned char> >
433  side_container;
434  side_container sides_to_add;
435 
436  const MeshBase::const_element_iterator end_el = _mesh.elements_end();
437  for (MeshBase::const_element_iterator el = _mesh.elements_begin();
438  el != end_el; ++el)
439  {
440  const Elem * elem = *el;
441 
442  // If the subdomains_relative_to container has the
443  // invalid_subdomain_id, we fall back on the "old" behavior of
444  // adding sides regardless of this Elem's subdomain. Otherwise,
445  // if the subdomains_relative_to container doesn't contain the
446  // current Elem's subdomain_id(), we won't add any sides from
447  // it.
448  if (!subdomains_relative_to.count(Elem::invalid_subdomain_id) &&
449  !subdomains_relative_to.count(elem->subdomain_id()))
450  continue;
451 
452  // Get the top-level parent for this element
453  const Elem * top_parent = elem->top_parent();
454 
455  // Find all the boundary side ids for this Elem.
456  const std::pair<boundary_side_iter, boundary_side_iter>
457  range = _boundary_side_id.equal_range(top_parent);
458 
459  for (unsigned int s=0; s<elem->n_sides(); s++)
460  {
461  bool add_this_side = false;
462  boundary_id_type this_bcid = invalid_id;
463 
464  for (boundary_side_iter bsi = range.first; bsi != range.second; ++bsi)
465  {
466  this_bcid = bsi->second.second;
467 
468  // if this side is flagged with a boundary condition
469  // and the user wants this id
470  if ((bsi->second.first == s) &&
471  (requested_boundary_ids.count(this_bcid)))
472  {
473  add_this_side = true;
474  break;
475  }
476  }
477 
478  // We may still want to add this side if the user called
479  // sync() with no requested_boundary_ids. This corresponds
480  // to the "old" style of calling sync() in which the entire
481  // boundary was copied to the BoundaryMesh, and handles the
482  // case where elements on the geometric boundary are not in
483  // any sidesets.
484  if (range.first == range.second &&
485  requested_boundary_ids.count(invalid_id) &&
486  elem->neighbor_ptr(s) == libmesh_nullptr)
487  add_this_side = true;
488 
489  if (add_this_side)
490  sides_to_add.push_back(std::make_pair(elem->id(), s));
491  }
492  }
493 
494 #ifdef LIBMESH_ENABLE_UNIQUE_ID
495  unique_id_type old_max_unique_id = boundary_mesh.parallel_max_unique_id();
496 #endif
497 
498  for (side_container::const_iterator it = sides_to_add.begin();
499  it != sides_to_add.end(); ++it)
500  {
501  const dof_id_type elem_id = it->first;
502  const unsigned char s = it->second;
503  Elem * elem = _mesh.elem_ptr(elem_id);
504 
505  // Build the side - do not use a "proxy" element here:
506  // This will be going into the boundary_mesh and needs to
507  // stand on its own.
508  UniquePtr<Elem> side (elem->build_side_ptr(s, false));
509 
510  side->processor_id() = elem->processor_id();
511 
512  const std::pair<dof_id_type, unsigned char> side_pair(elem_id, s);
513 
514  libmesh_assert(side_id_map.count(side_pair));
515 
516  const dof_id_type new_side_id = side_id_map[side_pair];
517 
518  side->set_id(new_side_id);
519 
520 #ifdef LIBMESH_ENABLE_UNIQUE_ID
521  side->set_unique_id() = old_max_unique_id + new_side_id;
522 #endif
523 
524  // Add the side
525  Elem * new_elem = boundary_mesh.add_elem(side.release());
526 
527 #ifdef LIBMESH_ENABLE_AMR
528  // Set parent links
529  if (elem->parent())
530  {
531  const std::pair<dof_id_type, unsigned char> parent_side_pair(elem->parent()->id(), s);
532 
533  libmesh_assert(side_id_map.count(parent_side_pair));
534 
535  Elem * side_parent = boundary_mesh.elem_ptr(side_id_map[parent_side_pair]);
536 
537  libmesh_assert(side_parent);
538 
539  new_elem->set_parent(side_parent);
540 
541  side_parent->set_refinement_flag(Elem::INACTIVE);
542 
543  // Figuring out which child we are of our parent
544  // is a trick. Due to libMesh child numbering
545  // conventions, if we are an element on a vertex,
546  // then we share that vertex with our parent, with
547  // the same local index.
548  bool found_child = false;
549  for (unsigned int v=0; v != new_elem->n_vertices(); ++v)
550  if (new_elem->node_ptr(v) == side_parent->node_ptr(v))
551  {
552  side_parent->add_child(new_elem, v);
553  found_child = true;
554  }
555 
556  // If we don't share any vertex with our parent,
557  // then we're the fourth child (index 3) of a
558  // triangle.
559  if (!found_child)
560  {
561  libmesh_assert_equal_to (new_elem->n_vertices(), 3);
562  side_parent->add_child(new_elem, 3);
563  }
564  }
565 #endif
566 
567  new_elem->set_interior_parent (const_cast<Elem *>(elem));
568 
569  // On non-local elements on DistributedMesh we might have
570  // RemoteElem neighbor links to construct
571  if (!_mesh.is_serial() &&
572  (elem->processor_id() != this->processor_id()))
573  {
574  // Check every interior side for a RemoteElem
575  for (unsigned int interior_side = 0;
576  interior_side != elem->n_sides();
577  ++interior_side)
578  {
579  // Might this interior side have a RemoteElem that
580  // needs a corresponding Remote on a boundary side?
581  if (elem->neighbor_ptr(interior_side) != remote_elem)
582  continue;
583 
584  // Which boundary side?
585  for (unsigned int boundary_side = 0;
586  boundary_side != new_elem->n_sides();
587  ++boundary_side)
588  {
589  // Look for matching node points. This is safe in
590  // *this* context.
591  bool found_all_nodes = true;
592  for (unsigned int boundary_node = 0;
593  boundary_node != new_elem->n_nodes();
594  ++boundary_node)
595  {
596  if (!new_elem->is_node_on_side(boundary_node,
597  boundary_side))
598  continue;
599 
600  bool found_this_node = false;
601  for (unsigned int interior_node = 0;
602  interior_node != elem->n_nodes();
603  ++interior_node)
604  {
605  if (!elem->is_node_on_side(interior_node,
606  interior_side))
607  continue;
608 
609  if (new_elem->point(boundary_node) ==
610  elem->point(interior_node))
611  {
612  found_this_node = true;
613  break;
614  }
615  }
616  if (!found_this_node)
617  {
618  found_all_nodes = false;
619  break;
620  }
621  }
622 
623  if (found_all_nodes)
624  {
625  new_elem->set_neighbor
626  (boundary_side,
627  const_cast<RemoteElem *>(remote_elem));
628  break;
629  }
630  }
631  }
632  }
633  }
634 
635  // We haven't been bothering to keep unique ids consistent on ghost
636  // elements
637  if (!boundary_mesh.is_serial())
638  MeshCommunication().make_node_unique_ids_parallel_consistent(boundary_mesh);
639 
640  // Make sure we didn't add ids inconsistently
641 #ifdef DEBUG
642 # ifdef LIBMESH_HAVE_RTTI
643  DistributedMesh * parmesh = dynamic_cast<DistributedMesh *>(&boundary_mesh);
644  if (parmesh)
645  parmesh->libmesh_assert_valid_parallel_ids();
646 # endif
647 #endif
648 }
virtual bool is_serial() const
Definition: mesh_base.h:137
unsigned short int side
Definition: xdr_io.C:49
const class libmesh_nullptr_t libmesh_nullptr
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
libmesh_assert(j)
virtual element_iterator elements_begin()=0
static const subdomain_id_type invalid_subdomain_id
Definition: elem.h:213
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
virtual element_iterator elements_end()=0
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)
virtual const Elem * elem_ptr(const dof_id_type i) const =0
uint8_t unique_id_type
Definition: id_types.h:79
processor_id_type processor_id() const
uint8_t dof_id_type
Definition: id_types.h:64
const RemoteElem * remote_elem
Definition: remote_elem.C:57
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 660 of file boundary_info.C.

References _boundary_ids, _boundary_node_id, _node_boundary_ids, and invalid_id.

Referenced by libMesh::MeshTools::Subdivision::add_boundary_ghosts(), add_node(), libMesh::AbaqusIO::assign_boundary_node_ids(), libMesh::MeshTools::Generation::build_extrusion(), build_node_list_from_side_list(), libMesh::MeshTools::Modification::change_boundary_id(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_nodesets(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::ReplicatedMesh::stitching_helper(), sync(), and libMesh::Parallel::Packing< Node * >::unpack().

662 {
663  if (id == invalid_id)
664  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
665  << invalid_id \
666  << "\n That is reserved for internal use.");
667 
668  // Don't add the same ID twice
669  std::pair<boundary_node_iter, boundary_node_iter> pos = _boundary_node_id.equal_range(node);
670 
671  for (; pos.first != pos.second; ++pos.first)
672  if (pos.first->second == id)
673  return;
674 
675  _boundary_node_id.insert(std::make_pair(node, id));
676  _boundary_ids.insert(id);
677  _node_boundary_ids.insert(id); // Also add this ID to the set of node boundary IDs
678 }
std::set< boundary_id_type > _node_boundary_ids
std::set< boundary_id_type > _boundary_ids
static const boundary_id_type invalid_id
std::multimap< const Node *, boundary_id_type > _boundary_node_id
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 652 of file boundary_info.C.

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

654 {
655  this->add_node (_mesh.node_ptr(node), id);
656 }
virtual const Node * node_ptr(const dof_id_type i) const =0
void add_node(const Node *node, const boundary_id_type id)
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 682 of file boundary_info.C.

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

684 {
685  if (ids.empty())
686  return;
687 
688  libmesh_assert(node);
689 
690  // Don't add the same ID twice
691  std::pair<boundary_node_iter, boundary_node_iter> pos = _boundary_node_id.equal_range(node);
692 
693  // The entries in the ids vector may be non-unique. If we expected
694  // *lots* of ids, it might be fastest to construct a std::set from
695  // the entries, but for a small number of entries, which is more
696  // typical, it is probably faster to copy the vector and do sort+unique.
697  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
698  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
699  std::sort(unique_ids.begin(), unique_ids.end());
700  std::vector<boundary_id_type>::iterator new_end =
701  std::unique(unique_ids.begin(), unique_ids.end());
702 
703  std::vector<boundary_id_type>::iterator it = unique_ids.begin();
704  for (; it != new_end; ++it)
705  {
706  boundary_id_type id = *it;
707 
708  if (id == invalid_id)
709  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
710  << invalid_id \
711  << "\n That is reserved for internal use.");
712 
713  bool already_inserted = false;
714  for (boundary_node_iter p = pos.first; p != pos.second; ++p)
715  if (p->second == id)
716  {
717  already_inserted = true;
718  break;
719  }
720  if (already_inserted)
721  continue;
722 
723  _boundary_node_id.insert(std::make_pair(node,id));
724  _boundary_ids.insert(id);
725  _node_boundary_ids.insert(id); // Also add this ID to the set of node boundary IDs
726  }
727 }
std::set< boundary_id_type > _node_boundary_ids
std::set< boundary_id_type > _boundary_ids
std::multimap< const Node *, boundary_id_type >::const_iterator boundary_node_iter
libmesh_assert(j)
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
std::multimap< const Node *, boundary_id_type > _boundary_node_id
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 828 of file boundary_info.C.

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

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), copy_boundary_ids(), libMesh::ExodusII_IO::read(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::ReplicatedMesh::stitching_helper(), and libMesh::Parallel::Packing< Elem * >::unpack().

831 {
832  this->add_shellface (_mesh.elem_ptr(e), shellface, id);
833 }
void add_shellface(const dof_id_type elem, const unsigned short int shellface, const boundary_id_type id)
virtual const Elem * elem_ptr(const dof_id_type i) const =0
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 837 of file boundary_info.C.

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

840 {
841  libmesh_assert(elem);
842 
843  // Only add BCs for level-0 elements.
844  libmesh_assert_equal_to (elem->level(), 0);
845 
846  // Shells only have 2 faces
847  libmesh_assert_less(shellface, 2);
848 
849  if (id == invalid_id)
850  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
851  << invalid_id \
852  << "\n That is reserved for internal use.");
853 
854  // Don't add the same ID twice
855  std::pair<boundary_shellface_iter, boundary_shellface_iter> pos = _boundary_shellface_id.equal_range(elem);
856 
857  for (; pos.first != pos.second; ++pos.first)
858  if (pos.first->second.first == shellface &&
859  pos.first->second.second == id)
860  return;
861 
862  _boundary_shellface_id.insert(std::make_pair(elem, std::make_pair(shellface, id)));
863  _boundary_ids.insert(id);
864  _shellface_boundary_ids.insert(id); // Also add this ID to the set of shellface boundary IDs
865 }
std::set< boundary_id_type > _boundary_ids
libmesh_assert(j)
static const boundary_id_type invalid_id
std::set< boundary_id_type > _shellface_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
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 869 of file boundary_info.C.

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

872 {
873  if (ids.empty())
874  return;
875 
876  libmesh_assert(elem);
877 
878  // Only add BCs for level-0 elements.
879  libmesh_assert_equal_to (elem->level(), 0);
880 
881  // Shells only have 2 faces
882  libmesh_assert_less(shellface, 2);
883 
884  // Don't add the same ID twice
885  std::pair<boundary_shellface_iter, boundary_shellface_iter> pos = _boundary_shellface_id.equal_range(elem);
886 
887  // The entries in the ids vector may be non-unique. If we expected
888  // *lots* of ids, it might be fastest to construct a std::set from
889  // the entries, but for a small number of entries, which is more
890  // typical, it is probably faster to copy the vector and do sort+unique.
891  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
892  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
893  std::sort(unique_ids.begin(), unique_ids.end());
894  std::vector<boundary_id_type>::iterator new_end =
895  std::unique(unique_ids.begin(), unique_ids.end());
896 
897  std::vector<boundary_id_type>::iterator it = unique_ids.begin();
898  for (; it != new_end; ++it)
899  {
900  boundary_id_type id = *it;
901 
902  if (id == invalid_id)
903  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
904  << invalid_id \
905  << "\n That is reserved for internal use.");
906 
907  bool already_inserted = false;
908  for (boundary_shellface_iter p = pos.first; p != pos.second; ++p)
909  if (p->second.first == shellface &&
910  p->second.second == id)
911  {
912  already_inserted = true;
913  break;
914  }
915  if (already_inserted)
916  continue;
917 
918  _boundary_shellface_id.insert(std::make_pair(elem, std::make_pair(shellface, id)));
919  _boundary_ids.insert(id);
920  _shellface_boundary_ids.insert(id); // Also add this ID to the set of shellface boundary IDs
921  }
922 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_shellface_iter
std::set< boundary_id_type > _boundary_ids
libmesh_assert(j)
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
std::set< boundary_id_type > _shellface_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
void libMesh::BoundaryInfo::add_side ( const dof_id_type  elem,
const unsigned short int  side,
const boundary_id_type  id 
)
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 934 of file boundary_info.C.

References _boundary_ids, _boundary_side_id, _side_boundary_ids, invalid_id, libMesh::Elem::level(), and libMesh::libmesh_assert().

937 {
938  libmesh_assert(elem);
939 
940  // Only add BCs for level-0 elements.
941  libmesh_assert_equal_to (elem->level(), 0);
942 
943  if (id == invalid_id)
944  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
945  << invalid_id \
946  << "\n That is reserved for internal use.");
947 
948  // Don't add the same ID twice
949  std::pair<boundary_side_iter, boundary_side_iter> pos = _boundary_side_id.equal_range(elem);
950 
951  for (; pos.first != pos.second; ++pos.first)
952  if (pos.first->second.first == side &&
953  pos.first->second.second == id)
954  return;
955 
956  _boundary_side_id.insert(std::make_pair(elem, std::make_pair(side, id)));
957  _boundary_ids.insert(id);
958  _side_boundary_ids.insert(id); // Also add this ID to the set of side boundary IDs
959 }
std::set< boundary_id_type > _boundary_ids
unsigned short int side
Definition: xdr_io.C:49
std::set< boundary_id_type > _side_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
libmesh_assert(j)
static const boundary_id_type invalid_id
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 963 of file boundary_info.C.

References _boundary_ids, _boundary_side_id, _side_boundary_ids, invalid_id, libMesh::Elem::level(), and libMesh::libmesh_assert().

966 {
967  if (ids.empty())
968  return;
969 
970  libmesh_assert(elem);
971 
972  // Only add BCs for level-0 elements.
973  libmesh_assert_equal_to (elem->level(), 0);
974 
975  // Don't add the same ID twice
976  std::pair<boundary_side_iter, boundary_side_iter> pos = _boundary_side_id.equal_range(elem);
977 
978  // The entries in the ids vector may be non-unique. If we expected
979  // *lots* of ids, it might be fastest to construct a std::set from
980  // the entries, but for a small number of entries, which is more
981  // typical, it is probably faster to copy the vector and do sort+unique.
982  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
983  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
984  std::sort(unique_ids.begin(), unique_ids.end());
985  std::vector<boundary_id_type>::iterator new_end =
986  std::unique(unique_ids.begin(), unique_ids.end());
987 
988  std::vector<boundary_id_type>::const_iterator it = unique_ids.begin();
989  for (; it != new_end; ++it)
990  {
991  boundary_id_type id = *it;
992 
993  if (id == invalid_id)
994  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
995  << invalid_id \
996  << "\n That is reserved for internal use.");
997 
998  bool already_inserted = false;
999  for (boundary_side_iter p = pos.first; p != pos.second; ++p)
1000  if (p->second.first == side && p->second.second == id)
1001  {
1002  already_inserted = true;
1003  break;
1004  }
1005  if (already_inserted)
1006  continue;
1007 
1008  _boundary_side_id.insert(std::make_pair(elem, std::make_pair(side, id)));
1009  _boundary_ids.insert(id);
1010  _side_boundary_ids.insert(id); // Also add this ID to the set of side boundary IDs
1011  }
1012 }
std::set< boundary_id_type > _boundary_ids
unsigned short int side
Definition: xdr_io.C:49
std::set< boundary_id_type > _side_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
libmesh_assert(j)
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
boundary_id_type libMesh::BoundaryInfo::boundary_id ( const Elem *const  elem,
const unsigned short int  side 
) const
Returns
The boundary id associated with the side side of element elem, or invalid_id if the side does not have an associated boundary id.
Note
Only one id per side is allowed, however multiple sides per element are allowed.
Deprecated:
Asking for just one boundary id means your code isn't safe to use on meshes with overlapping boundary ids. Try using BoundaryInfo::boundary_ids() or BoundaryInfo::has_boundary_id() instead.

Definition at line 1256 of file boundary_info.C.

References boundary_ids(), and invalid_id.

Referenced by n_boundary_ids().

1258 {
1259  libmesh_deprecated();
1260 
1261  std::vector<boundary_id_type> ids;
1262  this->boundary_ids(elem, side, ids);
1263 
1264  // If the set is empty, return invalid_id
1265  if (ids.empty())
1266  return invalid_id;
1267 
1268  // Otherwise, just return the first id we came across for this
1269  // element on this side.
1270  return *(ids.begin());
1271 }
unsigned short int side
Definition: xdr_io.C:49
std::vector< boundary_id_type > boundary_ids(const Node *node) const
static const boundary_id_type invalid_id
std::vector< boundary_id_type > libMesh::BoundaryInfo::boundary_ids ( const Node node) const
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.

This is the non-deprecated version of the function.

Definition at line 1041 of file boundary_info.C.

References _boundary_node_id.

1043 {
1044  // Clear out any previous contents
1045  vec_to_fill.clear();
1046 
1047  std::pair<boundary_node_iter, boundary_node_iter>
1048  pos = _boundary_node_id.equal_range(node);
1049 
1050  for (; pos.first != pos.second; ++pos.first)
1051  vec_to_fill.push_back(pos.first->second);
1052 }
std::multimap< const Node *, boundary_id_type > _boundary_node_id
std::vector< boundary_id_type > libMesh::BoundaryInfo::boundary_ids ( const Elem *const  elem,
const unsigned short int  side 
) const
Returns
The list of boundary ids associated with the side side of element elem.
Deprecated:
Instead, use the version of this function that fills a std::vector.

Definition at line 1286 of file boundary_info.C.

References boundary_ids().

1288 {
1289  libmesh_deprecated();
1290 
1291  std::vector<boundary_id_type> ids;
1292  this->boundary_ids(elem, side, ids);
1293  return ids;
1294 }
unsigned short int side
Definition: xdr_io.C:49
std::vector< boundary_id_type > boundary_ids(const Node *node) const
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.

This is the non-deprecated version of the function.

Definition at line 1298 of file boundary_info.C.

References _boundary_side_id, libMesh::Elem::is_child_on_side(), libMesh::Elem::level(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), side, libMesh::Elem::top_parent(), and libMesh::Elem::which_child_am_i().

1301 {
1302  libmesh_assert(elem);
1303 
1304  // Clear out any previous contents
1305  vec_to_fill.clear();
1306 
1307  // Only level-0 elements store BCs. If this is not a level-0
1308  // element get its level-0 parent and infer the BCs.
1309  const Elem * searched_elem = elem;
1310  if (elem->level() != 0)
1311  {
1312  if (elem->neighbor_ptr(side) == libmesh_nullptr)
1313  searched_elem = elem->top_parent ();
1314 #ifdef LIBMESH_ENABLE_AMR
1315  else
1316  while (searched_elem->parent() != libmesh_nullptr)
1317  {
1318  const Elem * parent = searched_elem->parent();
1319  if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
1320  return;
1321  searched_elem = parent;
1322  }
1323 #endif
1324  }
1325 
1326  std::pair<boundary_side_iter, boundary_side_iter>
1327  e = _boundary_side_id.equal_range(searched_elem);
1328 
1329  // Check each element in the range to see if its side matches the requested side.
1330  for (; e.first != e.second; ++e.first)
1331  if (e.first->second.first == side)
1332  vec_to_fill.push_back(e.first->second.second);
1333 }
unsigned short int side
Definition: xdr_io.C:49
const class libmesh_nullptr_t libmesh_nullptr
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
libmesh_assert(j)
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.

Definition at line 2155 of file boundary_info.C.

References _boundary_side_id.

Referenced by n_boundary_ids().

2158 {
2159  // Clear the input vectors, just in case they were used for
2160  // something else recently...
2161  el.clear();
2162  sl.clear();
2163  il.clear();
2164 
2165  boundary_side_iter pos = _boundary_side_id.begin();
2166  for (; pos != _boundary_side_id.end(); ++pos)
2167  {
2168  // Don't add remote sides
2169  if (pos->first->is_remote())
2170  continue;
2171 
2172  // Loop over the sides of possible children
2173  std::vector< const Elem * > family;
2174 #ifdef LIBMESH_ENABLE_AMR
2175  pos->first->active_family_tree_by_side(family, pos->second.first);
2176 #else
2177  family.push_back(pos->first);
2178 #endif
2179 
2180  // Populate the list items
2181  for (std::vector<const Elem *>::iterator elem_it = family.begin(); elem_it != family.end(); elem_it++)
2182  {
2183  el.push_back ((*elem_it)->id());
2184  sl.push_back (pos->second.first);
2185  il.push_back (pos->second.second);
2186  }
2187  }
2188 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
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.

Definition at line 2191 of file boundary_info.C.

References _boundary_edge_id.

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), n_boundary_ids(), and libMesh::ReplicatedMesh::stitching_helper().

2194 {
2195  // Clear the input vectors, just in case they were used for
2196  // something else recently...
2197  el.clear();
2198  sl.clear();
2199  il.clear();
2200 
2201  // Reserve the size, then use push_back
2202  el.reserve (_boundary_edge_id.size());
2203  sl.reserve (_boundary_edge_id.size());
2204  il.reserve (_boundary_edge_id.size());
2205 
2206  boundary_edge_iter pos = _boundary_edge_id.begin();
2207  for (; pos != _boundary_edge_id.end(); ++pos)
2208  {
2209  el.push_back (pos->first->id());
2210  sl.push_back (pos->second.first);
2211  il.push_back (pos->second.second);
2212  }
2213 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_edge_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
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 1724 of file boundary_info.C.

References _boundary_node_id.

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

1725 {
1726  b_ids.clear();
1727 
1728  boundary_node_iter pos = _boundary_node_id.begin();
1729  for (; pos != _boundary_node_id.end(); ++pos)
1730  {
1731  boundary_id_type id = pos->second;
1732 
1733  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
1734  b_ids.push_back(id);
1735  }
1736 }
std::multimap< const Node *, boundary_id_type >::const_iterator boundary_node_iter
int8_t boundary_id_type
Definition: id_types.h:51
std::multimap< const Node *, boundary_id_type > _boundary_node_id
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.

Definition at line 1860 of file boundary_info.C.

References _boundary_node_id.

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), n_boundary_ids(), libMesh::ReplicatedMesh::stitching_helper(), libMesh::CheckpointIO::write_nodesets(), libMesh::Nemesis_IO_Helper::write_nodesets(), and libMesh::ExodusII_IO_Helper::write_nodesets().

1862 {
1863  // Clear the input vectors, just in case they were used for
1864  // something else recently...
1865  nl.clear();
1866  il.clear();
1867 
1868  // Reserve the size, then use push_back
1869  nl.reserve (_boundary_node_id.size());
1870  il.reserve (_boundary_node_id.size());
1871 
1872  boundary_node_iter pos = _boundary_node_id.begin();
1873  for (; pos != _boundary_node_id.end(); ++pos)
1874  {
1875  nl.push_back (pos->first->id());
1876  il.push_back (pos->second);
1877  }
1878 }
std::multimap< const Node *, boundary_id_type >::const_iterator boundary_node_iter
std::multimap< const Node *, boundary_id_type > _boundary_node_id
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 1882 of file boundary_info.C.

References _boundary_side_id, _mesh, add_node(), libMesh::Parallel::any_source, boundary_ids(), libMesh::Elem::build_side_ptr(), libMesh::ParallelObject::comm(), end, libMesh::Parallel::Communicator::get_unique_tag(), libMesh::DofObject::id(), libMesh::MeshBase::is_serial(), libMesh::ParallelObject::n_processors(), libMesh::MeshBase::node_ptr(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), libMesh::Parallel::probe(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::Parallel::Communicator::receive(), libMesh::Parallel::Communicator::send(), side, libMesh::Parallel::Status::source(), and libMesh::Parallel::wait().

Referenced by n_boundary_ids().

1883 {
1884  // If we're on a distributed mesh, even the owner of a node is not
1885  // guaranteed to be able to properly assign its new boundary id(s)!
1886  // Nodal neighbors are not always ghosted, and a nodal neighbor
1887  // might have a boundary side.
1888  const bool mesh_is_serial = _mesh.is_serial();
1889 
1890  typedef std::set<std::pair<dof_id_type, boundary_id_type> > set_type;
1891 
1892  const processor_id_type n_proc = this->n_processors();
1893  const processor_id_type my_proc_id = this->processor_id();
1894  std::vector<set_type> nodes_to_push(n_proc);
1895 
1896  // Loop over the side list
1897  boundary_side_iter pos = _boundary_side_id.begin();
1898  for (; pos != _boundary_side_id.end(); ++pos)
1899  {
1900  // Don't add remote sides
1901  if (pos->first->is_remote())
1902  continue;
1903 
1904  // Need to loop over the sides of any possible children
1905  std::vector<const Elem *> family;
1906 #ifdef LIBMESH_ENABLE_AMR
1907  pos->first->active_family_tree_by_side (family, pos->second.first);
1908 #else
1909  family.push_back(pos->first);
1910 #endif
1911 
1912  for (std::size_t elem_it=0; elem_it < family.size(); elem_it++)
1913  {
1914  const Elem * cur_elem = family[elem_it];
1915 
1916  UniquePtr<const Elem> side = cur_elem->build_side_ptr(pos->second.first);
1917 
1918  // Add each node node on the side with the side's boundary id
1919  for (unsigned int i=0; i<side->n_nodes(); i++)
1920  {
1921  const boundary_id_type bcid = pos->second.second;
1922  this->add_node(side->node_ptr(i), bcid);
1923  if (!mesh_is_serial)
1924  {
1925  const processor_id_type proc_id =
1926  side->node_ptr(i)->processor_id();
1927  if (proc_id != my_proc_id)
1928  nodes_to_push[proc_id].insert
1929  (std::make_pair(side->node_id(i), bcid));
1930  }
1931  }
1932  }
1933  }
1934 
1935  // If we're on a serial mesh then we're done.
1936  if (mesh_is_serial)
1937  return;
1938 
1939  // Otherwise we need to push ghost node bcids to their owners, then
1940  // pull ghost node bcids from their owners.
1941  Parallel::MessageTag
1942  node_pushes_tag = this->comm().get_unique_tag(31337),
1943  node_pulls_tag = this->comm().get_unique_tag(31338),
1944  node_responses_tag = this->comm().get_unique_tag(31339);
1945 
1946  std::vector<Parallel::Request> node_push_requests(n_proc-1);
1947 
1948  for (processor_id_type p = 0; p != n_proc; ++p)
1949  {
1950  if (p == my_proc_id)
1951  continue;
1952 
1953  Parallel::Request &request =
1954  node_push_requests[p - (p > my_proc_id)];
1955 
1956  this->comm().send
1957  (p, nodes_to_push[p], request, node_pushes_tag);
1958  }
1959 
1960  for (processor_id_type p = 1; p != n_proc; ++p)
1961  {
1962  set_type received_nodes;
1963 
1964  this->comm().receive
1965  (Parallel::any_source, received_nodes, node_pushes_tag);
1966 
1967  for (set_type::const_iterator it = received_nodes.begin(),
1968  end = received_nodes.end(); it != end; ++it)
1969  this->add_node(_mesh.node_ptr(it->first), it->second);
1970  }
1971 
1972  // At this point we should know all the BCs for our own nodes; now
1973  // we need BCs for ghost nodes.
1974  //
1975  // FIXME - parallel_ghost_sync.h doesn't work here because it
1976  // assumes a fixed size datum on each node.
1977  std::vector<std::vector<dof_id_type> > node_ids_requested(n_proc);
1978 
1979  // Determine what nodes we need to request
1980  for (MeshBase::const_node_iterator it = _mesh.nodes_begin(),
1981  end = _mesh.nodes_end(); it != end; ++it)
1982  {
1983  const Node *node = *it;
1984  const processor_id_type pid = node->processor_id();
1985  if (pid != my_proc_id)
1986  node_ids_requested[pid].push_back(node->id());
1987  }
1988 
1989  typedef std::vector<std::pair<dof_id_type, boundary_id_type> > vec_type;
1990 
1991  std::vector<Parallel::Request>
1992  node_pull_requests(n_proc-1),
1993  node_response_requests(n_proc-1);
1994 
1995  // Make all requests
1996  for (processor_id_type p = 0; p != n_proc; ++p)
1997  {
1998  if (p == my_proc_id)
1999  continue;
2000 
2001  Parallel::Request &request =
2002  node_pull_requests[p - (p > my_proc_id)];
2003 
2004  this->comm().send
2005  (p, node_ids_requested[p], request, node_pulls_tag);
2006  }
2007 
2008  // Process all incoming requests
2009  std::vector<vec_type> responses(n_proc-1);
2010 
2011  for (processor_id_type p = 1; p != n_proc; ++p)
2012  {
2013  std::vector<dof_id_type> requested_nodes;
2014 
2015  Parallel::Status
2016  status(this->comm().probe (Parallel::any_source, node_pulls_tag));
2017  const processor_id_type
2018  source_pid = cast_int<processor_id_type>(status.source());
2019 
2020  this->comm().receive
2021  (source_pid, requested_nodes, node_pulls_tag);
2022 
2023  Parallel::Request &request =
2024  node_response_requests[p-1];
2025 
2026  std::vector<boundary_id_type> bcids;
2027 
2028  for (std::vector<dof_id_type>::const_iterator
2029  it = requested_nodes.begin(),
2030  end = requested_nodes.end(); it != end; ++it)
2031  {
2032  this->boundary_ids(_mesh.node_ptr(*it), bcids);
2033 
2034  for (std::size_t i=0; i != bcids.size(); ++i)
2035  {
2036  const boundary_id_type b = bcids[i];
2037  responses[p-1].push_back(std::make_pair(*it, b));
2038  }
2039  }
2040 
2041  this->comm().send
2042  (source_pid, responses[p-1], request, node_responses_tag);
2043  }
2044 
2045  // Process all incoming responses
2046  for (processor_id_type p = 1; p != n_proc; ++p)
2047  {
2048  Parallel::Status
2049  status(this->comm().probe (Parallel::any_source, node_responses_tag));
2050  const processor_id_type
2051  source_pid = cast_int<processor_id_type>(status.source());
2052 
2053  vec_type response;
2054 
2055  this->comm().receive
2056  (source_pid, response, node_responses_tag);
2057 
2058  for (vec_type::const_iterator
2059  it = response.begin(),
2060  end = response.end(); it != end; ++it)
2061  {
2062  this->add_node(_mesh.node_ptr(it->first), it->second);
2063  }
2064  }
2065 
2066  Parallel::wait (node_push_requests);
2067  Parallel::wait (node_pull_requests);
2068  Parallel::wait (node_response_requests);
2069 }
Status wait(Request &r)
Definition: parallel.h:561
virtual bool is_serial() const
Definition: mesh_base.h:137
const unsigned int any_source
Definition: parallel.h:200
unsigned short int side
Definition: xdr_io.C:49
processor_id_type n_processors() const
uint8_t processor_id_type
Definition: id_types.h:99
MPI_Request request
Definition: parallel.h:167
virtual const Node * node_ptr(const dof_id_type i) const =0
IterBase * end
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
std::vector< boundary_id_type > boundary_ids(const Node *node) const
virtual node_iterator nodes_begin()=0
void add_node(const Node *node, const boundary_id_type id)
int8_t boundary_id_type
Definition: id_types.h:51
MPI_Status status
Definition: parallel.h:172
void send(const unsigned int dest_processor_id, const T &buf, const MessageTag &tag=no_tag) const
virtual node_iterator nodes_end()=0
const Parallel::Communicator & comm() const
Status receive(const unsigned int dest_processor_id, T &buf, const MessageTag &tag=any_tag) const
MessageTag get_unique_tag(int tagvalue) const
status probe(const unsigned int src_processor_id, const MessageTag &tag=any_tag, const Communicator &comm=Communicator_World)
processor_id_type processor_id() const
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 1754 of file boundary_info.C.

References _boundary_shellface_id.

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

1755 {
1756  b_ids.clear();
1757 
1759  for (; pos != _boundary_shellface_id.end(); ++pos)
1760  {
1761  boundary_id_type id = pos->second.second;
1762 
1763  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
1764  b_ids.push_back(id);
1765  }
1766 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
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
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.

Definition at line 2216 of file boundary_info.C.

References _boundary_shellface_id.

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), n_boundary_ids(), libMesh::ReplicatedMesh::stitching_helper(), and libMesh::ExodusII_IO_Helper::write_sidesets().

2219 {
2220  // Clear the input vectors, just in case they were used for
2221  // something else recently...
2222  el.clear();
2223  sl.clear();
2224  il.clear();
2225 
2226  // Reserve the size, then use push_back
2227  el.reserve (_boundary_shellface_id.size());
2228  sl.reserve (_boundary_shellface_id.size());
2229  il.reserve (_boundary_shellface_id.size());
2230 
2232  for (; pos != _boundary_shellface_id.end(); ++pos)
2233  {
2234  el.push_back (pos->first->id());
2235  sl.push_back (pos->second.first);
2236  il.push_back (pos->second.second);
2237  }
2238 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_shellface_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
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 1739 of file boundary_info.C.

References _boundary_side_id.

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

1740 {
1741  b_ids.clear();
1742 
1743  boundary_side_iter pos = _boundary_side_id.begin();
1744  for (; pos != _boundary_side_id.end(); ++pos)
1745  {
1746  boundary_id_type id = pos->second.second;
1747 
1748  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
1749  b_ids.push_back(id);
1750  }
1751 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
int8_t boundary_id_type
Definition: id_types.h:51
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.

Definition at line 2131 of file boundary_info.C.

References _boundary_side_id.

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), n_boundary_ids(), libMesh::ReplicatedMesh::stitching_helper(), libMesh::FroIO::write(), libMesh::CheckpointIO::write_bcs(), libMesh::Nemesis_IO_Helper::write_sidesets(), and libMesh::ExodusII_IO_Helper::write_sidesets().

2134 {
2135  // Clear the input vectors, just in case they were used for
2136  // something else recently...
2137  el.clear();
2138  sl.clear();
2139  il.clear();
2140 
2141  // Reserve the size, then use push_back
2142  el.reserve (_boundary_side_id.size());
2143  sl.reserve (_boundary_side_id.size());
2144  il.reserve (_boundary_side_id.size());
2145 
2146  boundary_side_iter pos = _boundary_side_id.begin();
2147  for (; pos != _boundary_side_id.end(); ++pos)
2148  {
2149  el.push_back (pos->first->id());
2150  sl.push_back (pos->second.first);
2151  il.push_back (pos->second.second);
2152  }
2153 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
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 2074 of file boundary_info.C.

References _boundary_node_id, _mesh, libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), add_side(), libMesh::Elem::build_side_ptr(), libMesh::Elem::n_sides(), nodeset_name(), libMesh::out, side, and sideset_name().

Referenced by n_boundary_ids(), and libMesh::AbaqusIO::read().

2075 {
2076  // Check for early return
2077  if (_boundary_node_id.empty())
2078  {
2079  libMesh::out << "No boundary node IDs have been added: cannot build side list!" << std::endl;
2080  return;
2081  }
2082 
2083  MeshBase::const_element_iterator el = _mesh.active_elements_begin();
2084  const MeshBase::const_element_iterator end_el = _mesh.active_elements_end();
2085 
2086  for (; el != end_el; ++el)
2087  {
2088  const Elem * elem = *el;
2089 
2090  for (unsigned short side=0; side<elem->n_sides(); ++side)
2091  {
2092  UniquePtr<const Elem> side_elem = elem->build_side_ptr(side);
2093 
2094  // map from nodeset_id to count for that ID
2095  std::map<boundary_id_type, unsigned> nodesets_node_count;
2096  for (unsigned node_num=0; node_num < side_elem->n_nodes(); ++node_num)
2097  {
2098  const Node * node = side_elem->node_ptr(node_num);
2099  std::pair<boundary_node_iter, boundary_node_iter>
2100  range = _boundary_node_id.equal_range(node);
2101 
2102  // For each nodeset that this node is a member of, increment the associated
2103  // nodeset ID count
2104  for (boundary_node_iter pos = range.first; pos != range.second; ++pos)
2105  nodesets_node_count[pos->second]++;
2106  }
2107 
2108  // Now check to see what nodeset_counts have the correct
2109  // number of nodes in them. For any that do, add this side to
2110  // the sideset, making sure the sideset inherits the
2111  // nodeset's name, if there is one.
2112  std::map<boundary_id_type, unsigned>::const_iterator nodesets = nodesets_node_count.begin();
2113  for (; nodesets != nodesets_node_count.end(); ++nodesets)
2114  if (nodesets->second == side_elem->n_nodes())
2115  {
2116  add_side(elem, side, nodesets->first);
2117 
2118  // Let the sideset inherit any non-empty name from the nodeset
2119  std::string & nset_name = nodeset_name(nodesets->first);
2120 
2121  if (nset_name != "")
2122  sideset_name(nodesets->first) = nset_name;
2123  }
2124  } // end for side
2125  } // end for el
2126 }
std::string & nodeset_name(boundary_id_type id)
unsigned short int side
Definition: xdr_io.C:49
std::multimap< const Node *, boundary_id_type >::const_iterator boundary_node_iter
std::multimap< const Node *, boundary_id_type > _boundary_node_id
virtual element_iterator active_elements_begin()=0
std::string & sideset_name(boundary_id_type id)
virtual element_iterator active_elements_end()=0
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
OStreamProxy out(std::cout)
void libMesh::BoundaryInfo::clear ( )

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

Definition at line 139 of file boundary_info.C.

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

Referenced by libMesh::MeshBase::clear(), operator=(), and ~BoundaryInfo().

140 {
141  _boundary_node_id.clear();
142  _boundary_side_id.clear();
143  _boundary_edge_id.clear();
144  _boundary_shellface_id.clear();
145  _boundary_ids.clear();
146  _side_boundary_ids.clear();
147  _node_boundary_ids.clear();
148  _edge_boundary_ids.clear();
149  _shellface_boundary_ids.clear();
150 }
std::set< boundary_id_type > _node_boundary_ids
std::set< boundary_id_type > _edge_boundary_ids
std::set< boundary_id_type > _boundary_ids
std::set< boundary_id_type > _side_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
std::multimap< const Node *, boundary_id_type > _boundary_node_id
std::set< boundary_id_type > _shellface_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
void libMesh::BoundaryInfo::clear_boundary_node_ids ( )

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

Definition at line 731 of file boundary_info.C.

References _boundary_node_id.

732 {
733  _boundary_node_id.clear();
734 }
std::multimap< const Node *, boundary_id_type > _boundary_node_id
const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inlineinherited
Returns
A reference to the Parallel::Communicator object used by this mesh.

Definition at line 87 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_jacobian(), libMesh::__libmesh_petsc_snes_postcheck(), libMesh::__libmesh_petsc_snes_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::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), _find_id_maps(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::ImplicitSystem::add_matrix(), libMesh::System::add_vector(), libMesh::EigenSparseLinearSolver< T >::adjoint_solve(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::Parallel::BinSorter< KeyType, IdxType >::binsort(), libMesh::Parallel::Sort< KeyType, IdxType >::binsort(), libMesh::MeshCommunication::broadcast(), libMesh::SparseMatrix< T >::build(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::Parallel::Histogram< KeyType, IdxType >::build_histogram(), libMesh::PetscNonlinearSolver< T >::build_mat_null_space(), build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::DistributedVector< T >::clone(), libMesh::EigenSparseVector< T >::clone(), libMesh::LaspackVector< T >::clone(), libMesh::EpetraVector< T >::clone(), libMesh::PetscVector< T >::clone(), libMesh::EpetraVector< T >::close(), libMesh::Parallel::Sort< KeyType, IdxType >::communicate_bins(), 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::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), 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::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::EpetraVector< T >::EpetraVector(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::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_nelem_target(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::EquationSystems::get_solution(), libMesh::LocationMap< T >::init(), libMesh::PetscDiffSolver::init(), libMesh::TimeSolver::init(), libMesh::TopologyMap::init(), libMesh::TaoOptimizationSolver< T >::init(), libMesh::PetscNonlinearSolver< T >::init(), libMesh::DistributedVector< T >::init(), libMesh::EpetraVector< T >::init(), libMesh::PetscVector< T >::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), 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::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::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), 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_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::DistributedVector< T >::max(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshSerializer::MeshSerializer(), libMesh::DistributedVector< T >::min(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), n_boundary_conds(), n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), n_shellface_conds(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::ReplicatedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_n_elem(), libMesh::DistributedMesh::parallel_n_nodes(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::MeshTools::paranoid_n_levels(), libMesh::Partitioner::partition(), libMesh::MetisPartitioner::partition_range(), 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::SparseMatrix< T >::print(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::Parallel::Sort< KeyType, IdxType >::sort(), libMesh::MeshBase::subdomain_ids(), sync(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id(), libMesh::MeshRefinement::test_level_one(), libMesh::MeshRefinement::test_unflagged(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::DistributedVector< T >::zero_clone(), libMesh::EigenSparseVector< T >::zero_clone(), libMesh::LaspackVector< T >::zero_clone(), libMesh::EpetraVector< T >::zero_clone(), and libMesh::PetscVector< T >::zero_clone().

88  { return _communicator; }
const Parallel::Communicator & _communicator
void libMesh::BoundaryInfo::copy_boundary_ids ( const BoundaryInfo old_boundary_info,
const Elem *const  old_elem,
const Elem *const  new_elem 
)

Definition at line 1384 of file boundary_info.C.

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

Referenced by libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::all_second_order(), and n_boundary_ids().

1387 {
1388  libmesh_assert_equal_to (old_elem->n_sides(), new_elem->n_sides());
1389  libmesh_assert_equal_to (old_elem->n_edges(), new_elem->n_edges());
1390 
1391  std::vector<boundary_id_type> bndry_ids;
1392 
1393  for (unsigned short s=0; s<old_elem->n_sides(); s++)
1394  {
1395  old_boundary_info.raw_boundary_ids (old_elem, s, bndry_ids);
1396  this->add_side (new_elem, s, bndry_ids);
1397  }
1398 
1399  for (unsigned short e=0; e<old_elem->n_edges(); e++)
1400  {
1401  old_boundary_info.raw_edge_boundary_ids (old_elem, e, bndry_ids);
1402  this->add_edge (new_elem, e, bndry_ids);
1403  }
1404 
1405  for (unsigned short sf=0; sf != 2; sf++)
1406  {
1407  old_boundary_info.raw_shellface_boundary_ids (old_elem, sf, bndry_ids);
1408  this->add_shellface (new_elem, sf, bndry_ids);
1409  }
1410 }
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
void add_shellface(const dof_id_type elem, const unsigned short int shellface, const boundary_id_type id)
void add_edge(const dof_id_type elem, const unsigned short int edge, const boundary_id_type id)
std::vector< boundary_id_type > libMesh::BoundaryInfo::edge_boundary_ids ( const Elem *const  elem,
const unsigned short int  edge 
) 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.
Deprecated:
Instead, use the version of this function that fills a std::vector.

Definition at line 1065 of file boundary_info.C.

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), n_boundary_ids(), n_edge_boundary_ids(), libMesh::Parallel::Packing< const Elem * >::pack(), libMesh::ReplicatedMesh::stitching_helper(), and libMesh::XdrIO::write_serialized_bcs_helper().

1067 {
1068  libmesh_deprecated();
1069 
1070  std::vector<boundary_id_type> ids;
1071  this->edge_boundary_ids(elem, edge, ids);
1072  return ids;
1073 }
std::vector< boundary_id_type > edge_boundary_ids(const Elem *const elem, const unsigned short int edge) const
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.

This is the non-deprecated version of the function.

Definition at line 1077 of file boundary_info.C.

References _boundary_edge_id, libMesh::Elem::is_child_on_edge(), libMesh::Elem::is_edge_on_side(), libMesh::Elem::level(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), side, libMesh::Elem::top_parent(), and libMesh::Elem::which_child_am_i().

1080 {
1081  libmesh_assert(elem);
1082 
1083  // Clear out any previous contents
1084  vec_to_fill.clear();
1085 
1086  // Only level-0 elements store BCs. If this is not a level-0
1087  // element get its level-0 parent and infer the BCs.
1088  const Elem * searched_elem = elem;
1089 #ifdef LIBMESH_ENABLE_AMR
1090  if (elem->level() != 0)
1091  {
1092  // Find all the sides that contain edge. If one of those is a boundary
1093  // side, then this must be a boundary edge. In that case, we just use the
1094  // top-level parent.
1095  bool found_boundary_edge = false;
1096  for (unsigned int side=0; side<elem->n_sides(); side++)
1097  {
1098  if (elem->is_edge_on_side(edge,side))
1099  {
1100  if (elem->neighbor_ptr(side) == libmesh_nullptr)
1101  {
1102  searched_elem = elem->top_parent ();
1103  found_boundary_edge = true;
1104  break;
1105  }
1106  }
1107  }
1108 
1109  if (!found_boundary_edge)
1110  {
1111  // Child element is not on external edge, but it may have internal
1112  // "boundary" IDs. We will walk up the tree, at each level checking that
1113  // the current child is actually on the same edge of the parent that is
1114  // currently being searched for (i.e. that was passed in as "edge").
1115  while (searched_elem->parent() != libmesh_nullptr)
1116  {
1117  const Elem * parent = searched_elem->parent();
1118  if (parent->is_child_on_edge(parent->which_child_am_i(searched_elem), edge) == false)
1119  return;
1120  searched_elem = parent;
1121  }
1122  }
1123  }
1124 #endif
1125 
1126  std::pair<boundary_edge_iter, boundary_edge_iter>
1127  e = _boundary_edge_id.equal_range(searched_elem);
1128 
1129  // Check each element in the range to see if its edge matches the requested edge.
1130  for (; e.first != e.second; ++e.first)
1131  if (e.first->second.first == edge)
1132  vec_to_fill.push_back(e.first->second.second);
1133 }
unsigned short int side
Definition: xdr_io.C:49
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
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.

DistributedMesh-compatible code may need a set_union or other manipulations to work with sets of boundary ids which include ids on remote parts of the mesh.

Definition at line 700 of file boundary_info.h.

References _boundary_ids.

Referenced by libMesh::DofMap::check_dirichlet_bcid_consistency(), and libMesh::FroIO::write().

701  { return _boundary_ids; }
std::set< boundary_id_type > _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 716 of file boundary_info.h.

References _edge_boundary_ids.

717  { return _edge_boundary_ids; }
std::set< boundary_id_type > _edge_boundary_ids
boundary_id_type libMesh::BoundaryInfo::get_id_by_name ( const std::string &  name) const
Returns
The id of the named boundary if it exists, invalid_id otherwise.

Definition at line 2453 of file boundary_info.C.

References _ns_id_to_name, _ss_id_to_name, and invalid_id.

Referenced by get_node_boundary_ids().

2454 {
2455  // Search sidesets
2456  std::map<boundary_id_type, std::string>::const_iterator
2457  iter = _ss_id_to_name.begin(),
2458  end_iter = _ss_id_to_name.end();
2459 
2460  for (; iter != end_iter; ++iter)
2461  if (iter->second == name)
2462  return iter->first;
2463 
2464  // Search nodesets
2465  iter = _ns_id_to_name.begin();
2466  end_iter = _ns_id_to_name.end();
2467  for (; iter != end_iter; ++iter)
2468  if (iter->second == name)
2469  return iter->first;
2470 
2471  // If we made it here without returning, we don't have a sideset or
2472  // nodeset by the requested name, so return invalid_id
2473  return invalid_id;
2474 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:39
std::map< boundary_id_type, std::string > _ns_id_to_name
std::map< boundary_id_type, std::string > _ss_id_to_name
static const boundary_id_type invalid_id
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 732 of file boundary_info.h.

References _node_boundary_ids, get_id_by_name(), get_nodeset_name(), get_sideset_name(), libMesh::Quality::name(), nodeset_name(), libMesh::out, print_info(), print_summary(), and sideset_name().

Referenced by libMesh::Nemesis_IO_Helper::compute_num_global_nodesets().

733  { return _node_boundary_ids; }
std::set< boundary_id_type > _node_boundary_ids
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 2437 of file boundary_info.C.

References _ns_id_to_name.

Referenced by get_node_boundary_ids(), libMesh::Nemesis_IO_Helper::write_nodesets(), and libMesh::ExodusII_IO_Helper::write_nodesets().

2438 {
2439  static const std::string empty_string;
2440  std::map<boundary_id_type, std::string>::const_iterator it =
2441  _ns_id_to_name.find(id);
2442  if (it == _ns_id_to_name.end())
2443  return empty_string;
2444  else
2445  return it->second;
2446 }
std::map< boundary_id_type, std::string > _ns_id_to_name
const std::map<boundary_id_type, std::string>& libMesh::BoundaryInfo::get_nodeset_name_map ( ) const
inline

Definition at line 787 of file boundary_info.h.

References _ns_id_to_name.

Referenced by libMesh::CheckpointIO::write_bc_names(), and libMesh::XdrIO::write_serialized_bc_names().

788  { return _ns_id_to_name; }
std::map< boundary_id_type, std::string > _ns_id_to_name
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 725 of file boundary_info.h.

References _shellface_boundary_ids.

726  { return _shellface_boundary_ids; }
std::set< boundary_id_type > _shellface_boundary_ids
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 337 of file boundary_info.C.

References libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), libMesh::Elem::build_side_ptr(), libMesh::Elem::centroid(), libMesh::Elem::hmin(), libMesh::DofObject::id(), libMesh::Elem::interior_parent(), libMesh::Elem::n_nodes(), libMesh::Elem::n_sides(), libMesh::Elem::node_id(), libMesh::Real, and side.

341 {
342  LOG_SCOPE("get_side_and_node_maps()", "BoundaryInfo");
343 
344  node_id_map.clear();
345  side_id_map.clear();
346 
347  MeshBase::const_element_iterator el =
348  boundary_mesh.active_elements_begin();
349  const MeshBase::const_element_iterator end_el =
350  boundary_mesh.active_elements_end();
351 
352  for (; el != end_el; ++el)
353  {
354  const Elem * boundary_elem = *el;
355  const Elem * interior_parent = boundary_elem->interior_parent();
356 
357  // Find out which side of interior_parent boundary_elem corresponds to.
358  // Use centroid comparison as a way to check.
359  unsigned char interior_parent_side_index = 0;
360  bool found_matching_sides = false;
361  for (unsigned char side=0; side<interior_parent->n_sides(); side++)
362  {
363  UniquePtr<const Elem> interior_parent_side = interior_parent->build_side_ptr(side);
364  Real centroid_distance = (boundary_elem->centroid() - interior_parent_side->centroid()).norm();
365 
366  if (centroid_distance < (tolerance * boundary_elem->hmin()))
367  {
368  interior_parent_side_index = side;
369  found_matching_sides = true;
370  break;
371  }
372  }
373 
374  if (!found_matching_sides)
375  {
376  libmesh_error_msg("No matching side found within the specified tolerance");
377  }
378 
379  side_id_map[boundary_elem->id()] = interior_parent_side_index;
380 
381  UniquePtr<const Elem> interior_parent_side = interior_parent->build_side_ptr(interior_parent_side_index);
382  for (unsigned char local_node_index=0; local_node_index<boundary_elem->n_nodes(); local_node_index++)
383  {
384  dof_id_type boundary_node_id = boundary_elem->node_id(local_node_index);
385  dof_id_type interior_node_id = interior_parent_side->node_id(local_node_index);
386 
387  node_id_map[interior_node_id] = boundary_node_id;
388  }
389 
390  }
391 }
unsigned short int side
Definition: xdr_io.C:49
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
uint8_t dof_id_type
Definition: id_types.h:64
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 707 of file boundary_info.h.

References _side_boundary_ids.

Referenced by libMesh::MeshTools::Generation::build_extrusion(), and libMesh::Nemesis_IO_Helper::compute_num_global_sidesets().

708  { return _side_boundary_ids; }
std::set< boundary_id_type > _side_boundary_ids
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 2420 of file boundary_info.C.

References _ss_id_to_name.

Referenced by get_node_boundary_ids(), libMesh::Nemesis_IO_Helper::write_sidesets(), and libMesh::ExodusII_IO_Helper::write_sidesets().

2421 {
2422  static const std::string empty_string;
2423  std::map<boundary_id_type, std::string>::const_iterator it =
2424  _ss_id_to_name.find(id);
2425  if (it == _ss_id_to_name.end())
2426  return empty_string;
2427  else
2428  return it->second;
2429 }
std::map< boundary_id_type, std::string > _ss_id_to_name
const std::map<boundary_id_type, std::string>& libMesh::BoundaryInfo::get_sideset_name_map ( ) const
inline

Definition at line 779 of file boundary_info.h.

References _ss_id_to_name.

Referenced by libMesh::CheckpointIO::write_bc_names(), and libMesh::XdrIO::write_serialized_bc_names().

780  { return _ss_id_to_name; }
std::map< boundary_id_type, std::string > _ss_id_to_name
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 1016 of file boundary_info.C.

References _boundary_node_id.

Referenced by libMesh::FEMContext::has_side_boundary_id(), and n_boundary_ids().

1018 {
1019  std::pair<boundary_node_iter, boundary_node_iter> pos = _boundary_node_id.equal_range(node);
1020 
1021  for (; pos.first != pos.second; ++pos.first)
1022  if (pos.first->second == id)
1023  return true;
1024 
1025  return false;
1026 }
std::multimap< const Node *, boundary_id_type > _boundary_node_id
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 1275 of file boundary_info.C.

References boundary_ids().

1278 {
1279  std::vector<boundary_id_type> ids;
1280  this->boundary_ids(elem, side, ids);
1281  return (std::find(ids.begin(), ids.end(), id) != ids.end());
1282 }
unsigned short int side
Definition: xdr_io.C:49
std::vector< boundary_id_type > boundary_ids(const Node *node) const
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 1768 of file boundary_info.C.

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

Referenced by libMesh::MeshTools::Modification::all_tri(), libMesh::MeshTools::Modification::flatten(), n_boundary_ids(), libMesh::AbaqusIO::read(), libMesh::Nemesis_IO::read(), and libMesh::XdrIO::write().

1769 {
1770  // in serial we know the number of bcs from the
1771  // size of the container
1772  if (_mesh.is_serial())
1773  return _boundary_side_id.size();
1774 
1775  // in parallel we need to sum the number of local bcs
1776  parallel_object_only();
1777 
1778  std::size_t nbcs=0;
1779 
1780  boundary_side_iter pos = _boundary_side_id.begin();
1781  for (; pos != _boundary_side_id.end(); ++pos)
1782  if (pos->first->processor_id() == this->processor_id())
1783  nbcs++;
1784 
1785  this->comm().sum (nbcs);
1786 
1787  return nbcs;
1788 }
virtual bool is_serial() const
Definition: mesh_base.h:137
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
const Parallel::Communicator & comm() const
processor_id_type processor_id() const
unsigned int libMesh::BoundaryInfo::n_boundary_ids ( const Node node) const
Returns
The number of boundary ids associated with Node node.

Definition at line 1056 of file boundary_info.C.

References _boundary_node_id.

1057 {
1058  std::pair<boundary_node_iter, boundary_node_iter> pos = _boundary_node_id.equal_range(node);
1059 
1060  return cast_int<unsigned int>(std::distance(pos.first, pos.second));
1061 }
std::multimap< const Node *, boundary_id_type > _boundary_node_id
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 1338 of file boundary_info.C.

References boundary_ids().

1340 {
1341  std::vector<boundary_id_type> ids;
1342  this->boundary_ids(elem, side, ids);
1343  return ids.size();
1344 }
unsigned short int side
Definition: xdr_io.C:49
std::vector< boundary_id_type > boundary_ids(const Node *node) const
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 1137 of file boundary_info.C.

References edge_boundary_ids().

Referenced by n_boundary_ids(), and libMesh::Parallel::Packing< const Elem * >::packable_size().

1139 {
1140  std::vector<boundary_id_type> ids;
1141  this->edge_boundary_ids(elem, edge, ids);
1142  return ids.size();
1143 }
std::vector< boundary_id_type > edge_boundary_ids(const Elem *const elem, const unsigned short int edge) const
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 1790 of file boundary_info.C.

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

Referenced by n_boundary_ids(), libMesh::Nemesis_IO::prepare_to_write_nodal_data(), libMesh::Nemesis_IO::write(), libMesh::ExodusII_IO::write(), libMesh::XdrIO::write(), and libMesh::ExodusII_IO::write_nodal_data_common().

1791 {
1792  // in serial we know the number of nodesets from the
1793  // size of the container
1794  if (_mesh.is_serial())
1795  return _boundary_edge_id.size();
1796 
1797  // in parallel we need to sum the number of local nodesets
1798  parallel_object_only();
1799 
1800  std::size_t n_edge_bcs=0;
1801 
1802  boundary_edge_iter pos = _boundary_edge_id.begin();
1803  for (; pos != _boundary_edge_id.end(); ++pos)
1804  if (pos->first->processor_id() == this->processor_id())
1805  n_edge_bcs++;
1806 
1807  this->comm().sum (n_edge_bcs);
1808 
1809  return n_edge_bcs;
1810 }
virtual bool is_serial() const
Definition: mesh_base.h:137
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_edge_iter
const Parallel::Communicator & comm() const
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
processor_id_type processor_id() const
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 1836 of file boundary_info.C.

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

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

1837 {
1838  // in serial we know the number of nodesets from the
1839  // size of the container
1840  if (_mesh.is_serial())
1841  return _boundary_node_id.size();
1842 
1843  // in parallel we need to sum the number of local nodesets
1844  parallel_object_only();
1845 
1846  std::size_t n_nodesets=0;
1847 
1848  boundary_node_iter pos = _boundary_node_id.begin();
1849  for (; pos != _boundary_node_id.end(); ++pos)
1850  if (pos->first->processor_id() == this->processor_id())
1851  n_nodesets++;
1852 
1853  this->comm().sum (n_nodesets);
1854 
1855  return n_nodesets;
1856 }
virtual bool is_serial() const
Definition: mesh_base.h:137
std::multimap< const Node *, boundary_id_type >::const_iterator boundary_node_iter
std::multimap< const Node *, boundary_id_type > _boundary_node_id
const Parallel::Communicator & comm() const
processor_id_type processor_id() const
processor_id_type libMesh::ParallelObject::n_processors ( ) const
inlineinherited
Returns
The number of processors in the group.

Definition at line 93 of file parallel_object.h.

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

Referenced by libMesh::ParmetisPartitioner::_do_repartition(), _find_id_maps(), libMesh::DistributedMesh::add_elem(), libMesh::DistributedMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::MeshCommunication::broadcast(), build_node_list_from_side_list(), libMesh::DistributedMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::MeshBase::get_info(), libMesh::EquationSystems::get_solution(), libMesh::DistributedVector< T >::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), 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::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::SparseMatrix< T >::print(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::CheckpointIO::read_nodes(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Parallel::Sort< KeyType, IdxType >::sort(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

94  { return cast_int<processor_id_type>(_communicator.size()); }
unsigned int size() const
Definition: parallel.h:722
const Parallel::Communicator & _communicator
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 1220 of file boundary_info.C.

References shellface_boundary_ids().

Referenced by n_boundary_ids(), and libMesh::Parallel::Packing< const Elem * >::packable_size().

1222 {
1223  std::vector<boundary_id_type> ids;
1224  this->shellface_boundary_ids(elem, shellface, ids);
1225  return ids.size();
1226 }
void shellface_boundary_ids(const Elem *const elem, const unsigned short int shellface, std::vector< boundary_id_type > &vec_to_fill) const
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 1813 of file boundary_info.C.

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

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

1814 {
1815  // in serial we know the number of nodesets from the
1816  // size of the container
1817  if (_mesh.is_serial())
1818  return _boundary_shellface_id.size();
1819 
1820  // in parallel we need to sum the number of local nodesets
1821  parallel_object_only();
1822 
1823  std::size_t n_shellface_bcs=0;
1824 
1826  for (; pos != _boundary_shellface_id.end(); ++pos)
1827  if (pos->first->processor_id() == this->processor_id())
1828  n_shellface_bcs++;
1829 
1830  this->comm().sum (n_shellface_bcs);
1831 
1832  return n_shellface_bcs;
1833 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_shellface_iter
virtual bool is_serial() const
Definition: mesh_base.h:137
const Parallel::Communicator & comm() const
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
processor_id_type processor_id() const
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 2448 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(), get_node_boundary_ids(), and libMesh::ExodusII_IO::read().

2449 {
2450  return _ns_id_to_name[id];
2451 }
std::map< boundary_id_type, std::string > _ns_id_to_name
BoundaryInfo & libMesh::BoundaryInfo::operator= ( const BoundaryInfo other_boundary_info)

Actual copying operation.

Note
The copy will have a reference to the same Mesh as the original.

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

References _boundary_edge_id, _boundary_ids, _boundary_node_id, _boundary_shellface_id, _boundary_side_id, _edge_boundary_ids, _mesh, _node_boundary_ids, _shellface_boundary_ids, _side_boundary_ids, clear(), libMesh::MeshBase::elem_ptr(), end, libMesh::DofObject::id(), and libMesh::MeshBase::node_ptr().

56 {
57  // Overwrite any preexisting boundary info
58  this->clear();
59 
70  // Copy node boundary info
71  {
72  boundary_node_iter it = other_boundary_info._boundary_node_id.begin();
73  const boundary_node_iter end = other_boundary_info._boundary_node_id.end();
74 
75  for (; it != end; ++it)
76  {
77  const Node * other_node = it->first;
78  _boundary_node_id.insert(std::make_pair(_mesh.node_ptr(other_node->id()),
79  it->second));
80  }
81  }
82 
83  // Copy edge boundary info
84  {
85  boundary_edge_iter it = other_boundary_info._boundary_edge_id.begin();
86  const boundary_edge_iter end = other_boundary_info._boundary_edge_id.end();
87 
88  for (; it != end; ++it)
89  {
90  const Elem * other_elem = it->first;
91  _boundary_edge_id.insert(std::make_pair(_mesh.elem_ptr(other_elem->id()),
92  it->second));
93  }
94  }
95 
96  // Copy shellface boundary info
97  {
98  boundary_shellface_iter it = other_boundary_info._boundary_shellface_id.begin();
99  const boundary_shellface_iter end = other_boundary_info._boundary_shellface_id.end();
100 
101  for (; it != end; ++it)
102  {
103  const Elem * other_elem = it->first;
104  _boundary_shellface_id.insert(std::make_pair(_mesh.elem_ptr(other_elem->id()),
105  it->second));
106  }
107  }
108 
109  // Copy side boundary info
110  {
111  boundary_side_iter it = other_boundary_info._boundary_side_id.begin();
112  const boundary_side_iter end = other_boundary_info._boundary_side_id.end();
113 
114  for (; it != end; ++it)
115  {
116  const Elem * other_elem = it->first;
117  _boundary_side_id.insert(std::make_pair(_mesh.elem_ptr(other_elem->id()),
118  it->second));
119  }
120  }
121 
122  _boundary_ids = other_boundary_info._boundary_ids;
123  _side_boundary_ids = other_boundary_info._side_boundary_ids;
124  _node_boundary_ids = other_boundary_info._node_boundary_ids;
125  _edge_boundary_ids = other_boundary_info._edge_boundary_ids;
126  _shellface_boundary_ids = other_boundary_info._shellface_boundary_ids;
127 
128  return *this;
129 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_shellface_iter
std::set< boundary_id_type > _node_boundary_ids
std::set< boundary_id_type > _edge_boundary_ids
std::set< boundary_id_type > _boundary_ids
std::multimap< const Node *, boundary_id_type >::const_iterator boundary_node_iter
virtual const Node * node_ptr(const dof_id_type i) const =0
std::set< boundary_id_type > _side_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_edge_iter
IterBase * end
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
std::multimap< const Node *, boundary_id_type > _boundary_node_id
std::set< boundary_id_type > _shellface_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
virtual const Elem * elem_ptr(const dof_id_type i) const =0
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
void libMesh::BoundaryInfo::print_info ( std::ostream &  out = libMesh::out) const

Prints the boundary information data structure.

Definition at line 2241 of file boundary_info.C.

References _boundary_edge_id, _boundary_node_id, _boundary_shellface_id, _boundary_side_id, and end.

Referenced by get_node_boundary_ids().

2242 {
2243  // Print out the nodal BCs
2244  if (!_boundary_node_id.empty())
2245  {
2246  out_stream << "Nodal Boundary conditions:" << std::endl
2247  << "--------------------------" << std::endl
2248  << " (Node No., ID) " << std::endl;
2249 
2252 
2253  for (; it != end; ++it)
2254  out_stream << " (" << (*it).first->id()
2255  << ", " << (*it).second
2256  << ")" << std::endl;
2257  }
2258 
2259  // Print out the element edge BCs
2260  if (!_boundary_edge_id.empty())
2261  {
2262  out_stream << std::endl
2263  << "Edge Boundary conditions:" << std::endl
2264  << "-------------------------" << std::endl
2265  << " (Elem No., Edge No., ID) " << std::endl;
2266 
2268  const boundary_edge_iter end = _boundary_edge_id.end();
2269 
2270  for (; it != end; ++it)
2271  out_stream << " (" << (*it).first->id()
2272  << ", " << (*it).second.first
2273  << ", " << (*it).second.second
2274  << ")" << std::endl;
2275  }
2276 
2277  // Print out the element shellface BCs
2278  if (!_boundary_shellface_id.empty())
2279  {
2280  out_stream << std::endl
2281  << "Shell-face Boundary conditions:" << std::endl
2282  << "-------------------------" << std::endl
2283  << " (Elem No., Shell-face No., ID) " << std::endl;
2284 
2287 
2288  for (; it != end; ++it)
2289  out_stream << " (" << (*it).first->id()
2290  << ", " << (*it).second.first
2291  << ", " << (*it).second.second
2292  << ")" << std::endl;
2293  }
2294 
2295  // Print out the element side BCs
2296  if (!_boundary_side_id.empty())
2297  {
2298  out_stream << std::endl
2299  << "Side Boundary conditions:" << std::endl
2300  << "-------------------------" << std::endl
2301  << " (Elem No., Side No., ID) " << std::endl;
2302 
2304  const boundary_side_iter end = _boundary_side_id.end();
2305 
2306  for (; it != end; ++it)
2307  out_stream << " (" << (*it).first->id()
2308  << ", " << (*it).second.first
2309  << ", " << (*it).second.second
2310  << ")" << std::endl;
2311  }
2312 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_shellface_iter
std::multimap< const Node *, boundary_id_type >::const_iterator boundary_node_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_edge_iter
IterBase * end
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
std::multimap< const Node *, boundary_id_type > _boundary_node_id
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
void libMesh::BoundaryInfo::print_summary ( std::ostream &  out = libMesh::out) const

Prints a summary of the boundary information.

Definition at line 2316 of file boundary_info.C.

References _boundary_edge_id, _boundary_node_id, _boundary_shellface_id, _boundary_side_id, and end.

Referenced by get_node_boundary_ids().

2317 {
2318  // Print out the nodal BCs
2319  if (!_boundary_node_id.empty())
2320  {
2321  out_stream << "Nodal Boundary conditions:" << std::endl
2322  << "--------------------------" << std::endl
2323  << " (ID, number of nodes) " << std::endl;
2324 
2325  std::map<boundary_id_type, std::size_t> ID_counts;
2326 
2329 
2330  for (; it != end; ++it)
2331  ID_counts[(*it).second]++;
2332 
2333  std::map<boundary_id_type, std::size_t>::const_iterator ID_it = ID_counts.begin();
2334  const std::map<boundary_id_type, std::size_t>::const_iterator ID_end = ID_counts.end();
2335 
2336  for (; ID_it != ID_end; ++ID_it)
2337  out_stream << " (" << (*ID_it).first
2338  << ", " << (*ID_it).second
2339  << ")" << std::endl;
2340  }
2341 
2342  // Print out the element edge BCs
2343  if (!_boundary_edge_id.empty())
2344  {
2345  out_stream << std::endl
2346  << "Edge Boundary conditions:" << std::endl
2347  << "-------------------------" << std::endl
2348  << " (ID, number of edges) " << std::endl;
2349 
2350  std::map<boundary_id_type, std::size_t> ID_counts;
2351 
2353  const boundary_edge_iter end = _boundary_edge_id.end();
2354 
2355  for (; it != end; ++it)
2356  ID_counts[(*it).second.second]++;
2357 
2358  std::map<boundary_id_type, std::size_t>::const_iterator ID_it = ID_counts.begin();
2359  const std::map<boundary_id_type, std::size_t>::const_iterator ID_end = ID_counts.end();
2360 
2361  for (; ID_it != ID_end; ++ID_it)
2362  out_stream << " (" << (*ID_it).first
2363  << ", " << (*ID_it).second
2364  << ")" << std::endl;
2365  }
2366 
2367 
2368  // Print out the element edge BCs
2369  if (!_boundary_shellface_id.empty())
2370  {
2371  out_stream << std::endl
2372  << "Shell-face Boundary conditions:" << std::endl
2373  << "-------------------------" << std::endl
2374  << " (ID, number of shellfaces) " << std::endl;
2375 
2376  std::map<boundary_id_type, std::size_t> ID_counts;
2377 
2380 
2381  for (; it != end; ++it)
2382  ID_counts[(*it).second.second]++;
2383 
2384  std::map<boundary_id_type, std::size_t>::const_iterator ID_it = ID_counts.begin();
2385  const std::map<boundary_id_type, std::size_t>::const_iterator ID_end = ID_counts.end();
2386 
2387  for (; ID_it != ID_end; ++ID_it)
2388  out_stream << " (" << (*ID_it).first
2389  << ", " << (*ID_it).second
2390  << ")" << std::endl;
2391  }
2392 
2393  // Print out the element side BCs
2394  if (!_boundary_side_id.empty())
2395  {
2396  out_stream << std::endl
2397  << "Side Boundary conditions:" << std::endl
2398  << "-------------------------" << std::endl
2399  << " (ID, number of sides) " << std::endl;
2400 
2401  std::map<boundary_id_type, std::size_t> ID_counts;
2402 
2404  const boundary_side_iter end = _boundary_side_id.end();
2405 
2406  for (; it != end; ++it)
2407  ID_counts[(*it).second.second]++;
2408 
2409  std::map<boundary_id_type, std::size_t>::const_iterator ID_it = ID_counts.begin();
2410  const std::map<boundary_id_type, std::size_t>::const_iterator ID_end = ID_counts.end();
2411 
2412  for (; ID_it != ID_end; ++ID_it)
2413  out_stream << " (" << (*ID_it).first
2414  << ", " << (*ID_it).second
2415  << ")" << std::endl;
2416  }
2417 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_shellface_iter
std::multimap< const Node *, boundary_id_type >::const_iterator boundary_node_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_edge_iter
IterBase * end
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
std::multimap< const Node *, boundary_id_type > _boundary_node_id
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
processor_id_type libMesh::ParallelObject::processor_id ( ) const
inlineinherited
Returns
The rank of this processor in the group.

Definition at line 99 of file parallel_object.h.

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

Referenced by _find_id_maps(), libMesh::EquationSystems::_read_impl(), libMesh::DistributedMesh::add_elem(), add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::MeshRefinement::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::MeshCommunication::broadcast(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), build_node_list_from_side_list(), libMesh::DofMap::build_sparsity(), libMesh::DistributedMesh::clear(), 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::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::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::DistributedMesh::delete_node(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), 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::Nemesis_IO_Helper::get_loadbal_param(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::EquationSystems::get_solution(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::DistributedVector< T >::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), 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::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_local_elem(), n_boundary_conds(), n_edge_conds(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), n_nodeset_conds(), n_shellface_conds(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::MetisPartitioner::partition_range(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::SparseMatrix< T >::print(), libMesh::NumericVector< T >::print_global(), 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::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::CheckpointIO::read_header(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::MeshTools::weight(), libMesh::NameBasedIO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::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_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), 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::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().

100  { return cast_int<processor_id_type>(_communicator.rank()); }
const Parallel::Communicator & _communicator
unsigned int rank() const
Definition: parallel.h:720
std::vector< boundary_id_type > libMesh::BoundaryInfo::raw_boundary_ids ( const Elem *const  elem,
const unsigned short int  side 
) 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.

Deprecated:
Instead, use the version of this function that fills a std::vector.

Definition at line 1348 of file boundary_info.C.

Referenced by copy_boundary_ids(), and n_boundary_ids().

1350 {
1351  libmesh_deprecated();
1352 
1353  std::vector<boundary_id_type> ids;
1354  this->raw_boundary_ids(elem, side, ids);
1355  return ids;
1356 }
unsigned short int side
Definition: xdr_io.C:49
std::vector< boundary_id_type > raw_boundary_ids(const Elem *const elem, const unsigned short int side) const
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.

This is the non-deprecated version of the function.

Definition at line 1360 of file boundary_info.C.

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

1363 {
1364  libmesh_assert(elem);
1365 
1366  // Clear out any previous contents
1367  vec_to_fill.clear();
1368 
1369  // Only level-0 elements store BCs.
1370  if (elem->parent())
1371  return;
1372 
1373  std::pair<boundary_side_iter, boundary_side_iter>
1374  e = _boundary_side_id.equal_range(elem);
1375 
1376  // Check each element in the range to see if its side matches the requested side.
1377  for (; e.first != e.second; ++e.first)
1378  if (e.first->second.first == side)
1379  vec_to_fill.push_back(e.first->second.second);
1380 }
unsigned short int side
Definition: xdr_io.C:49
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
libmesh_assert(j)
std::vector< boundary_id_type > libMesh::BoundaryInfo::raw_edge_boundary_ids ( const Elem *const  elem,
const unsigned short int  edge 
) 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.
Deprecated:
Instead, use the version of this function that fills a std::vector.

Definition at line 1147 of file boundary_info.C.

Referenced by copy_boundary_ids(), and n_boundary_ids().

1149 {
1150  libmesh_deprecated();
1151 
1152  std::vector<boundary_id_type> ids;
1153  this->raw_edge_boundary_ids(elem, edge, ids);
1154  return ids;
1155 }
std::vector< boundary_id_type > raw_edge_boundary_ids(const Elem *const elem, const unsigned short int edge) const
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.

This is the non-deprecated version of the function.

Definition at line 1159 of file boundary_info.C.

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

1162 {
1163  libmesh_assert(elem);
1164 
1165  // Clear out any previous contents
1166  vec_to_fill.clear();
1167 
1168  // Only level-0 elements store BCs.
1169  if (elem->parent())
1170  return;
1171 
1172  std::pair<boundary_edge_iter, boundary_edge_iter>
1173  e = _boundary_edge_id.equal_range(elem);
1174 
1175  // Check each element in the range to see if its edge matches the requested edge.
1176  for (; e.first != e.second; ++e.first)
1177  if (e.first->second.first == edge)
1178  vec_to_fill.push_back(e.first->second.second);
1179 }
libmesh_assert(j)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
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 1230 of file boundary_info.C.

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

Referenced by copy_boundary_ids(), and n_boundary_ids().

1233 {
1234  libmesh_assert(elem);
1235 
1236  // Shells only have 2 faces
1237  libmesh_assert_less(shellface, 2);
1238 
1239  // Clear out any previous contents
1240  vec_to_fill.clear();
1241 
1242  // Only level-0 elements store BCs.
1243  if (elem->parent())
1244  return;
1245 
1246  std::pair<boundary_shellface_iter, boundary_shellface_iter>
1247  e = _boundary_shellface_id.equal_range(elem);
1248 
1249  // Check each element in the range to see if its shellface matches the requested shellface.
1250  for (; e.first != e.second; ++e.first)
1251  if (e.first->second.first == shellface)
1252  vec_to_fill.push_back(e.first->second.second);
1253 }
libmesh_assert(j)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
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 154 of file boundary_info.C.

References _boundary_edge_id, _boundary_ids, _boundary_node_id, _boundary_shellface_id, _boundary_side_id, _edge_boundary_ids, _node_boundary_ids, _shellface_boundary_ids, _side_boundary_ids, and end.

Referenced by libMesh::UnstructuredMesh::all_first_order(), libMesh::TetGenMeshInterface::delete_2D_hull_elements(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::TetGenMeshInterface::pointset_convexhull(), and libMesh::ReplicatedMesh::stitching_helper().

155 {
156  // Clear the old caches
157  _boundary_ids.clear();
158  _side_boundary_ids.clear();
159  _node_boundary_ids.clear();
160  _edge_boundary_ids.clear();
161  _shellface_boundary_ids.clear();
162 
163  // Loop over id maps to regenerate each set.
164  for (boundary_node_iter it = _boundary_node_id.begin(),
165  end = _boundary_node_id.end();
166  it != end; ++it)
167  {
168  const boundary_id_type id = it->second;
169  _boundary_ids.insert(id);
170  _node_boundary_ids.insert(id);
171  }
172 
173  for (boundary_edge_iter it = _boundary_edge_id.begin(),
174  end = _boundary_edge_id.end();
175  it != end; ++it)
176  {
177  const boundary_id_type id = it->second.second;
178  _boundary_ids.insert(id);
179  _edge_boundary_ids.insert(id);
180  }
181 
182  for (boundary_side_iter it = _boundary_side_id.begin(),
183  end = _boundary_side_id.end();
184  it != end; ++it)
185  {
186  const boundary_id_type id = it->second.second;
187  _boundary_ids.insert(id);
188  _side_boundary_ids.insert(id);
189  }
190 
192  end = _boundary_shellface_id.end();
193  it != end; ++it)
194  {
195  const boundary_id_type id = it->second.second;
196  _boundary_ids.insert(id);
197  _shellface_boundary_ids.insert(id);
198  }
199 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_shellface_iter
std::set< boundary_id_type > _node_boundary_ids
std::set< boundary_id_type > _edge_boundary_ids
std::set< boundary_id_type > _boundary_ids
std::multimap< const Node *, boundary_id_type >::const_iterator boundary_node_iter
std::set< boundary_id_type > _side_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_edge_iter
IterBase * end
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::const_iterator boundary_side_iter
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
int8_t boundary_id_type
Definition: id_types.h:51
std::multimap< const Node *, boundary_id_type > _boundary_node_id
std::set< boundary_id_type > _shellface_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
void libMesh::BoundaryInfo::remove ( const Elem elem)

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

Definition at line 1424 of file boundary_info.C.

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

1425 {
1426  libmesh_assert(elem);
1427 
1428  // Erase everything associated with elem
1429  _boundary_edge_id.erase (elem);
1430  _boundary_side_id.erase (elem);
1431  _boundary_shellface_id.erase (elem);
1432 }
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
libmesh_assert(j)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
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 1436 of file boundary_info.C.

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

Referenced by libMesh::MeshTools::Modification::change_boundary_id().

1438 {
1439  libmesh_assert(elem);
1440 
1441  // The user shouldn't be trying to remove only one child's boundary
1442  // id
1443  libmesh_assert_equal_to (elem->level(), 0);
1444 
1445  // Some older compilers don't support erasing from a map with
1446  // const_iterators, so we explicitly use non-const iterators here.
1447  std::pair<erase_iter, erase_iter>
1448  e = _boundary_edge_id.equal_range(elem);
1449 
1450  // elem may be there, maybe multiple occurrences
1451  while (e.first != e.second)
1452  {
1453  // if this is true we found the requested edge
1454  // of the element and want to erase the id
1455  if (e.first->second.first == edge)
1456  {
1457  // (postfix++ - increment the iterator before it's invalid)
1458  _boundary_edge_id.erase(e.first++);
1459  }
1460  else
1461  ++e.first;
1462  }
1463 }
libmesh_assert(j)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
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 1467 of file boundary_info.C.

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

1470 {
1471  libmesh_assert(elem);
1472 
1473  // The user shouldn't be trying to remove only one child's boundary
1474  // id
1475  libmesh_assert_equal_to (elem->level(), 0);
1476 
1477  // Some older compilers don't support erasing from a map with
1478  // const_iterators, so we explicitly use non-const iterators here.
1479  std::pair<erase_iter, erase_iter>
1480  e = _boundary_edge_id.equal_range(elem);
1481 
1482  // elem may be there, maybe multiple occurrences
1483  while (e.first != e.second)
1484  {
1485  // if this is true we found the requested edge
1486  // of the element and want to erase the requested id
1487  if (e.first->second.first == edge &&
1488  e.first->second.second == id)
1489  {
1490  // (postfix++ - increment the iterator before it's invalid)
1491  _boundary_edge_id.erase(e.first++);
1492  }
1493  else
1494  ++e.first;
1495  }
1496 }
libmesh_assert(j)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
void libMesh::BoundaryInfo::remove_id ( boundary_id_type  id)

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.

Definition at line 1627 of file boundary_info.C.

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

Referenced by libMesh::MeshTools::Modification::change_boundary_id().

1628 {
1629  // Erase id from ids containers
1630  _boundary_ids.erase(id);
1631  _side_boundary_ids.erase(id);
1632  _edge_boundary_ids.erase(id);
1633  _shellface_boundary_ids.erase(id);
1634  _node_boundary_ids.erase(id);
1635  _ss_id_to_name.erase(id);
1636  _ns_id_to_name.erase(id);
1637 
1638  // Erase pointers to geometric entities with this id.
1639  for (boundary_node_erase_iter it = _boundary_node_id.begin(); it != _boundary_node_id.end(); /*below*/)
1640  {
1641  if (it->second == id)
1642  _boundary_node_id.erase(it++);
1643  else
1644  ++it;
1645  }
1646 
1647  for (erase_iter it = _boundary_edge_id.begin(); it != _boundary_edge_id.end(); /*below*/)
1648  {
1649  if (it->second.second == id)
1650  _boundary_edge_id.erase(it++);
1651  else
1652  ++it;
1653  }
1654 
1655  for (erase_iter it = _boundary_shellface_id.begin(); it != _boundary_shellface_id.end(); /*below*/)
1656  {
1657  if (it->second.second == id)
1658  _boundary_shellface_id.erase(it++);
1659  else
1660  ++it;
1661  }
1662 
1663  for (erase_iter it = _boundary_side_id.begin(); it != _boundary_side_id.end(); /*below*/)
1664  {
1665  if (it->second.second == id)
1666  _boundary_side_id.erase(it++);
1667  else
1668  ++it;
1669  }
1670 }
std::map< boundary_id_type, std::string > _ns_id_to_name
std::set< boundary_id_type > _node_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > >::iterator erase_iter
std::set< boundary_id_type > _edge_boundary_ids
std::multimap< const Node *, boundary_id_type >::iterator boundary_node_erase_iter
std::set< boundary_id_type > _boundary_ids
std::set< boundary_id_type > _side_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
std::map< boundary_id_type, std::string > _ss_id_to_name
std::multimap< const Node *, boundary_id_type > _boundary_node_id
std::set< boundary_id_type > _shellface_boundary_ids
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_edge_id
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 1499 of file boundary_info.C.

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

Referenced by libMesh::MeshTools::Modification::change_boundary_id().

1501 {
1502  libmesh_assert(elem);
1503 
1504  // The user shouldn't be trying to remove only one child's boundary
1505  // id
1506  libmesh_assert_equal_to (elem->level(), 0);
1507 
1508  // Shells only have 2 faces
1509  libmesh_assert_less(shellface, 2);
1510 
1511  // Some older compilers don't support erasing from a map with
1512  // const_iterators, so we explicitly use non-const iterators here.
1513  std::pair<erase_iter, erase_iter>
1514  e = _boundary_shellface_id.equal_range(elem);
1515 
1516  // elem may be there, maybe multiple occurrences
1517  while (e.first != e.second)
1518  {
1519  // if this is true we found the requested shellface
1520  // of the element and want to erase the id
1521  if (e.first->second.first == shellface)
1522  {
1523  // (postfix++ - increment the iterator before it's invalid)
1524  _boundary_shellface_id.erase(e.first++);
1525  }
1526  else
1527  ++e.first;
1528  }
1529 }
libmesh_assert(j)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
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 1533 of file boundary_info.C.

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

1536 {
1537  libmesh_assert(elem);
1538 
1539  // The user shouldn't be trying to remove only one child's boundary
1540  // id
1541  libmesh_assert_equal_to (elem->level(), 0);
1542 
1543  // Shells only have 2 faces
1544  libmesh_assert_less(shellface, 2);
1545 
1546  // Some older compilers don't support erasing from a map with
1547  // const_iterators, so we explicitly use non-const iterators here.
1548  std::pair<erase_iter, erase_iter>
1549  e = _boundary_shellface_id.equal_range(elem);
1550 
1551  // elem may be there, maybe multiple occurrences
1552  while (e.first != e.second)
1553  {
1554  // if this is true we found the requested shellface
1555  // of the element and want to erase the requested id
1556  if (e.first->second.first == shellface &&
1557  e.first->second.second == id)
1558  {
1559  // (postfix++ - increment the iterator before it's invalid)
1560  _boundary_shellface_id.erase(e.first++);
1561  }
1562  else
1563  ++e.first;
1564  }
1565 }
libmesh_assert(j)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_id
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 1567 of file boundary_info.C.

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

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), and libMesh::ReplicatedMesh::stitching_helper().

1569 {
1570  libmesh_assert(elem);
1571 
1572  // The user shouldn't be trying to remove only one child's boundary
1573  // id
1574  libmesh_assert_equal_to (elem->level(), 0);
1575 
1576  // Some older compilers don't support erasing from a map with
1577  // const_iterators, so we explicitly use non-const iterators here.
1578  std::pair<erase_iter, erase_iter>
1579  e = _boundary_side_id.equal_range(elem);
1580 
1581  // elem may be there, maybe multiple occurrences
1582  while (e.first != e.second)
1583  {
1584  // if this is true we found the requested side
1585  // of the element and want to erase the id
1586  if (e.first->second.first == side)
1587  {
1588  // (postfix++ - increment the iterator before it's invalid)
1589  _boundary_side_id.erase(e.first++);
1590  }
1591  else
1592  ++e.first;
1593  }
1594 }
unsigned short int side
Definition: xdr_io.C:49
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
libmesh_assert(j)
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 1598 of file boundary_info.C.

References _boundary_side_id, and libMesh::libmesh_assert().

1601 {
1602  libmesh_assert(elem);
1603 
1604  // Some older compilers don't support erasing from a map with
1605  // const_iterators, so we explicitly use non-const iterators here.
1606  std::pair<erase_iter, erase_iter>
1607  e = _boundary_side_id.equal_range(elem);
1608 
1609  // elem may be there, maybe multiple occurrences
1610  while (e.first != e.second)
1611  {
1612  // if this is true we found the requested side
1613  // of the element and want to erase the requested id
1614  if (e.first->second.first == side &&
1615  e.first->second.second == id)
1616  {
1617  // (postfix++ - increment the iterator before it's invalid)
1618  _boundary_side_id.erase(e.first++);
1619  }
1620  else
1621  ++e.first;
1622  }
1623 }
unsigned short int side
Definition: xdr_io.C:49
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
libmesh_assert(j)
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 785 of file boundary_info.h.

References _ns_id_to_name.

Referenced by libMesh::MeshCommunication::broadcast(), libMesh::CheckpointIO::read_bc_names(), libMesh::CheckpointIO::read_header(), and libMesh::XdrIO::read_serialized_bc_names().

786  { return _ns_id_to_name; }
std::map< boundary_id_type, std::string > _ns_id_to_name
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 777 of file boundary_info.h.

References _ss_id_to_name.

Referenced by libMesh::MeshCommunication::broadcast(), libMesh::CheckpointIO::read_bc_names(), libMesh::CheckpointIO::read_header(), and libMesh::XdrIO::read_serialized_bc_names().

778  { return _ss_id_to_name; }
std::map< boundary_id_type, std::string > _ss_id_to_name
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 1183 of file boundary_info.C.

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

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), n_boundary_ids(), n_shellface_boundary_ids(), libMesh::Parallel::Packing< const Elem * >::pack(), and libMesh::XdrIO::write_serialized_bcs_helper().

1186 {
1187  libmesh_assert(elem);
1188 
1189  // Shells only have 2 faces
1190  libmesh_assert_less(shellface, 2);
1191 
1192  // Clear out any previous contents
1193  vec_to_fill.clear();
1194 
1195  // Only level-0 elements store BCs. If this is not a level-0
1196  // element get its level-0 parent and infer the BCs.
1197  const Elem * searched_elem = elem;
1198 #ifdef LIBMESH_ENABLE_AMR
1199  if (elem->level() != 0)
1200  {
1201  while (searched_elem->parent() != libmesh_nullptr)
1202  {
1203  const Elem * parent = searched_elem->parent();
1204  searched_elem = parent;
1205  }
1206  }
1207 #endif
1208 
1209  std::pair<boundary_shellface_iter, boundary_shellface_iter>
1210  e = _boundary_shellface_id.equal_range(searched_elem);
1211 
1212  // Check each element in the range to see if its shellface matches the requested shellface.
1213  for (; e.first != e.second; ++e.first)
1214  if (e.first->second.first == shellface)
1215  vec_to_fill.push_back(e.first->second.second);
1216 }
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_shellface_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 1674 of file boundary_info.C.

References _boundary_side_id, libMesh::invalid_uint, libMesh::Elem::is_child_on_side(), libMesh::Elem::level(), libmesh_nullptr, libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), side, libMesh::Elem::top_parent(), and libMesh::Elem::which_child_am_i().

Referenced by libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::FEAbstract::compute_periodic_node_constraints(), and n_boundary_ids().

1676 {
1677  const Elem * searched_elem = elem;
1678  if (elem->level() != 0)
1679  searched_elem = elem->top_parent();
1680 
1681  std::pair<boundary_side_iter, boundary_side_iter>
1682  e = _boundary_side_id.equal_range(searched_elem);
1683 
1684  // elem may have zero or multiple occurrences
1685  for (; e.first != e.second; ++e.first)
1686  {
1687  // if this is true we found the requested boundary_id
1688  // of the element and want to return the side
1689  if (e.first->second.second == boundary_id_in)
1690  {
1691  unsigned int side = e.first->second.first;
1692 
1693  // If we're on this external boundary then we share this
1694  // external boundary id
1695  if (elem->neighbor_ptr(side) == libmesh_nullptr)
1696  return side;
1697 
1698  // If we're on an internal boundary then we need to be sure
1699  // it's the same internal boundary as our top_parent
1700  const Elem * p = elem;
1701 
1702 #ifdef LIBMESH_ENABLE_AMR
1703 
1704  while (p != libmesh_nullptr)
1705  {
1706  const Elem * parent = p->parent();
1707  if (!parent->is_child_on_side(parent->which_child_am_i(p), side))
1708  break;
1709  p = parent;
1710  }
1711 #endif
1712  // We're on that side of our top_parent; return it
1713  if (!p)
1714  return side;
1715  }
1716  }
1717 
1718  // if we get here, we found elem in the data structure but not
1719  // the requested boundary id, so return the default value
1720  return libMesh::invalid_uint;
1721 }
const unsigned int invalid_uint
Definition: libmesh.h:184
unsigned short int side
Definition: xdr_io.C:49
const class libmesh_nullptr_t libmesh_nullptr
std::multimap< const Elem *, std::pair< unsigned short int, boundary_id_type > > _boundary_side_id
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 2432 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(), get_node_boundary_ids(), libMesh::UNVIO::groups_in(), and libMesh::ExodusII_IO::read().

2433 {
2434  return _ss_id_to_name[id];
2435 }
std::map< boundary_id_type, std::string > _ss_id_to_name
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 203 of file boundary_info.C.

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

Referenced by sync().

204 {
205  std::set<boundary_id_type> request_boundary_ids(_boundary_ids);
206  request_boundary_ids.insert(invalid_id);
207  if (!_mesh.is_serial())
208  this->comm().set_union(request_boundary_ids);
209 
210  this->sync(request_boundary_ids,
211  boundary_mesh);
212 }
virtual bool is_serial() const
Definition: mesh_base.h:137
void sync(UnstructuredMesh &boundary_mesh)
std::set< boundary_id_type > _boundary_ids
static const boundary_id_type invalid_id
const Parallel::Communicator & comm() const
void set_union(T &data, const unsigned int root_id) const
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 216 of file boundary_info.C.

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

218 {
219  // Call the 3 argument version of this function with a dummy value for the third set.
220  std::set<subdomain_id_type> subdomains_relative_to;
221  subdomains_relative_to.insert(Elem::invalid_subdomain_id);
222 
223  this->sync(requested_boundary_ids,
224  boundary_mesh,
225  subdomains_relative_to);
226 }
void sync(UnstructuredMesh &boundary_mesh)
static const subdomain_id_type invalid_subdomain_id
Definition: elem.h:213
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. Use a temporary serializer here.

Re-create the boundary mesh.

Definition at line 230 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::delete_remote_elements(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::MeshBase::get_boundary_info(), libMesh::DofObject::id(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::Elem::n_nodes(), libMesh::MeshBase::n_partitions(), libMesh::Elem::node_id(), libMesh::MeshBase::node_ptr(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), libMesh::MeshBase::partitioner(), libMesh::MeshBase::prepare_for_use(), libMesh::DofObject::processor_id(), libMesh::MeshBase::set_n_partitions(), libMesh::Elem::set_node(), and libMesh::Partitioner::set_node_processor_ids().

233 {
234  LOG_SCOPE("sync()", "BoundaryInfo");
235 
236  boundary_mesh.clear();
237 
243  if (!_mesh.is_serial())
244  boundary_mesh.delete_remote_elements();
245 
252  MeshSerializer serializer
253  (const_cast<MeshBase &>(_mesh), boundary_mesh.is_serial());
254 
259  boundary_mesh.set_n_partitions() = _mesh.n_partitions();
260 
261  std::map<dof_id_type, dof_id_type> node_id_map;
262  std::map<std::pair<dof_id_type, unsigned char>, dof_id_type> side_id_map;
263 
264  this->_find_id_maps(requested_boundary_ids, 0, &node_id_map, 0, &side_id_map, subdomains_relative_to);
265 
266  // Let's add all the boundary nodes we found to the boundary mesh
267 
268  MeshBase::const_node_iterator n_end = _mesh.nodes_end();
269 
270  for (MeshBase::const_node_iterator n_it = _mesh.nodes_begin();
271  n_it != n_end; ++n_it)
272  {
273  const Node * node = *n_it;
274  dof_id_type node_id = node->id();
275  if (node_id_map.count(node_id))
276  {
277  boundary_mesh.add_point(*node, node_id_map[node_id], node->processor_id());
278 
279  // Copy over all the node's boundary IDs to boundary_mesh
280  std::vector<boundary_id_type> node_boundary_ids;
281  this->boundary_ids(node, node_boundary_ids);
282  for (std::size_t index=0; index<node_boundary_ids.size(); index++)
283  {
284  boundary_mesh.get_boundary_info().add_node(node_id_map[node_id],
285  node_boundary_ids[index]);
286  }
287  }
288  }
289 
290  // Let's add the elements
291  this->add_elements (requested_boundary_ids, boundary_mesh, subdomains_relative_to);
292 
293  // The new elements are currently using the interior mesh's nodes;
294  // we want them to use the boundary mesh's nodes instead.
295 
296  // This side's Node pointers still point to the nodes of the original mesh.
297  // We need to re-point them to the boundary mesh's nodes! Since we copied *ALL* of
298  // the original mesh's nodes over, we should be guaranteed to have the same ordering.
299 
300  const MeshBase::element_iterator end_bdy_el =
301  boundary_mesh.elements_end();
302 
303  for (MeshBase::element_iterator el = boundary_mesh.elements_begin();
304  el != end_bdy_el; ++el)
305  {
306  Elem * new_elem = *el;
307 
308  for (unsigned int nn=0; nn<new_elem->n_nodes(); ++nn)
309  {
310  // Get the correct node pointer, based on the id()
311  Node * new_node =
312  boundary_mesh.node_ptr(node_id_map[new_elem->node_id(nn)]);
313 
314  // sanity check: be sure that the new Node exists and its
315  // global id really matches
316  libmesh_assert (new_node);
317  libmesh_assert_equal_to (new_node->id(),
318  node_id_map[new_elem->node_id(nn)]);
319 
320  // Assign the new node pointer
321  new_elem->set_node(nn) = new_node;
322  }
323  }
324 
325  // Don't repartition this mesh; we want it to stay in sync with the
326  // interior partitioning.
327  boundary_mesh.partitioner().reset(libmesh_nullptr);
328 
329  // Make boundary_mesh nodes and elements contiguous
330  boundary_mesh.prepare_for_use(/*skip_renumber =*/ false);
331 
332  // and finally distribute element partitioning to the nodes
334 }
void add_elements(const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh)
virtual bool is_serial() const
Definition: mesh_base.h:137
static void set_node_processor_ids(MeshBase &mesh)
Definition: partitioner.C:431
unsigned int n_partitions() const
Definition: mesh_base.h:818
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
std::vector< boundary_id_type > boundary_ids(const Node *node) const
virtual node_iterator nodes_begin()=0
virtual node_iterator nodes_end()=0
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)
uint8_t dof_id_type
Definition: id_types.h:64

Friends And Related Function Documentation

friend class MeshBase
friend

Definition at line 59 of file boundary_info.h.

Member Data Documentation

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

Data structure that maps edges of elements to boundary ids. This is only relevant in 3D.

Definition at line 841 of file boundary_info.h.

Referenced by add_edge(), build_edge_list(), clear(), edge_boundary_ids(), n_edge_conds(), operator=(), print_info(), print_summary(), raw_edge_boundary_ids(), regenerate_id_sets(), remove(), remove_edge(), and remove_id().

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.

Definition at line 892 of file boundary_info.h.

Referenced by add_edge(), add_node(), add_shellface(), add_side(), clear(), get_boundary_ids(), n_boundary_ids(), operator=(), regenerate_id_sets(), remove_id(), and sync().

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

Data structure that maps faces of shell elements to boundary ids. This is only relevant for shell elements.

Definition at line 855 of file boundary_info.h.

Referenced by add_shellface(), build_shellface_boundary_ids(), build_shellface_list(), clear(), n_shellface_conds(), operator=(), print_info(), print_summary(), raw_shellface_boundary_ids(), regenerate_id_sets(), remove(), remove_id(), remove_shellface(), and shellface_boundary_ids().

std::multimap<const Elem *, std::pair<unsigned short int, boundary_id_type> > libMesh::BoundaryInfo::_boundary_side_id
private
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.

Definition at line 910 of file boundary_info.h.

Referenced by add_edge(), clear(), get_edge_boundary_ids(), operator=(), regenerate_id_sets(), and remove_id().

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.

Definition at line 919 of file boundary_info.h.

Referenced by add_node(), clear(), get_node_boundary_ids(), operator=(), regenerate_id_sets(), and remove_id().

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 that support named blocks. Currently this is only implemented for ExodusII

Definition at line 943 of file boundary_info.h.

Referenced by get_id_by_name(), get_nodeset_name(), get_nodeset_name_map(), nodeset_name(), remove_id(), and set_nodeset_name_map().

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.

Definition at line 929 of file boundary_info.h.

Referenced by add_shellface(), clear(), get_shellface_boundary_ids(), operator=(), regenerate_id_sets(), and remove_id().

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.

Definition at line 901 of file boundary_info.h.

Referenced by add_side(), clear(), get_side_boundary_ids(), operator=(), regenerate_id_sets(), and remove_id().

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 that support named blocks. Currently this is only implemented for ExodusII

Definition at line 936 of file boundary_info.h.

Referenced by get_id_by_name(), get_sideset_name(), get_sideset_name_map(), remove_id(), set_sideset_name_map(), and sideset_name().


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