$extrastylesheet
libMesh::BoundaryInfo Class Reference

#include <boundary_info.h>

Inheritance diagram for libMesh::BoundaryInfo:

List of all members.

Classes

class  Fill

Public Member Functions

BoundaryInfooperator= (const BoundaryInfo &other_boundary_info)
 ~BoundaryInfo ()
void clear ()
void sync (UnstructuredMesh &boundary_mesh, MeshData *boundary_mesh_data=NULL, MeshData *this_mesh_data=NULL)
void sync (const std::set< boundary_id_type > &requested_boundary_ids, UnstructuredMesh &boundary_mesh, MeshData *boundary_mesh_data=NULL, MeshData *this_mesh_data=NULL)
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_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_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)
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
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
std::vector< boundary_id_typeraw_edge_boundary_ids (const Elem *const elem, const unsigned short int edge) 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
std::vector< boundary_id_typeraw_boundary_ids (const Elem *const elem, const unsigned short int side) const
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
std::size_t n_boundary_conds () const
std::size_t n_edge_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
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_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 (const MeshBase &m)

Protected Attributes

const Parallel::Communicator_communicator

Private Attributes

const 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_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::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

The BoundaryInfo class contains information relevant to boundary conditions: it does not hold actual boundary condition data (check MeshData for that), but can mark element faces and nodes with ids useful for identifying the type of boundary condtion. It can also build a mesh that just includes boundary elements/faces.

TODO[JWP]: Generalize this to work with MeshBase again.

Definition at line 59 of file boundary_info.h.


Constructor & Destructor Documentation

libMesh::BoundaryInfo::BoundaryInfo ( const 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 46 of file boundary_info.C.

                                            :
  ParallelObject(m.comm()),
  _mesh (m)
{
}

Destructor. Not much to do.

Definition at line 114 of file boundary_info.C.

References clear().

{
  this->clear();
}

Member Function Documentation

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

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

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), libMesh::SerialMesh::stitching_helper(), and libMesh::Parallel::unpack().

{
  this->add_edge (_mesh.elem(e), edge, 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 611 of file boundary_info.C.

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

{
  libmesh_assert(elem);

  // Only add BCs for level-0 elements.
  libmesh_assert_equal_to (elem->level(), 0);

  if (id == invalid_id)
    libmesh_error_msg("ERROR: You may not set a boundary ID of "        \
                      << invalid_id                                     \
                      << "\n That is reserved for internal use.");

  // A convenient typedef
  typedef std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::
    const_iterator Iter;

  // Don't add the same ID twice
  std::pair<Iter, Iter> pos = _boundary_edge_id.equal_range(elem);

  for (;pos.first != pos.second; ++pos.first)
    if (pos.first->second.first == edge &&
        pos.first->second.second == id)
      return;

  std::pair<unsigned short int, boundary_id_type> p(edge,id);
  std::pair<const Elem*, std::pair<unsigned short int, boundary_id_type> >
    kv (elem, p);

  _boundary_edge_id.insert(kv);
  _boundary_ids.insert(id);
  _edge_boundary_ids.insert(id); // Also add this ID to the set of edge boundary IDs
}
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 648 of file boundary_info.C.

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

{
  if (ids.empty())
    return;

  libmesh_assert(elem);

  // Only add BCs for level-0 elements.
  libmesh_assert_equal_to (elem->level(), 0);

  // A convenient typedef
  typedef std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::
    const_iterator Iter;

  // Don't add the same ID twice
  std::pair<Iter, Iter> pos = _boundary_edge_id.equal_range(elem);

  for (unsigned int i=0; i!= ids.size(); ++i)
    {
      boundary_id_type id=ids[i];

      if (id == invalid_id)
        libmesh_error_msg("ERROR: You may not set a boundary ID of "   \
                          << invalid_id                                \
                          << "\n That is reserved for internal use.");

      bool already_inserted = false;
      for (Iter p = pos.first;p != pos.second; ++p)
        if (p->second.first == edge &&
            p->second.second == id)
          {
            already_inserted = true;
            break;
          }
      if (already_inserted)
        continue;

      std::pair<unsigned short int, boundary_id_type> p(edge,id);
      std::pair<const Elem*, std::pair<unsigned short int, boundary_id_type> >
        kv (elem, p);

      _boundary_edge_id.insert(kv);
      _boundary_ids.insert(id);
      _edge_boundary_ids.insert(id); // Also add this ID to the set of edge boundary IDs
    }
}
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 530 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::GmshIO::read_mesh(), libMesh::CheckpointIO::read_nodesets(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::SerialMesh::stitching_helper(), and libMesh::Parallel::unpack().

{
  if (id == invalid_id)
    libmesh_error_msg("ERROR: You may not set a boundary ID of "   \
                      << invalid_id                                \
                      << "\n That is reserved for internal use.");

  // A convenient typedef
  typedef std::multimap<const Node*, boundary_id_type>::const_iterator Iter;

  // Don't add the same ID twice
  std::pair<Iter, Iter> pos = _boundary_node_id.equal_range(node);

  for (;pos.first != pos.second; ++pos.first)
    if (pos.first->second == id)
      return;

  std::pair<const Node*, boundary_id_type> kv (node, id);

  _boundary_node_id.insert(kv);
  _boundary_ids.insert(id);
  _node_boundary_ids.insert(id); // Also add this ID to the set of node boundary IDs
}
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 522 of file boundary_info.C.

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

{
  this->add_node (_mesh.node_ptr(node), 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 555 of file boundary_info.C.

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

{
  if (ids.empty())
    return;

  libmesh_assert(node);

  // A convenient typedef
  typedef std::multimap<const Node*, boundary_id_type>::const_iterator Iter;

  // Don't add the same ID twice
  std::pair<Iter, Iter> pos = _boundary_node_id.equal_range(node);

  for (unsigned int i=0; i!= ids.size(); ++i)
    {
      boundary_id_type id=ids[i];

      if (id == invalid_id)
        libmesh_error_msg("ERROR: You may not set a boundary ID of "    \
                          << invalid_id                                 \
                          << "\n That is reserved for internal use.");

      bool already_inserted = false;
      for (Iter p = pos.first;p != pos.second; ++p)
        if (p->second == id)
          {
            already_inserted = true;
            break;
          }
      if (already_inserted)
        continue;

      std::pair<const Node*, boundary_id_type> kv (node, id);

      _boundary_node_id.insert(kv);
      _boundary_ids.insert(id);
      _node_boundary_ids.insert(id); // Also add this ID to the set of node boundary IDs
    }
}
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 706 of file boundary_info.C.

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

{
  libmesh_assert(elem);

  // Only add BCs for level-0 elements.
  libmesh_assert_equal_to (elem->level(), 0);

  if (id == invalid_id)
    libmesh_error_msg("ERROR: You may not set a boundary ID of "        \
                      << invalid_id                                     \
                      << "\n That is reserved for internal use.");

  // A convenient typedef
  typedef std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::
    const_iterator Iter;

  // Don't add the same ID twice
  std::pair<Iter, Iter> pos = _boundary_side_id.equal_range(elem);

  for (;pos.first != pos.second; ++pos.first)
    if (pos.first->second.first == side &&
        pos.first->second.second == id)
      return;

  std::pair<unsigned short int, boundary_id_type> p(side,id);
  std::pair<const Elem*, std::pair<unsigned short int, boundary_id_type> >
    kv (elem, p);

  _boundary_side_id.insert(kv);
  _boundary_ids.insert(id);
  _side_boundary_ids.insert(id); // Also add this ID to the set of side boundary IDs
}
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 743 of file boundary_info.C.

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

{
  if (ids.empty())
    return;

  libmesh_assert(elem);

  // Only add BCs for level-0 elements.
  libmesh_assert_equal_to (elem->level(), 0);

  // A convenient typedef
  typedef std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::
    const_iterator Iter;

  // Don't add the same ID twice
  std::pair<Iter, Iter> pos = _boundary_side_id.equal_range(elem);

  for (unsigned int i=0; i!= ids.size(); ++i)
    {
      boundary_id_type id=ids[i];

      if (id == invalid_id)
        libmesh_error_msg("ERROR: You may not set a boundary ID of "    \
                          << invalid_id                                 \
                          << "\n That is reserved for internal use.");

      bool already_inserted = false;
      for (Iter p = pos.first;p != pos.second; ++p)
        if (p->second.first == side &&
            p->second.second == id)
          {
            already_inserted = true;
            break;
          }
      if (already_inserted)
        continue;

      std::pair<unsigned short int, boundary_id_type> p(side,id);
      std::pair<const Elem*, std::pair<unsigned short int, boundary_id_type> >
        kv (elem, p);

      _boundary_side_id.insert(kv);
      _boundary_ids.insert(id);
      _side_boundary_ids.insert(id); // Also add this ID to the set of side boundary IDs
    }
}
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 1005 of file boundary_info.C.

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

Referenced by libMesh::MeshTools::Subdivision::all_subdivision(), and libMesh::DivaIO::write_stream().

{
  // Asking for just one boundary id means your code isn't safe to use
  // on meshes with overlapping boundary ids.  Try using
  // BoundaryInfo::boundary_ids or BoundaryInfo::has_boundary_id
  // instead.
  libmesh_deprecated();

  libmesh_assert(elem);

  // Only level-0 elements store BCs.  If this is not a level-0
  // element, one of its parent elements may have either internal
  // or external boundary IDs.  We find that parent now.
  const Elem*  searched_elem = elem;
  if (elem->level() != 0)
    {
      // Child element on external side: the top_parent will have the BCs
      if (elem->neighbor(side) == NULL)
        searched_elem = elem->top_parent ();

#ifdef LIBMESH_ENABLE_AMR
      // Child element is not on external side, but it may have internal
      // "boundary" IDs.  We will walk up the tree, at each level checking that
      // the current child is actually on the same side of the parent that is
      // currently being searched for (i.e. that was passed in as "side").
      else
        while (searched_elem->parent() != NULL)
          {
            const Elem * parent = searched_elem->parent();
            if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
              return invalid_id;
            searched_elem = parent;
          }
#endif
    }

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator >
    e = _boundary_side_id.equal_range(searched_elem);

  // elem not in the data structure
  if (e.first == e.second)
    return invalid_id;

  // elem is there, maybe multiple occurrences
  for (; e.first != e.second; ++e.first)
    // if this is true we found the requested side
    // of the element and want to return the id
    if (e.first->second.first == side)
      return e.first->second.second;

  // if we get here, we found elem in the data structure but not
  // the requested side, so return the default value
  return invalid_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.

Definition at line 1109 of file boundary_info.C.

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

{
  libmesh_assert(elem);

  std::vector<boundary_id_type> ids;

  // Only level-0 elements store BCs.  If this is not a level-0
  // element get its level-0 parent and infer the BCs.
  const Elem*  searched_elem = elem;
  if (elem->level() != 0)
    {
      if (elem->neighbor(side) == NULL)
        searched_elem = elem->top_parent ();
#ifdef LIBMESH_ENABLE_AMR
      else
        while (searched_elem->parent() != NULL)
          {
            const Elem * parent = searched_elem->parent();
            if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
              return ids;
            searched_elem = parent;
          }
#endif
    }

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator >
    e = _boundary_side_id.equal_range(searched_elem);

  // elem not in the data structure
  if (e.first == e.second)
    return ids;

  // elem is there, maybe multiple occurrences
  for (; e.first != e.second; ++e.first)
    // if this is true we found the requested side of the element
    if (e.first->second.first == side)
      ids.push_back(e.first->second.second);

  // Whether or not we found anything, return "ids".  If it's empty, it
  // means no valid bounary IDs were found for "side"
  return ids;
}
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 and ids for those sides.

Definition at line 1668 of file boundary_info.C.

References _boundary_side_id, and libMesh::Elem::active_family_tree_by_side().

{
  std::multimap<const Elem*,
    std::pair<unsigned short int,
    boundary_id_type> >::const_iterator pos;

  for (pos=_boundary_side_id.begin(); pos != _boundary_side_id.end();
       ++pos)
    {
      // Don't add remote sides
      if (pos->first->is_remote())
        continue;

      // Loop over the sides of possible children
      std::vector< const Elem * > family;
#ifdef LIBMESH_ENABLE_AMR
      pos->first->active_family_tree_by_side(family, pos->second.first);
#else
      family.push_back(pos->first);
#endif

      // Populate the list items
      for (std::vector<const Elem *>::iterator elem_it = family.begin(); elem_it != family.end(); elem_it++)
        {
          el.push_back ((*elem_it)->id());
          sl.push_back (pos->second.first);
          il.push_back (pos->second.second);
        }
    }
}
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.

Definition at line 1702 of file boundary_info.C.

References _boundary_edge_id, and _boundary_side_id.

{
  // Reserve the size, then use push_back
  el.reserve (_boundary_side_id.size());
  sl.reserve (_boundary_side_id.size());
  il.reserve (_boundary_side_id.size());

  std::multimap<const Elem*,
    std::pair<unsigned short int,
    boundary_id_type> >::const_iterator pos;

  for (pos=_boundary_edge_id.begin(); pos != _boundary_edge_id.end();
       ++pos)
    {
      el.push_back (pos->first->id());
      sl.push_back (pos->second.first);
      il.push_back (pos->second.second);
    }
}
void libMesh::BoundaryInfo::build_node_boundary_ids ( std::vector< boundary_id_type > &  b_ids) const

Builds the list of unique node boundary ids.

Definition at line 1414 of file boundary_info.C.

References _boundary_node_id.

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

{
  b_ids.clear();

  std::multimap<const Node*, boundary_id_type>::const_iterator pos
    = _boundary_node_id.begin();

  for (; pos != _boundary_node_id.end(); ++pos)
    {
      boundary_id_type id = pos->second;

      if(std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
        b_ids.push_back(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.

Definition at line 1523 of file boundary_info.C.

References _boundary_node_id.

Referenced by libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::SerialMesh::stitching_helper(), libMesh::CheckpointIO::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), and libMesh::Nemesis_IO_Helper::write_nodesets().

{
  // Reserve the size, then use push_back
  nl.reserve (_boundary_node_id.size());
  il.reserve (_boundary_node_id.size());

  std::multimap<const Node*, boundary_id_type>::const_iterator pos
    = _boundary_node_id.begin();

  for (; pos != _boundary_node_id.end(); ++pos)
    {
      nl.push_back (pos->first->id());
      il.push_back (pos->second);
    }
}

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

Definition at line 1542 of file boundary_info.C.

References _boundary_side_id, libMesh::Elem::active_family_tree_by_side(), add_node(), libMesh::Elem::build_side(), and side.

{
  std::multimap<const Elem*,
    std::pair<unsigned short int,
    boundary_id_type> >::const_iterator pos;

  //Loop over the side list
  for (pos=_boundary_side_id.begin(); pos != _boundary_side_id.end(); ++pos)
    {
      // Don't add remote sides
      if(pos->first->is_remote())
        continue;

      //Need to loop over the sides of any possible children
      std::vector< const Elem * > family;
#ifdef LIBMESH_ENABLE_AMR
      pos->first->active_family_tree_by_side (family, pos->second.first);
#else
      family.push_back(pos->first);
#endif

      for(std::size_t elem_it=0; elem_it < family.size(); elem_it++)
        {
          const Elem * cur_elem = family[elem_it];

          UniquePtr<Elem> side = cur_elem->build_side(pos->second.first);

          //Add each node node on the side with the side's boundary id
          for(unsigned int i=0; i<side->n_nodes(); i++)
            {
              Node * node = side->get_node(i);

              this->add_node(node, pos->second.second);
            }
        }
    }
}
void libMesh::BoundaryInfo::build_side_boundary_ids ( std::vector< boundary_id_type > &  b_ids) const

Builds the list of unique side boundary ids.

Definition at line 1431 of file boundary_info.C.

References _boundary_side_id.

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

{
  b_ids.clear();

  std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::const_iterator pos
    = _boundary_side_id.begin();

  for (; pos != _boundary_side_id.end(); ++pos)
    {
      boundary_id_type id = pos->second.second;

      if(std::find(b_ids.begin(),b_ids.end(),id) == b_ids.end())
        b_ids.push_back(id);
    }
}
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 and ids for those sides.

Definition at line 1646 of file boundary_info.C.

References _boundary_side_id.

Referenced by libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::FroIO::write(), libMesh::CheckpointIO::write_bcs(), libMesh::LegacyXdrIO::write_mesh(), libMesh::ExodusII_IO_Helper::write_sidesets(), and libMesh::Nemesis_IO_Helper::write_sidesets().

{
  // Reserve the size, then use push_back
  el.reserve (_boundary_side_id.size());
  sl.reserve (_boundary_side_id.size());
  il.reserve (_boundary_side_id.size());

  std::multimap<const Elem*,
    std::pair<unsigned short int,
    boundary_id_type> >::const_iterator pos;

  for (pos=_boundary_side_id.begin(); pos != _boundary_side_id.end();
       ++pos)
    {
      el.push_back (pos->first->id());
      sl.push_back (pos->second.first);
      il.push_back (pos->second.second);
    }
}

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

Definition at line 1583 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(), libMesh::Elem::n_sides(), nodeset_name(), libMesh::out, side, and sideset_name().

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

{
  // Check for early return
  if (_boundary_node_id.empty())
    {
      libMesh::out << "No boundary node IDs have been added: cannot build side list!" << std::endl;
      return;
    }

  // typedef for less typing!
  typedef std::multimap<const Node*, boundary_id_type>::const_iterator iterator_t;

  // Return value and iterator for equal_range()
  iterator_t pos;
  std::pair<iterator_t, iterator_t> range;

  MeshBase::const_element_iterator el = _mesh.active_elements_begin();
  const MeshBase::const_element_iterator end_el = _mesh.active_elements_end();

  for (; el != end_el; ++el)
    {
      const Elem* elem = *el;

      for (unsigned short side=0; side<elem->n_sides(); ++side)
        {
          UniquePtr<Elem> side_elem = elem->build_side(side);

          // map from nodeset_id to count for that ID
          std::map<boundary_id_type, unsigned> nodesets_node_count;
          for (unsigned node_num=0; node_num < side_elem->n_nodes(); ++node_num)
            {
              Node* node = side_elem->get_node(node_num);
              range = _boundary_node_id.equal_range(node);

              // For each nodeset that this node is a member of, increment the associated
              // nodeset ID count
              for (pos = range.first; pos != range.second; ++pos)
                nodesets_node_count[pos->second]++;
            }

          // Now check to see what nodeset_counts have the correct
          // number of nodes in them.  For any that do, add this side to
          // the sideset, making sure the sideset inherits the
          // nodeset's name, if there is one.
          std::map<boundary_id_type, unsigned>::const_iterator nodesets = nodesets_node_count.begin();
          for (; nodesets != nodesets_node_count.end(); ++nodesets)
            if (nodesets->second == side_elem->n_nodes())
              {
                add_side(elem, side, nodesets->first);

                // Let the sideset inherit any non-empty name from the nodeset
                std::string& nset_name = nodeset_name(nodesets->first);

                if (nset_name != "")
                  sideset_name(nodesets->first) = nset_name;
              }
        } // end for side
    } // end for el
}

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

Definition at line 121 of file boundary_info.C.

References _boundary_ids, _boundary_node_id, _boundary_side_id, _node_boundary_ids, and _side_boundary_ids.

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

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

Definition at line 597 of file boundary_info.C.

References _boundary_node_id.

{
  _boundary_node_id.clear();
}
const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const [inline, inherited]
Returns:
a reference to the Parallel::Communicator object used by this mesh.

Definition at line 86 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_residual(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::MetisPartitioner::_do_partition(), libMesh::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::ImplicitSystem::add_matrix(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::bounding_box(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::MeshRefinement::coarsen_elements(), 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::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshSetSystem_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), 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::CondensedEigenSystem::get_eigenpair(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_flags(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshSerializer::MeshSerializer(), libMesh::ParallelMesh::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(), libMesh::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::parallel_max_node_id(), libMesh::ParallelMesh::parallel_n_elem(), libMesh::ParallelMesh::parallel_n_nodes(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::System::project_vector(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), 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::CheckpointIO::write(), libMesh::XdrIO::write(), libMesh::LegacyXdrIO::write_mesh(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), and libMesh::DivaIO::write_stream().

  { return _communicator; }
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.

Definition at line 841 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::Elem::n_sides(), libMesh::Elem::neighbor(), libMesh::Elem::parent(), side, libMesh::Elem::top_parent(), and libMesh::Elem::which_child_am_i().

Referenced by libMesh::MeshTools::Modification::change_boundary_id(), libMesh::Parallel::pack(), and libMesh::SerialMesh::stitching_helper().

{
  libmesh_assert(elem);

  std::vector<boundary_id_type> ids;

  // Only level-0 elements store BCs.  If this is not a level-0
  // element get its level-0 parent and infer the BCs.
  const Elem* searched_elem = elem;
#ifdef LIBMESH_ENABLE_AMR
  if (elem->level() != 0)
    {
      // Find all the sides that contain edge. If one of those is a boundary
      // side, then this must be a boundary edge. In that case, we just use the
      // top-level parent.
      bool found_boundary_edge = false;
      for(unsigned int side=0; side<elem->n_sides(); side++)
        {
          if(elem->is_edge_on_side(edge,side))
            {
              if (elem->neighbor(side) == NULL)
                {
                  searched_elem = elem->top_parent ();
                  found_boundary_edge = true;
                  break;
                }
            }
        }

      if(!found_boundary_edge)
        {
          // Child element is not on external edge, but it may have internal
          // "boundary" IDs.  We will walk up the tree, at each level checking that
          // the current child is actually on the same edge of the parent that is
          // currently being searched for (i.e. that was passed in as "edge").
          while (searched_elem->parent() != NULL)
            {
              const Elem * parent = searched_elem->parent();
              if (parent->is_child_on_edge(parent->which_child_am_i(searched_elem), edge) == false)
                return ids;
              searched_elem = parent;
            }
        }
    }
#endif

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator >
    e = _boundary_edge_id.equal_range(searched_elem);

  // elem not in the data structure
  if (e.first == e.second)
    return ids;

  // elem is there, maybe multiple occurrences
  for (; e.first != e.second; ++e.first)
    // if this is true we found the requested edge of the element
    if (e.first->second.first == edge)
      ids.push_back(e.first->second.second);

  // Whether or not we found anything, return "ids".  If it's empty, it
  // means no valid bounary IDs were found for "edge"
  return ids;
}
const std::set<boundary_id_type>& libMesh::BoundaryInfo::get_boundary_ids ( ) const [inline]
Returns:
the user-specified boundary ids.

Definition at line 412 of file boundary_info.h.

References _boundary_ids.

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

  { return _boundary_ids; }

Returns a reference to the set of all boundary IDs specified on edges. Edge-based boundary IDs should only be used in 3D.

Definition at line 427 of file boundary_info.h.

References _edge_boundary_ids.

  { return _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 1913 of file boundary_info.C.

References _ns_id_to_name, _ss_id_to_name, and invalid_id.

{
  // Search sidesets
  std::map<boundary_id_type, std::string>::const_iterator
    iter = _ss_id_to_name.begin(),
    end_iter = _ss_id_to_name.end();

  for (; iter != end_iter; ++iter)
    if (iter->second == name)
      return iter->first;

  // Search nodesets
  iter = _ns_id_to_name.begin();
  end_iter = _ns_id_to_name.end();
  for (; iter != end_iter; ++iter)
    if (iter->second == name)
      return iter->first;

  // If we made it here without returning, we don't have a sideset or
  // nodeset by the requested name, so return invalid_id
  return invalid_id;
}

Returns a reference to the set of all boundary IDs specified on nodes.

Definition at line 434 of file boundary_info.h.

References _node_boundary_ids.

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

  { return _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 1897 of file boundary_info.C.

References _ns_id_to_name.

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

{
  static const std::string empty_string;
  std::map<boundary_id_type, std::string>::const_iterator it =
    _ns_id_to_name.find(id);
  if (it == _ns_id_to_name.end())
    return empty_string;
  else
    return it->second;
}
const std::map<boundary_id_type, std::string>& libMesh::BoundaryInfo::get_nodeset_name_map ( ) const [inline]

Returns a reference to the set of all boundary IDs specified on sides.

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

  { return _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 1880 of file boundary_info.C.

References _ss_id_to_name.

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

{
  static const std::string empty_string;
  std::map<boundary_id_type, std::string>::const_iterator it =
    _ss_id_to_name.find(id);
  if (it == _ss_id_to_name.end())
    return empty_string;
  else
    return it->second;
}
const std::map<boundary_id_type, std::string>& libMesh::BoundaryInfo::get_sideset_name_map ( ) const [inline]
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 794 of file boundary_info.C.

References _boundary_node_id.

Referenced by libMesh::FEMContext::has_side_boundary_id().

{
  // A convenient typedef
  typedef std::multimap<const Node*, boundary_id_type>::const_iterator Iter;

  std::pair<Iter, Iter> pos = _boundary_node_id.equal_range(node);

  for (;pos.first != pos.second; ++pos.first)
    if (pos.first->second == id)
      return true;

  return false;
}
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 1066 of file boundary_info.C.

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

{
  libmesh_assert(elem);

  // Only level-0 elements store BCs.  If this is not a level-0
  // element get its level-0 parent and infer the BCs.
  const Elem*  searched_elem = elem;
  if (elem->level() != 0)
    {
      if (elem->neighbor(side) == NULL)
        searched_elem = elem->top_parent ();
#ifdef LIBMESH_ENABLE_AMR
      else
        while (searched_elem->parent() != NULL)
          {
            const Elem * parent = searched_elem->parent();
            if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
              return false;
            searched_elem = parent;
          }
#endif
    }

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator >
    e = _boundary_side_id.equal_range(searched_elem);

  // elem is there, maybe multiple occurrences
  for (; e.first != e.second; ++e.first)
    // if this is true we found the requested id on this side of the element
    if (e.first->second.first == side &&
        e.first->second.second == id)
      return true;

  return false;
}
Returns:
the number of element-side-based boundary conditions.

Definition at line 1447 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::flatten(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::write(), libMesh::LegacyXdrIO::write_mesh(), and libMesh::LegacyXdrIO::write_soln().

{
  // in serial we know the number of bcs from the
  // size of the container
  if (_mesh.is_serial())
    return _boundary_side_id.size();

  // in parallel we need to sum the number of local bcs
  parallel_object_only();

  std::size_t nbcs=0;

  std::multimap<const Elem*,
    std::pair<unsigned short int,
    boundary_id_type> >::const_iterator pos;

  for (pos=_boundary_side_id.begin(); pos != _boundary_side_id.end(); ++pos)
    if (pos->first->processor_id() == this->processor_id())
      nbcs++;

  this->comm().sum (nbcs);

  return nbcs;
}
std::size_t libMesh::BoundaryInfo::n_boundary_ids ( ) const [inline]

Returns the number of user-specified boundary ids.

Definition at line 249 of file boundary_info.h.

References _boundary_ids.

Referenced by libMesh::MeshTools::Subdivision::all_subdivision(), libMesh::MeshTools::Modification::all_tri(), libMesh::Parallel::packable_size(), and libMesh::FroIO::write().

{ return _boundary_ids.size(); }
unsigned int libMesh::BoundaryInfo::n_boundary_ids ( const Node node) const

Returns the number of boundary ids associated with Node node.

Definition at line 828 of file boundary_info.C.

References _boundary_node_id.

{
  // A convenient typedef
  typedef std::multimap<const Node*, boundary_id_type>::const_iterator Iter;

  std::pair<Iter, Iter> pos = _boundary_node_id.equal_range(node);

  return cast_int<unsigned int>
    (std::distance(pos.first, pos.second));
}
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 1158 of file boundary_info.C.

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

{
  libmesh_assert(elem);

  // Only level-0 elements store BCs.  If this is not a level-0
  // element get its level-0 parent and infer the BCs.
  const Elem*  searched_elem = elem;
  if (elem->level() != 0)
    {
      if (elem->neighbor(side) == NULL)
        searched_elem = elem->top_parent ();
#ifdef LIBMESH_ENABLE_AMR
      else
        while (searched_elem->parent() != NULL)
          {
            const Elem * parent = searched_elem->parent();
            if (parent->is_child_on_side(parent->which_child_am_i(searched_elem), side) == false)
              return 0;
            searched_elem = parent;
          }
#endif
    }

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator >
    e = _boundary_side_id.equal_range(searched_elem);

  unsigned int n_ids = 0;

  // elem is there, maybe multiple occurrences
  for (; e.first != e.second; ++e.first)
    // if this is true we found the requested side of the element
    if (e.first->second.first == side)
      n_ids++;

  return n_ids;
}
unsigned int libMesh::BoundaryInfo::n_edge_boundary_ids ( const Elem *const  elem,
const unsigned short int  edge 
) const

Returns the number of boundary ids associated with the edge edge of element elem. Edge-based boundary IDs should only be used in 3D.

Definition at line 911 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::Elem::n_sides(), libMesh::Elem::neighbor(), libMesh::Elem::parent(), side, libMesh::Elem::top_parent(), and libMesh::Elem::which_child_am_i().

Referenced by libMesh::Parallel::packable_size().

{
  libmesh_assert(elem);

  // Only level-0 elements store BCs.  If this is not a level-0
  // element get its level-0 parent and infer the BCs.
  const Elem* searched_elem = elem;
#ifdef LIBMESH_ENABLE_AMR
  if (elem->level() != 0)
    {
      // Find all the sides that contain edge. If one of those is a boundary
      // side, then this must be a boundary edge. In that case, we just use the
      // top-level parent.
      bool found_boundary_edge = false;
      for(unsigned int side=0; side<elem->n_sides(); side++)
        {
          if(elem->is_edge_on_side(edge,side))
            {
              if (elem->neighbor(side) == NULL)
                {
                  searched_elem = elem->top_parent ();
                  found_boundary_edge = true;
                  break;
                }
            }
        }

      if(!found_boundary_edge)
        {
          // Child element is not on external edge, but it may have internal
          // "boundary" IDs.  We will walk up the tree, at each level checking that
          // the current child is actually on the same edge of the parent that is
          // currently being searched for (i.e. that was passed in as "edge").
          while (searched_elem->parent() != NULL)
            {
              const Elem * parent = searched_elem->parent();
              if (parent->is_child_on_edge(parent->which_child_am_i(searched_elem), edge) == false)
                return 0;
              searched_elem = parent;
            }
        }
    }
#endif

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator >
    e = _boundary_edge_id.equal_range(searched_elem);

  unsigned int n_ids = 0;

  // elem is there, maybe multiple occurrences
  for (; e.first != e.second; ++e.first)
    // if this is true we found the requested edge of the element
    if (e.first->second.first == edge)
      n_ids++;

  return n_ids;
}
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.

Definition at line 1472 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 libMesh::Nemesis_IO::write(), libMesh::ExodusII_IO::write(), libMesh::XdrIO::write(), libMesh::Nemesis_IO::write_nodal_data(), and libMesh::ExodusII_IO::write_nodal_data_common().

{
  // in serial we know the number of nodesets from the
  // size of the container
  if (_mesh.is_serial())
    return _boundary_edge_id.size();

  // in parallel we need to sum the number of local nodesets
  parallel_object_only();

  std::size_t n_edge_bcs=0;

  std::multimap<const Elem*,
    std::pair<unsigned short int,
    boundary_id_type> >::const_iterator pos;

  for (pos=_boundary_edge_id.begin(); pos != _boundary_edge_id.end(); ++pos)
    if (pos->first->processor_id() == this->processor_id())
      n_edge_bcs++;

  this->comm().sum (n_edge_bcs);

  return n_edge_bcs;
}
Returns:
the number of node-based boundary conditions.

Definition at line 1498 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 libMesh::XdrIO::write().

{
  // in serial we know the number of nodesets from the
  // size of the container
  if (_mesh.is_serial())
    return _boundary_node_id.size();

  // in parallel we need to sum the number of local nodesets
  parallel_object_only();

  std::size_t n_nodesets=0;

  std::multimap<const Node*, boundary_id_type>::const_iterator pos;

  for (pos=_boundary_node_id.begin(); pos != _boundary_node_id.end(); ++pos)
    if (pos->first->processor_id() == this->processor_id())
      n_nodesets++;

  this->comm().sum (n_nodesets);

  return n_nodesets;
}
Returns:
the number of processors in the group.

Definition at line 92 of file parallel_object.h.

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

Referenced by libMesh::ParmetisPartitioner::_do_repartition(), libMesh::ParallelMesh::add_elem(), libMesh::ParallelMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::ParallelMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshBase::get_info(), libMesh::EquationSystems::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), 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::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::MeshTools::processor_bounding_box(), libMesh::System::project_vector(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::Partitioner::repartition(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), sync(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::CheckpointIO::write(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

  { return cast_int<processor_id_type>(_communicator.size()); }

Returns a writable reference for setting an optional name for a nodeset.

Definition at line 1908 of file boundary_info.C.

References _ns_id_to_name.

Referenced by libMesh::AbaqusIO::assign_boundary_node_ids(), build_side_list_from_node_list(), and libMesh::ExodusII_IO::read().

{
  return _ns_id_to_name[id];
}
BoundaryInfo & libMesh::BoundaryInfo::operator= ( const BoundaryInfo other_boundary_info)

Actual copying operation.

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

A quick note: 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).

Definition at line 52 of file boundary_info.C.

References _boundary_edge_id, _boundary_ids, _boundary_node_id, _boundary_side_id, _mesh, _node_boundary_ids, _side_boundary_ids, libMesh::MeshBase::elem(), end, libMesh::DofObject::id(), and libMesh::MeshBase::node_ptr().

{
  // Copy node boundary info
  {
    std::multimap<const Node*, boundary_id_type>::const_iterator it = other_boundary_info._boundary_node_id.begin();
    const std::multimap<const Node*, boundary_id_type>::const_iterator end = other_boundary_info._boundary_node_id.end();

    for(; it != end; ++it)
      {
        const Node * other_node = it->first;
        _boundary_node_id.insert
          (std::pair<const Node*, boundary_id_type>
           (_mesh.node_ptr(other_node->id()), it->second) );
      }
  }

  // Copy edge boundary info
  {
    std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::
      const_iterator it = other_boundary_info._boundary_edge_id.begin();
    const std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::
      const_iterator end = other_boundary_info._boundary_edge_id.end();

    for(; it != end; ++it)
      {
        const Elem * other_elem = it->first;
        _boundary_edge_id.insert
          (std::pair<const Elem*, std::pair<unsigned short int, boundary_id_type> >
           (_mesh.elem(other_elem->id()), it->second) );
      }
  }

  // Copy side boundary info
  {
    std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::
      const_iterator it = other_boundary_info._boundary_side_id.begin();
    const std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::
      const_iterator end = other_boundary_info._boundary_side_id.end();

    for(; it != end; ++it)
      {
        const Elem * other_elem = it->first;
        _boundary_side_id.insert
          (std::pair<const Elem*, std::pair<unsigned short int, boundary_id_type> >
           (_mesh.elem(other_elem->id()), it->second) );
      }
  }

  _boundary_ids = other_boundary_info._boundary_ids;
  _side_boundary_ids = other_boundary_info._side_boundary_ids;
  _node_boundary_ids = other_boundary_info._node_boundary_ids;

  return *this;
}
void libMesh::BoundaryInfo::print_info ( std::ostream &  out = libMesh::out) const

Print the boundary information data structure.

Definition at line 1725 of file boundary_info.C.

References _boundary_edge_id, _boundary_node_id, _boundary_side_id, and end.

{
  // Print out the nodal BCs
  if (!_boundary_node_id.empty())
    {
      out_stream << "Nodal Boundary conditions:" << std::endl
                 << "--------------------------" << std::endl
                 << "  (Node No., ID)               " << std::endl;

      //       std::for_each(_boundary_node_id.begin(),
      //    _boundary_node_id.end(),
      //    PrintNodeInfo());

      std::multimap<const Node*, boundary_id_type>::const_iterator it        = _boundary_node_id.begin();
      const std::multimap<const Node*, boundary_id_type>::const_iterator end = _boundary_node_id.end();

      for (; it != end; ++it)
        out_stream << "  (" << (*it).first->id()
                   << ", "  << (*it).second
                   << ")"  << std::endl;
    }

  // Print out the element edge BCs
  if (!_boundary_edge_id.empty())
    {
      out_stream << std::endl
                 << "Edge Boundary conditions:" << std::endl
                 << "-------------------------" << std::endl
                 << "  (Elem No., Edge No., ID)      " << std::endl;

      //       std::for_each(_boundary_edge_id.begin(),
      //    _boundary_edge_id.end(),
      //    PrintSideInfo());

      std::multimap<const Elem*,
        std::pair<unsigned short int, boundary_id_type> >::const_iterator it = _boundary_edge_id.begin();
      const std::multimap<const Elem*,
        std::pair<unsigned short int, boundary_id_type> >::const_iterator end = _boundary_edge_id.end();

      for (; it != end; ++it)
        out_stream << "  (" << (*it).first->id()
                   << ", "  << (*it).second.first
                   << ", "  << (*it).second.second
                   << ")"   << std::endl;
    }

  // Print out the element side BCs
  if (!_boundary_side_id.empty())
    {
      out_stream << std::endl
                 << "Side Boundary conditions:" << std::endl
                 << "-------------------------" << std::endl
                 << "  (Elem No., Side No., ID)      " << std::endl;

      //       std::for_each(_boundary_side_id.begin(),
      //    _boundary_side_id.end(),
      //    PrintSideInfo());

      std::multimap<const Elem*,
        std::pair<unsigned short int, boundary_id_type> >::const_iterator it = _boundary_side_id.begin();
      const std::multimap<const Elem*,
        std::pair<unsigned short int, boundary_id_type> >::const_iterator end = _boundary_side_id.end();

      for (; it != end; ++it)
        out_stream << "  (" << (*it).first->id()
                   << ", "  << (*it).second.first
                   << ", "  << (*it).second.second
                   << ")"   << std::endl;
    }
}
void libMesh::BoundaryInfo::print_summary ( std::ostream &  out = libMesh::out) const

Print a summary of the boundary information.

Definition at line 1798 of file boundary_info.C.

References _boundary_edge_id, _boundary_node_id, _boundary_side_id, and end.

{
  // Print out the nodal BCs
  if (!_boundary_node_id.empty())
    {
      out_stream << "Nodal Boundary conditions:" << std::endl
                 << "--------------------------" << std::endl
                 << "  (ID, number of nodes)   " << std::endl;

      std::map<boundary_id_type, std::size_t> ID_counts;

      std::multimap<const Node*, boundary_id_type>::const_iterator it        = _boundary_node_id.begin();
      const std::multimap<const Node*, boundary_id_type>::const_iterator end = _boundary_node_id.end();

      for (; it != end; ++it)
        ID_counts[(*it).second]++;

      std::map<boundary_id_type, std::size_t>::const_iterator ID_it        = ID_counts.begin();
      const std::map<boundary_id_type, std::size_t>::const_iterator ID_end = ID_counts.end();

      for (; ID_it != ID_end; ++ID_it)
        out_stream << "  (" << (*ID_it).first
                   << ", "  << (*ID_it).second
                   << ")"  << std::endl;
    }

  // Print out the element edge BCs
  if (!_boundary_edge_id.empty())
    {
      out_stream << std::endl
                 << "Edge Boundary conditions:" << std::endl
                 << "-------------------------" << std::endl
                 << "  (ID, number of edges)   " << std::endl;

      std::map<boundary_id_type, std::size_t> ID_counts;

      std::multimap<const Elem*,
        std::pair<unsigned short int, boundary_id_type> >::const_iterator it = _boundary_edge_id.begin();
      const std::multimap<const Elem*,
        std::pair<unsigned short int, boundary_id_type> >::const_iterator end = _boundary_edge_id.end();

      for (; it != end; ++it)
        ID_counts[(*it).second.second]++;

      std::map<boundary_id_type, std::size_t>::const_iterator ID_it        = ID_counts.begin();
      const std::map<boundary_id_type, std::size_t>::const_iterator ID_end = ID_counts.end();

      for (; ID_it != ID_end; ++ID_it)
        out_stream << "  (" << (*ID_it).first
                   << ", "  << (*ID_it).second
                   << ")"  << std::endl;
    }

  // Print out the element side BCs
  if (!_boundary_side_id.empty())
    {
      out_stream << std::endl
                 << "Side Boundary conditions:" << std::endl
                 << "-------------------------" << std::endl
                 << "  (ID, number of sides)   " << std::endl;

      std::map<boundary_id_type, std::size_t> ID_counts;

      std::multimap<const Elem*,
        std::pair<unsigned short int, boundary_id_type> >::const_iterator it = _boundary_side_id.begin();
      const std::multimap<const Elem*,
        std::pair<unsigned short int, boundary_id_type> >::const_iterator end = _boundary_side_id.end();

      for (; it != end; ++it)
        ID_counts[(*it).second.second]++;

      std::map<boundary_id_type, std::size_t>::const_iterator ID_it        = ID_counts.begin();
      const std::map<boundary_id_type, std::size_t>::const_iterator ID_end = ID_counts.end();

      for (; ID_it != ID_end; ++ID_it)
        out_stream << "  (" << (*ID_it).first
                   << ", "  << (*ID_it).second
                   << ")"  << std::endl;
    }
}
Returns:
the rank of this processor in the group.

Definition at line 98 of file parallel_object.h.

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

Referenced by libMesh::MetisPartitioner::_do_partition(), libMesh::EquationSystems::_read_impl(), libMesh::SerialMesh::active_local_elements_begin(), libMesh::ParallelMesh::active_local_elements_begin(), libMesh::SerialMesh::active_local_elements_end(), libMesh::ParallelMesh::active_local_elements_end(), libMesh::SerialMesh::active_local_subdomain_elements_begin(), libMesh::ParallelMesh::active_local_subdomain_elements_begin(), libMesh::SerialMesh::active_local_subdomain_elements_end(), libMesh::ParallelMesh::active_local_subdomain_elements_end(), libMesh::SerialMesh::active_not_local_elements_begin(), libMesh::ParallelMesh::active_not_local_elements_begin(), libMesh::SerialMesh::active_not_local_elements_end(), libMesh::ParallelMesh::active_not_local_elements_end(), libMesh::ParallelMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::ParallelMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::DofMap::build_sparsity(), libMesh::ParallelMesh::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::ExodusII_IO_Helper::create(), libMesh::ParallelMesh::delete_elem(), libMesh::ParallelMesh::delete_node(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::SerialMesh::facelocal_elements_begin(), libMesh::ParallelMesh::facelocal_elements_begin(), libMesh::SerialMesh::facelocal_elements_end(), libMesh::ParallelMesh::facelocal_elements_end(), libMesh::MeshFunction::find_element(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMap::first_dof(), libMesh::DofMap::first_old_dof(), 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::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::Nemesis_IO_Helper::get_ss_param_global(), 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::ParallelMesh::insert_elem(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::SerialMesh::local_elements_begin(), libMesh::ParallelMesh::local_elements_begin(), libMesh::SerialMesh::local_elements_end(), libMesh::ParallelMesh::local_elements_end(), libMesh::SerialMesh::local_level_elements_begin(), libMesh::ParallelMesh::local_level_elements_begin(), libMesh::SerialMesh::local_level_elements_end(), libMesh::ParallelMesh::local_level_elements_end(), libMesh::SerialMesh::local_nodes_begin(), libMesh::ParallelMesh::local_nodes_begin(), libMesh::SerialMesh::local_nodes_end(), libMesh::ParallelMesh::local_nodes_end(), libMesh::SerialMesh::local_not_level_elements_begin(), libMesh::ParallelMesh::local_not_level_elements_begin(), libMesh::SerialMesh::local_not_level_elements_end(), libMesh::ParallelMesh::local_not_level_elements_end(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_local_elem(), n_boundary_conds(), n_edge_conds(), libMesh::DofMap::n_local_dofs(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), n_nodeset_conds(), libMesh::SerialMesh::not_local_elements_begin(), libMesh::ParallelMesh::not_local_elements_begin(), libMesh::SerialMesh::not_local_elements_end(), libMesh::ParallelMesh::not_local_elements_end(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::ParallelMesh::ParallelMesh(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::System::project_vector(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::MeshData::read_xdr(), libMesh::SerialMesh::semilocal_elements_begin(), libMesh::ParallelMesh::semilocal_elements_begin(), libMesh::SerialMesh::semilocal_elements_end(), libMesh::ParallelMesh::semilocal_elements_end(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), sync(), libMesh::MeshTools::total_weight(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::MeshTools::weight(), libMesh::NameBasedIO::write(), libMesh::ExodusII_IO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().

  { return cast_int<processor_id_type>(_communicator.rank()); }
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.

Definition at line 1201 of file boundary_info.C.

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

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

{
  libmesh_assert(elem);

  std::vector<boundary_id_type> ids;

  // Only level-0 elements store BCs.
  if (elem->parent())
    return ids;

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator >
    e = _boundary_side_id.equal_range(elem);

  // Check any occurrences
  for (; e.first != e.second; ++e.first)
    // if this is true we found the requested side of the element
    if (e.first->second.first == side)
      ids.push_back(e.first->second.second);

  // if nothing got pushed back, we didn't find elem in the data
  // structure with the requested side, so return the default empty
  // vector
  return ids;
}
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.

Definition at line 975 of file boundary_info.C.

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

{
  libmesh_assert(elem);

  std::vector<boundary_id_type> ids;

  // Only level-0 elements store BCs.
  if (elem->parent())
    return ids;

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator >
    e = _boundary_edge_id.equal_range(elem);

  // Check any occurrences
  for (; e.first != e.second; ++e.first)
    // if this is true we found the requested edge of the element
    if (e.first->second.first == edge)
      ids.push_back(e.first->second.second);

  // if nothing got pushed back, we didn't find elem in the data
  // structure with the requested edge, so return the default empty
  // vector
  return ids;
}
void libMesh::BoundaryInfo::remove ( const Elem elem) [inline]

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

Definition at line 658 of file boundary_info.h.

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

{
  libmesh_assert(elem);

  // Erase everything associated with elem
  _boundary_edge_id.erase (elem);
  _boundary_side_id.erase (elem);
}
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 1231 of file boundary_info.C.

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

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

{
  libmesh_assert(elem);

  // The user shouldn't be trying to remove only one child's boundary
  // id
  libmesh_assert_equal_to (elem->level(), 0);

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::iterator >
    e = _boundary_edge_id.equal_range(elem);

  // elem may be there, maybe multiple occurrences
  while (e.first != e.second)
    {
      // if this is true we found the requested edge
      // of the element and want to erase the id
      if (e.first->second.first == edge)
        {
          // (postfix++ - increment the iterator before it's invalid)
          _boundary_edge_id.erase(e.first++);
        }
      else
        ++e.first;
    }
}
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 1263 of file boundary_info.C.

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

{
  libmesh_assert(elem);

  // The user shouldn't be trying to remove only one child's boundary
  // id
  libmesh_assert_equal_to (elem->level(), 0);

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::iterator >
    e = _boundary_edge_id.equal_range(elem);

  // elem may be there, maybe multiple occurrences
  while (e.first != e.second)
    {
      // if this is true we found the requested edge
      // of the element and want to erase the requested id
      if (e.first->second.first == edge &&
          e.first->second.second == id)
        {
          // (postfix++ - increment the iterator before it's invalid)
          _boundary_edge_id.erase(e.first++);
        }
      else
        ++e.first;
    }
}
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 1295 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::SerialMesh::stitching_helper().

{
  libmesh_assert(elem);

  // The user shouldn't be trying to remove only one child's boundary
  // id
  libmesh_assert_equal_to (elem->level(), 0);

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::iterator >
    e = _boundary_side_id.equal_range(elem);

  // elem may be there, maybe multiple occurrences
  while (e.first != e.second)
    {
      // if this is true we found the requested side
      // of the element and want to erase the id
      if (e.first->second.first == side)
        {
          // (postfix++ - increment the iterator before it's invalid)
          _boundary_side_id.erase(e.first++);
        }
      else
        ++e.first;
    }
}
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 1327 of file boundary_info.C.

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

{
  libmesh_assert(elem);

  // The user shouldn't be trying to remove only one child's boundary
  // id
  libmesh_assert_equal_to (elem->level(), 0);

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::iterator >
    e = _boundary_side_id.equal_range(elem);

  // elem may be there, maybe multiple occurrences
  while (e.first != e.second)
    {
      // if this is true we found the requested side
      // of the element and want to erase the requested id
      if (e.first->second.first == side &&
          e.first->second.second == id)
        {
          // (postfix++ - increment the iterator before it's invalid)
          _boundary_side_id.erase(e.first++);
        }
      else
        ++e.first;
    }
}
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 487 of file boundary_info.h.

References _ns_id_to_name.

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

  { return _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 479 of file boundary_info.h.

References _ss_id_to_name.

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

  { return _ss_id_to_name; }
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 1361 of file boundary_info.C.

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

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

{
  const Elem* searched_elem = elem;
  if (elem->level() != 0)
    searched_elem = elem->top_parent();

  std::pair<std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator,
    std::multimap<const Elem*,
    std::pair<unsigned short int, boundary_id_type> >::const_iterator >
    e = _boundary_side_id.equal_range(searched_elem);

  // elem may have zero or multiple occurrences
  for (; e.first != e.second; ++e.first)
    {
      // if this is true we found the requested boundary_id
      // of the element and want to return the side
      if (e.first->second.second == boundary_id_in)
        {
          unsigned int side = e.first->second.first;

          // If we're on this external boundary then we share this
          // external boundary id
          if (elem->neighbor(side) == NULL)
            return side;

          // If we're on an internal boundary then we need to be sure
          // it's the same internal boundary as our top_parent
          const Elem *p = elem;

#ifdef LIBMESH_ENABLE_AMR

          while (p != NULL)
            {
              const Elem *parent = p->parent();
              if (!parent->is_child_on_side(parent->which_child_am_i(p), side))
                break;
              p = parent;
            }
#endif
          // We're on that side of our top_parent; return it
          if (!p)
            return side;
        }
    }

  // if we get here, we found elem in the data structure but not
  // the requested boundary id, so return the default value
  return libMesh::invalid_uint;
}

Returns a writable reference for setting an optional name for a sideset.

Definition at line 1892 of file boundary_info.C.

References _ss_id_to_name.

Referenced by libMesh::AbaqusIO::assign_sideset_ids(), build_side_list_from_node_list(), libMesh::UNVIO::groups_in(), and libMesh::ExodusII_IO::read().

{
  return _ss_id_to_name[id];
}
void libMesh::BoundaryInfo::sync ( UnstructuredMesh boundary_mesh,
MeshData boundary_mesh_data = NULL,
MeshData this_mesh_data = NULL 
)

Close the data structures and prepare for use. Synchronizes the boundary_mesh data structures with the mesh data structures. Allows the boundary_mesh to be used like any other mesh. Before this is called the boundary_mesh data structure is empty.

If you are using a MeshData class with this Mesh, you can pass a pointer to both the boundary_mesh's MeshData object, and the MeshData object used for this mesh.

Definition at line 132 of file boundary_info.C.

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

Referenced by libMesh::DivaIO::write_stream().

{
  std::set<boundary_id_type> request_boundary_ids(_boundary_ids);
  request_boundary_ids.insert(invalid_id);
  if (!_mesh.is_serial())
    this->comm().set_union(request_boundary_ids);

  this->sync(request_boundary_ids, boundary_mesh,
             boundary_mesh_data, this_mesh_data);
}
void libMesh::BoundaryInfo::sync ( const std::set< boundary_id_type > &  requested_boundary_ids,
UnstructuredMesh boundary_mesh,
MeshData boundary_mesh_data = NULL,
MeshData this_mesh_data = NULL 
)

Close the data structures and prepare for use. Synchronizes the boundary_mesh data structures with the mesh data structures. Allows the boundary_mesh to be used like any other mesh. Before this is called the boundary_mesh data structure is empty. Only boundary elements with the specified ids are extracted.

If you are using a MeshData class with this Mesh, you can pass a pointer to both the boundary_mesh's MeshData object, and the MeshData object used for this 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.

The boundary mesh elements will be one lower dimension than the interior mesh elements.

We no longer need to set_mesh_dimension() explicitly here, though: prepare_for_use() will call cache_elem_dims(), which will also be correct in the multi-dimensional case.

Re-create the boundary mesh.

Definition at line 147 of file boundary_info.C.

References _boundary_side_id, _mesh, libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::MeshData::assign(), libMesh::Elem::build_side(), libMesh::MeshBase::clear(), libMesh::ParallelObject::comm(), libMesh::MeshBase::delete_remote_elements(), libMesh::MeshBase::elem(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::Elem::get_node(), libMesh::DofObject::id(), libMesh::Elem::INACTIVE, invalid_id, libMesh::DofObject::invalid_processor_id, libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::Elem::n_nodes(), libMesh::MeshBase::n_partitions(), libMesh::ParallelObject::n_processors(), libMesh::Elem::n_sides(), libMesh::Elem::n_vertices(), libMesh::Elem::neighbor(), libMesh::Elem::node(), libMesh::MeshBase::node_ptr(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), libMesh::Elem::parent(), libMesh::MeshBase::partitioner(), libMesh::MeshBase::pid_elements_begin(), libMesh::MeshBase::pid_elements_end(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::Elem::set_interior_parent(), libMesh::MeshBase::set_n_partitions(), libMesh::Elem::set_node(), libMesh::Partitioner::set_node_processor_ids(), libMesh::Elem::set_parent(), libMesh::Parallel::Communicator::set_union(), side, libMesh::START_LOG(), and libMesh::Elem::top_parent().

{
  START_LOG("sync()", "BoundaryInfo");

  boundary_mesh.clear();

  if (!_mesh.is_serial())
    boundary_mesh.delete_remote_elements();

  MeshSerializer serializer
    (const_cast<MeshBase&>(_mesh), boundary_mesh.is_serial());

  boundary_mesh.set_n_partitions() = _mesh.n_partitions();

  std::map<dof_id_type, dof_id_type> node_id_map;
  std::map<std::pair<dof_id_type, unsigned char>, dof_id_type> side_id_map;

  // We'll do the same modulus trick that ParallelMesh uses to avoid
  // id conflicts between different processors
  dof_id_type next_node_id = this->processor_id(),
    next_elem_id = this->processor_id();

  // We'll pass through the mesh once first to build
  // the maps and count boundary nodes and elements
  // We have to examine all elements here rather than just local
  // elements, because it's possible to have a local boundary node
  // that's not on a local boundary element, e.g. at the tip of a
  // triangle.
  const MeshBase::const_element_iterator end_el = _mesh.elements_end();
  for (MeshBase::const_element_iterator el = _mesh.elements_begin();
       el != end_el; ++el)
    {
      const Elem *elem = *el;

      for (unsigned char s=0; s<elem->n_sides(); s++)
        if (elem->neighbor(s) == NULL) // on the boundary
          {
            // Get the top-level parent for this element
            const Elem* top_parent = elem->top_parent();

            // A convenient typedef
            typedef
              std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::
              const_iterator Iter;

            // Find the right id number for that side
            std::pair<Iter, Iter> pos = _boundary_side_id.equal_range(top_parent);

            bool add_this_side = false;
            boundary_id_type this_bcid = invalid_id;

            for (; pos.first != pos.second; ++pos.first)
              {
                this_bcid = pos.first->second.second;

                // if this side is flagged with a boundary condition
                // and the user wants this id
                if ((pos.first->second.first == s) &&
                    (requested_boundary_ids.count(this_bcid)))
                  {
                    add_this_side = true;
                    break;
                  }
              }

            // if side s wasn't found or doesn't have a boundary
            // condition we may still want to add it
            if (pos.first == pos.second)
              {
                this_bcid = invalid_id;
                if (requested_boundary_ids.count(this_bcid))
                  add_this_side = true;
              }

            if (add_this_side)
              {
                std::pair<dof_id_type, unsigned char> side_pair(elem->id(), s);
                libmesh_assert (!side_id_map.count(side_pair));
                side_id_map[side_pair] = next_elem_id;
                next_elem_id += this->n_processors() + 1;

                // Use a proxy element for the side to query nodes
                UniquePtr<Elem> side (elem->build_side(s));
                for (unsigned int n = 0; n != side->n_nodes(); ++n)
                  {
                    Node *node = side->get_node(n);
                    libmesh_assert(node);

                    // In parallel we only know enough to number our own nodes.
                    if (node->processor_id() != this->processor_id())
                      continue;

                    dof_id_type node_id = node->id();
                    if (!node_id_map.count(node_id))
                      {
                        node_id_map[node_id] = next_node_id;
                        next_node_id += this->n_processors() + 1;
                      }
                  }
              }
          }
    }

  // Join up the results from other processors
  this->comm().set_union(side_id_map);
  this->comm().set_union(node_id_map);

  // Finally we'll pass through any unpartitioned elements to add them
  // to the maps and counts.
  next_node_id = this->n_processors();
  next_elem_id = this->n_processors();

  const MeshBase::const_element_iterator end_unpartitioned_el =
    _mesh.pid_elements_end(DofObject::invalid_processor_id);
  for (MeshBase::const_element_iterator el =
         _mesh.pid_elements_begin(DofObject::invalid_processor_id);
       el != end_unpartitioned_el; ++el)
    {
      const Elem *elem = *el;

      for (unsigned char s=0; s<elem->n_sides(); s++)
        if (elem->neighbor(s) == NULL) // on the boundary
          {
            // Get the top-level parent for this element
            const Elem* top_parent = elem->top_parent();

            // A convenient typedef
            typedef
              std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::
              const_iterator Iter;

            // Find the right id number for that side
            std::pair<Iter, Iter> pos = _boundary_side_id.equal_range(top_parent);

            bool add_this_side = false;
            boundary_id_type this_bcid = invalid_id;

            for (; pos.first != pos.second; ++pos.first)
              {
                this_bcid = pos.first->second.second;
                // if this side is flagged with a boundary condition
                // and the user wants this id
                if ((pos.first->second.first == s) &&
                    (requested_boundary_ids.count(this_bcid)))
                  {
                    add_this_side = true;
                    break;
                  }
              }

            // if side s doesn't have a boundary condition we may
            // still want to add it
            if (pos.first == pos.second)
              {
                this_bcid = invalid_id;
                if (requested_boundary_ids.count(this_bcid))
                  add_this_side = true;
              }

            if (add_this_side)
              {
                std::pair<dof_id_type, unsigned char> side_pair(elem->id(), s);
                libmesh_assert (!side_id_map.count(side_pair));
                side_id_map[side_pair] = next_elem_id;
                next_elem_id += this->n_processors() + 1;

                // Use a proxy element for the side to query nodes
                UniquePtr<Elem> side (elem->build_side(s));
                for (unsigned int n = 0; n != side->n_nodes(); ++n)
                  {
                    Node *node = side->get_node(n);
                    libmesh_assert(node);
                    dof_id_type node_id = node->id();
                    if (!node_id_map.count(node_id))
                      {
                        node_id_map[node_id] = next_node_id;
                        next_node_id += this->n_processors() + 1;
                      }
                  }
              }
          }
    }

  // FIXME: ought to renumber side/node_id_map image to be contiguous
  // to save memory, also ought to reserve memory

  // Let's add all the nodes to the boundary mesh

  MeshBase::const_node_iterator n_end  = _mesh.nodes_end();

  for(MeshBase::const_node_iterator n_it = _mesh.nodes_begin();
      n_it != n_end; ++n_it)
    {
      const Node* node = *n_it;
      dof_id_type node_id = node->id();
      if (node_id_map.count(node_id))
        boundary_mesh.add_point(*node, node_id_map[node_id], node->processor_id());
    }


  // Finally let's add the elements


  for (MeshBase::const_element_iterator el = _mesh.elements_begin();
       el != end_el; ++el)
    {
      const Elem* elem = *el;

      for (unsigned int s=0; s<elem->n_sides(); s++)
        if (elem->neighbor(s) == NULL) // on the boundary
          {
            // Get the top-level parent for this element
            const Elem* top_parent = elem->top_parent();

            // A convenient typedef
            typedef
              std::multimap<const Elem*, std::pair<unsigned short int, boundary_id_type> >::
              const_iterator Iter;

            // Find the right id number for that side
            std::pair<Iter, Iter> pos = _boundary_side_id.equal_range(top_parent);

            bool add_this_side = false;
            boundary_id_type this_bcid = invalid_id;

            for (; pos.first != pos.second; ++pos.first)
              {
                this_bcid = pos.first->second.second;

                // if this side is flagged with a boundary condition
                // and the user wants this id
                if ((pos.first->second.first == s) &&
                    (requested_boundary_ids.count(this_bcid)))
                  {
                    add_this_side = true;
                    break;
                  }
              }

            // if side s wasn't found or doesn't have a boundary
            // condition we may still want to add it
            if (pos.first == pos.second)
              {
                this_bcid = invalid_id;
                if (requested_boundary_ids.count(this_bcid))
                  add_this_side = true;
              }

            if (add_this_side)
              {
                // Build the side - do not use a "proxy" element here:
                // This will be going into the boundary_mesh and needs to
                // stand on its own.
                UniquePtr<Elem> side (elem->build_side(s, false));

                side->processor_id() = elem->processor_id();

                const std::pair<dof_id_type, unsigned char> side_pair(elem->id(), s);

                libmesh_assert(side_id_map.count(side_pair));

                side->set_id(side_id_map[side_pair]);

                // Add the side
                Elem* new_elem = boundary_mesh.add_elem(side.release());

                // This side's Node pointers still point to the nodes of the original mesh.
                // We need to re-point them to the boundary mesh's nodes!  Since we copied *ALL* of
                // the original mesh's nodes over, we should be guaranteed to have the same ordering.
                for (unsigned int nn=0; nn<new_elem->n_nodes(); ++nn)
                  {
                    // Get the correct node pointer, based on the id()
                    Node* new_node = boundary_mesh.node_ptr(node_id_map[new_elem->node(nn)]);

                    // sanity check: be sure that the new Node exists
                    // and its global id really matches
                    libmesh_assert (new_node);
                    libmesh_assert_equal_to (new_node->id(), node_id_map[new_elem->node(nn)]);

                    // Assign the new node pointer
                    new_elem->set_node(nn) = new_node;
                  }

#ifdef LIBMESH_ENABLE_AMR
                // Finally, set the parent and interior_parent links
                if (elem->parent())
                  {
                    const std::pair<dof_id_type, unsigned char> parent_side_pair(elem->parent()->id(), s);

                    libmesh_assert(side_id_map.count(parent_side_pair));

                    Elem* side_parent = boundary_mesh.elem(side_id_map[parent_side_pair]);

                    libmesh_assert(side_parent);

                    new_elem->set_parent(side_parent);

                    side_parent->set_refinement_flag(Elem::INACTIVE);

                    // Figuring out which child we are of our parent
                    // is a trick.  Due to libMesh child numbering
                    // conventions, if we are an element on a vertex,
                    // then we share that vertex with our parent, with
                    // the same local index.
                    bool found_child = false;
                    for (unsigned int v=0; v != new_elem->n_vertices(); ++v)
                      if (new_elem->get_node(v) == side_parent->get_node(v))
                        {
                          side_parent->add_child(new_elem, v);
                          found_child = true;
                        }

                    // If we don't share any vertex with our parent,
                    // then we're the fourth child (index 3) of a
                    // triangle.
                    if (!found_child)
                      {
                        libmesh_assert_equal_to (new_elem->n_vertices(), 3);
                        side_parent->add_child(new_elem, 3);
                      }
                  }
#endif

                new_elem->set_interior_parent (const_cast<Elem*>(elem));
              }
          }
    }

  // When desired, copy the MeshData
  // to the boundary_mesh
  if ((boundary_mesh_data != NULL) && (this_mesh_data != NULL))
    boundary_mesh_data->assign(*this_mesh_data);

  // Don't repartition this mesh; we want it to stay in sync with the
  // interior partitioning.
  boundary_mesh.partitioner().reset(NULL);

  // Make boundary_mesh nodes and elements contiguous
  boundary_mesh.prepare_for_use(/*skip_renumber =*/ false);

  // and finally distribute element partitioning to the nodes
  Partitioner::set_node_processor_ids(boundary_mesh);

  STOP_LOG("sync()", "BoundaryInfo");
}

Friends And Related Function Documentation

friend class MeshBase [friend]

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

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

A collection of user-specified boundary ids for sides, edges and nodes. See _side_boundary_ids, _edge_boundary_ids and _node_boundary_ids for sets containing IDs for only sides and only nodes, respectively.

Definition at line 535 of file boundary_info.h.

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

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 and _node_boundary_ids.

Definition at line 549 of file boundary_info.h.

Referenced by add_edge(), and get_edge_boundary_ids().

Set of user-specified boundary IDs for nodes *only*. Note: _boundary_ids is the union of this set, _edge_boundary_ids and _side_boundary_ids.

Definition at line 555 of file boundary_info.h.

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

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

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

Set of user-specified boundary IDs for sides *only*. Note: _boundary_ids is the union of this set, _edge_boundary_ids and _node_boundary_ids.

Definition at line 541 of file boundary_info.h.

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

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

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


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