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

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

Typdef for iterators into the _boundary_edge_id container.

Definition at line 798 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 784 of file boundary_info.h.

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

Typdef for iterators into the _boundary_node_id container.

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

Typdef for iterators into the _boundary_shellface_id container.

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

Typdef for iterators into the _boundary_side_id container.

Definition at line 827 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 835 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 
)
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 2437 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::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, and libMesh::Elem::top_parent().

Referenced by add_elements(), and sync().

2442 {
2443  // We'll do the same modulus trick that DistributedMesh uses to avoid
2444  // id conflicts between different processors
2445  dof_id_type
2446  next_node_id = first_free_node_id + this->processor_id(),
2447  next_elem_id = first_free_elem_id + this->processor_id();
2448 
2449  // We'll pass through the mesh once first to build
2450  // the maps and count boundary nodes and elements.
2451  // To find local boundary nodes, we have to examine all elements
2452  // here rather than just local elements, because it's possible to
2453  // have a local boundary node that's not on a local boundary
2454  // element, e.g. at the tip of a triangle.
2455 
2456  // We'll loop through two different ranges here: first all elements,
2457  // looking for local nodes, and second through unpartitioned
2458  // elements, looking for all remaining nodes.
2459  const MeshBase::const_element_iterator end_el = _mesh.elements_end();
2460  bool hit_end_el = false;
2461  const MeshBase::const_element_iterator end_unpartitioned_el =
2463 
2464  for (MeshBase::const_element_iterator el = _mesh.elements_begin();
2465  !hit_end_el || (el != end_unpartitioned_el); ++el)
2466  {
2467  if ((el == end_el) && !hit_end_el)
2468  {
2469  // Note that we're done with local nodes and just looking
2470  // for remaining unpartitioned nodes
2471  hit_end_el = true;
2472 
2473  // Join up the local results from other processors
2474  if (side_id_map)
2475  this->comm().set_union(*side_id_map);
2476  if (node_id_map)
2477  this->comm().set_union(*node_id_map);
2478 
2479  // Finally we'll pass through any unpartitioned elements to add them
2480  // to the maps and counts.
2481  next_node_id = first_free_node_id + this->n_processors();
2482  next_elem_id = first_free_elem_id + this->n_processors();
2483 
2485  if (el == end_unpartitioned_el)
2486  break;
2487  }
2488 
2489  const Elem * elem = *el;
2490 
2491  for (unsigned char s=0; s<elem->n_sides(); s++)
2492  if (elem->neighbor_ptr(s) == libmesh_nullptr) // on the boundary
2493  {
2494  // Get the top-level parent for this element
2495  const Elem * top_parent = elem->top_parent();
2496 
2497  // Find the right id number for that side
2498  std::pair<boundary_side_iter, boundary_side_iter> pos = _boundary_side_id.equal_range(top_parent);
2499 
2500  bool add_this_side = false;
2501  boundary_id_type this_bcid = invalid_id;
2502 
2503  for (; pos.first != pos.second; ++pos.first)
2504  {
2505  this_bcid = pos.first->second.second;
2506 
2507  // if this side is flagged with a boundary condition
2508  // and the user wants this id
2509  if ((pos.first->second.first == s) &&
2510  (requested_boundary_ids.count(this_bcid)))
2511  {
2512  add_this_side = true;
2513  break;
2514  }
2515  }
2516 
2517  // if side s wasn't found or doesn't have a boundary
2518  // condition we may still want to add it
2519  if (pos.first == pos.second)
2520  {
2521  this_bcid = invalid_id;
2522  if (requested_boundary_ids.count(this_bcid))
2523  add_this_side = true;
2524  }
2525 
2526  if (add_this_side)
2527  {
2528  // We only assign ids for our own and for
2529  // unpartitioned elements
2530  if (side_id_map &&
2531  ((elem->processor_id() == this->processor_id()) ||
2532  (elem->processor_id() ==
2534  {
2535  std::pair<dof_id_type, unsigned char> side_pair(elem->id(), s);
2536  libmesh_assert (!side_id_map->count(side_pair));
2537  (*side_id_map)[side_pair] = next_elem_id;
2538  next_elem_id += this->n_processors() + 1;
2539  }
2540 
2541  // Use a proxy element for the side to query nodes
2542  UniquePtr<const Elem> side (elem->build_side_ptr(s));
2543  for (unsigned int n = 0; n != side->n_nodes(); ++n)
2544  {
2545  const Node & node = side->node_ref(n);
2546 
2547  // In parallel we don't know enough to number
2548  // others' nodes ourselves.
2549  if (!hit_end_el &&
2550  (node.processor_id() != this->processor_id()))
2551  continue;
2552 
2553  dof_id_type node_id = node.id();
2554  if (node_id_map && !node_id_map->count(node_id))
2555  {
2556  (*node_id_map)[node_id] = next_node_id;
2557  next_node_id += this->n_processors() + 1;
2558  }
2559  }
2560  }
2561  }
2562  }
2563 
2564  // FIXME: ought to renumber side/node_id_map image to be contiguous
2565  // to save memory, also ought to reserve memory
2566 }
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 > > _boundary_side_id
libmesh_assert(j)
virtual element_iterator elements_begin()=0
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:346
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 692 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().

695 {
696  this->add_edge (_mesh.elem_ptr(e), edge, id);
697 }
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 701 of file boundary_info.C.

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

704 {
705  libmesh_assert(elem);
706 
707  // Only add BCs for level-0 elements.
708  libmesh_assert_equal_to (elem->level(), 0);
709 
710  if (id == invalid_id)
711  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
712  << invalid_id \
713  << "\n That is reserved for internal use.");
714 
715  // Don't add the same ID twice
716  std::pair<boundary_edge_iter, boundary_edge_iter> pos = _boundary_edge_id.equal_range(elem);
717 
718  for (; pos.first != pos.second; ++pos.first)
719  if (pos.first->second.first == edge &&
720  pos.first->second.second == id)
721  return;
722 
723  _boundary_edge_id.insert(std::make_pair(elem, std::make_pair(edge, id)));
724  _boundary_ids.insert(id);
725  _edge_boundary_ids.insert(id); // Also add this ID to the set of edge boundary IDs
726 }
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 730 of file boundary_info.C.

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

733 {
734  if (ids.empty())
735  return;
736 
737  libmesh_assert(elem);
738 
739  // Only add BCs for level-0 elements.
740  libmesh_assert_equal_to (elem->level(), 0);
741 
742  // Don't add the same ID twice
743  std::pair<boundary_edge_iter, boundary_edge_iter> pos = _boundary_edge_id.equal_range(elem);
744 
745  // The entries in the ids vector may be non-unique. If we expected
746  // *lots* of ids, it might be fastest to construct a std::set from
747  // the entries, but for a small number of entries, which is more
748  // typical, it is probably faster to copy the vector and do sort+unique.
749  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
750  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
751  std::sort(unique_ids.begin(), unique_ids.end());
752  std::vector<boundary_id_type>::iterator new_end =
753  std::unique(unique_ids.begin(), unique_ids.end());
754 
755  std::vector<boundary_id_type>::iterator it = unique_ids.begin();
756  for (; it != new_end; ++it)
757  {
758  boundary_id_type id = *it;
759 
760  if (id == invalid_id)
761  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
762  << invalid_id \
763  << "\n That is reserved for internal use.");
764 
765  bool already_inserted = false;
766  for (boundary_edge_iter p = pos.first; p != pos.second; ++p)
767  if (p->second.first == edge &&
768  p->second.second == id)
769  {
770  already_inserted = true;
771  break;
772  }
773  if (already_inserted)
774  continue;
775 
776  _boundary_edge_id.insert(std::make_pair(elem, std::make_pair(edge, id)));
777  _boundary_ids.insert(id);
778  _edge_boundary_ids.insert(id); // Also add this ID to the set of edge boundary IDs
779  }
780 }
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 378 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::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, and libMesh::Elem::top_parent().

Referenced by sync().

380 {
381  LOG_SCOPE("add_elements()", "BoundaryInfo");
382 
383  // We're not prepared to mix serial and distributed meshes in this
384  // method, so make sure they match from the start.
385  libmesh_assert_equal_to(_mesh.is_serial(),
386  boundary_mesh.is_serial());
387 
388  std::map<std::pair<dof_id_type, unsigned char>, dof_id_type> side_id_map;
389  this->_find_id_maps(requested_boundary_ids,
390  0,
392  boundary_mesh.max_elem_id(),
393  &side_id_map);
394 
395  // We have to add sides *outside* any element loop, because if
396  // boundary_mesh and _mesh are the same then those additions can
397  // invalidate our element iterators. So we just use the element
398  // loop to make a list of sides to add.
399  typedef std::vector<std::pair<dof_id_type, unsigned char> >
400  side_container;
401  side_container sides_to_add;
402 
403  const MeshBase::const_element_iterator end_el = _mesh.elements_end();
404  for (MeshBase::const_element_iterator el = _mesh.elements_begin();
405  el != end_el; ++el)
406  {
407  const Elem * elem = *el;
408 
409  for (unsigned int s=0; s<elem->n_sides(); s++)
410  if (elem->neighbor_ptr(s) == libmesh_nullptr) // on the boundary
411  {
412  // Get the top-level parent for this element
413  const Elem * top_parent = elem->top_parent();
414 
415  // Find the right id number for that side
416  std::pair<boundary_side_iter, boundary_side_iter> pos = _boundary_side_id.equal_range(top_parent);
417 
418  bool add_this_side = false;
419  boundary_id_type this_bcid = invalid_id;
420 
421  for (; pos.first != pos.second; ++pos.first)
422  {
423  this_bcid = pos.first->second.second;
424 
425  // if this side is flagged with a boundary condition
426  // and the user wants this id
427  if ((pos.first->second.first == s) &&
428  (requested_boundary_ids.count(this_bcid)))
429  {
430  add_this_side = true;
431  break;
432  }
433  }
434 
435  // if side s wasn't found or doesn't have a boundary
436  // condition we may still want to add it
437  if (pos.first == pos.second)
438  {
439  this_bcid = invalid_id;
440  if (requested_boundary_ids.count(this_bcid))
441  add_this_side = true;
442  }
443 
444  if (add_this_side)
445  sides_to_add.push_back
446  (std::make_pair(elem->id(), s));
447  }
448  }
449 
450 #ifdef LIBMESH_ENABLE_UNIQUE_ID
451  unique_id_type old_max_unique_id = boundary_mesh.parallel_max_unique_id();
452 #endif
453 
454  for (side_container::const_iterator it = sides_to_add.begin();
455  it != sides_to_add.end(); ++it)
456  {
457  const dof_id_type elem_id = it->first;
458  const unsigned char s = it->second;
459  Elem * elem = _mesh.elem_ptr(elem_id);
460 
461  // Build the side - do not use a "proxy" element here:
462  // This will be going into the boundary_mesh and needs to
463  // stand on its own.
464  UniquePtr<Elem> side (elem->build_side_ptr(s, false));
465 
466  side->processor_id() = elem->processor_id();
467 
468  const std::pair<dof_id_type, unsigned char> side_pair(elem_id, s);
469 
470  libmesh_assert(side_id_map.count(side_pair));
471 
472  const dof_id_type new_side_id = side_id_map[side_pair];
473 
474  side->set_id(new_side_id);
475 
476 #ifdef LIBMESH_ENABLE_UNIQUE_ID
477  side->set_unique_id() = old_max_unique_id + new_side_id;
478 #endif
479 
480  // Add the side
481  Elem * new_elem = boundary_mesh.add_elem(side.release());
482 
483 #ifdef LIBMESH_ENABLE_AMR
484  // Set parent links
485  if (elem->parent())
486  {
487  const std::pair<dof_id_type, unsigned char> parent_side_pair(elem->parent()->id(), s);
488 
489  libmesh_assert(side_id_map.count(parent_side_pair));
490 
491  Elem * side_parent = boundary_mesh.elem_ptr(side_id_map[parent_side_pair]);
492 
493  libmesh_assert(side_parent);
494 
495  new_elem->set_parent(side_parent);
496 
497  side_parent->set_refinement_flag(Elem::INACTIVE);
498 
499  // Figuring out which child we are of our parent
500  // is a trick. Due to libMesh child numbering
501  // conventions, if we are an element on a vertex,
502  // then we share that vertex with our parent, with
503  // the same local index.
504  bool found_child = false;
505  for (unsigned int v=0; v != new_elem->n_vertices(); ++v)
506  if (new_elem->node_ptr(v) == side_parent->node_ptr(v))
507  {
508  side_parent->add_child(new_elem, v);
509  found_child = true;
510  }
511 
512  // If we don't share any vertex with our parent,
513  // then we're the fourth child (index 3) of a
514  // triangle.
515  if (!found_child)
516  {
517  libmesh_assert_equal_to (new_elem->n_vertices(), 3);
518  side_parent->add_child(new_elem, 3);
519  }
520  }
521 #endif
522 
523  new_elem->set_interior_parent (const_cast<Elem *>(elem));
524 
525  // On non-local elements on DistributedMesh we might have
526  // RemoteElem neighbor links to construct
527  if (!_mesh.is_serial() &&
528  (elem->processor_id() != this->processor_id()))
529  {
530  // Check every interior side for a RemoteElem
531  for (unsigned int interior_side = 0;
532  interior_side != elem->n_sides();
533  ++interior_side)
534  {
535  // Might this interior side have a RemoteElem that
536  // needs a corresponding Remote on a boundary side?
537  if (elem->neighbor_ptr(interior_side) != remote_elem)
538  continue;
539 
540  // Which boundary side?
541  for (unsigned int boundary_side = 0;
542  boundary_side != new_elem->n_sides();
543  ++boundary_side)
544  {
545  // Look for matching node points. This is safe in
546  // *this* context.
547  bool found_all_nodes = true;
548  for (unsigned int boundary_node = 0;
549  boundary_node != new_elem->n_nodes();
550  ++boundary_node)
551  {
552  if (!new_elem->is_node_on_side(boundary_node,
553  boundary_side))
554  continue;
555 
556  bool found_this_node = false;
557  for (unsigned int interior_node = 0;
558  interior_node != elem->n_nodes();
559  ++interior_node)
560  {
561  if (!elem->is_node_on_side(interior_node,
562  interior_side))
563  continue;
564 
565  if (new_elem->point(boundary_node) ==
566  elem->point(interior_node))
567  {
568  found_this_node = true;
569  break;
570  }
571  }
572  if (!found_this_node)
573  {
574  found_all_nodes = false;
575  break;
576  }
577  }
578 
579  if (found_all_nodes)
580  {
581  new_elem->set_neighbor
582  (boundary_side,
583  const_cast<RemoteElem *>(remote_elem));
584  break;
585  }
586  }
587  }
588  }
589  }
590 
591  // We haven't been bothering to keep unique ids consistent on ghost
592  // elements
593  if (!boundary_mesh.is_serial())
594  MeshCommunication().make_node_unique_ids_parallel_consistent(boundary_mesh);
595 
596  // Make sure we didn't add ids inconsistently
597 #ifdef DEBUG
598 # ifdef LIBMESH_HAVE_RTTI
599  DistributedMesh * parmesh = dynamic_cast<DistributedMesh *>(&boundary_mesh);
600  if (parmesh)
601  parmesh->libmesh_assert_valid_parallel_ids();
602 # endif
603 #endif
604 }
virtual bool is_serial() const
Definition: mesh_base.h:134
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)
virtual element_iterator elements_begin()=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)
int8_t boundary_id_type
Definition: id_types.h:51
static const boundary_id_type invalid_id
virtual element_iterator elements_end()=0
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 616 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(), and libMesh::Parallel::Packing< Node * >::unpack().

618 {
619  if (id == invalid_id)
620  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
621  << invalid_id \
622  << "\n That is reserved for internal use.");
623 
624  // Don't add the same ID twice
625  std::pair<boundary_node_iter, boundary_node_iter> pos = _boundary_node_id.equal_range(node);
626 
627  for (; pos.first != pos.second; ++pos.first)
628  if (pos.first->second == id)
629  return;
630 
631  _boundary_node_id.insert(std::make_pair(node, id));
632  _boundary_ids.insert(id);
633  _node_boundary_ids.insert(id); // Also add this ID to the set of node boundary IDs
634 }
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 608 of file boundary_info.C.

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

610 {
611  this->add_node (_mesh.node_ptr(node), id);
612 }
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 638 of file boundary_info.C.

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

640 {
641  if (ids.empty())
642  return;
643 
644  libmesh_assert(node);
645 
646  // Don't add the same ID twice
647  std::pair<boundary_node_iter, boundary_node_iter> pos = _boundary_node_id.equal_range(node);
648 
649  // The entries in the ids vector may be non-unique. If we expected
650  // *lots* of ids, it might be fastest to construct a std::set from
651  // the entries, but for a small number of entries, which is more
652  // typical, it is probably faster to copy the vector and do sort+unique.
653  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
654  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
655  std::sort(unique_ids.begin(), unique_ids.end());
656  std::vector<boundary_id_type>::iterator new_end =
657  std::unique(unique_ids.begin(), unique_ids.end());
658 
659  std::vector<boundary_id_type>::iterator it = unique_ids.begin();
660  for (; it != new_end; ++it)
661  {
662  boundary_id_type id = *it;
663 
664  if (id == invalid_id)
665  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
666  << invalid_id \
667  << "\n That is reserved for internal use.");
668 
669  bool already_inserted = false;
670  for (boundary_node_iter p = pos.first; p != pos.second; ++p)
671  if (p->second == id)
672  {
673  already_inserted = true;
674  break;
675  }
676  if (already_inserted)
677  continue;
678 
679  _boundary_node_id.insert(std::make_pair(node,id));
680  _boundary_ids.insert(id);
681  _node_boundary_ids.insert(id); // Also add this ID to the set of node boundary IDs
682  }
683 }
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 784 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().

787 {
788  this->add_shellface (_mesh.elem_ptr(e), shellface, id);
789 }
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 793 of file boundary_info.C.

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

796 {
797  libmesh_assert(elem);
798 
799  // Only add BCs for level-0 elements.
800  libmesh_assert_equal_to (elem->level(), 0);
801 
802  // Shells only have 2 faces
803  libmesh_assert_less(shellface, 2);
804 
805  if (id == invalid_id)
806  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
807  << invalid_id \
808  << "\n That is reserved for internal use.");
809 
810  // Don't add the same ID twice
811  std::pair<boundary_shellface_iter, boundary_shellface_iter> pos = _boundary_shellface_id.equal_range(elem);
812 
813  for (; pos.first != pos.second; ++pos.first)
814  if (pos.first->second.first == shellface &&
815  pos.first->second.second == id)
816  return;
817 
818  _boundary_shellface_id.insert(std::make_pair(elem, std::make_pair(shellface, id)));
819  _boundary_ids.insert(id);
820  _shellface_boundary_ids.insert(id); // Also add this ID to the set of shellface boundary IDs
821 }
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 825 of file boundary_info.C.

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

828 {
829  if (ids.empty())
830  return;
831 
832  libmesh_assert(elem);
833 
834  // Only add BCs for level-0 elements.
835  libmesh_assert_equal_to (elem->level(), 0);
836 
837  // Shells only have 2 faces
838  libmesh_assert_less(shellface, 2);
839 
840  // Don't add the same ID twice
841  std::pair<boundary_shellface_iter, boundary_shellface_iter> pos = _boundary_shellface_id.equal_range(elem);
842 
843  // The entries in the ids vector may be non-unique. If we expected
844  // *lots* of ids, it might be fastest to construct a std::set from
845  // the entries, but for a small number of entries, which is more
846  // typical, it is probably faster to copy the vector and do sort+unique.
847  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
848  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
849  std::sort(unique_ids.begin(), unique_ids.end());
850  std::vector<boundary_id_type>::iterator new_end =
851  std::unique(unique_ids.begin(), unique_ids.end());
852 
853  std::vector<boundary_id_type>::iterator it = unique_ids.begin();
854  for (; it != new_end; ++it)
855  {
856  boundary_id_type id = *it;
857 
858  if (id == invalid_id)
859  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
860  << invalid_id \
861  << "\n That is reserved for internal use.");
862 
863  bool already_inserted = false;
864  for (boundary_shellface_iter p = pos.first; p != pos.second; ++p)
865  if (p->second.first == shellface &&
866  p->second.second == id)
867  {
868  already_inserted = true;
869  break;
870  }
871  if (already_inserted)
872  continue;
873 
874  _boundary_shellface_id.insert(std::make_pair(elem, std::make_pair(shellface, id)));
875  _boundary_ids.insert(id);
876  _shellface_boundary_ids.insert(id); // Also add this ID to the set of shellface boundary IDs
877  }
878 }
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 890 of file boundary_info.C.

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

893 {
894  libmesh_assert(elem);
895 
896  // Only add BCs for level-0 elements.
897  libmesh_assert_equal_to (elem->level(), 0);
898 
899  if (id == invalid_id)
900  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
901  << invalid_id \
902  << "\n That is reserved for internal use.");
903 
904  // Don't add the same ID twice
905  std::pair<boundary_side_iter, boundary_side_iter> pos = _boundary_side_id.equal_range(elem);
906 
907  for (; pos.first != pos.second; ++pos.first)
908  if (pos.first->second.first == side &&
909  pos.first->second.second == id)
910  return;
911 
912  _boundary_side_id.insert(std::make_pair(elem, std::make_pair(side, id)));
913  _boundary_ids.insert(id);
914  _side_boundary_ids.insert(id); // Also add this ID to the set of side boundary IDs
915 }
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 919 of file boundary_info.C.

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

922 {
923  if (ids.empty())
924  return;
925 
926  libmesh_assert(elem);
927 
928  // Only add BCs for level-0 elements.
929  libmesh_assert_equal_to (elem->level(), 0);
930 
931  // Don't add the same ID twice
932  std::pair<boundary_side_iter, boundary_side_iter> pos = _boundary_side_id.equal_range(elem);
933 
934  // The entries in the ids vector may be non-unique. If we expected
935  // *lots* of ids, it might be fastest to construct a std::set from
936  // the entries, but for a small number of entries, which is more
937  // typical, it is probably faster to copy the vector and do sort+unique.
938  // http://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector
939  std::vector<boundary_id_type> unique_ids(ids.begin(), ids.end());
940  std::sort(unique_ids.begin(), unique_ids.end());
941  std::vector<boundary_id_type>::iterator new_end =
942  std::unique(unique_ids.begin(), unique_ids.end());
943 
944  std::vector<boundary_id_type>::const_iterator it = unique_ids.begin();
945  for (; it != new_end; ++it)
946  {
947  boundary_id_type id = *it;
948 
949  if (id == invalid_id)
950  libmesh_error_msg("ERROR: You may not set a boundary ID of " \
951  << invalid_id \
952  << "\n That is reserved for internal use.");
953 
954  bool already_inserted = false;
955  for (boundary_side_iter p = pos.first; p != pos.second; ++p)
956  if (p->second.first == side && p->second.second == id)
957  {
958  already_inserted = true;
959  break;
960  }
961  if (already_inserted)
962  continue;
963 
964  _boundary_side_id.insert(std::make_pair(elem, std::make_pair(side, id)));
965  _boundary_ids.insert(id);
966  _side_boundary_ids.insert(id); // Also add this ID to the set of side boundary IDs
967  }
968 }
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. Note that only one id per side is allowed, however multiple sides per element are allowed. Returns invalid_id if the side does not have an associated boundary id, hence invalid_id can be used as the default boundary id.

Definition at line 1212 of file boundary_info.C.

References boundary_ids(), and invalid_id.

Referenced by n_boundary_ids().

1214 {
1215  // Asking for just one boundary id means your code isn't safe to use
1216  // on meshes with overlapping boundary ids. Try using
1217  // BoundaryInfo::boundary_ids or BoundaryInfo::has_boundary_id
1218  // instead.
1219  libmesh_deprecated();
1220 
1221  std::vector<boundary_id_type> ids;
1222  this->boundary_ids(elem, side, ids);
1223 
1224  // If the set is empty, return invalid_id
1225  if (ids.empty())
1226  return invalid_id;
1227 
1228  // Otherwise, just return the first id we came across for this
1229  // element on this side.
1230  return *(ids.begin());
1231 }
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 997 of file boundary_info.C.

References _boundary_node_id.

999 {
1000  // Clear out any previous contents
1001  vec_to_fill.clear();
1002 
1003  std::pair<boundary_node_iter, boundary_node_iter>
1004  pos = _boundary_node_id.equal_range(node);
1005 
1006  for (; pos.first != pos.second; ++pos.first)
1007  vec_to_fill.push_back(pos.first->second);
1008 }
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.

This function has been deprecated. Instead, use the version of this function that fills a std::vector.

Definition at line 1246 of file boundary_info.C.

References boundary_ids().

1248 {
1249  libmesh_deprecated();
1250 
1251  std::vector<boundary_id_type> ids;
1252  this->boundary_ids(elem, side, ids);
1253  return ids;
1254 }
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 1258 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().

1261 {
1262  libmesh_assert(elem);
1263 
1264  // Clear out any previous contents
1265  vec_to_fill.clear();
1266 
1267  // Only level-0 elements store BCs. If this is not a level-0
1268  // element get its level-0 parent and infer the BCs.
1269  const Elem * searched_elem = elem;
1270  if (elem->level() != 0)
1271  {
1272  if (elem->neighbor_ptr(side) == libmesh_nullptr)
1273  searched_elem = elem->top_parent ();
1274 #ifdef LIBMESH_ENABLE_AMR
1275  else
1276  while (searched_elem->parent() != libmesh_nullptr)
1277  {
1278  const Elem * parent = searched_elem->parent();
1279  if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
1280  return;
1281  searched_elem = parent;
1282  }
1283 #endif
1284  }
1285 
1286  std::pair<boundary_side_iter, boundary_side_iter>
1287  e = _boundary_side_id.equal_range(searched_elem);
1288 
1289  // Check each element in the range to see if its side matches the requested side.
1290  for (; e.first != e.second; ++e.first)
1291  if (e.first->second.first == side)
1292  vec_to_fill.push_back(e.first->second.second);
1293 }
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 2114 of file boundary_info.C.

References _boundary_side_id.

Referenced by n_boundary_ids().

2117 {
2118  // Clear the input vectors, just in case they were used for
2119  // something else recently...
2120  el.clear();
2121  sl.clear();
2122  il.clear();
2123 
2124  boundary_side_iter pos = _boundary_side_id.begin();
2125  for (; pos != _boundary_side_id.end(); ++pos)
2126  {
2127  // Don't add remote sides
2128  if (pos->first->is_remote())
2129  continue;
2130 
2131  // Loop over the sides of possible children
2132  std::vector< const Elem * > family;
2133 #ifdef LIBMESH_ENABLE_AMR
2134  pos->first->active_family_tree_by_side(family, pos->second.first);
2135 #else
2136  family.push_back(pos->first);
2137 #endif
2138 
2139  // Populate the list items
2140  for (std::vector<const Elem *>::iterator elem_it = family.begin(); elem_it != family.end(); elem_it++)
2141  {
2142  el.push_back ((*elem_it)->id());
2143  sl.push_back (pos->second.first);
2144  il.push_back (pos->second.second);
2145  }
2146  }
2147 }
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 2150 of file boundary_info.C.

References _boundary_edge_id.

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

2153 {
2154  // Clear the input vectors, just in case they were used for
2155  // something else recently...
2156  el.clear();
2157  sl.clear();
2158  il.clear();
2159 
2160  // Reserve the size, then use push_back
2161  el.reserve (_boundary_edge_id.size());
2162  sl.reserve (_boundary_edge_id.size());
2163  il.reserve (_boundary_edge_id.size());
2164 
2165  boundary_edge_iter pos = _boundary_edge_id.begin();
2166  for (; pos != _boundary_edge_id.end(); ++pos)
2167  {
2168  el.push_back (pos->first->id());
2169  sl.push_back (pos->second.first);
2170  il.push_back (pos->second.second);
2171  }
2172 }
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 1684 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().

1685 {
1686  b_ids.clear();
1687 
1688  boundary_node_iter pos = _boundary_node_id.begin();
1689  for (; pos != _boundary_node_id.end(); ++pos)
1690  {
1691  boundary_id_type id = pos->second;
1692 
1693  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
1694  b_ids.push_back(id);
1695  }
1696 }
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 1820 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().

1822 {
1823  // Clear the input vectors, just in case they were used for
1824  // something else recently...
1825  nl.clear();
1826  il.clear();
1827 
1828  // Reserve the size, then use push_back
1829  nl.reserve (_boundary_node_id.size());
1830  il.reserve (_boundary_node_id.size());
1831 
1832  boundary_node_iter pos = _boundary_node_id.begin();
1833  for (; pos != _boundary_node_id.end(); ++pos)
1834  {
1835  nl.push_back (pos->first->id());
1836  il.push_back (pos->second);
1837  }
1838 }
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 1842 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().

1843 {
1844  // If we're on a distributed mesh, even the owner of a node is not
1845  // guaranteed to be able to properly assign its new boundary id(s)!
1846  // Nodal neighbors are not always ghosted, and a nodal neighbor
1847  // might have a boundary side.
1848  const bool mesh_is_serial = _mesh.is_serial();
1849 
1850  typedef std::set<std::pair<dof_id_type, boundary_id_type> > set_type;
1851 
1852  const processor_id_type n_proc = this->n_processors();
1853  const processor_id_type my_proc_id = this->processor_id();
1854  std::vector<set_type> nodes_to_push(n_proc);
1855 
1856  // Loop over the side list
1857  boundary_side_iter pos = _boundary_side_id.begin();
1858  for (; pos != _boundary_side_id.end(); ++pos)
1859  {
1860  // Don't add remote sides
1861  if (pos->first->is_remote())
1862  continue;
1863 
1864  // Need to loop over the sides of any possible children
1865  std::vector<const Elem *> family;
1866 #ifdef LIBMESH_ENABLE_AMR
1867  pos->first->active_family_tree_by_side (family, pos->second.first);
1868 #else
1869  family.push_back(pos->first);
1870 #endif
1871 
1872  for (std::size_t elem_it=0; elem_it < family.size(); elem_it++)
1873  {
1874  const Elem * cur_elem = family[elem_it];
1875 
1876  UniquePtr<const Elem> side = cur_elem->build_side_ptr(pos->second.first);
1877 
1878  // Add each node node on the side with the side's boundary id
1879  for (unsigned int i=0; i<side->n_nodes(); i++)
1880  {
1881  const boundary_id_type bcid = pos->second.second;
1882  this->add_node(side->node_ptr(i), bcid);
1883  if (!mesh_is_serial)
1884  {
1885  const processor_id_type proc_id =
1886  side->node_ptr(i)->processor_id();
1887  if (proc_id != my_proc_id)
1888  nodes_to_push[proc_id].insert
1889  (std::make_pair(side->node_id(i), bcid));
1890  }
1891  }
1892  }
1893  }
1894 
1895  // If we're on a serial mesh then we're done.
1896  if (mesh_is_serial)
1897  return;
1898 
1899  // Otherwise we need to push ghost node bcids to their owners, then
1900  // pull ghost node bcids from their owners.
1901  Parallel::MessageTag
1902  node_pushes_tag = this->comm().get_unique_tag(31337),
1903  node_pulls_tag = this->comm().get_unique_tag(31338),
1904  node_responses_tag = this->comm().get_unique_tag(31339);
1905 
1906  std::vector<Parallel::Request> node_push_requests(n_proc-1);
1907 
1908  for (processor_id_type p = 0; p != n_proc; ++p)
1909  {
1910  if (p == my_proc_id)
1911  continue;
1912 
1913  Parallel::Request &request =
1914  node_push_requests[p - (p > my_proc_id)];
1915 
1916  this->comm().send
1917  (p, nodes_to_push[p], request, node_pushes_tag);
1918  }
1919 
1920  for (processor_id_type p = 1; p != n_proc; ++p)
1921  {
1922  set_type received_nodes;
1923 
1924  this->comm().receive
1925  (Parallel::any_source, received_nodes, node_pushes_tag);
1926 
1927  for (set_type::const_iterator it = received_nodes.begin(),
1928  end = received_nodes.end(); it != end; ++it)
1929  this->add_node(_mesh.node_ptr(it->first), it->second);
1930  }
1931 
1932  // At this point we should know all the BCs for our own nodes; now
1933  // we need BCs for ghost nodes.
1934  //
1935  // FIXME - parallel_ghost_sync.h doesn't work here because it
1936  // assumes a fixed size datum on each node.
1937  std::vector<std::vector<dof_id_type> > node_ids_requested(n_proc);
1938 
1939  // Determine what nodes we need to request
1940  for (MeshBase::const_node_iterator it = _mesh.nodes_begin(),
1941  end = _mesh.nodes_end(); it != end; ++it)
1942  {
1943  const Node *node = *it;
1944  const processor_id_type pid = node->processor_id();
1945  if (pid != my_proc_id)
1946  node_ids_requested[pid].push_back(node->id());
1947  }
1948 
1949  typedef std::vector<std::pair<dof_id_type, boundary_id_type> > vec_type;
1950 
1951  std::vector<Parallel::Request> node_pull_requests(n_proc-1),
1952  node_response_requests(n_proc-1);
1953 
1954  // Make all requests
1955  for (processor_id_type p = 0; p != n_proc; ++p)
1956  {
1957  if (p == my_proc_id)
1958  continue;
1959 
1960  Parallel::Request &request =
1961  node_pull_requests[p - (p > my_proc_id)];
1962 
1963  this->comm().send
1964  (p, node_ids_requested[p], request, node_pulls_tag);
1965  }
1966 
1967  // Process all incoming requests
1968  std::vector<vec_type> responses(n_proc-1);
1969 
1970  for (processor_id_type p = 1; p != n_proc; ++p)
1971  {
1972  std::vector<dof_id_type> requested_nodes;
1973 
1974  Parallel::Status
1975  status(this->comm().probe (Parallel::any_source, node_pulls_tag));
1976  const processor_id_type
1977  source_pid = cast_int<processor_id_type>(status.source());
1978 
1979  this->comm().receive
1980  (source_pid, requested_nodes, node_pulls_tag);
1981 
1982  Parallel::Request &request =
1983  node_response_requests[p-1];
1984 
1985  std::vector<boundary_id_type> bcids;
1986 
1987  for (std::vector<dof_id_type>::const_iterator
1988  it = requested_nodes.begin(),
1989  end = requested_nodes.end(); it != end; ++it)
1990  {
1991  this->boundary_ids(_mesh.node_ptr(*it), bcids);
1992 
1993  for (std::size_t i=0; i != bcids.size(); ++i)
1994  {
1995  const boundary_id_type b = bcids[i];
1996  responses[p-1].push_back(std::make_pair(*it, b));
1997  }
1998  }
1999 
2000  this->comm().send
2001  (source_pid, responses[p-1], request, node_responses_tag);
2002  }
2003 
2004  // Process all incoming responses
2005  for (processor_id_type p = 1; p != n_proc; ++p)
2006  {
2007  Parallel::Status
2008  status(this->comm().probe (Parallel::any_source, node_responses_tag));
2009  const processor_id_type
2010  source_pid = cast_int<processor_id_type>(status.source());
2011 
2012  vec_type response;
2013 
2014  this->comm().receive
2015  (source_pid, response, node_responses_tag);
2016 
2017  for (vec_type::const_iterator
2018  it = response.begin(),
2019  end = response.end(); it != end; ++it)
2020  {
2021  this->add_node(_mesh.node_ptr(it->first), it->second);
2022  }
2023  }
2024 
2025  Parallel::wait (node_push_requests);
2026  Parallel::wait (node_pull_requests);
2027  Parallel::wait (node_response_requests);
2028 }
Status wait(Request &r)
Definition: parallel.h:519
virtual bool is_serial() const
Definition: mesh_base.h:134
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 1714 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().

1715 {
1716  b_ids.clear();
1717 
1719  for (; pos != _boundary_shellface_id.end(); ++pos)
1720  {
1721  boundary_id_type id = pos->second.second;
1722 
1723  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
1724  b_ids.push_back(id);
1725  }
1726 }
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 2175 of file boundary_info.C.

References _boundary_shellface_id.

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

2178 {
2179  // Clear the input vectors, just in case they were used for
2180  // something else recently...
2181  el.clear();
2182  sl.clear();
2183  il.clear();
2184 
2185  // Reserve the size, then use push_back
2186  el.reserve (_boundary_shellface_id.size());
2187  sl.reserve (_boundary_shellface_id.size());
2188  il.reserve (_boundary_shellface_id.size());
2189 
2191  for (; pos != _boundary_shellface_id.end(); ++pos)
2192  {
2193  el.push_back (pos->first->id());
2194  sl.push_back (pos->second.first);
2195  il.push_back (pos->second.second);
2196  }
2197 }
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 1699 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().

1700 {
1701  b_ids.clear();
1702 
1703  boundary_side_iter pos = _boundary_side_id.begin();
1704  for (; pos != _boundary_side_id.end(); ++pos)
1705  {
1706  boundary_id_type id = pos->second.second;
1707 
1708  if (std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
1709  b_ids.push_back(id);
1710  }
1711 }
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 2090 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::FroIO::write(), libMesh::CheckpointIO::write_bcs(), libMesh::Nemesis_IO_Helper::write_sidesets(), and libMesh::ExodusII_IO_Helper::write_sidesets().

2093 {
2094  // Clear the input vectors, just in case they were used for
2095  // something else recently...
2096  el.clear();
2097  sl.clear();
2098  il.clear();
2099 
2100  // Reserve the size, then use push_back
2101  el.reserve (_boundary_side_id.size());
2102  sl.reserve (_boundary_side_id.size());
2103  il.reserve (_boundary_side_id.size());
2104 
2105  boundary_side_iter pos = _boundary_side_id.begin();
2106  for (; pos != _boundary_side_id.end(); ++pos)
2107  {
2108  el.push_back (pos->first->id());
2109  sl.push_back (pos->second.first);
2110  il.push_back (pos->second.second);
2111  }
2112 }
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 2033 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().

2034 {
2035  // Check for early return
2036  if (_boundary_node_id.empty())
2037  {
2038  libMesh::out << "No boundary node IDs have been added: cannot build side list!" << std::endl;
2039  return;
2040  }
2041 
2042  MeshBase::const_element_iterator el = _mesh.active_elements_begin();
2043  const MeshBase::const_element_iterator end_el = _mesh.active_elements_end();
2044 
2045  for (; el != end_el; ++el)
2046  {
2047  const Elem * elem = *el;
2048 
2049  for (unsigned short side=0; side<elem->n_sides(); ++side)
2050  {
2051  UniquePtr<const Elem> side_elem = elem->build_side_ptr(side);
2052 
2053  // map from nodeset_id to count for that ID
2054  std::map<boundary_id_type, unsigned> nodesets_node_count;
2055  for (unsigned node_num=0; node_num < side_elem->n_nodes(); ++node_num)
2056  {
2057  const Node * node = side_elem->node_ptr(node_num);
2058  std::pair<boundary_node_iter, boundary_node_iter>
2059  range = _boundary_node_id.equal_range(node);
2060 
2061  // For each nodeset that this node is a member of, increment the associated
2062  // nodeset ID count
2063  for (boundary_node_iter pos = range.first; pos != range.second; ++pos)
2064  nodesets_node_count[pos->second]++;
2065  }
2066 
2067  // Now check to see what nodeset_counts have the correct
2068  // number of nodes in them. For any that do, add this side to
2069  // the sideset, making sure the sideset inherits the
2070  // nodeset's name, if there is one.
2071  std::map<boundary_id_type, unsigned>::const_iterator nodesets = nodesets_node_count.begin();
2072  for (; nodesets != nodesets_node_count.end(); ++nodesets)
2073  if (nodesets->second == side_elem->n_nodes())
2074  {
2075  add_side(elem, side, nodesets->first);
2076 
2077  // Let the sideset inherit any non-empty name from the nodeset
2078  std::string & nset_name = nodeset_name(nodesets->first);
2079 
2080  if (nset_name != "")
2081  sideset_name(nodesets->first) = nset_name;
2082  }
2083  } // end for side
2084  } // end for el
2085 }
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. Returns 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 687 of file boundary_info.C.

References _boundary_node_id.

688 {
689  _boundary_node_id.clear();
690 }
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::MeshTools::bounding_box(), 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::MeshRefinement::create_parent_error_vector(), 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::MeshTools::processor_bounding_box(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), 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::MeshTools::subdomain_bounding_box(), 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::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::LaspackVector< T >::zero_clone(), libMesh::EigenSparseVector< 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 1344 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().

1347 {
1348  libmesh_assert_equal_to (old_elem->n_sides(), new_elem->n_sides());
1349  libmesh_assert_equal_to (old_elem->n_edges(), new_elem->n_edges());
1350 
1351  std::vector<boundary_id_type> bndry_ids;
1352 
1353  for (unsigned short s=0; s<old_elem->n_sides(); s++)
1354  {
1355  old_boundary_info.raw_boundary_ids (old_elem, s, bndry_ids);
1356  this->add_side (new_elem, s, bndry_ids);
1357  }
1358 
1359  for (unsigned short e=0; e<old_elem->n_edges(); e++)
1360  {
1361  old_boundary_info.raw_edge_boundary_ids (old_elem, e, bndry_ids);
1362  this->add_edge (new_elem, e, bndry_ids);
1363  }
1364 
1365  for (unsigned short sf=0; sf != 2; sf++)
1366  {
1367  old_boundary_info.raw_shellface_boundary_ids (old_elem, sf, bndry_ids);
1368  this->add_shellface (new_elem, sf, bndry_ids);
1369  }
1370 }
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. Edge-based boundary IDs should only be used in 3D.

This function has been deprecated. Instead, use the version of this function that fills a std::vector.

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

1023 {
1024  libmesh_deprecated();
1025 
1026  std::vector<boundary_id_type> ids;
1027  this->edge_boundary_ids(elem, edge, ids);
1028  return ids;
1029 }
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. Edge-based boundary IDs should only be used in 3D.

This is the non-deprecated version of the function.

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

1036 {
1037  libmesh_assert(elem);
1038 
1039  // Clear out any previous contents
1040  vec_to_fill.clear();
1041 
1042  // Only level-0 elements store BCs. If this is not a level-0
1043  // element get its level-0 parent and infer the BCs.
1044  const Elem * searched_elem = elem;
1045 #ifdef LIBMESH_ENABLE_AMR
1046  if (elem->level() != 0)
1047  {
1048  // Find all the sides that contain edge. If one of those is a boundary
1049  // side, then this must be a boundary edge. In that case, we just use the
1050  // top-level parent.
1051  bool found_boundary_edge = false;
1052  for (unsigned int side=0; side<elem->n_sides(); side++)
1053  {
1054  if (elem->is_edge_on_side(edge,side))
1055  {
1056  if (elem->neighbor_ptr(side) == libmesh_nullptr)
1057  {
1058  searched_elem = elem->top_parent ();
1059  found_boundary_edge = true;
1060  break;
1061  }
1062  }
1063  }
1064 
1065  if (!found_boundary_edge)
1066  {
1067  // Child element is not on external edge, but it may have internal
1068  // "boundary" IDs. We will walk up the tree, at each level checking that
1069  // the current child is actually on the same edge of the parent that is
1070  // currently being searched for (i.e. that was passed in as "edge").
1071  while (searched_elem->parent() != libmesh_nullptr)
1072  {
1073  const Elem * parent = searched_elem->parent();
1074  if (parent->is_child_on_edge(parent->which_child_am_i(searched_elem), edge) == false)
1075  return;
1076  searched_elem = parent;
1077  }
1078  }
1079  }
1080 #endif
1081 
1082  std::pair<boundary_edge_iter, boundary_edge_iter>
1083  e = _boundary_edge_id.equal_range(searched_elem);
1084 
1085  // Check each element in the range to see if its edge matches the requested edge.
1086  for (; e.first != e.second; ++e.first)
1087  if (e.first->second.first == edge)
1088  vec_to_fill.push_back(e.first->second.second);
1089 }
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 655 of file boundary_info.h.

References _boundary_ids.

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

656  { 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. Edge-based boundary IDs should only be used in 3D.

Definition at line 670 of file boundary_info.h.

References _edge_boundary_ids.

671  { 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 2412 of file boundary_info.C.

References _ns_id_to_name, _ss_id_to_name, and invalid_id.

Referenced by get_node_boundary_ids().

2413 {
2414  // Search sidesets
2415  std::map<boundary_id_type, std::string>::const_iterator
2416  iter = _ss_id_to_name.begin(),
2417  end_iter = _ss_id_to_name.end();
2418 
2419  for (; iter != end_iter; ++iter)
2420  if (iter->second == name)
2421  return iter->first;
2422 
2423  // Search nodesets
2424  iter = _ns_id_to_name.begin();
2425  end_iter = _ns_id_to_name.end();
2426  for (; iter != end_iter; ++iter)
2427  if (iter->second == name)
2428  return iter->first;
2429 
2430  // If we made it here without returning, we don't have a sideset or
2431  // nodeset by the requested name, so return invalid_id
2432  return invalid_id;
2433 }
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 684 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().

685  { 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 2396 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().

2397 {
2398  static const std::string empty_string;
2399  std::map<boundary_id_type, std::string>::const_iterator it =
2400  _ns_id_to_name.find(id);
2401  if (it == _ns_id_to_name.end())
2402  return empty_string;
2403  else
2404  return it->second;
2405 }
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 739 of file boundary_info.h.

References _ns_id_to_name.

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

740  { 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. This is only relevant on shell elements.

Definition at line 677 of file boundary_info.h.

References _shellface_boundary_ids.

678  { 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 321 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.

325 {
326  LOG_SCOPE("get_side_and_node_maps()", "BoundaryInfo");
327 
328  node_id_map.clear();
329  side_id_map.clear();
330 
331  MeshBase::const_element_iterator el =
332  boundary_mesh.active_elements_begin();
333  const MeshBase::const_element_iterator end_el =
334  boundary_mesh.active_elements_end();
335 
336  for (; el != end_el; ++el)
337  {
338  const Elem * boundary_elem = *el;
339  const Elem * interior_parent = boundary_elem->interior_parent();
340 
341  // Find out which side of interior_parent boundary_elem correponds to.
342  // Use centroid comparison as a way to check.
343  unsigned char interior_parent_side_index = 0;
344  bool found_matching_sides = false;
345  for(unsigned char side=0; side<interior_parent->n_sides(); side++)
346  {
347  UniquePtr<const Elem> interior_parent_side = interior_parent->build_side_ptr(side);
348  Real centroid_distance = (boundary_elem->centroid() - interior_parent_side->centroid()).norm();
349 
350  if( centroid_distance < (tolerance * boundary_elem->hmin()) )
351  {
352  interior_parent_side_index = side;
353  found_matching_sides = true;
354  break;
355  }
356  }
357 
358  if(!found_matching_sides)
359  {
360  libmesh_error_msg("No matching side found within the specified tolerance");
361  }
362 
363  side_id_map[boundary_elem->id()] = interior_parent_side_index;
364 
365  UniquePtr<const Elem> interior_parent_side = interior_parent->build_side_ptr(interior_parent_side_index);
366  for(unsigned char local_node_index=0; local_node_index<boundary_elem->n_nodes(); local_node_index++)
367  {
368  dof_id_type boundary_node_id = boundary_elem->node_id(local_node_index);
369  dof_id_type interior_node_id = interior_parent_side->node_id(local_node_index);
370 
371  node_id_map[interior_node_id] = boundary_node_id;
372  }
373 
374  }
375 }
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 662 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().

663  { 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 2379 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().

2380 {
2381  static const std::string empty_string;
2382  std::map<boundary_id_type, std::string>::const_iterator it =
2383  _ss_id_to_name.find(id);
2384  if (it == _ss_id_to_name.end())
2385  return empty_string;
2386  else
2387  return it->second;
2388 }
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 731 of file boundary_info.h.

References _ss_id_to_name.

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

732  { 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 iff the given node is associated with the given id.

Definition at line 972 of file boundary_info.C.

References _boundary_node_id.

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

974 {
975  std::pair<boundary_node_iter, boundary_node_iter> pos = _boundary_node_id.equal_range(node);
976 
977  for (; pos.first != pos.second; ++pos.first)
978  if (pos.first->second == id)
979  return true;
980 
981  return false;
982 }
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 iff the given side of the given element is associated with the given id.

Definition at line 1235 of file boundary_info.C.

References boundary_ids().

1238 {
1239  std::vector<boundary_id_type> ids;
1240  this->boundary_ids(elem, side, ids);
1241  return (std::find(ids.begin(), ids.end(), id) != ids.end());
1242 }
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 1728 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::Nemesis_IO::read(), and libMesh::XdrIO::write().

1729 {
1730  // in serial we know the number of bcs from the
1731  // size of the container
1732  if (_mesh.is_serial())
1733  return _boundary_side_id.size();
1734 
1735  // in parallel we need to sum the number of local bcs
1736  parallel_object_only();
1737 
1738  std::size_t nbcs=0;
1739 
1740  boundary_side_iter pos = _boundary_side_id.begin();
1741  for (; pos != _boundary_side_id.end(); ++pos)
1742  if (pos->first->processor_id() == this->processor_id())
1743  nbcs++;
1744 
1745  this->comm().sum (nbcs);
1746 
1747  return nbcs;
1748 }
virtual bool is_serial() const
Definition: mesh_base.h:134
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 1012 of file boundary_info.C.

References _boundary_node_id.

1013 {
1014  std::pair<boundary_node_iter, boundary_node_iter> pos = _boundary_node_id.equal_range(node);
1015 
1016  return cast_int<unsigned int>(std::distance(pos.first, pos.second));
1017 }
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 1298 of file boundary_info.C.

References boundary_ids().

1300 {
1301  std::vector<boundary_id_type> ids;
1302  this->boundary_ids(elem, side, ids);
1303  return ids.size();
1304 }
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. Edge-based boundary IDs should only be used in 3D.

Definition at line 1093 of file boundary_info.C.

References edge_boundary_ids().

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

1095 {
1096  std::vector<boundary_id_type> ids;
1097  this->edge_boundary_ids(elem, edge, ids);
1098  return ids.size();
1099 }
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 1750 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().

1751 {
1752  // in serial we know the number of nodesets from the
1753  // size of the container
1754  if (_mesh.is_serial())
1755  return _boundary_edge_id.size();
1756 
1757  // in parallel we need to sum the number of local nodesets
1758  parallel_object_only();
1759 
1760  std::size_t n_edge_bcs=0;
1761 
1762  boundary_edge_iter pos = _boundary_edge_id.begin();
1763  for (; pos != _boundary_edge_id.end(); ++pos)
1764  if (pos->first->processor_id() == this->processor_id())
1765  n_edge_bcs++;
1766 
1767  this->comm().sum (n_edge_bcs);
1768 
1769  return n_edge_bcs;
1770 }
virtual bool is_serial() const
Definition: mesh_base.h:134
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 1796 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().

1797 {
1798  // in serial we know the number of nodesets from the
1799  // size of the container
1800  if (_mesh.is_serial())
1801  return _boundary_node_id.size();
1802 
1803  // in parallel we need to sum the number of local nodesets
1804  parallel_object_only();
1805 
1806  std::size_t n_nodesets=0;
1807 
1808  boundary_node_iter pos = _boundary_node_id.begin();
1809  for (; pos != _boundary_node_id.end(); ++pos)
1810  if (pos->first->processor_id() == this->processor_id())
1811  n_nodesets++;
1812 
1813  this->comm().sum (n_nodesets);
1814 
1815  return n_nodesets;
1816 }
virtual bool is_serial() const
Definition: mesh_base.h:134
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::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::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::MeshTools::processor_bounding_box(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), 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::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:679
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. This is only relevant for shell elements.

Definition at line 1176 of file boundary_info.C.

References shellface_boundary_ids().

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

1178 {
1179  std::vector<boundary_id_type> ids;
1180  this->shellface_boundary_ids(elem, shellface, ids);
1181  return ids.size();
1182 }
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 1773 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().

1774 {
1775  // in serial we know the number of nodesets from the
1776  // size of the container
1777  if (_mesh.is_serial())
1778  return _boundary_shellface_id.size();
1779 
1780  // in parallel we need to sum the number of local nodesets
1781  parallel_object_only();
1782 
1783  std::size_t n_shellface_bcs=0;
1784 
1786  for (; pos != _boundary_shellface_id.end(); ++pos)
1787  if (pos->first->processor_id() == this->processor_id())
1788  n_shellface_bcs++;
1789 
1790  this->comm().sum (n_shellface_bcs);
1791 
1792  return n_shellface_bcs;
1793 }
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:134
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 2407 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().

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

Actual copying operation.

Note that it does not copy the mesh over (for obvious reasons).

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

Print the boundary information data structure.

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

2201 {
2202  // Print out the nodal BCs
2203  if (!_boundary_node_id.empty())
2204  {
2205  out_stream << "Nodal Boundary conditions:" << std::endl
2206  << "--------------------------" << std::endl
2207  << " (Node No., ID) " << std::endl;
2208 
2211 
2212  for (; it != end; ++it)
2213  out_stream << " (" << (*it).first->id()
2214  << ", " << (*it).second
2215  << ")" << std::endl;
2216  }
2217 
2218  // Print out the element edge BCs
2219  if (!_boundary_edge_id.empty())
2220  {
2221  out_stream << std::endl
2222  << "Edge Boundary conditions:" << std::endl
2223  << "-------------------------" << std::endl
2224  << " (Elem No., Edge No., ID) " << std::endl;
2225 
2227  const boundary_edge_iter end = _boundary_edge_id.end();
2228 
2229  for (; it != end; ++it)
2230  out_stream << " (" << (*it).first->id()
2231  << ", " << (*it).second.first
2232  << ", " << (*it).second.second
2233  << ")" << std::endl;
2234  }
2235 
2236  // Print out the element shellface BCs
2237  if (!_boundary_shellface_id.empty())
2238  {
2239  out_stream << std::endl
2240  << "Shell-face Boundary conditions:" << std::endl
2241  << "-------------------------" << std::endl
2242  << " (Elem No., Shell-face No., ID) " << std::endl;
2243 
2246 
2247  for (; it != end; ++it)
2248  out_stream << " (" << (*it).first->id()
2249  << ", " << (*it).second.first
2250  << ", " << (*it).second.second
2251  << ")" << std::endl;
2252  }
2253 
2254  // Print out the element side BCs
2255  if (!_boundary_side_id.empty())
2256  {
2257  out_stream << std::endl
2258  << "Side Boundary conditions:" << std::endl
2259  << "-------------------------" << std::endl
2260  << " (Elem No., Side No., ID) " << std::endl;
2261 
2263  const boundary_side_iter end = _boundary_side_id.end();
2264 
2265  for (; it != end; ++it)
2266  out_stream << " (" << (*it).first->id()
2267  << ", " << (*it).second.first
2268  << ", " << (*it).second.second
2269  << ")" << std::endl;
2270  }
2271 }
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

Print a summary of the boundary information.

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

2276 {
2277  // Print out the nodal BCs
2278  if (!_boundary_node_id.empty())
2279  {
2280  out_stream << "Nodal Boundary conditions:" << std::endl
2281  << "--------------------------" << std::endl
2282  << " (ID, number of nodes) " << std::endl;
2283 
2284  std::map<boundary_id_type, std::size_t> ID_counts;
2285 
2288 
2289  for (; it != end; ++it)
2290  ID_counts[(*it).second]++;
2291 
2292  std::map<boundary_id_type, std::size_t>::const_iterator ID_it = ID_counts.begin();
2293  const std::map<boundary_id_type, std::size_t>::const_iterator ID_end = ID_counts.end();
2294 
2295  for (; ID_it != ID_end; ++ID_it)
2296  out_stream << " (" << (*ID_it).first
2297  << ", " << (*ID_it).second
2298  << ")" << std::endl;
2299  }
2300 
2301  // Print out the element edge BCs
2302  if (!_boundary_edge_id.empty())
2303  {
2304  out_stream << std::endl
2305  << "Edge Boundary conditions:" << std::endl
2306  << "-------------------------" << std::endl
2307  << " (ID, number of edges) " << std::endl;
2308 
2309  std::map<boundary_id_type, std::size_t> ID_counts;
2310 
2312  const boundary_edge_iter end = _boundary_edge_id.end();
2313 
2314  for (; it != end; ++it)
2315  ID_counts[(*it).second.second]++;
2316 
2317  std::map<boundary_id_type, std::size_t>::const_iterator ID_it = ID_counts.begin();
2318  const std::map<boundary_id_type, std::size_t>::const_iterator ID_end = ID_counts.end();
2319 
2320  for (; ID_it != ID_end; ++ID_it)
2321  out_stream << " (" << (*ID_it).first
2322  << ", " << (*ID_it).second
2323  << ")" << std::endl;
2324  }
2325 
2326 
2327  // Print out the element edge BCs
2328  if (!_boundary_shellface_id.empty())
2329  {
2330  out_stream << std::endl
2331  << "Shell-face Boundary conditions:" << std::endl
2332  << "-------------------------" << std::endl
2333  << " (ID, number of shellfaces) " << std::endl;
2334 
2335  std::map<boundary_id_type, std::size_t> ID_counts;
2336 
2339 
2340  for (; it != end; ++it)
2341  ID_counts[(*it).second.second]++;
2342 
2343  std::map<boundary_id_type, std::size_t>::const_iterator ID_it = ID_counts.begin();
2344  const std::map<boundary_id_type, std::size_t>::const_iterator ID_end = ID_counts.end();
2345 
2346  for (; ID_it != ID_end; ++ID_it)
2347  out_stream << " (" << (*ID_it).first
2348  << ", " << (*ID_it).second
2349  << ")" << std::endl;
2350  }
2351 
2352  // Print out the element side BCs
2353  if (!_boundary_side_id.empty())
2354  {
2355  out_stream << std::endl
2356  << "Side Boundary conditions:" << std::endl
2357  << "-------------------------" << std::endl
2358  << " (ID, number of sides) " << std::endl;
2359 
2360  std::map<boundary_id_type, std::size_t> ID_counts;
2361 
2363  const boundary_side_iter end = _boundary_side_id.end();
2364 
2365  for (; it != end; ++it)
2366  ID_counts[(*it).second.second]++;
2367 
2368  std::map<boundary_id_type, std::size_t>::const_iterator ID_it = ID_counts.begin();
2369  const std::map<boundary_id_type, std::size_t>::const_iterator ID_end = ID_counts.end();
2370 
2371  for (; ID_it != ID_end; ++ID_it)
2372  out_stream << " (" << (*ID_it).first
2373  << ", " << (*ID_it).second
2374  << ")" << std::endl;
2375  }
2376 }
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::XdrIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), 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::Parallel::Packing< Node * >::unpack(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::MeshTools::weight(), libMesh::NameBasedIO::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:677
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.

This function has been deprecated. Instead, use the version of this function that fills a std::vector.

Definition at line 1308 of file boundary_info.C.

Referenced by copy_boundary_ids(), and n_boundary_ids().

1310 {
1311  libmesh_deprecated();
1312 
1313  std::vector<boundary_id_type> ids;
1314  this->raw_boundary_ids(elem, side, ids);
1315  return ids;
1316 }
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 1320 of file boundary_info.C.

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

1323 {
1324  libmesh_assert(elem);
1325 
1326  // Clear out any previous contents
1327  vec_to_fill.clear();
1328 
1329  // Only level-0 elements store BCs.
1330  if (elem->parent())
1331  return;
1332 
1333  std::pair<boundary_side_iter, boundary_side_iter>
1334  e = _boundary_side_id.equal_range(elem);
1335 
1336  // Check each element in the range to see if its side matches the requested side.
1337  for (; e.first != e.second; ++e.first)
1338  if (e.first->second.first == side)
1339  vec_to_fill.push_back(e.first->second.second);
1340 }
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. Edge-based boundary IDs should only be used in 3D.

This function has been deprecated. Instead, use the version of this function that fills a std::vector.

Definition at line 1103 of file boundary_info.C.

Referenced by copy_boundary_ids(), and n_boundary_ids().

1105 {
1106  libmesh_deprecated();
1107 
1108  std::vector<boundary_id_type> ids;
1109  this->raw_edge_boundary_ids(elem, edge, ids);
1110  return ids;
1111 }
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. Edge-based boundary IDs should only be used in 3D.

This is the non-deprecated version of the function.

Definition at line 1115 of file boundary_info.C.

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

1118 {
1119  libmesh_assert(elem);
1120 
1121  // Clear out any previous contents
1122  vec_to_fill.clear();
1123 
1124  // Only level-0 elements store BCs.
1125  if (elem->parent())
1126  return;
1127 
1128  std::pair<boundary_edge_iter, boundary_edge_iter>
1129  e = _boundary_edge_id.equal_range(elem);
1130 
1131  // Check each element in the range to see if its edge matches the requested edge.
1132  for (; e.first != e.second; ++e.first)
1133  if (e.first->second.first == edge)
1134  vec_to_fill.push_back(e.first->second.second);
1135 }
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. This is only relevant for shell elements.

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

1189 {
1190  libmesh_assert(elem);
1191 
1192  // Shells only have 2 faces
1193  libmesh_assert_less(shellface, 2);
1194 
1195  // Clear out any previous contents
1196  vec_to_fill.clear();
1197 
1198  // Only level-0 elements store BCs.
1199  if (elem->parent())
1200  return;
1201 
1202  std::pair<boundary_shellface_iter, boundary_shellface_iter>
1203  e = _boundary_shellface_id.equal_range(elem);
1204 
1205  // Check each element in the range to see if its shellface matches the requested shellface.
1206  for (; e.first != e.second; ++e.first)
1207  if (e.first->second.first == shellface)
1208  vec_to_fill.push_back(e.first->second.second);
1209 }
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 1384 of file boundary_info.C.

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

1385 {
1386  libmesh_assert(elem);
1387 
1388  // Erase everything associated with elem
1389  _boundary_edge_id.erase (elem);
1390  _boundary_side_id.erase (elem);
1391  _boundary_shellface_id.erase (elem);
1392 }
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 1396 of file boundary_info.C.

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

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

1398 {
1399  libmesh_assert(elem);
1400 
1401  // The user shouldn't be trying to remove only one child's boundary
1402  // id
1403  libmesh_assert_equal_to (elem->level(), 0);
1404 
1405  // Some older compilers don't support erasing from a map with
1406  // const_iterators, so we explicitly use non-const iterators here.
1407  std::pair<erase_iter, erase_iter>
1408  e = _boundary_edge_id.equal_range(elem);
1409 
1410  // elem may be there, maybe multiple occurrences
1411  while (e.first != e.second)
1412  {
1413  // if this is true we found the requested edge
1414  // of the element and want to erase the id
1415  if (e.first->second.first == edge)
1416  {
1417  // (postfix++ - increment the iterator before it's invalid)
1418  _boundary_edge_id.erase(e.first++);
1419  }
1420  else
1421  ++e.first;
1422  }
1423 }
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 1427 of file boundary_info.C.

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

1430 {
1431  libmesh_assert(elem);
1432 
1433  // The user shouldn't be trying to remove only one child's boundary
1434  // id
1435  libmesh_assert_equal_to (elem->level(), 0);
1436 
1437  // Some older compilers don't support erasing from a map with
1438  // const_iterators, so we explicitly use non-const iterators here.
1439  std::pair<erase_iter, erase_iter>
1440  e = _boundary_edge_id.equal_range(elem);
1441 
1442  // elem may be there, maybe multiple occurrences
1443  while (e.first != e.second)
1444  {
1445  // if this is true we found the requested edge
1446  // of the element and want to erase the requested id
1447  if (e.first->second.first == edge &&
1448  e.first->second.second == id)
1449  {
1450  // (postfix++ - increment the iterator before it's invalid)
1451  _boundary_edge_id.erase(e.first++);
1452  }
1453  else
1454  ++e.first;
1455  }
1456 }
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 1587 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().

1588 {
1589  // Erase id from ids containers
1590  _boundary_ids.erase(id);
1591  _side_boundary_ids.erase(id);
1592  _edge_boundary_ids.erase(id);
1593  _shellface_boundary_ids.erase(id);
1594  _node_boundary_ids.erase(id);
1595  _ss_id_to_name.erase(id);
1596  _ns_id_to_name.erase(id);
1597 
1598  // Erase pointers to geometric entities with this id.
1599  for (boundary_node_erase_iter it = _boundary_node_id.begin(); it != _boundary_node_id.end(); /*below*/)
1600  {
1601  if (it->second == id)
1602  _boundary_node_id.erase(it++);
1603  else
1604  ++it;
1605  }
1606 
1607  for (erase_iter it = _boundary_edge_id.begin(); it != _boundary_edge_id.end(); /*below*/)
1608  {
1609  if (it->second.second == id)
1610  _boundary_edge_id.erase(it++);
1611  else
1612  ++it;
1613  }
1614 
1615  for (erase_iter it = _boundary_shellface_id.begin(); it != _boundary_shellface_id.end(); /*below*/)
1616  {
1617  if (it->second.second == id)
1618  _boundary_shellface_id.erase(it++);
1619  else
1620  ++it;
1621  }
1622 
1623  for (erase_iter it = _boundary_side_id.begin(); it != _boundary_side_id.end(); /*below*/)
1624  {
1625  if (it->second.second == id)
1626  _boundary_side_id.erase(it++);
1627  else
1628  ++it;
1629  }
1630 }
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 1459 of file boundary_info.C.

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

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

1461 {
1462  libmesh_assert(elem);
1463 
1464  // The user shouldn't be trying to remove only one child's boundary
1465  // id
1466  libmesh_assert_equal_to (elem->level(), 0);
1467 
1468  // Shells only have 2 faces
1469  libmesh_assert_less(shellface, 2);
1470 
1471  // Some older compilers don't support erasing from a map with
1472  // const_iterators, so we explicitly use non-const iterators here.
1473  std::pair<erase_iter, erase_iter>
1474  e = _boundary_shellface_id.equal_range(elem);
1475 
1476  // elem may be there, maybe multiple occurrences
1477  while (e.first != e.second)
1478  {
1479  // if this is true we found the requested shellface
1480  // of the element and want to erase the id
1481  if (e.first->second.first == shellface)
1482  {
1483  // (postfix++ - increment the iterator before it's invalid)
1484  _boundary_shellface_id.erase(e.first++);
1485  }
1486  else
1487  ++e.first;
1488  }
1489 }
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 1493 of file boundary_info.C.

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

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

1529 {
1530  libmesh_assert(elem);
1531 
1532  // The user shouldn't be trying to remove only one child's boundary
1533  // id
1534  libmesh_assert_equal_to (elem->level(), 0);
1535 
1536  // Some older compilers don't support erasing from a map with
1537  // const_iterators, so we explicitly use non-const iterators here.
1538  std::pair<erase_iter, erase_iter>
1539  e = _boundary_side_id.equal_range(elem);
1540 
1541  // elem may be there, maybe multiple occurrences
1542  while (e.first != e.second)
1543  {
1544  // if this is true we found the requested side
1545  // of the element and want to erase the id
1546  if (e.first->second.first == side)
1547  {
1548  // (postfix++ - increment the iterator before it's invalid)
1549  _boundary_side_id.erase(e.first++);
1550  }
1551  else
1552  ++e.first;
1553  }
1554 }
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 1558 of file boundary_info.C.

References _boundary_side_id, and libMesh::libmesh_assert().

1561 {
1562  libmesh_assert(elem);
1563 
1564  // Some older compilers don't support erasing from a map with
1565  // const_iterators, so we explicitly use non-const iterators here.
1566  std::pair<erase_iter, erase_iter>
1567  e = _boundary_side_id.equal_range(elem);
1568 
1569  // elem may be there, maybe multiple occurrences
1570  while (e.first != e.second)
1571  {
1572  // if this is true we found the requested side
1573  // of the element and want to erase the requested id
1574  if (e.first->second.first == side &&
1575  e.first->second.second == id)
1576  {
1577  // (postfix++ - increment the iterator before it's invalid)
1578  _boundary_side_id.erase(e.first++);
1579  }
1580  else
1581  ++e.first;
1582  }
1583 }
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

Return a writeable reference to the whole nodeset name map

Definition at line 737 of file boundary_info.h.

References _ns_id_to_name.

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

738  { 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

Return a writeable reference to the whole sideset name map

Definition at line 729 of file boundary_info.h.

References _ss_id_to_name.

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

730  { 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. This is only relevant for shell elements.

Definition at line 1139 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(), libMesh::ReplicatedMesh::stitching_helper(), and libMesh::XdrIO::write_serialized_bcs_helper().

1142 {
1143  libmesh_assert(elem);
1144 
1145  // Shells only have 2 faces
1146  libmesh_assert_less(shellface, 2);
1147 
1148  // Clear out any previous contents
1149  vec_to_fill.clear();
1150 
1151  // Only level-0 elements store BCs. If this is not a level-0
1152  // element get its level-0 parent and infer the BCs.
1153  const Elem * searched_elem = elem;
1154 #ifdef LIBMESH_ENABLE_AMR
1155  if (elem->level() != 0)
1156  {
1157  while (searched_elem->parent() != libmesh_nullptr)
1158  {
1159  const Elem * parent = searched_elem->parent();
1160  searched_elem = parent;
1161  }
1162  }
1163 #endif
1164 
1165  std::pair<boundary_shellface_iter, boundary_shellface_iter>
1166  e = _boundary_shellface_id.equal_range(searched_elem);
1167 
1168  // Check each element in the range to see if its shellface matches the requested shellface.
1169  for (; e.first != e.second; ++e.first)
1170  if (e.first->second.first == shellface)
1171  vec_to_fill.push_back(e.first->second.second);
1172 }
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. If multiple sides of elem have the same id, only the lowest numbered such side is returned.

Returns invalid_uint if no side has the requested boundary id.

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

1636 {
1637  const Elem * searched_elem = elem;
1638  if (elem->level() != 0)
1639  searched_elem = elem->top_parent();
1640 
1641  std::pair<boundary_side_iter, boundary_side_iter>
1642  e = _boundary_side_id.equal_range(searched_elem);
1643 
1644  // elem may have zero or multiple occurrences
1645  for (; e.first != e.second; ++e.first)
1646  {
1647  // if this is true we found the requested boundary_id
1648  // of the element and want to return the side
1649  if (e.first->second.second == boundary_id_in)
1650  {
1651  unsigned int side = e.first->second.first;
1652 
1653  // If we're on this external boundary then we share this
1654  // external boundary id
1655  if (elem->neighbor_ptr(side) == libmesh_nullptr)
1656  return side;
1657 
1658  // If we're on an internal boundary then we need to be sure
1659  // it's the same internal boundary as our top_parent
1660  const Elem * p = elem;
1661 
1662 #ifdef LIBMESH_ENABLE_AMR
1663 
1664  while (p != libmesh_nullptr)
1665  {
1666  const Elem * parent = p->parent();
1667  if (!parent->is_child_on_side(parent->which_child_am_i(p), side))
1668  break;
1669  p = parent;
1670  }
1671 #endif
1672  // We're on that side of our top_parent; return it
1673  if (!p)
1674  return side;
1675  }
1676  }
1677 
1678  // if we get here, we found elem in the data structure but not
1679  // the requested boundary id, so return the default value
1680  return libMesh::invalid_uint;
1681 }
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 2391 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().

2392 {
2393  return _ss_id_to_name[id];
2394 }
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().

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:134
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.

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

References _find_id_maps(), _mesh, add_elements(), libMesh::MeshBase::add_point(), boundary_ids(), libMesh::MeshBase::boundary_info, libMesh::MeshBase::clear(), libMesh::MeshBase::delete_remote_elements(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), 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().

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