$extrastylesheet
libMesh::BoundaryMesh Class Reference

#include <boundary_mesh.h>

Inheritance diagram for libMesh::BoundaryMesh:

List of all members.

Public Types

typedef Predicates::multi_predicate Predicate

Public Member Functions

 BoundaryMesh (const Parallel::Communicator &comm_in, unsigned char dim=1)
 BoundaryMesh (unsigned char dim=1)
 ~BoundaryMesh ()
virtual UniquePtr< MeshBaseclone () const
virtual void clear ()
virtual void redistribute ()
virtual void update_post_partitioning ()
virtual bool is_serial () const
template<typename T >
void libmesh_assert_valid_parallel_object_ids (const mapvector< T *, dof_id_type > &) const
virtual void libmesh_assert_valid_parallel_ids () const
void libmesh_assert_valid_parallel_flags () const
template<typename T >
dof_id_type renumber_dof_objects (mapvector< T *, dof_id_type > &)
virtual void renumber_nodes_and_elements ()
virtual void allgather ()
virtual void delete_remote_elements ()
virtual void add_extra_ghost_elem (Elem *e)
virtual void clear_extra_ghost_elems ()
virtual dof_id_type n_nodes () const
virtual dof_id_type max_node_id () const
virtual void reserve_nodes (const dof_id_type)
virtual dof_id_type n_elem () const
virtual dof_id_type n_active_elem () const
virtual dof_id_type max_elem_id () const
virtual void reserve_elem (const dof_id_type)
virtual void update_parallel_id_counts ()
dof_id_type parallel_n_nodes () const
dof_id_type parallel_max_node_id () const
dof_id_type parallel_n_elem () const
dof_id_type parallel_max_elem_id () const
virtual const Pointpoint (const dof_id_type i) const
virtual const Nodenode (const dof_id_type i) const
virtual Nodenode (const dof_id_type i)
virtual const Nodenode_ptr (const dof_id_type i) const
virtual Nodenode_ptr (const dof_id_type i)
virtual const Nodequery_node_ptr (const dof_id_type i) const
virtual Nodequery_node_ptr (const dof_id_type i)
virtual const Elemelem (const dof_id_type i) const
virtual Elemelem (const dof_id_type i)
virtual const Elemquery_elem (const dof_id_type i) const
virtual Elemquery_elem (const dof_id_type i)
virtual Nodeadd_point (const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)
virtual Nodeadd_node (Node *n)
virtual Nodeinsert_node (Node *n)
virtual void delete_node (Node *n)
virtual void renumber_node (dof_id_type old_id, dof_id_type new_id)
virtual Elemadd_elem (Elem *e)
virtual Eleminsert_elem (Elem *e)
virtual void delete_elem (Elem *e)
virtual void renumber_elem (dof_id_type old_id, dof_id_type new_id)
virtual void fix_broken_node_and_element_numbering ()
element_iterator elements_begin ()
const_element_iterator elements_begin () const
element_iterator elements_end ()
const_element_iterator elements_end () const
element_iterator active_elements_begin ()
const_element_iterator active_elements_begin () const
element_iterator active_elements_end ()
const_element_iterator active_elements_end () const
element_iterator ancestor_elements_begin ()
const_element_iterator ancestor_elements_begin () const
element_iterator ancestor_elements_end ()
const_element_iterator ancestor_elements_end () const
element_iterator subactive_elements_begin ()
const_element_iterator subactive_elements_begin () const
element_iterator subactive_elements_end ()
const_element_iterator subactive_elements_end () const
element_iterator not_active_elements_begin ()
const_element_iterator not_active_elements_begin () const
element_iterator not_active_elements_end ()
const_element_iterator not_active_elements_end () const
element_iterator not_ancestor_elements_begin ()
const_element_iterator not_ancestor_elements_begin () const
element_iterator not_ancestor_elements_end ()
const_element_iterator not_ancestor_elements_end () const
element_iterator not_subactive_elements_begin ()
const_element_iterator not_subactive_elements_begin () const
element_iterator not_subactive_elements_end ()
const_element_iterator not_subactive_elements_end () const
element_iterator local_elements_begin ()
const_element_iterator local_elements_begin () const
element_iterator local_elements_end ()
const_element_iterator local_elements_end () const
element_iterator semilocal_elements_begin ()
const_element_iterator semilocal_elements_begin () const
element_iterator semilocal_elements_end ()
const_element_iterator semilocal_elements_end () const
element_iterator facelocal_elements_begin ()
const_element_iterator facelocal_elements_begin () const
element_iterator facelocal_elements_end ()
const_element_iterator facelocal_elements_end () const
element_iterator not_local_elements_begin ()
const_element_iterator not_local_elements_begin () const
element_iterator not_local_elements_end ()
const_element_iterator not_local_elements_end () const
element_iterator active_local_elements_begin ()
const_element_iterator active_local_elements_begin () const
element_iterator active_local_elements_end ()
const_element_iterator active_local_elements_end () const
element_iterator active_not_local_elements_begin ()
const_element_iterator active_not_local_elements_begin () const
element_iterator active_not_local_elements_end ()
const_element_iterator active_not_local_elements_end () const
element_iterator level_elements_begin (const unsigned int level)
const_element_iterator level_elements_begin (const unsigned int level) const
element_iterator level_elements_end (const unsigned int level)
const_element_iterator level_elements_end (const unsigned int level) const
element_iterator not_level_elements_begin (const unsigned int level)
const_element_iterator not_level_elements_begin (const unsigned int level) const
element_iterator not_level_elements_end (const unsigned int level)
const_element_iterator not_level_elements_end (const unsigned int level) const
element_iterator local_level_elements_begin (const unsigned int level)
const_element_iterator local_level_elements_begin (const unsigned int level) const
element_iterator local_level_elements_end (const unsigned int level)
const_element_iterator local_level_elements_end (const unsigned int level) const
element_iterator local_not_level_elements_begin (const unsigned int level)
const_element_iterator local_not_level_elements_begin (const unsigned int level) const
element_iterator local_not_level_elements_end (const unsigned int level)
const_element_iterator local_not_level_elements_end (const unsigned int level) const
element_iterator pid_elements_begin (const processor_id_type proc_id)
const_element_iterator pid_elements_begin (const processor_id_type proc_id) const
element_iterator pid_elements_end (const processor_id_type proc_id)
const_element_iterator pid_elements_end (const processor_id_type proc_id) const
element_iterator type_elements_begin (const ElemType type)
const_element_iterator type_elements_begin (const ElemType type) const
element_iterator type_elements_end (const ElemType type)
const_element_iterator type_elements_end (const ElemType type) const
element_iterator active_type_elements_begin (const ElemType type)
const_element_iterator active_type_elements_begin (const ElemType type) const
element_iterator active_type_elements_end (const ElemType type)
const_element_iterator active_type_elements_end (const ElemType type) const
element_iterator active_pid_elements_begin (const processor_id_type proc_id)
const_element_iterator active_pid_elements_begin (const processor_id_type proc_id) const
element_iterator active_pid_elements_end (const processor_id_type proc_id)
const_element_iterator active_pid_elements_end (const processor_id_type proc_id) const
element_iterator unpartitioned_elements_begin ()
const_element_iterator unpartitioned_elements_begin () const
element_iterator unpartitioned_elements_end ()
const_element_iterator unpartitioned_elements_end () const
element_iterator active_local_subdomain_elements_begin (const subdomain_id_type subdomain_id)
const_element_iterator active_local_subdomain_elements_begin (const subdomain_id_type subdomain_id) const
element_iterator active_local_subdomain_elements_end (const subdomain_id_type subdomain_id)
const_element_iterator active_local_subdomain_elements_end (const subdomain_id_type subdomain_id) const
element_iterator active_subdomain_elements_begin (const subdomain_id_type subdomain_id)
const_element_iterator active_subdomain_elements_begin (const subdomain_id_type subdomain_id) const
element_iterator active_subdomain_elements_end (const subdomain_id_type subdomain_id)
const_element_iterator active_subdomain_elements_end (const subdomain_id_type subdomain_id) const
node_iterator nodes_begin ()
const_node_iterator nodes_begin () const
node_iterator nodes_end ()
const_node_iterator nodes_end () const
node_iterator active_nodes_begin ()
const_node_iterator active_nodes_begin () const
node_iterator active_nodes_end ()
const_node_iterator active_nodes_end () const
node_iterator local_nodes_begin ()
const_node_iterator local_nodes_begin () const
node_iterator local_nodes_end ()
const_node_iterator local_nodes_end () const
node_iterator pid_nodes_begin (const processor_id_type proc_id)
const_node_iterator pid_nodes_begin (const processor_id_type proc_id) const
node_iterator pid_nodes_end (const processor_id_type proc_id)
const_node_iterator pid_nodes_end (const processor_id_type proc_id) const
void read (const std::string &name, MeshData *mesh_data=NULL, bool skip_renumber_nodes_and_elements=false)
void write (const std::string &name, MeshData *mesh_data=NULL)
void write (const std::string &name, const std::vector< Number > &values, const std::vector< std::string > &variable_names)
virtual void all_first_order ()
virtual void all_second_order (const bool full_ordered=true)
void create_pid_mesh (UnstructuredMesh &pid_mesh, const processor_id_type pid) const
void create_submesh (UnstructuredMesh &new_mesh, const_element_iterator &it, const const_element_iterator &it_end) const
virtual void copy_nodes_and_elements (const UnstructuredMesh &other_mesh, const bool skip_find_neighbors=false)
virtual void find_neighbors (const bool reset_remote_elements=false, const bool reset_current_list=true)
virtual bool contract ()
virtual UniquePtr< Partitioner > & partitioner ()
const BoundaryInfoget_boundary_info () const
BoundaryInfoget_boundary_info ()
bool is_prepared () const
unsigned int mesh_dimension () const
void set_mesh_dimension (unsigned char d)
const std::set< unsigned char > & elem_dimensions () const
unsigned int spatial_dimension () const
dof_id_type n_nodes_on_proc (const processor_id_type proc) const
dof_id_type n_local_nodes () const
dof_id_type n_unpartitioned_nodes () const
unique_id_type next_unique_id ()
void set_next_unique_id (unique_id_type id)
dof_id_type n_elem_on_proc (const processor_id_type proc) const
dof_id_type n_local_elem () const
dof_id_type n_unpartitioned_elem () const
dof_id_type n_active_elem_on_proc (const processor_id_type proc) const
dof_id_type n_active_local_elem () const
dof_id_type n_sub_elem () const
dof_id_type n_active_sub_elem () const
void prepare_for_use (const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false)
virtual void partition (const unsigned int n_parts)
void partition ()
void allow_renumbering (bool allow)
bool allow_renumbering () const
void skip_partitioning (bool skip)
bool skip_partitioning () const
void subdomain_ids (std::set< subdomain_id_type > &ids) const
subdomain_id_type n_subdomains () const
unsigned int n_partitions () const
std::string get_info () const
void print_info (std::ostream &os=libMesh::out) const
unsigned int recalculate_n_partitions ()
const PointLocatorBasepoint_locator () const
UniquePtr< PointLocatorBasesub_point_locator () const
void clear_point_locator ()
std::string & subdomain_name (subdomain_id_type id)
const std::string & subdomain_name (subdomain_id_type id) const
subdomain_id_type get_id_by_name (const std::string &name) const
std::map< subdomain_id_type,
std::string > & 
set_subdomain_name_map ()
const std::map
< subdomain_id_type,
std::string > & 
get_subdomain_name_map () const
void cache_elem_dims ()
const Parallel::Communicatorcomm () const
processor_id_type n_processors () const
processor_id_type processor_id () const

Public Attributes

UniquePtr< BoundaryInfoboundary_info

Protected Member Functions

virtual void assign_unique_ids ()
unsigned int & set_n_partitions ()

Protected Attributes

mapvector< Node *, dof_id_type_nodes
mapvector< Elem *, dof_id_type_elements
bool _is_serial
dof_id_type _n_nodes
dof_id_type _n_elem
dof_id_type _max_node_id
dof_id_type _max_elem_id
dof_id_type _next_free_local_node_id
dof_id_type _next_free_local_elem_id
dof_id_type _next_free_unpartitioned_node_id
dof_id_type _next_free_unpartitioned_elem_id
std::set< Elem * > _extra_ghost_elems
unsigned int _n_parts
bool _is_prepared
UniquePtr< PointLocatorBase_point_locator
UniquePtr< Partitioner_partitioner
unique_id_type _next_unique_id
bool _skip_partitioning
bool _skip_renumber_nodes_and_elements
std::map< subdomain_id_type,
std::string > 
_block_id_to_name
std::set< unsigned char > _elem_dims
const Parallel::Communicator_communicator

Friends

class Partitioner
class MeshInput< MeshBase >
class BoundaryInfo
std::ostream & operator<< (std::ostream &os, const MeshBase &m)

Detailed Description

The BoundaryMesh is a Mesh in its own right, but it contains a description of the boundary of some other mesh. This is useful for writing the boundary of a domain for inspecting boundary conditions and other things.

Definition at line 42 of file boundary_mesh.h.


Member Typedef Documentation

We need an empty, generic class to act as a predicate for this and derived mesh classes.

Definition at line 647 of file mesh_base.h.


Constructor & Destructor Documentation

libMesh::BoundaryMesh::BoundaryMesh ( const Parallel::Communicator comm_in,
unsigned char  dim = 1 
) [explicit]

Constructor. Initializes dimenstion and processor id.

Definition at line 32 of file boundary_mesh.C.

                                            :
  Mesh(comm_in,d)
{
}
libMesh::BoundaryMesh::BoundaryMesh ( unsigned char  dim = 1) [explicit]

Deprecated constructor. Takes dim, the dimension of the mesh. The mesh dimension can be changed (and may automatically be changed by mesh generation/loading) later.

Definition at line 42 of file boundary_mesh.C.

                                          :
  Mesh(d)
{
}

Destructor.

Definition at line 50 of file boundary_mesh.C.

References libMesh::ParallelMesh::clear().

{
  this->clear();
}

Member Function Documentation

Implements libMesh::MeshBase.

Definition at line 47 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Active<elem_iterator_imp> p;
  return element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 292 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Active<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 534 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Active<elem_iterator_imp> p;
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 779 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Active<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 634 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

Referenced by libMesh::ParallelMesh::n_active_elem().

{
  Predicates::ActiveLocal<elem_iterator_imp> p(this->processor_id());
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 879 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::ActiveLocal<const_elem_iterator_imp> p(this->processor_id());
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 256 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::ActiveLocalSubdomain<elem_iterator_imp> p(this->processor_id(),subdomain_id);
  return element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 500 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::ActiveLocalSubdomain<const_elem_iterator_imp> p(this->processor_id(),subdomain_id);
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 743 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::ActiveLocalSubdomain<elem_iterator_imp> p(this->processor_id(),subdomain_id);
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 987 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::ActiveLocalSubdomain<const_elem_iterator_imp> p(this->processor_id(),subdomain_id);
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1021 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Active<node_iterator_imp> p;
  return node_iterator(_nodes.begin(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1061 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Active<const_node_iterator_imp> p;
  return const_node_iterator(_nodes.begin(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1101 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Active<node_iterator_imp> p;
  return node_iterator(_nodes.end(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1141 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Active<const_node_iterator_imp> p;
  return const_node_iterator(_nodes.end(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 644 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::ActiveNotLocal<elem_iterator_imp> p(this->processor_id());
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 889 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::ActiveNotLocal<const_elem_iterator_imp> p(this->processor_id());
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 237 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

Referenced by libMesh::ParallelMesh::n_active_elem().

{
  Predicates::ActivePID<elem_iterator_imp> p(proc_id);
  return element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 481 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::ActivePID<const_elem_iterator_imp> p(proc_id);
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 724 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

Referenced by libMesh::ParallelMesh::n_active_elem().

{
  Predicates::ActivePID<elem_iterator_imp> p(proc_id);
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 968 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::ActivePID<const_elem_iterator_imp> p(proc_id);
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 266 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::ActiveSubdomain<elem_iterator_imp> p(subdomain_id);
  return element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 510 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::ActiveSubdomain<const_elem_iterator_imp> p(subdomain_id);
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 753 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::ActiveSubdomain<elem_iterator_imp> p(subdomain_id);
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 997 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::ActiveSubdomain<const_elem_iterator_imp> p(subdomain_id);
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 227 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::ActiveType<elem_iterator_imp> p(type);
  return element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 471 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::ActiveType<const_elem_iterator_imp> p(type);
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 714 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::ActiveType<elem_iterator_imp> p(type);
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 958 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::ActiveType<const_elem_iterator_imp> p(type);
  return const_element_iterator(_elements.end(), _elements.end(), p);
}
Elem * libMesh::ParallelMesh::add_elem ( Elem e) [virtual, inherited]

Add elem e to the end of the element array. To add an element locally, set e->processor_id() before adding it. To ensure a specific element id, call e->set_id() before adding it; only do this in parallel if you are manually keeping ids consistent.

Implements libMesh::MeshBase.

Definition at line 359 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::ParallelMesh::_max_elem_id, libMesh::ParallelMesh::_n_elem, libMesh::ParallelMesh::_next_free_local_elem_id, libMesh::ParallelMesh::_next_free_unpartitioned_elem_id, libMesh::MeshBase::_next_unique_id, libMesh::DofObject::id(), libMesh::DofObject::invalid_processor_id, libMesh::ParallelMesh::is_serial(), libMesh::libmesh_assert(), std::max(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::DofObject::set_id(), libMesh::DofObject::set_unique_id(), libMesh::DofObject::valid_id(), and libMesh::DofObject::valid_unique_id().

Referenced by libMesh::ParallelMesh::add_extra_ghost_elem().

{
  // Don't try to add NULLs!
  libmesh_assert(e);

  // Trying to add an existing element is a no-op
  if (e->valid_id() && _elements[e->id()] == e)
    return e;

  const processor_id_type elem_procid = e->processor_id();

  if (!e->valid_id())
    {
      // We should only be creating new ids past the end of the range
      // of existing ids
      libmesh_assert_greater_equal(_next_free_unpartitioned_elem_id,
                                   _max_elem_id);
      libmesh_assert_greater_equal(_next_free_local_elem_id, _max_elem_id);

      // Use the unpartitioned ids for unpartitioned elems,
      // in serial, and temporarily for ghost elems
      dof_id_type *next_id = &_next_free_unpartitioned_elem_id;
      if (elem_procid == this->processor_id() &&
          !this->is_serial())
        next_id = &_next_free_local_elem_id;
      e->set_id (*next_id);
    }

  {
    // Advance next_ids up high enough that each is pointing to an
    // unused id and any subsequent increments will still point us
    // to unused ids
    _max_elem_id = std::max(_max_elem_id,
                            static_cast<dof_id_type>(e->id()+1));

    if (_next_free_unpartitioned_elem_id < _max_elem_id)
      _next_free_unpartitioned_elem_id =
        ((_max_elem_id-1) / (this->n_processors() + 1) + 1) *
        (this->n_processors() + 1) + this->n_processors();
    if (_next_free_local_elem_id < _max_elem_id)
      _next_free_local_elem_id =
        ((_max_elem_id + this->n_processors() - 1) / (this->n_processors() + 1) + 1) *
        (this->n_processors() + 1) + this->processor_id();

#ifndef NDEBUG
    // We need a const mapvector so we don't inadvertently create
    // NULL entries when testing for non-NULL ones
    const mapvector<Elem*,dof_id_type>& const_elements = _elements;
#endif
    libmesh_assert(!const_elements[_next_free_unpartitioned_elem_id]);
    libmesh_assert(!const_elements[_next_free_local_elem_id]);
  }

  // Don't try to overwrite existing elems
  libmesh_assert (!_elements[e->id()]);

  _elements[e->id()] = e;

  // Try to make the cached elem data more accurate
  if (elem_procid == this->processor_id() ||
      elem_procid == DofObject::invalid_processor_id)
    _n_elem++;

#ifdef LIBMESH_ENABLE_UNIQUE_ID
  if (!e->valid_unique_id() && processor_id() == e->processor_id())
    {
      e->set_unique_id() = _next_unique_id;
      _next_unique_id += this->n_processors();
    }
#endif

  // Unpartitioned elems should be added on every processor
  // And shouldn't be added in the same batch as ghost elems
  // But we might be just adding on processor 0 to
  // broadcast later
  // #ifdef DEBUG
  //   if (elem_procid == DofObject::invalid_processor_id)
  //     {
  //       dof_id_type elem_id = e->id();
  //       this->comm().max(elem_id);
  //       libmesh_assert_equal_to (elem_id, e->id());
  //     }
  // #endif

  return e;
}
void libMesh::ParallelMesh::add_extra_ghost_elem ( Elem e) [virtual, inherited]

Inserts the element _and_ adds it to a list of elements not to get deleted by delete_remote_elements. This is handy for inserting off-processor elements that you want to keep track of on this processor.

Definition at line 1296 of file parallel_mesh.C.

References libMesh::ParallelMesh::_extra_ghost_elems, and libMesh::ParallelMesh::add_elem().

{
  // First add the elem like normal
  add_elem(e);

  // Now add it to the set that won't be deleted when we call
  // delete_remote_elements()
  _extra_ghost_elems.insert(e);
}
Node * libMesh::ParallelMesh::add_node ( Node n) [virtual, inherited]

Add Node n to the end of the vertex array.

Implements libMesh::MeshBase.

Definition at line 533 of file parallel_mesh.C.

References libMesh::ParallelMesh::_max_node_id, libMesh::ParallelMesh::_n_nodes, libMesh::ParallelMesh::_next_free_local_node_id, libMesh::ParallelMesh::_next_free_unpartitioned_node_id, libMesh::MeshBase::_next_unique_id, libMesh::ParallelMesh::_nodes, libMesh::DofObject::id(), libMesh::DofObject::invalid_processor_id, libMesh::ParallelMesh::is_serial(), libMesh::libmesh_assert(), std::max(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::DofObject::set_id(), libMesh::DofObject::set_unique_id(), libMesh::DofObject::valid_id(), and libMesh::DofObject::valid_unique_id().

Referenced by libMesh::ParallelMesh::add_point(), and libMesh::ParallelMesh::insert_node().

{
  // Don't try to add NULLs!
  libmesh_assert(n);

  // Trying to add an existing node is a no-op
  if (n->valid_id() && _nodes[n->id()] == n)
    return n;

  const processor_id_type node_procid = n->processor_id();

  if (!n->valid_id())
    {
      // We should only be creating new ids past the end of the range
      // of existing ids
      libmesh_assert_greater_equal(_next_free_unpartitioned_node_id,
                                   _max_node_id);
      libmesh_assert_greater_equal(_next_free_local_node_id, _max_node_id);

      // Use the unpartitioned ids for unpartitioned nodes,
      // in serial, and temporarily for ghost nodes
      dof_id_type *next_id = &_next_free_unpartitioned_node_id;
      if (node_procid == this->processor_id() &&
          !this->is_serial())
        next_id = &_next_free_local_node_id;
      n->set_id (*next_id);
    }

  {
    // Advance next_ids up high enough that each is pointing to an
    // unused id and any subsequent increments will still point us
    // to unused ids
    _max_node_id = std::max(_max_node_id,
                            static_cast<dof_id_type>(n->id()+1));

    if (_next_free_unpartitioned_node_id < _max_node_id)
      _next_free_unpartitioned_node_id =
        ((_max_node_id-1) / (this->n_processors() + 1) + 1) *
        (this->n_processors() + 1) + this->n_processors();
    if (_next_free_local_node_id < _max_node_id)
      _next_free_local_node_id =
        ((_max_node_id + this->n_processors() - 1) / (this->n_processors() + 1) + 1) *
        (this->n_processors() + 1) + this->processor_id();

#ifndef NDEBUG
    // We need a const mapvector so we don't inadvertently create
    // NULL entries when testing for non-NULL ones
    const mapvector<Node*,dof_id_type>& const_nodes = _nodes;
#endif
    libmesh_assert(!const_nodes[_next_free_unpartitioned_node_id]);
    libmesh_assert(!const_nodes[_next_free_local_node_id]);
  }

  // Don't try to overwrite existing nodes
  libmesh_assert (!_nodes[n->id()]);

  _nodes[n->id()] = n;

  // Try to make the cached node data more accurate
  if (node_procid == this->processor_id() ||
      node_procid == DofObject::invalid_processor_id)
    _n_nodes++;

#ifdef LIBMESH_ENABLE_UNIQUE_ID
  if (!n->valid_unique_id() && processor_id() == n->processor_id())
    {
      n->set_unique_id() = _next_unique_id;
      _next_unique_id += this->n_processors();
    }
#endif


  // Unpartitioned nodes should be added on every processor
  // And shouldn't be added in the same batch as ghost nodes
  // But we might be just adding on processor 0 to
  // broadcast later
  // #ifdef DEBUG
  //   if (node_procid == DofObject::invalid_processor_id)
  //     {
  //       dof_id_type node_id = n->id();
  //       this->comm().max(node_id);
  //       libmesh_assert_equal_to (node_id, n->id());
  //     }
  // #endif

  return n;
}
Node * libMesh::ParallelMesh::add_point ( const Point p,
const dof_id_type  id = DofObject::invalid_id,
const processor_id_type  proc_id = DofObject::invalid_processor_id 
) [virtual, inherited]

functions for adding /deleting nodes elements.

Implements libMesh::MeshBase.

Definition at line 509 of file parallel_mesh.C.

References libMesh::ParallelMesh::_nodes, libMesh::ParallelMesh::add_node(), libMesh::Node::build(), libMesh::DofObject::id(), libMesh::libmesh_assert(), and libMesh::DofObject::processor_id().

{
  if (_nodes.count(id))
    {
      Node *n = _nodes[id];
      libmesh_assert (n);
      libmesh_assert_equal_to (n->id(), id);

      *n = p;
      n->processor_id() = proc_id;

      return n;
    }

  Node* n = Node::build(p, id).release();
  n->processor_id() = proc_id;

  return ParallelMesh::add_node(n);
}
void libMesh::UnstructuredMesh::all_first_order ( ) [virtual, inherited]

Converts a mesh with higher-order elements into a mesh with linear elements. For example, a mesh consisting of Tet10 will be converted to a mesh with Tet4 etc.

Prepare to identify (and then delete) a bunch of no-longer-used nodes.

Loop over the high-ordered elements. First make sure they _are_ indeed high-order, and then replace them with an equivalent first-order element.

If the second order element had any boundary conditions they should be transfered to the first-order element. The old boundary conditions will be removed from the BoundaryInfo data structure by insert_elem.

Implements libMesh::MeshBase.

Definition at line 293 of file mesh_modification.C.

References libMesh::MeshBase::_is_prepared, libMesh::Elem::add_child(), libMesh::BoundaryInfo::add_side(), libMesh::Elem::build(), libMesh::Elem::child(), libMesh::MeshBase::delete_node(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::Elem::first_order_equivalent_type(), libMesh::MeshBase::get_boundary_info(), libMesh::Elem::get_node(), libMesh::Elem::has_children(), libMesh::DofObject::id(), libMesh::MeshBase::insert_elem(), libMesh::libmesh_assert(), libMesh::MeshBase::max_node_id(), libMesh::Elem::n_children(), libMesh::Elem::n_sides(), libMesh::Elem::n_vertices(), libMesh::Elem::neighbor(), libMesh::Elem::node(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), libMesh::Elem::p_level(), libMesh::Elem::p_refinement_flag(), libMesh::Elem::parent(), libMesh::MeshBase::prepare_for_use(), libMesh::DofObject::processor_id(), libMesh::BoundaryInfo::raw_boundary_ids(), libMesh::Elem::refinement_flag(), libMesh::remote_elem, libMesh::MeshBase::renumber_nodes_and_elements(), libMesh::Elem::replace_child(), libMesh::DofObject::set_id(), libMesh::Elem::set_neighbor(), libMesh::Elem::set_node(), libMesh::Partitioner::set_node_processor_ids(), libMesh::Elem::set_p_level(), libMesh::Elem::set_p_refinement_flag(), libMesh::Elem::set_parent(), libMesh::Elem::set_refinement_flag(), libMesh::START_LOG(), libMesh::Elem::subdomain_id(), libMesh::Elem::type(), and libMesh::Elem::which_child_am_i().

{
  /*
   * when the mesh is not prepared,
   * at least renumber the nodes and
   * elements, so that the node ids
   * are correct
   */
  if (!this->_is_prepared)
    this->renumber_nodes_and_elements ();

  START_LOG("all_first_order()", "Mesh");

  std::vector<bool> node_touched_by_me(this->max_node_id(), false);

  element_iterator endit = elements_end();
  for (element_iterator it = elements_begin();
       it != endit; ++it)
    {
      Elem* so_elem = *it;

      libmesh_assert(so_elem);

      /*
       * build the first-order equivalent, add to
       * the new_elements list.
       */
      Elem* lo_elem = Elem::build
        (Elem::first_order_equivalent_type
         (so_elem->type()), so_elem->parent()).release();

      for (unsigned int s=0; s != so_elem->n_sides(); ++s)
        if (so_elem->neighbor(s) == remote_elem)
          lo_elem->set_neighbor(s, const_cast<RemoteElem*>(remote_elem));

#ifdef LIBMESH_ENABLE_AMR
      /*
       * Reset the parent links of any child elements
       */
      if (so_elem->has_children())
        for (unsigned int c=0; c != so_elem->n_children(); ++c)
          {
            so_elem->child(c)->set_parent(lo_elem);
            lo_elem->add_child(so_elem->child(c), c);
          }

      /*
       * Reset the child link of any parent element
       */
      if (so_elem->parent())
        {
          unsigned int c =
            so_elem->parent()->which_child_am_i(so_elem);
          lo_elem->parent()->replace_child(lo_elem, c);
        }

      /*
       * Copy as much data to the new element as makes sense
       */
      lo_elem->set_p_level(so_elem->p_level());
      lo_elem->set_refinement_flag(so_elem->refinement_flag());
      lo_elem->set_p_refinement_flag(so_elem->p_refinement_flag());
#endif

      libmesh_assert_equal_to (lo_elem->n_vertices(), so_elem->n_vertices());

      /*
       * By definition the vertices of the linear and
       * second order element are identically numbered.
       * transfer these.
       */
      for (unsigned int v=0; v < so_elem->n_vertices(); v++)
        {
          lo_elem->set_node(v) = so_elem->get_node(v);
          node_touched_by_me[lo_elem->node(v)] = true;
        }

      libmesh_assert_equal_to (lo_elem->n_sides(), so_elem->n_sides());

      for (unsigned short s=0; s<so_elem->n_sides(); s++)
        {
          const std::vector<boundary_id_type> boundary_ids =
            this->get_boundary_info().raw_boundary_ids (so_elem, s);

          this->get_boundary_info().add_side (lo_elem, s, boundary_ids);
        }

      /*
       * The new first-order element is ready.
       * Inserting it into the mesh will replace and delete
       * the second-order element.
       */
      lo_elem->set_id(so_elem->id());
      lo_elem->processor_id() = so_elem->processor_id();
      lo_elem->subdomain_id() = so_elem->subdomain_id();
      this->insert_elem(lo_elem);
    }

  const MeshBase::node_iterator nd_end = this->nodes_end();
  MeshBase::node_iterator nd = this->nodes_begin();
  while (nd != nd_end)
    {
      Node *the_node = *nd;
      ++nd;
      if (!node_touched_by_me[the_node->id()])
        this->delete_node(the_node);
    }

  STOP_LOG("all_first_order()", "Mesh");

  // On hanging nodes that used to also be second order nodes, we
  // might now have an invalid nodal processor_id()
  Partitioner::set_node_processor_ids(*this);

  // delete or renumber nodes, etc
  this->prepare_for_use(/*skip_renumber =*/ false);
}
void libMesh::UnstructuredMesh::all_second_order ( const bool  full_ordered = true) [virtual, inherited]

Converts a (conforming, non-refined) mesh with linear elements into a mesh with second-order elements. For example, a mesh consisting of Tet4 will be converted to a mesh with Tet10 etc. Note that for some elements like Hex8 there exist two higher order equivalents, Hex20 and Hex27. When full_ordered is true (default), then Hex27 is built. Otherwise, Hex20 is built. The same holds obviously for Quad4, Prism6 ...

Loop over the low-ordered elements in the _elements vector. First make sure they _are_ indeed low-order, and then replace them with an equivalent second-order element. Don't forget to delete the low-order element, or else it will leak!

If the linear element had any boundary conditions they should be transfered to the second-order element. The old boundary conditions will be removed from the BoundaryInfo data structure by insert_elem.

Also, prepare_for_use() will reconstruct most of our neighbor links, but if we have any remote_elem links in a distributed mesh, they need to be preserved. We do that in the same loop here.

Implements libMesh::MeshBase.

Definition at line 427 of file mesh_modification.C.

References libMesh::MeshBase::_is_prepared, libMesh::MeshBase::add_point(), libMesh::BoundaryInfo::add_side(), libMesh::Elem::build(), libMesh::ParallelObject::comm(), libMesh::Elem::default_order(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::FIRST, libMesh::MeshBase::get_boundary_info(), libMesh::Elem::get_node(), libMesh::DofObject::id(), libMesh::MeshBase::insert_elem(), libMesh::DofObject::invalid_id, libMesh::MeshBase::is_serial(), libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::Parallel::Communicator::max(), libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::Elem::n_sides(), libMesh::Elem::n_vertices(), libMesh::Elem::neighbor(), libMesh::MeshBase::node(), libMesh::MeshBase::point(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::BoundaryInfo::raw_boundary_ids(), libMesh::Real, libMesh::remote_elem, libMesh::MeshBase::renumber_nodes_and_elements(), libMesh::MeshBase::reserve_nodes(), libMesh::Elem::second_order_equivalent_type(), libMesh::START_LOG(), libMesh::Elem::subdomain_id(), and libMesh::Elem::type().

Referenced by libMesh::MeshTools::Generation::build_cube().

{
  // This function must be run on all processors at once
  parallel_object_only();

  /*
   * when the mesh is not prepared,
   * at least renumber the nodes and
   * elements, so that the node ids
   * are correct
   */
  if (!this->_is_prepared)
    this->renumber_nodes_and_elements ();

  /*
   * If the mesh is empty
   * then we have nothing to do
   */
  if (!this->n_elem())
    return;

  /*
   * If the mesh is already second order
   * then we have nothing to do.
   * We have to test for this in a round-about way to avoid
   * a bug on distributed parallel meshes with more processors
   * than elements.
   */
  bool already_second_order = false;
  if (this->elements_begin() != this->elements_end() &&
      (*(this->elements_begin()))->default_order() != FIRST)
    already_second_order = true;
  this->comm().max(already_second_order);
  if (already_second_order)
    return;

  START_LOG("all_second_order()", "Mesh");

  /*
   * this map helps in identifying second order
   * nodes.  Namely, a second-order node:
   * - edge node
   * - face node
   * - bubble node
   * is uniquely defined through a set of adjacent
   * vertices.  This set of adjacent vertices is
   * used to identify already added higher-order
   * nodes.  We are safe to use node id's since we
   * make sure that these are correctly numbered.
   */
  std::map<std::vector<dof_id_type>, Node*> adj_vertices_to_so_nodes;

  /*
   * for speed-up of the \p add_point() method, we
   * can reserve memory.  Guess the number of additional
   * nodes for different dimensions
   */
  switch (this->mesh_dimension())
    {
    case 1:
      /*
       * in 1D, there can only be order-increase from Edge2
       * to Edge3.  Something like 1/2 of n_nodes() have
       * to be added
       */
      this->reserve_nodes(static_cast<unsigned int>
                          (1.5*static_cast<double>(this->n_nodes())));
      break;

    case 2:
      /*
       * in 2D, either refine from Tri3 to Tri6 (double the nodes)
       * or from Quad4 to Quad8 (again, double) or Quad9 (2.25 that much)
       */
      this->reserve_nodes(static_cast<unsigned int>
                          (2*static_cast<double>(this->n_nodes())));
      break;


    case 3:
      /*
       * in 3D, either refine from Tet4 to Tet10 (factor = 2.5) up to
       * Hex8 to Hex27 (something  > 3).  Since in 3D there _are_ already
       * quite some nodes, and since we do not want to overburden the memory by
       * a too conservative guess, use the lower bound
       */
      this->reserve_nodes(static_cast<unsigned int>
                          (2.5*static_cast<double>(this->n_nodes())));
      break;

    default:
      // Hm?
      libmesh_error_msg("Unknown mesh dimension " << this->mesh_dimension());
    }



  /*
   * form a vector that will hold the node id's of
   * the vertices that are adjacent to the son-th
   * second-order node.  Pull this outside of the
   * loop so that silly compilers don't repeatedly
   * create and destroy the vector.
   */
  std::vector<dof_id_type> adjacent_vertices_ids;

  const_element_iterator endit = elements_end();
  for (const_element_iterator it = elements_begin();
       it != endit; ++it)
    {
      // the linear-order element
      const Elem* lo_elem = *it;

      libmesh_assert(lo_elem);

      // make sure it is linear order
      if (lo_elem->default_order() != FIRST)
        libmesh_error_msg("ERROR: This is not a linear element: type=" << lo_elem->type());

      // this does _not_ work for refined elements
      libmesh_assert_equal_to (lo_elem->level (), 0);

      /*
       * build the second-order equivalent, add to
       * the new_elements list.  Note that this here
       * is the only point where \p full_ordered
       * is necessary.  The remaining code works well
       * for either type of seconrd-order equivalent, e.g.
       * Hex20 or Hex27, as equivalents for Hex8
       */
      Elem* so_elem =
        Elem::build (Elem::second_order_equivalent_type(lo_elem->type(),
                                                        full_ordered) ).release();

      libmesh_assert_equal_to (lo_elem->n_vertices(), so_elem->n_vertices());


      /*
       * By definition the vertices of the linear and
       * second order element are identically numbered.
       * transfer these.
       */
      for (unsigned int v=0; v < lo_elem->n_vertices(); v++)
        so_elem->set_node(v) = lo_elem->get_node(v);

      /*
       * Now handle the additional mid-side nodes.  This
       * is simply handled through a map that remembers
       * the already-added nodes.  This map maps the global
       * ids of the vertices (that uniquely define this
       * higher-order node) to the new node.
       * Notation: son = second-order node
       */
      const unsigned int son_begin = so_elem->n_vertices();
      const unsigned int son_end   = so_elem->n_nodes();


      for (unsigned int son=son_begin; son<son_end; son++)
        {
          const unsigned int n_adjacent_vertices =
            so_elem->n_second_order_adjacent_vertices(son);

          adjacent_vertices_ids.resize(n_adjacent_vertices);

          for (unsigned int v=0; v<n_adjacent_vertices; v++)
            adjacent_vertices_ids[v] =
              so_elem->node( so_elem->second_order_adjacent_vertex(son,v) );

          /*
           * \p adjacent_vertices_ids is now in order of the current
           * side.  sort it, so that comparisons  with the
           * \p adjacent_vertices_ids created through other elements'
           * sides can match
           */
          std::sort(adjacent_vertices_ids.begin(),
                    adjacent_vertices_ids.end());


          // does this set of vertices already has a mid-node added?
          std::pair<std::map<std::vector<dof_id_type>, Node*>::iterator,
            std::map<std::vector<dof_id_type>, Node*>::iterator>
            pos = adj_vertices_to_so_nodes.equal_range (adjacent_vertices_ids);

          // no, not added yet
          if (pos.first == pos.second)
            {
              /*
               * for this set of vertices, there is no
               * second_order node yet.  Add it.
               *
               * compute the location of the new node as
               * the average over the adjacent vertices.
               */
              Point new_location = this->point(adjacent_vertices_ids[0]);
              for (unsigned int v=1; v<n_adjacent_vertices; v++)
                new_location += this->point(adjacent_vertices_ids[v]);

              new_location /= static_cast<Real>(n_adjacent_vertices);

              /* Add the new point to the mesh, giving it a globally
               * well-defined processor id.
               */
              Node* so_node = this->add_point
                (new_location, DofObject::invalid_id,
                 this->node(adjacent_vertices_ids[0]).processor_id());

              /*
               * insert the new node with its defining vertex
               * set into the map, and relocate pos to this
               * new entry, so that the so_elem can use
               * \p pos for inserting the node
               */
              adj_vertices_to_so_nodes.insert(pos.first,
                                              std::make_pair(adjacent_vertices_ids,
                                                             so_node));

              so_elem->set_node(son) = so_node;
            }
          // yes, already added.
          else
            {
              libmesh_assert(pos.first->second);

              so_elem->set_node(son) = pos.first->second;
            }
        }


      libmesh_assert_equal_to (lo_elem->n_sides(), so_elem->n_sides());

      for (unsigned short s=0; s<lo_elem->n_sides(); s++)
        {
          const std::vector<boundary_id_type> boundary_ids =
            this->get_boundary_info().raw_boundary_ids (lo_elem, s);

          this->get_boundary_info().add_side (so_elem, s, boundary_ids);

          if (lo_elem->neighbor(s) == remote_elem)
            so_elem->set_neighbor(s, const_cast<RemoteElem*>(remote_elem));
        }

      /*
       * The new second-order element is ready.
       * Inserting it into the mesh will replace and delete
       * the first-order element.
       */
      so_elem->set_id(lo_elem->id());
      so_elem->processor_id() = lo_elem->processor_id();
      so_elem->subdomain_id() = lo_elem->subdomain_id();
      this->insert_elem(so_elem);
    }

  // we can clear the map
  adj_vertices_to_so_nodes.clear();


  STOP_LOG("all_second_order()", "Mesh");

  // In a ParallelMesh our ghost node processor ids may be bad and
  // the ids of nodes touching remote elements may be inconsistent.
  // Fix them.
  if (!this->is_serial())
    MeshCommunication().make_nodes_parallel_consistent (*this);

  // renumber nodes, elements etc
  this->prepare_for_use(/*skip_renumber =*/ false);
}
void libMesh::ParallelMesh::allgather ( ) [virtual, inherited]

Gathers all elements and nodes of the mesh onto every processor

Reimplemented from libMesh::MeshBase.

Definition at line 1307 of file parallel_mesh.C.

References libMesh::ParallelMesh::_is_serial, libMesh::MeshCommunication::allgather(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_flags(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_ids(), libMesh::ParallelMesh::max_elem_id(), libMesh::ParallelMesh::max_node_id(), libMesh::ParallelMesh::n_elem(), libMesh::ParallelMesh::n_nodes(), libMesh::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::parallel_max_node_id(), libMesh::ParallelMesh::parallel_n_elem(), and libMesh::ParallelMesh::parallel_n_nodes().

{
  if (_is_serial)
    return;
  _is_serial = true;
  MeshCommunication().allgather(*this);

  // Make sure our caches are up to date and our
  // DofObjects are well packed
#ifdef DEBUG
  libmesh_assert_equal_to (this->n_nodes(), this->parallel_n_nodes());
  libmesh_assert_equal_to (this->n_elem(), this->parallel_n_elem());
  const dof_id_type pmax_node_id = this->parallel_max_node_id();
  const dof_id_type pmax_elem_id = this->parallel_max_elem_id();
  libmesh_assert_equal_to (this->max_node_id(), pmax_node_id);
  libmesh_assert_equal_to (this->max_elem_id(), pmax_elem_id);

  // If we've disabled renumbering we can't be sure we're contiguous
  // libmesh_assert_equal_to (this->n_nodes(), this->max_node_id());
  // libmesh_assert_equal_to (this->n_elem(), this->max_elem_id());

  // Make sure our neighbor links are all fine
  MeshTools::libmesh_assert_valid_neighbors(*this);

  // Make sure our ids and flags are consistent
  this->libmesh_assert_valid_parallel_ids();
  this->libmesh_assert_valid_parallel_flags();
#endif
}
void libMesh::MeshBase::allow_renumbering ( bool  allow) [inline, inherited]

If false is passed in then this mesh will no longer be renumbered when being prepared for use. This may slightly adversely affect performance during subsequent element access, particulary when using a distributed mesh.

Definition at line 551 of file mesh_base.h.

References libMesh::MeshBase::_skip_renumber_nodes_and_elements.

Referenced by libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ErrorVector::plot_error(), and libMesh::NameBasedIO::read().

Implements libMesh::MeshBase.

Definition at line 67 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Ancestor<elem_iterator_imp> p;
  return element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 311 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Ancestor<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 554 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Ancestor<elem_iterator_imp> p;
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 799 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Ancestor<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.end(), _elements.end(), p);
}
void libMesh::ParallelMesh::assign_unique_ids ( ) [protected, virtual, inherited]

Assign globally unique IDs to all DOF objects (Elements and Nodes) if the library has been configured with unique_id support.

Implements libMesh::MeshBase.

Definition at line 1338 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::MeshBase::_next_unique_id, libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::begin(), libMesh::mapvector< Val, index_t >::end(), end, libMesh::ParallelObject::n_processors(), and libMesh::ParallelObject::processor_id().

{
  {
    elem_iterator_imp        it = _elements.begin();
    const elem_iterator_imp end = _elements.end();

    for (; it != end; ++it)
      if ((*it) && ! (*it)->valid_unique_id() && processor_id() == (*it)->processor_id())
        {
          (*it)->set_unique_id() = _next_unique_id;
          _next_unique_id += this->n_processors();
        }
  }

  {
    node_iterator_imp it  = _nodes.begin();
    node_iterator_imp end = _nodes.end();

    for (; it != end; ++it)
      if ((*it) && ! (*it)->valid_unique_id() && processor_id() == (*it)->processor_id())
        {
          (*it)->set_unique_id() = _next_unique_id;
          _next_unique_id += this->n_processors();
        }
  }
}
void libMesh::MeshBase::cache_elem_dims ( ) [inherited]

Search the mesh and cache the different dimenions of the elements present in the mesh. This is done in prepare_for_use(), but can be done manually by other classes after major mesh modifications.

Definition at line 497 of file mesh_base.C.

References libMesh::MeshBase::_elem_dims, libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), libMesh::ParallelObject::comm(), end, and libMesh::Parallel::Communicator::set_union().

Referenced by libMesh::MeshBase::prepare_for_use().

{
  // This requires an inspection on every processor
  parallel_object_only();

  const_element_iterator el  = this->active_local_elements_begin();
  const_element_iterator end = this->active_local_elements_end();

  for (; el!=end; ++el)
    _elem_dims.insert((*el)->dim());

  // Some different dimension elements may only live on other processors
  this->comm().set_union(_elem_dims);
}
void libMesh::ParallelMesh::clear ( ) [virtual, inherited]

Clear all internal data.

Reimplemented from libMesh::MeshBase.

Definition at line 674 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::ParallelMesh::_is_serial, libMesh::ParallelMesh::_max_elem_id, libMesh::ParallelMesh::_max_node_id, libMesh::ParallelMesh::_n_elem, libMesh::ParallelMesh::_n_nodes, libMesh::ParallelMesh::_next_free_local_elem_id, libMesh::ParallelMesh::_next_free_local_node_id, libMesh::ParallelMesh::_next_free_unpartitioned_elem_id, libMesh::ParallelMesh::_next_free_unpartitioned_node_id, libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::begin(), libMesh::mapvector< Val, index_t >::end(), end, libMesh::ParallelObject::n_processors(), and libMesh::ParallelObject::processor_id().

Referenced by libMesh::DivaIO::write_stream(), ~BoundaryMesh(), and libMesh::ParallelMesh::~ParallelMesh().

{
  // Call parent clear function
  MeshBase::clear();


  // Clear our elements and nodes
  {
    elem_iterator_imp        it = _elements.begin();
    const elem_iterator_imp end = _elements.end();

    // There is no need to remove the elements from
    // the BoundaryInfo data structure since we
    // already cleared it.
    for (; it != end; ++it)
      delete *it;

    _elements.clear();
  }

  // clear the nodes data structure
  {
    node_iterator_imp it  = _nodes.begin();
    node_iterator_imp end = _nodes.end();

    // There is no need to remove the nodes from
    // the BoundaryInfo data structure since we
    // already cleared it.
    for (; it != end; ++it)
      delete *it;

    _nodes.clear();
  }

  // We're no longer distributed if we were before
  _is_serial = true;

  // Correct our caches
  _n_nodes = 0;
  _n_elem = 0;
  _max_node_id = 0;
  _max_elem_id = 0;
  _next_free_local_node_id = this->processor_id();
  _next_free_local_elem_id = this->processor_id();
  _next_free_unpartitioned_node_id = this->n_processors();
  _next_free_unpartitioned_elem_id = this->n_processors();
}
virtual void libMesh::ParallelMesh::clear_extra_ghost_elems ( ) [inline, virtual, inherited]

Clears extra ghost elements.

Definition at line 179 of file parallel_mesh.h.

References libMesh::ParallelMesh::_extra_ghost_elems.

{ _extra_ghost_elems.clear(); }

Releases the current PointLocator object.

Definition at line 454 of file mesh_base.C.

References libMesh::MeshBase::_point_locator.

Referenced by libMesh::MeshBase::clear(), libMesh::UnstructuredMesh::contract(), and libMesh::MeshBase::prepare_for_use().

{
  _point_locator.reset(NULL);
}
virtual UniquePtr<MeshBase> libMesh::ParallelMesh::clone ( ) const [inline, virtual, inherited]

Virtual copy-constructor, creates a copy of this mesh

Implements libMesh::MeshBase.

Definition at line 88 of file parallel_mesh.h.

References libMesh::ParallelMesh::ParallelMesh().

  { return UniquePtr<MeshBase>(new ParallelMesh(*this)); }
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(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), libMesh::BoundaryInfo::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(), libMesh::BoundaryInfo::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; }
bool libMesh::UnstructuredMesh::contract ( ) [virtual, inherited]

Delete subactive (i.e. children of coarsened) elements. This removes all elements descended from currently active elements in the mesh.

Implements libMesh::MeshBase.

Definition at line 694 of file unstructured_mesh.C.

References libMesh::Elem::active(), libMesh::Elem::ancestor(), libMesh::MeshBase::clear_point_locator(), libMesh::Elem::contract(), libMesh::MeshBase::delete_elem(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), end, libMesh::libmesh_assert(), libMesh::Elem::parent(), libMesh::MeshBase::renumber_nodes_and_elements(), libMesh::START_LOG(), and libMesh::Elem::subactive().

{
  START_LOG ("contract()", "Mesh");

  // Flag indicating if this call actually changes the mesh
  bool mesh_changed = false;

  element_iterator in        = elements_begin();
  const element_iterator end = elements_end();

#ifdef DEBUG
  for ( ; in != end; ++in)
    if (*in != NULL)
      {
        Elem* el = *in;
        libmesh_assert(el->active() || el->subactive() || el->ancestor());
      }
  in = elements_begin();
#endif

  // Loop over the elements.
  for ( ; in != end; ++in)
    if (*in != NULL)
      {
        Elem* el = *in;

        // Delete all the subactive ones
        if (el->subactive())
          {
            // No level-0 element should be subactive.
            // Note that we CAN'T test elem->level(), as that
            // touches elem->parent()->dim(), and elem->parent()
            // might have already been deleted!
            libmesh_assert(el->parent());

            // Delete the element
            // This just sets a pointer to NULL, and doesn't
            // invalidate any iterators
            this->delete_elem(el);

            // the mesh has certainly changed
            mesh_changed = true;
          }
        else
          {
            // Compress all the active ones
            if (el->active())
              el->contract();
            else
              libmesh_assert (el->ancestor());
          }
      }

  // Strip any newly-created NULL voids out of the element array
  this->renumber_nodes_and_elements();

  // FIXME: Need to understand why deleting subactive children
  // invalidates the point locator.  For now we will clear it explicitly
  this->clear_point_locator();

  STOP_LOG ("contract()", "Mesh");

  return mesh_changed;
}
void libMesh::UnstructuredMesh::copy_nodes_and_elements ( const UnstructuredMesh other_mesh,
const bool  skip_find_neighbors = false 
) [virtual, inherited]

Deep copy of another unstructured mesh class (used by subclass copy constructors)

Definition at line 74 of file unstructured_mesh.C.

References libMesh::MeshBase::_elem_dims, libMesh::MeshBase::_is_prepared, libMesh::MeshBase::_n_parts, libMesh::Elem::add_child(), libMesh::MeshBase::allow_renumbering(), libMesh::Elem::build(), libMesh::Elem::child(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), end, equal(), libMesh::Elem::has_children(), libMesh::DofObject::id(), libMesh::libmesh_assert(), libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids(), libMesh::Elem::n_children(), libMesh::MeshBase::n_elem(), libMesh::Elem::n_neighbors(), libMesh::MeshBase::n_nodes(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor(), libMesh::Elem::node(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), libMesh::Elem::p_refinement_flag(), libMesh::Elem::parent(), libMesh::DofObject::processor_id(), libMesh::Elem::refinement_flag(), libMesh::remote_elem, libMesh::Elem::set_neighbor(), libMesh::MeshBase::skip_partitioning(), libMesh::Elem::subdomain_id(), libMesh::Elem::type(), and libMesh::Elem::which_child_am_i().

Referenced by libMesh::ParallelMesh::ParallelMesh(), libMesh::SerialMesh::SerialMesh(), and libMesh::SerialMesh::stitching_helper().

{
  // We're assuming our subclass data needs no copy
  libmesh_assert_equal_to (_n_parts, other_mesh._n_parts);
  libmesh_assert (std::equal(_elem_dims.begin(), _elem_dims.end(), other_mesh._elem_dims.begin()));
  libmesh_assert_equal_to (_is_prepared, other_mesh._is_prepared);

  // We're assuming the other mesh has proper element number ordering,
  // so that we add parents before their children.
#ifdef DEBUG
  MeshTools::libmesh_assert_valid_amr_elem_ids(other_mesh);
#endif

  //Copy in Nodes
  {
    //Preallocate Memory if necessary
    this->reserve_nodes(other_mesh.n_nodes());

    const_node_iterator it = other_mesh.nodes_begin();
    const_node_iterator end = other_mesh.nodes_end();

    for (; it != end; ++it)
      {
        const Node *oldn = *it;

        // Add new nodes in old node Point locations
        /*Node *newn =*/ this->add_point(*oldn, oldn->id(), oldn->processor_id());

        // And start them off in the same subdomain
        //        newn->processor_id() = oldn->processor_id();
      }
  }

  //Copy in Elements
  {
    //Preallocate Memory if necessary
    this->reserve_elem(other_mesh.n_elem());

    // Declare a map linking old and new elements, needed to copy the neighbor lists
    std::map<const Elem*, Elem*> old_elems_to_new_elems;

    // Loop over the elements
    MeshBase::const_element_iterator it = other_mesh.elements_begin();
    const MeshBase::const_element_iterator end = other_mesh.elements_end();

    // FIXME: Where do we set element IDs??
    for (; it != end; ++it)
      {
        //Look at the old element
        const Elem *old = *it;
        //Build a new element
        Elem *newparent = old->parent() ?
          this->elem(old->parent()->id()) : NULL;
        UniquePtr<Elem> ap = Elem::build(old->type(), newparent);
        Elem * el = ap.release();

        el->subdomain_id() = old->subdomain_id();

        for (unsigned int s=0; s != old->n_sides(); ++s)
          if (old->neighbor(s) == remote_elem)
            el->set_neighbor(s, const_cast<RemoteElem*>(remote_elem));

#ifdef LIBMESH_ENABLE_AMR
        if (old->has_children())
          for (unsigned int c=0; c != old->n_children(); ++c)
            if (old->child(c) == remote_elem)
              el->add_child(const_cast<RemoteElem*>(remote_elem), c);

        //Create the parent's child pointers if necessary
        if (newparent)
          {
            unsigned int oldc = old->parent()->which_child_am_i(old);
            newparent->add_child(el, oldc);
          }

        // Copy the refinement flags
        el->set_refinement_flag(old->refinement_flag());
        el->set_p_refinement_flag(old->p_refinement_flag());
#endif // #ifdef LIBMESH_ENABLE_AMR

        //Assign all the nodes
        for(unsigned int i=0;i<el->n_nodes();i++)
          el->set_node(i) = &this->node(old->node(i));

        // And start it off in the same subdomain
        el->processor_id() = old->processor_id();

        // Give it the same id
        el->set_id(old->id());

        //Hold onto it
        if(!skip_find_neighbors)
          {
            this->add_elem(el);
          }
        else
          {
            Elem* new_el = this->add_elem(el);
            old_elems_to_new_elems[old] = new_el;
          }

        // Add the link between the original element and this copy to the map
        if(skip_find_neighbors)
          old_elems_to_new_elems[old] = el;
      }

    // Loop (again) over the elements to fill in the neighbors
    if(skip_find_neighbors)
      {
        it = other_mesh.elements_begin();
        for (; it != end; ++it)
          {
            Elem* old_elem = *it;
            Elem* new_elem = old_elems_to_new_elems[old_elem];
            for (unsigned int s=0; s != old_elem->n_neighbors(); ++s)
              {
                const Elem* old_neighbor = old_elem->neighbor(s);
                Elem* new_neighbor = old_elems_to_new_elems[old_neighbor];
                new_elem->set_neighbor(s, new_neighbor);
              }
          }
      }
  }

  //Finally prepare the new Mesh for use.  Keep the same numbering and
  //partitioning but also the same renumbering and partitioning
  //policies as our source mesh.
  this->allow_renumbering(false);
  this->skip_partitioning(true);
  this->prepare_for_use(false, skip_find_neighbors);
  this->allow_renumbering(other_mesh.allow_renumbering());
  this->skip_partitioning(other_mesh.skip_partitioning());
}
void libMesh::UnstructuredMesh::create_pid_mesh ( UnstructuredMesh pid_mesh,
const processor_id_type  pid 
) const [inherited]

Generates a new mesh containing all the elements which are assigned to processor pid. This mesh is written to the pid_mesh reference which you must create and pass to the function.

Definition at line 560 of file unstructured_mesh.C.

References libMesh::MeshBase::active_pid_elements_begin(), libMesh::MeshBase::active_pid_elements_end(), libMesh::UnstructuredMesh::create_submesh(), libMesh::ParallelObject::n_processors(), and libMesh::out.

{

  // Issue a warning if the number the number of processors
  // currently available is less that that requested for
  // partitioning.  This is not necessarily an error since
  // you may run on one processor and still partition the
  // mesh into several partitions.
#ifdef DEBUG
  if (this->n_processors() < pid)
    {
      libMesh::out << "WARNING:  You are creating a "
                   << "mesh for a processor id (="
                   << pid
                   << ") greater than "
                   << "the number of processors available for "
                   << "the calculation. (="
                   << this->n_processors()
                   << ")."
                   << std::endl;
    }
#endif

  // Create iterators to loop over the list of elements
  //   const_active_pid_elem_iterator       it(this->elements_begin(),   pid);
  //   const const_active_pid_elem_iterator it_end(this->elements_end(), pid);

  const_element_iterator       it     = this->active_pid_elements_begin(pid);
  const const_element_iterator it_end = this->active_pid_elements_end(pid);

  this->create_submesh (pid_mesh, it, it_end);
}
void libMesh::UnstructuredMesh::create_submesh ( UnstructuredMesh new_mesh,
const_element_iterator it,
const const_element_iterator it_end 
) const [inherited]

Constructs a mesh called "new_mesh" from the current mesh by iterating over the elements between it and it_end and adding them to the new mesh.

Definition at line 600 of file unstructured_mesh.C.

References libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::BoundaryInfo::add_side(), bc_id, libMesh::BoundaryInfo::boundary_ids(), libMesh::Elem::build(), libMesh::MeshBase::clear(), libMesh::MeshBase::get_boundary_info(), libMesh::DofObject::invalid_id, libMesh::BoundaryInfo::invalid_id, libMesh::libmesh_assert(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::Elem::n_nodes(), libMesh::Elem::n_sides(), libMesh::Elem::node(), libMesh::MeshBase::node_ptr(), libMesh::Elem::point(), libMesh::MeshBase::prepare_for_use(), libMesh::DofObject::processor_id(), libMesh::Elem::set_node(), libMesh::Elem::subdomain_id(), and libMesh::Elem::type().

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

{
  // Just in case the subdomain_mesh already has some information
  // in it, get rid of it.
  new_mesh.clear();

  // Fail if (*this == new_mesh), we cannot create a submesh inside ourself!
  // This may happen if the user accidently passes the original mesh into
  // this function!  We will check this by making sure we did not just
  // clear ourself.
  libmesh_assert_not_equal_to (this->n_nodes(), 0);
  libmesh_assert_not_equal_to (this->n_elem(), 0);

  // How the nodes on this mesh will be renumbered to nodes
  // on the new_mesh.
  std::vector<dof_id_type> new_node_numbers (this->n_nodes());

  std::fill (new_node_numbers.begin(),
             new_node_numbers.end(),
             DofObject::invalid_id);



  // the number of nodes on the new mesh, will be incremented
  dof_id_type n_new_nodes = 0;
  dof_id_type n_new_elem  = 0;

  for (; it != it_end; ++it)
    {
      // increment the new element counter
      n_new_elem++;

      const Elem* old_elem = *it;

      // Add an equivalent element type to the new_mesh
      Elem* new_elem =
        new_mesh.add_elem (Elem::build(old_elem->type()).release());

      libmesh_assert(new_elem);

      // Loop over the nodes on this element.
      for (unsigned int n=0; n<old_elem->n_nodes(); n++)
        {
          libmesh_assert_less (old_elem->node(n), new_node_numbers.size());

          if (new_node_numbers[old_elem->node(n)] == DofObject::invalid_id)
            {
              new_node_numbers[old_elem->node(n)] = n_new_nodes;

              // Add this node to the new mesh
              new_mesh.add_point (old_elem->point(n));

              // Increment the new node counter
              n_new_nodes++;
            }

          // Define this element's connectivity on the new mesh
          libmesh_assert_less (new_node_numbers[old_elem->node(n)], new_mesh.n_nodes());

          new_elem->set_node(n) = new_mesh.node_ptr (new_node_numbers[old_elem->node(n)]);
        }

      // Copy ids for this element
      new_elem->subdomain_id() = old_elem->subdomain_id();
      new_elem->processor_id() = old_elem->processor_id();

      // Maybe add boundary conditions for this element
      for (unsigned short s=0; s<old_elem->n_sides(); s++)
        // We're supporting boundary ids on internal sides now
        //if (old_elem->neighbor(s) == NULL)
        {
          const std::vector<boundary_id_type>& bc_ids =
            this->get_boundary_info().boundary_ids(old_elem, s);
          for (std::vector<boundary_id_type>::const_iterator id_it=bc_ids.begin(); id_it!=bc_ids.end(); ++id_it)
            {
              const boundary_id_type bc_id = *id_it;
              if (bc_id != this->get_boundary_info().invalid_id)
                new_mesh.get_boundary_info().add_side (new_elem, s,
                                                       bc_id);
            }
        }
    } // end loop over elements


  // Prepare the new_mesh for use
  new_mesh.prepare_for_use(/*skip_renumber =*/false);

}
void libMesh::ParallelMesh::delete_elem ( Elem e) [virtual, inherited]

Removes element e from the mesh. Note that calling this method may produce isolated nodes, i.e. nodes not connected to any element. This method must be implemented in derived classes in such a way that it does not invalidate element iterators.

Implements libMesh::MeshBase.

Definition at line 466 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::ParallelMesh::_n_elem, libMesh::MeshBase::get_boundary_info(), libMesh::DofObject::id(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), and libMesh::BoundaryInfo::remove().

Referenced by libMesh::MeshCommunication::delete_remote_elements(), and libMesh::ParallelMesh::insert_elem().

{
  libmesh_assert (e);

  // Try to make the cached elem data more accurate
  processor_id_type elem_procid = e->processor_id();
  if (elem_procid == this->processor_id() ||
      elem_procid == DofObject::invalid_processor_id)
    _n_elem--;

  // Delete the element from the BoundaryInfo object
  this->get_boundary_info().remove(e);

  // But not yet from the container; we might invalidate
  // an iterator that way!

  //_elements.erase(e->id());

  // Instead, we set it to NULL for now

  _elements[e->id()] = NULL;

  // delete the element
  delete e;
}
void libMesh::ParallelMesh::delete_node ( Node n) [virtual, inherited]

Removes the Node n from the mesh.

Implements libMesh::MeshBase.

Definition at line 630 of file parallel_mesh.C.

References libMesh::ParallelMesh::_n_nodes, libMesh::ParallelMesh::_nodes, libMesh::MeshBase::get_boundary_info(), libMesh::DofObject::id(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), and libMesh::BoundaryInfo::remove().

Referenced by libMesh::MeshCommunication::delete_remote_elements().

{
  libmesh_assert(n);
  libmesh_assert(_nodes[n->id()]);

  // Try to make the cached elem data more accurate
  processor_id_type node_procid = n->processor_id();
  if (node_procid == this->processor_id() ||
      node_procid == DofObject::invalid_processor_id)
    _n_nodes--;

  // Delete the node from the BoundaryInfo object
  this->get_boundary_info().remove(n);

  // But not yet from the container; we might invalidate
  // an iterator that way!

  //_nodes.erase(n->id());

  // Instead, we set it to NULL for now

  _nodes[n->id()] = NULL;

  // delete the node
  delete n;
}
void libMesh::ParallelMesh::delete_remote_elements ( ) [virtual, inherited]

Deletes all nonlocal elements of the mesh except for "ghosts" which touch a local element, and deletes all nodes which are not part of a local or ghost element

Reimplemented from libMesh::MeshBase.

Definition at line 1229 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::ParallelMesh::_extra_ghost_elems, libMesh::ParallelMesh::_is_serial, libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::begin(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::mapvector< Val, index_t >::end(), libMesh::mapvector< Val, index_t >::erase(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_flags(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_ids(), libMesh::MeshTools::libmesh_assert_valid_refinement_tree(), libMesh::ParallelMesh::max_elem_id(), libMesh::ParallelMesh::max_node_id(), libMesh::ParallelMesh::n_elem(), libMesh::ParallelMesh::n_nodes(), libMesh::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::parallel_max_node_id(), libMesh::ParallelMesh::parallel_n_elem(), libMesh::ParallelMesh::parallel_n_nodes(), and libMesh::ParallelMesh::update_parallel_id_counts().

{
#ifdef DEBUG
  // Make sure our neighbor links are all fine
  MeshTools::libmesh_assert_valid_neighbors(*this);

  // And our child/parent links, and our flags
  MeshTools::libmesh_assert_valid_refinement_tree(*this);

  // Make sure our ids and flags are consistent
  this->libmesh_assert_valid_parallel_ids();
  this->libmesh_assert_valid_parallel_flags();

  libmesh_assert_equal_to (this->n_nodes(), this->parallel_n_nodes());
  libmesh_assert_equal_to (this->n_elem(), this->parallel_n_elem());
  const dof_id_type pmax_node_id = this->parallel_max_node_id();
  const dof_id_type pmax_elem_id = this->parallel_max_elem_id();
  libmesh_assert_equal_to (this->max_node_id(), pmax_node_id);
  libmesh_assert_equal_to (this->max_elem_id(), pmax_elem_id);
#endif

  _is_serial = false;
  MeshCommunication().delete_remote_elements(*this, _extra_ghost_elems);

  libmesh_assert_equal_to (this->max_elem_id(), this->parallel_max_elem_id());

  // Now make sure the containers actually shrink - strip
  // any newly-created NULL voids out of the element array
  mapvector<Elem*,dof_id_type>::veclike_iterator e_it        = _elements.begin();
  const mapvector<Elem*,dof_id_type>::veclike_iterator e_end = _elements.end();
  for (; e_it != e_end;)
    if (!*e_it)
      _elements.erase(e_it++);
    else
      ++e_it;

  mapvector<Node*,dof_id_type>::veclike_iterator n_it        = _nodes.begin();
  const mapvector<Node*,dof_id_type>::veclike_iterator n_end = _nodes.end();
  for (; n_it != n_end;)
    if (!*n_it)
      _nodes.erase(n_it++);
    else
      ++n_it;

  // We may have deleted no-longer-connected nodes or coarsened-away
  // elements; let's update our caches.
  this->update_parallel_id_counts();

#ifdef DEBUG
  // We might not have well-packed objects if the user didn't allow us
  // to renumber
  // libmesh_assert_equal_to (this->n_nodes(), this->max_node_id());
  // libmesh_assert_equal_to (this->n_elem(), this->max_elem_id());

  // Make sure our neighbor links are all fine
  MeshTools::libmesh_assert_valid_neighbors(*this);

  // And our child/parent links, and our flags
  MeshTools::libmesh_assert_valid_refinement_tree(*this);

  // Make sure our ids and flags are consistent
  this->libmesh_assert_valid_parallel_ids();
  this->libmesh_assert_valid_parallel_flags();
#endif
}
const Elem * libMesh::ParallelMesh::elem ( const dof_id_type  i) const [virtual, inherited]

Return a pointer to the $ i^{th} $ element, which should be present in this processor's subset of the mesh data structure.

Implements libMesh::MeshBase.

Definition at line 305 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, and libMesh::libmesh_assert().

Referenced by libMesh::ParallelMesh::ParallelMesh().

{
  libmesh_assert(_elements[i]);
  libmesh_assert_equal_to (_elements[i]->id(), i);

  return _elements[i];
}
Elem * libMesh::ParallelMesh::elem ( const dof_id_type  i) [virtual, inherited]

Return a writeable pointer to the $ i^{th} $ element, which should be present in this processor's subset of the mesh data structure.

Implements libMesh::MeshBase.

Definition at line 316 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, and libMesh::libmesh_assert().

{
  libmesh_assert(_elements[i]);
  libmesh_assert_equal_to (_elements[i]->id(), i);

  return _elements[i];
}
const std::set<unsigned char>& libMesh::MeshBase::elem_dimensions ( ) const [inline, inherited]
Returns:
set of dimensions of elements present in the mesh.

Definition at line 175 of file mesh_base.h.

References libMesh::MeshBase::_elem_dims.

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::FEMContext::FEMContext(), and libMesh::MeshBase::get_info().

  { return _elem_dims; }

Elem iterator accessor functions.

Implements libMesh::MeshBase.

Definition at line 37 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

Referenced by libMesh::ParallelMesh::renumber_nodes_and_elements().

{
  Predicates::NotNull<elem_iterator_imp> p;
  return element_iterator(_elements.begin(), _elements.end(), p);
}

const Elem iterator accessor functions.

Implements libMesh::MeshBase.

Definition at line 282 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotNull<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 524 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

Referenced by libMesh::ParallelMesh::renumber_nodes_and_elements().

{
  Predicates::NotNull<elem_iterator_imp> p;
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 769 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotNull<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 614 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::FaceLocal<elem_iterator_imp> p(this->processor_id());
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 859 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::FaceLocal<const_elem_iterator_imp> p(this->processor_id());
  return const_element_iterator(_elements.end(), _elements.end(), p);
}
void libMesh::UnstructuredMesh::find_neighbors ( const bool  reset_remote_elements = false,
const bool  reset_current_list = true 
) [virtual, inherited]

Other functions from MeshBase requiring re-definition.

Here we look at all of the child elements which don't already have valid neighbors.

If a child element has a NULL neighbor it is either because it is on the boundary or because its neighbor is at a different level. In the latter case we must get the neighbor from the parent.

If a child element has a remote_elem neighbor on a boundary it shares with its parent, that info may have become out-dated through coarsening of the neighbor's parent. In this case, if the parent's neighbor is active then the child should share it.

Furthermore, that neighbor better be active, otherwise we missed a child somewhere.

Implements libMesh::MeshBase.

Definition at line 221 of file unstructured_mesh.C.

References libMesh::Elem::active(), libMesh::Elem::ancestor(), libMesh::Elem::centroid(), libMesh::Elem::child(), libMesh::Elem::dim(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), end, libMesh::err, libMesh::Elem::has_children(), libMesh::Elem::hmin(), libMesh::DofObject::id(), libMesh::Elem::is_child_on_side(), libMesh::Elem::key(), libMesh::Elem::level(), libMesh::MeshBase::level_elements_begin(), libMesh::MeshBase::level_elements_end(), libMesh::libmesh_assert(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::Elem::n_children(), libMesh::MeshTools::n_levels(), libMesh::Elem::n_neighbors(), libMesh::Elem::neighbor(), libMesh::Elem::parent(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::remote_elem, libMesh::Elem::set_neighbor(), libMesh::Elem::side(), libMesh::START_LOG(), libMesh::Elem::subactive(), libMesh::Elem::which_child_am_i(), and libMesh::NameBasedIO::write().

Referenced by libMesh::TriangleWrapper::copy_tri_to_mesh().

{
  // We might actually want to run this on an empty mesh
  // (e.g. the boundary mesh for a nonexistant bcid!)
  // libmesh_assert_not_equal_to (this->n_nodes(), 0);
  // libmesh_assert_not_equal_to (this->n_elem(), 0);

  // This function must be run on all processors at once
  parallel_object_only();

  START_LOG("find_neighbors()", "Mesh");

  const element_iterator el_end = this->elements_end();

  //TODO:[BSK] This should be removed later?!
  if (reset_current_list)
    for (element_iterator el = this->elements_begin(); el != el_end; ++el)
      {
        Elem* e = *el;
        for (unsigned int s=0; s<e->n_neighbors(); s++)
          if (e->neighbor(s) != remote_elem ||
              reset_remote_elements)
            e->set_neighbor(s,NULL);
      }

  // Find neighboring elements by first finding elements
  // with identical side keys and then check to see if they
  // are neighbors
  {
    // data structures -- Use the hash_multimap if available
    typedef unsigned int                    key_type;
    typedef std::pair<Elem*, unsigned char> val_type;
    typedef std::pair<key_type, val_type>   key_val_pair;

    typedef LIBMESH_BEST_UNORDERED_MULTIMAP<key_type, val_type> map_type;

    // A map from side keys to corresponding elements & side numbers
    map_type side_to_elem_map;



    for (element_iterator el = this->elements_begin(); el != el_end; ++el)
      {
        Elem* element = *el;

        for (unsigned char ms=0; ms<element->n_neighbors(); ms++)
          {
          next_side:
            // If we haven't yet found a neighbor on this side, try.
            // Even if we think our neighbor is remote, that
            // information may be out of date.
            if (element->neighbor(ms) == NULL ||
                element->neighbor(ms) == remote_elem)
              {
                // Get the key for the side of this element
                const unsigned int key = element->key(ms);

                // Look for elements that have an identical side key
                std::pair <map_type::iterator, map_type::iterator>
                  bounds = side_to_elem_map.equal_range(key);

                // May be multiple keys, check all the possible
                // elements which _might_ be neighbors.
                if (bounds.first != bounds.second)
                  {
                    // Get the side for this element
                    const UniquePtr<Elem> my_side(element->side(ms));

                    // Look at all the entries with an equivalent key
                    while (bounds.first != bounds.second)
                      {
                        // Get the potential element
                        Elem* neighbor = bounds.first->second.first;

                        // Get the side for the neighboring element
                        const unsigned int ns = bounds.first->second.second;
                        const UniquePtr<Elem> their_side(neighbor->side(ns));
                        //libmesh_assert(my_side.get());
                        //libmesh_assert(their_side.get());

                        // If found a match with my side
                        //
                        // We need special tests here for 1D:
                        // since parents and children have an equal
                        // side (i.e. a node), we need to check
                        // ns != ms, and we also check level() to
                        // avoid setting our neighbor pointer to
                        // any of our neighbor's descendants
                        if( (*my_side == *their_side) &&
                            (element->level() == neighbor->level()) &&
                            ((element->dim() != 1) || (ns != ms)) )
                          {
                            // So share a side.  Is this a mixed pair
                            // of subactive and active/ancestor
                            // elements?
                            // If not, then we're neighbors.
                            // If so, then the subactive's neighbor is

                            if (element->subactive() ==
                                neighbor->subactive())
                              {
                                // an element is only subactive if it has
                                // been coarsened but not deleted
                                element->set_neighbor (ms,neighbor);
                                neighbor->set_neighbor(ns,element);
                              }
                            else if (element->subactive())
                              {
                                element->set_neighbor(ms,neighbor);
                              }
                            else if (neighbor->subactive())
                              {
                                neighbor->set_neighbor(ns,element);
                              }
                            side_to_elem_map.erase (bounds.first);

                            // get out of this nested crap
                            goto next_side;
                          }

                        ++bounds.first;
                      }
                  }

                // didn't find a match...
                // Build the map entry for this element
                key_val_pair kvp;

                kvp.first         = key;
                kvp.second.first  = element;
                kvp.second.second = ms;

                // use the lower bound as a hint for
                // where to put it.
#if defined(LIBMESH_HAVE_UNORDERED_MAP) || defined(LIBMESH_HAVE_TR1_UNORDERED_MAP) || defined(LIBMESH_HAVE_HASH_MAP) || defined(LIBMESH_HAVE_EXT_HASH_MAP)
                side_to_elem_map.insert (kvp);
#else
                side_to_elem_map.insert (bounds.first,kvp);
#endif
              }
          }
      }
  }

#ifdef LIBMESH_ENABLE_AMR

  const unsigned int n_levels = MeshTools::n_levels(*this);
  for (unsigned int level = 1; level < n_levels; ++level)
    {
      element_iterator end = this->level_elements_end(level);
      for (element_iterator el = this->level_elements_begin(level);
           el != end; ++el)
        {
          Elem* current_elem = *el;
          libmesh_assert(current_elem);
          Elem* parent = current_elem->parent();
          libmesh_assert(parent);
          const unsigned int my_child_num = parent->which_child_am_i(current_elem);

          for (unsigned int s=0; s < current_elem->n_neighbors(); s++)
            {
              if (current_elem->neighbor(s) == NULL ||
                  (current_elem->neighbor(s) == remote_elem &&
                   parent->is_child_on_side(my_child_num, s)))
                {
                  Elem *neigh = parent->neighbor(s);

                  // If neigh was refined and had non-subactive children
                  // made remote earlier, then a non-subactive elem should
                  // actually have one of those remote children as a
                  // neighbor
                  if (neigh && (neigh->ancestor()) && (!current_elem->subactive()))
                    {
#ifdef DEBUG
                      // Let's make sure that "had children made remote"
                      // situation is actually the case
                      libmesh_assert(neigh->has_children());
                      bool neigh_has_remote_children = false;
                      for (unsigned int c = 0; c != neigh->n_children(); ++c)
                        {
                          if (neigh->child(c) == remote_elem)
                            neigh_has_remote_children = true;
                        }
                      libmesh_assert(neigh_has_remote_children);

                      // And let's double-check that we don't have
                      // a remote_elem neighboring a local element
                      libmesh_assert_not_equal_to (current_elem->processor_id(),
                                                   this->processor_id());
#endif // DEBUG
                      neigh = const_cast<RemoteElem*>(remote_elem);
                    }

                  current_elem->set_neighbor(s, neigh);
#ifdef DEBUG
                  if (neigh != NULL && neigh != remote_elem)
                    // We ignore subactive elements here because
                    // we don't care about neighbors of subactive element.
                    if ((!neigh->active()) && (!current_elem->subactive()))
                      {
                        libMesh::err << "On processor " << this->processor_id()
                                     << std::endl;
                        libMesh::err << "Bad element ID = " << current_elem->id()
                                     << ", Side " << s << ", Bad neighbor ID = " << neigh->id() << std::endl;
                        libMesh::err << "Bad element proc_ID = " << current_elem->processor_id()
                                     << ", Bad neighbor proc_ID = " << neigh->processor_id() << std::endl;
                        libMesh::err << "Bad element size = " << current_elem->hmin()
                                     << ", Bad neighbor size = " << neigh->hmin() << std::endl;
                        libMesh::err << "Bad element center = " << current_elem->centroid()
                                     << ", Bad neighbor center = " << neigh->centroid() << std::endl;
                        libMesh::err << "ERROR: "
                                     << (current_elem->active()?"Active":"Ancestor")
                                     << " Element at level "
                                     << current_elem->level() << std::endl;
                        libMesh::err << "with "
                                     << (parent->active()?"active":
                                         (parent->subactive()?"subactive":"ancestor"))
                                     << " parent share "
                                     << (neigh->subactive()?"subactive":"ancestor")
                                     << " neighbor at level " << neigh->level()
                                     << std::endl;
                        NameBasedIO(*this).write ("bad_mesh.gmv");
                        libmesh_error_msg("Problematic mesh written to bad_mesh.gmv.");
                      }
#endif // DEBUG
                }
            }
        }
    }

#endif // AMR


#ifdef DEBUG
  MeshTools::libmesh_assert_valid_neighbors(*this);
#endif

  STOP_LOG("find_neighbors()", "Mesh");
}

There is no reason for a user to ever call this function.

This function restores a previously broken element/node numbering such that mesh.node(n)->id() == n.

Implements libMesh::MeshBase.

Definition at line 1176 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::begin(), libMesh::mapvector< Val, index_t >::end(), and end.

{
  // We need access to iterators for the underlying containers,
  // not the mapvector<> reimplementations.
  mapvector<Node*,dof_id_type>::maptype &nodes = this->_nodes;
  mapvector<Elem*,dof_id_type>::maptype &elems = this->_elements;

  // Nodes first
  {
    mapvector<Node*,dof_id_type>::maptype::iterator
      it  = nodes.begin(),
      end = nodes.end();

    for (; it != end; ++it)
      if (it->second != NULL)
        it->second->set_id() = it->first;
  }

  // Elements next
  {
    mapvector<Elem*,dof_id_type>::maptype::iterator
      it  = elems.begin(),
      end = elems.end();

    for (; it != end; ++it)
      if (it->second != NULL)
        it->second->set_id() = it->first;
  }
}
const BoundaryInfo& libMesh::MeshBase::get_boundary_info ( ) const [inline, inherited]

The information about boundary ids on the mesh

Definition at line 115 of file mesh_base.h.

References libMesh::MeshBase::boundary_info.

Referenced by libMesh::MeshRefinement::_coarsen_elements(), libMesh::MeshTools::Subdivision::add_boundary_ghosts(), libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Subdivision::all_subdivision(), libMesh::MeshTools::Modification::all_tri(), libMesh::AbaqusIO::assign_boundary_node_ids(), libMesh::AbaqusIO::assign_sideset_ids(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshTools::Modification::change_boundary_id(), libMesh::MeshBase::clear(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::FEAbstract::compute_periodic_node_constraints(), libMesh::UnstructuredMesh::create_submesh(), libMesh::SerialMesh::delete_elem(), libMesh::ParallelMesh::delete_elem(), libMesh::SerialMesh::delete_node(), libMesh::ParallelMesh::delete_node(), libMesh::MeshTools::Modification::flatten(), libMesh::UNVIO::groups_in(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::BoundaryProjectSolution::operator()(), libMesh::Parallel::pack(), libMesh::Parallel::packable_size(), libMesh::ParallelMesh::ParallelMesh(), libMesh::AbaqusIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_bcs(), libMesh::GmshIO::read_mesh(), libMesh::LegacyXdrIO::read_mesh(), libMesh::CheckpointIO::read_nodesets(), libMesh::SerialMesh::renumber_nodes_and_elements(), libMesh::ParallelMesh::renumber_nodes_and_elements(), libMesh::SerialMesh::SerialMesh(), libMesh::SerialMesh::stitching_helper(), libMesh::Elem::topological_neighbor(), libMesh::Parallel::unpack(), libMesh::FroIO::write(), libMesh::Nemesis_IO::write(), libMesh::ExodusII_IO::write(), libMesh::XdrIO::write(), libMesh::LegacyXdrIO::write_mesh(), libMesh::Nemesis_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::LegacyXdrIO::write_soln(), and libMesh::DivaIO::write_stream().

{ return *boundary_info; }

Writeable information about boundary ids on the mesh

Definition at line 120 of file mesh_base.h.

References libMesh::MeshBase::boundary_info.

{ return *boundary_info; }
subdomain_id_type libMesh::MeshBase::get_id_by_name ( const std::string &  name) const [inherited]

Returns the id of the named subdomain if it exists, Elem::invalid_subdomain_id otherwise.

Definition at line 481 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name, and libMesh::Elem::invalid_subdomain_id.

{
  // Linear search over the map values.
  std::map<subdomain_id_type, std::string>::const_iterator
    iter = _block_id_to_name.begin(),
    end_iter = _block_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 subdomain
  // with the requested name, so return Elem::invalid_subdomain_id.
  return Elem::invalid_subdomain_id;
}
std::string libMesh::MeshBase::get_info ( ) const [inherited]
Returns:
a string containing relevant information about the mesh.

Definition at line 315 of file mesh_base.C.

References libMesh::MeshBase::elem_dimensions(), end, libMesh::MeshBase::n_active_elem(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::n_partitions(), libMesh::ParallelObject::n_processors(), libMesh::MeshBase::n_subdomains(), libMesh::n_threads(), libMesh::ParallelObject::processor_id(), and libMesh::MeshBase::spatial_dimension().

Referenced by libMesh::MeshBase::print_info().

{
  std::ostringstream oss;

  oss << " Mesh Information:"                                  << '\n'
      << "  elem_dimensions()={";
  {
    std::set<unsigned char>::const_iterator it =
      this->elem_dimensions().begin();
    if (it != this->elem_dimensions().end())
      oss << *it;
    for (; it != this->elem_dimensions().end(); ++it)
      oss << ',' << *it;
  }
  oss << "  spatial_dimension()=" << this->spatial_dimension() << '\n'
      << "  n_nodes()="           << this->n_nodes()           << '\n'
      << "    n_local_nodes()="   << this->n_local_nodes()     << '\n'
      << "  n_elem()="            << this->n_elem()            << '\n'
      << "    n_local_elem()="    << this->n_local_elem()      << '\n'
#ifdef LIBMESH_ENABLE_AMR
      << "    n_active_elem()="   << this->n_active_elem()     << '\n'
#endif
      << "  n_subdomains()="      << static_cast<std::size_t>(this->n_subdomains()) << '\n'
      << "  n_partitions()="      << static_cast<std::size_t>(this->n_partitions()) << '\n'
      << "  n_processors()="      << static_cast<std::size_t>(this->n_processors()) << '\n'
      << "  n_threads()="         << static_cast<std::size_t>(libMesh::n_threads()) << '\n'
      << "  processor_id()="      << static_cast<std::size_t>(this->processor_id()) << '\n';

  return oss.str();
}
Elem * libMesh::ParallelMesh::insert_elem ( Elem e) [virtual, inherited]

Insert elem e to the element array, preserving its id and replacing/deleting any existing element with the same id.

Implements libMesh::MeshBase.

Definition at line 448 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::ParallelMesh::_n_elem, libMesh::ParallelMesh::delete_elem(), libMesh::DofObject::id(), libMesh::DofObject::invalid_processor_id, libMesh::ParallelObject::processor_id(), and libMesh::DofObject::processor_id().

{
  if (_elements[e->id()])
    this->delete_elem(_elements[e->id()]);

  // Try to make the cached elem data more accurate
  processor_id_type elem_procid = e->processor_id();
  if (elem_procid == this->processor_id() ||
      elem_procid == DofObject::invalid_processor_id)
    _n_elem++;

  _elements[e->id()] = e;

  return e;
}
Node * libMesh::ParallelMesh::insert_node ( Node n) [virtual, inherited]

Calls add_node().

Implements libMesh::MeshBase.

Definition at line 623 of file parallel_mesh.C.

References libMesh::ParallelMesh::add_node().

{
  return ParallelMesh::add_node(n);
}
bool libMesh::MeshBase::is_prepared ( ) const [inline, inherited]
Returns:
true if the mesh has been prepared via a call to prepare_for_use, false otherwise.

Definition at line 131 of file mesh_base.h.

References libMesh::MeshBase::_is_prepared.

Referenced by libMesh::DofMap::build_sparsity(), libMesh::DofMap::create_dof_constraints(), libMesh::DofMap::distribute_dofs(), and libMesh::DofMap::reinit().

  { return _is_prepared; }
virtual bool libMesh::ParallelMesh::is_serial ( ) const [inline, virtual, inherited]
Returns:
true if all elements and nodes of the mesh exist on the current processor, false otherwise

Reimplemented from libMesh::MeshBase.

Definition at line 118 of file parallel_mesh.h.

References libMesh::ParallelMesh::_is_serial.

Referenced by libMesh::ParallelMesh::add_elem(), libMesh::ParallelMesh::add_node(), libMesh::MeshCommunication::delete_remote_elements(), and libMesh::ParallelMesh::redistribute().

  { return _is_serial; }
ParallelMesh::element_iterator libMesh::ParallelMesh::level_elements_begin ( const unsigned int  level) [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 167 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

Referenced by libMesh::MeshCommunication::delete_remote_elements().

{
  Predicates::Level<elem_iterator_imp> p(level);
  return element_iterator(_elements.begin(), _elements.end(), p);
}
ParallelMesh::const_element_iterator libMesh::ParallelMesh::level_elements_begin ( const unsigned int  level) const [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 411 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Level<const_elem_iterator_imp> p(level);
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}
ParallelMesh::element_iterator libMesh::ParallelMesh::level_elements_end ( const unsigned int  level) [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 654 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

Referenced by libMesh::MeshCommunication::delete_remote_elements().

{
  Predicates::Level<elem_iterator_imp> p(level);
  return element_iterator(_elements.end(), _elements.end(), p);
}
ParallelMesh::const_element_iterator libMesh::ParallelMesh::level_elements_end ( const unsigned int  level) const [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 899 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Level<const_elem_iterator_imp> p(level);
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Verify refinement_flag and p_refinement_flag consistency of our elements containers. Calls libmesh_assert() on each possible failure.

Definition at line 820 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::ParallelObject::comm(), libMesh::invalid_uint, libMesh::libmesh_assert(), libMesh::Parallel::Communicator::min(), libMesh::Elem::p_refinement_flag(), libMesh::ParallelMesh::parallel_max_elem_id(), and libMesh::Elem::refinement_flag().

Referenced by libMesh::ParallelMesh::allgather(), libMesh::ParallelMesh::delete_remote_elements(), and libMesh::ParallelMesh::renumber_nodes_and_elements().

{
#ifdef LIBMESH_ENABLE_AMR
  // This function must be run on all processors at once
  parallel_object_only();

  dof_id_type pmax_elem_id = this->parallel_max_elem_id();

  for (dof_id_type i=0; i != pmax_elem_id; ++i)
    {
      Elem* el = _elements[i]; // Returns NULL if there's no map entry

      unsigned int refinement_flag   = el ?
        static_cast<unsigned int> (el->refinement_flag()) : libMesh::invalid_uint;
#ifndef NDEBUG
      unsigned int p_refinement_flag = el ?
        static_cast<unsigned int> (el->p_refinement_flag()) : libMesh::invalid_uint;
#endif

      unsigned int min_rflag = refinement_flag;
      this->comm().min(min_rflag);
      // All processors with this element should agree on flag
      libmesh_assert (!el || min_rflag == refinement_flag);

#ifndef NDEBUG
      unsigned int min_pflag = p_refinement_flag;
#endif
      // All processors with this element should agree on flag
      libmesh_assert (!el || min_pflag == p_refinement_flag);
    }
#endif // LIBMESH_ENABLE_AMR
}
template<typename T >
void libMesh::ParallelMesh::libmesh_assert_valid_parallel_object_ids ( const mapvector< T *, dof_id_type > &  objects) const [inherited]

Verify id and processor_id consistency of a parallel objects container. Calls libmesh_assert() on each possible failure in that container.

Definition at line 761 of file parallel_mesh.C.

References libMesh::DofObject::invalid_id, libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), std::max(), and libMesh::processor_id().

Referenced by libMesh::ParallelMesh::libmesh_assert_valid_parallel_ids().

{
  // This function must be run on all processors at once
  parallel_object_only();

  const dof_id_type pmax_node_id = this->parallel_max_node_id();
  const dof_id_type pmax_elem_id = this->parallel_max_elem_id();
  const dof_id_type pmax_id = std::max(pmax_node_id, pmax_elem_id);

  for (dof_id_type i=0; i != pmax_id; ++i)
    {
      T* obj = objects[i]; // Returns NULL if there's no map entry

      dof_id_type dofid = obj && obj->valid_id() ?
        obj->id() : DofObject::invalid_id;
      // Local lookups by id should return the requested object
      libmesh_assert(!obj || obj->id() == i);

      dof_id_type min_dofid = dofid;
      this->comm().min(min_dofid);
      // All processors with an object should agree on id
      libmesh_assert (!obj || dofid == min_dofid);

      dof_id_type procid = obj && obj->valid_processor_id() ?
        obj->processor_id() : DofObject::invalid_processor_id;

      dof_id_type min_procid = procid;
      this->comm().min(min_procid);

      // All processors with an object should agree on processor id
      libmesh_assert (!obj || procid == min_procid);

      // Either:
      // 1.) I own this elem (min_procid == this->processor_id()) *and* I have a valid pointer to it (obj != NULL)
      // or
      // 2.) I don't own this elem (min_procid != this->processor_id()).  (In this case I may or may not have a valid pointer to it.)

      // Original assert logic
      // libmesh_assert (min_procid != this->processor_id() || obj);

      // More human-understandable logic...
      libmesh_assert (
                      ((min_procid == this->processor_id()) && obj)
                      ||
                      (min_procid != this->processor_id())
                      );
    }
}

Implements libMesh::MeshBase.

Definition at line 839 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::Local<const_elem_iterator_imp> p(this->processor_id());
  return const_element_iterator(_elements.end(), _elements.end(), p);
}
ParallelMesh::element_iterator libMesh::ParallelMesh::local_level_elements_begin ( const unsigned int  level) [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 187 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::LocalLevel<elem_iterator_imp> p(this->processor_id(),level);
  return element_iterator(_elements.begin(), _elements.end(), p);
}
ParallelMesh::const_element_iterator libMesh::ParallelMesh::local_level_elements_begin ( const unsigned int  level) const [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 431 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::LocalLevel<const_elem_iterator_imp> p(this->processor_id(),level);
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}
ParallelMesh::element_iterator libMesh::ParallelMesh::local_level_elements_end ( const unsigned int  level) [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 674 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::LocalLevel<elem_iterator_imp> p(this->processor_id(),level);
  return element_iterator(_elements.end(), _elements.end(), p);
}
ParallelMesh::const_element_iterator libMesh::ParallelMesh::local_level_elements_end ( const unsigned int  level) const [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 919 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::LocalLevel<const_elem_iterator_imp> p(this->processor_id(),level);
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1111 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::Local<node_iterator_imp> p(this->processor_id());
  return node_iterator(_nodes.end(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1151 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::Local<const_node_iterator_imp> p(this->processor_id());
  return const_node_iterator(_nodes.end(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 197 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::LocalNotLevel<elem_iterator_imp> p(this->processor_id(),level);
  return element_iterator(_elements.begin(), _elements.end(), p);
}
ParallelMesh::const_element_iterator libMesh::ParallelMesh::local_not_level_elements_begin ( const unsigned int  level) const [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 441 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::LocalNotLevel<const_elem_iterator_imp> p(this->processor_id(),level);
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}
ParallelMesh::element_iterator libMesh::ParallelMesh::local_not_level_elements_end ( const unsigned int  level) [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 684 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::LocalNotLevel<elem_iterator_imp> p(this->processor_id(),level);
  return element_iterator(_elements.end(), _elements.end(), p);
}
ParallelMesh::const_element_iterator libMesh::ParallelMesh::local_not_level_elements_end ( const unsigned int  level) const [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 929 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::LocalNotLevel<const_elem_iterator_imp> p(this->processor_id(),level);
  return const_element_iterator(_elements.end(), _elements.end(), p);
}
unsigned int libMesh::MeshBase::mesh_dimension ( ) const [inherited]
Returns:
the logical dimension of the mesh; i.e. the manifold dimension of the elements in the mesh. If we ever support multi-dimensional meshes (e.g. hexes and quads in the same mesh) then this will return the largest such dimension.

Definition at line 118 of file mesh_base.C.

References libMesh::MeshBase::_elem_dims, and libMesh::libmesh_assert().

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::HPCoarsenTest::add_projection(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Generation::build_cube(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_solution_vector(), libMesh::EquationSystems::build_variable_names(), libMesh::System::calculate_norm(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshTools::Modification::distort(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::LaplaceMeshSmoother::init(), libMesh::PointLocatorTree::init(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::FEInterface::n_vec_dim(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::ProjectSolution::operator()(), libMesh::BoundaryProjectSolution::operator()(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::GMVIO::read(), libMesh::VTKIO::read(), libMesh::System::read_header(), libMesh::LegacyXdrIO::read_mesh(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::HPCoarsenTest::select_refinement(), libMesh::MeshTools::Modification::smooth(), libMesh::DofMap::use_coupled_neighbor_dofs(), libMesh::PostscriptIO::write(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::TecplotIO::write_binary(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::UCDIO::write_nodal_data(), libMesh::EnsightIO::write_scalar_ascii(), libMesh::GnuPlotIO::write_solution(), libMesh::DivaIO::write_stream(), and libMesh::EnsightIO::write_vector_ascii().

{
  libmesh_assert(!_elem_dims.empty());
  return cast_int<unsigned int>(*_elem_dims.rbegin());
}
dof_id_type libMesh::ParallelMesh::n_active_elem ( ) const [virtual, inherited]

Returns the number of active elements in the mesh. Implemented in terms of active_element_iterators.

Implements libMesh::MeshBase.

Definition at line 1208 of file parallel_mesh.C.

References libMesh::ParallelMesh::active_local_elements_begin(), libMesh::ParallelMesh::active_local_elements_end(), libMesh::ParallelMesh::active_pid_elements_begin(), libMesh::ParallelMesh::active_pid_elements_end(), libMesh::ParallelObject::comm(), libMesh::DofObject::invalid_processor_id, and libMesh::Parallel::Communicator::sum().

{
  parallel_object_only();

  // Get local active elements first
  dof_id_type active_elements =
    static_cast<dof_id_type>(std::distance (this->active_local_elements_begin(),
                                            this->active_local_elements_end()));
  this->comm().sum(active_elements);

  // Then add unpartitioned active elements, which should exist on
  // every processor
  active_elements +=
    static_cast<dof_id_type>(std::distance
                             (this->active_pid_elements_begin(DofObject::invalid_processor_id),
                              this->active_pid_elements_end(DofObject::invalid_processor_id)));
  return active_elements;
}

Returns the number of active elements on processor proc.

Definition at line 276 of file mesh_base.C.

References libMesh::MeshBase::active_pid_elements_begin(), libMesh::MeshBase::active_pid_elements_end(), and libMesh::ParallelObject::n_processors().

Referenced by libMesh::MeshBase::n_active_local_elem().

{
  libmesh_assert_less (proc_id, this->n_processors());
  return static_cast<dof_id_type>(std::distance (this->active_pid_elements_begin(proc_id),
                                                 this->active_pid_elements_end  (proc_id)));
}

Same, but only counts active elements.

Definition at line 300 of file mesh_base.C.

References libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), and end.

Referenced by libMesh::TecplotIO::write_ascii(), libMesh::GMVIO::write_ascii_old_impl(), and libMesh::TecplotIO::write_binary().

{
  dof_id_type ne=0;

  const_element_iterator       el  = this->active_elements_begin();
  const const_element_iterator end = this->active_elements_end();

  for (; el!=end; ++el)
    ne += (*el)->n_sub_elem();

  return ne;
}
virtual dof_id_type libMesh::ParallelMesh::n_elem ( ) const [inline, virtual, inherited]

Returns the number of elements in the mesh. The standard n_elem() function may return a cached value on distributed meshes, and so can be called by any processor at any time.

Implements libMesh::MeshBase.

Definition at line 185 of file parallel_mesh.h.

References libMesh::ParallelMesh::_n_elem.

Referenced by libMesh::ParallelMesh::allgather(), libMesh::ParallelMesh::delete_remote_elements(), libMesh::ParallelMesh::ParallelMesh(), and libMesh::ParallelMesh::renumber_nodes_and_elements().

{ return _n_elem; }

Returns the number of elements on processor proc.

Definition at line 263 of file mesh_base.C.

References libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), libMesh::ParallelObject::n_processors(), libMesh::MeshBase::pid_elements_begin(), and libMesh::MeshBase::pid_elements_end().

Referenced by libMesh::MeshBase::n_local_elem(), and libMesh::MeshBase::n_unpartitioned_elem().

{
  // We're either counting a processor's elements or unpartitioned
  // elements
  libmesh_assert (proc_id < this->n_processors() ||
                  proc_id == DofObject::invalid_processor_id);

  return static_cast<dof_id_type>(std::distance (this->pid_elements_begin(proc_id),
                                                 this->pid_elements_end  (proc_id)));
}
dof_id_type libMesh::MeshBase::n_local_elem ( ) const [inline, inherited]

Returns the number of elements on the local processor.

Definition at line 297 of file mesh_base.h.

References libMesh::MeshBase::n_elem_on_proc(), and libMesh::ParallelObject::processor_id().

Referenced by libMesh::MeshBase::get_info(), and libMesh::ParallelMesh::parallel_n_elem().

  { return this->n_elem_on_proc (this->processor_id()); }
dof_id_type libMesh::MeshBase::n_local_nodes ( ) const [inline, inherited]

Returns the number of nodes on the local processor.

Definition at line 211 of file mesh_base.h.

References libMesh::MeshBase::n_nodes_on_proc(), and libMesh::ParallelObject::processor_id().

Referenced by libMesh::MeshBase::get_info(), libMesh::VTKIO::nodes_to_vtk(), and libMesh::ParallelMesh::parallel_n_nodes().

  { return this->n_nodes_on_proc (this->processor_id()); }
virtual dof_id_type libMesh::ParallelMesh::n_nodes ( ) const [inline, virtual, inherited]

Returns the number of nodes in the mesh. This function and others must be defined in derived classes since the MeshBase class has no specific storage for nodes or elements. The standard n_nodes() function may return a cached value on distributed meshes, and so can be called by any processor at any time.

Implements libMesh::MeshBase.

Definition at line 182 of file parallel_mesh.h.

References libMesh::ParallelMesh::_n_nodes.

Referenced by libMesh::ParallelMesh::allgather(), libMesh::ParallelMesh::delete_remote_elements(), libMesh::ParallelMesh::ParallelMesh(), and libMesh::ParallelMesh::renumber_nodes_and_elements().

{ return _n_nodes; }

Returns the number of nodes on processor proc.

Definition at line 250 of file mesh_base.C.

References libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), libMesh::ParallelObject::n_processors(), libMesh::MeshBase::pid_nodes_begin(), and libMesh::MeshBase::pid_nodes_end().

Referenced by libMesh::MeshBase::n_local_nodes(), and libMesh::MeshBase::n_unpartitioned_nodes().

{
  // We're either counting a processor's nodes or unpartitioned
  // nodes
  libmesh_assert (proc_id < this->n_processors() ||
                  proc_id == DofObject::invalid_processor_id);

  return static_cast<dof_id_type>(std::distance (this->pid_nodes_begin(proc_id),
                                                 this->pid_nodes_end  (proc_id)));
}
unsigned int libMesh::MeshBase::n_partitions ( ) const [inline, inherited]

Returns the number of partitions which have been defined via a call to either mesh.partition() or by building a Partitioner object and calling partition. Note that the partitioner objects are responsible for setting this value.

Definition at line 593 of file mesh_base.h.

References libMesh::MeshBase::_n_parts.

Referenced by libMesh::MeshBase::get_info(), libMesh::BoundaryInfo::sync(), libMesh::NameBasedIO::write(), libMesh::GMVIO::write_ascii_new_impl(), and libMesh::GMVIO::write_ascii_old_impl().

  { return _n_parts; }
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(), libMesh::BoundaryInfo::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()); }

This function returns the number of elements that will be written out in the Tecplot format. For example, a 9-noded quadrilateral will be broken into 4 linear sub-elements for plotting purposes. Thus, for a mesh of 2 QUAD9 elements n_tecplot_elem() will return 8. Implemented in terms of element_iterators.

Definition at line 285 of file mesh_base.C.

References libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), and end.

{
  dof_id_type ne=0;

  const_element_iterator       el  = this->elements_begin();
  const const_element_iterator end = this->elements_end();

  for (; el!=end; ++el)
    ne += (*el)->n_sub_elem();

  return ne;
}

Returns the number of subdomains in the global mesh. Subdomains correspond to separate subsets of the mesh which could correspond e.g. to different materials in a solid mechanics application, or regions where different physical processes are important. The subdomain mapping is independent from the parallel decomposition.

Definition at line 235 of file mesh_base.C.

References libMesh::MeshBase::subdomain_ids().

Referenced by libMesh::MeshBase::get_info(), libMesh::XdrIO::write(), and libMesh::NameBasedIO::write_nodal_data().

{
  // This requires an inspection on every processor
  parallel_object_only();

  std::set<subdomain_id_type> ids;

  this->subdomain_ids (ids);

  return cast_int<subdomain_id_type>(ids.size());
}

Returns the number of elements owned by no processor.

Definition at line 303 of file mesh_base.h.

References libMesh::DofObject::invalid_processor_id, and libMesh::MeshBase::n_elem_on_proc().

Referenced by libMesh::ParallelMesh::parallel_n_elem(), and libMesh::MeshBase::partition().

Returns the number of nodes owned by no processor.

Definition at line 217 of file mesh_base.h.

References libMesh::DofObject::invalid_processor_id, and libMesh::MeshBase::n_nodes_on_proc().

Referenced by libMesh::ParallelMesh::parallel_n_nodes().

Returns the next unique id to be used.

Definition at line 230 of file mesh_base.h.

References libMesh::MeshBase::_next_unique_id.

{ return _next_unique_id; }
const Node & libMesh::ParallelMesh::node ( const dof_id_type  i) const [virtual, inherited]

Return a constant reference (for reading only) to the $ i^{th} $ node, which should be present in this processor's subset of the mesh data structure.

Implements libMesh::MeshBase.

Definition at line 229 of file parallel_mesh.C.

References libMesh::ParallelMesh::_nodes, and libMesh::libmesh_assert().

{
  libmesh_assert(_nodes[i]);
  libmesh_assert_equal_to (_nodes[i]->id(), i);

  return (*_nodes[i]);
}
Node & libMesh::ParallelMesh::node ( const dof_id_type  i) [virtual, inherited]

Return a reference to the $ i^{th} $ node, which should be present in this processor's subset of the mesh data structure.

Implements libMesh::MeshBase.

Definition at line 241 of file parallel_mesh.C.

References libMesh::ParallelMesh::_nodes, and libMesh::libmesh_assert().

{
  libmesh_assert(_nodes[i]);
  libmesh_assert_equal_to (_nodes[i]->id(), i);

  return (*_nodes[i]);
}
const Node * libMesh::ParallelMesh::node_ptr ( const dof_id_type  i) const [virtual, inherited]

Return a pointer to the $ i^{th} $ node, which should be present in this processor's subset of the mesh data structure.

Implements libMesh::MeshBase.

Definition at line 251 of file parallel_mesh.C.

References libMesh::ParallelMesh::_nodes, and libMesh::libmesh_assert().

{
  libmesh_assert(_nodes[i]);
  libmesh_assert_equal_to (_nodes[i]->id(), i);

  return _nodes[i];
}
Node * libMesh::ParallelMesh::node_ptr ( const dof_id_type  i) [virtual, inherited]

Return a writeable pointer to the $ i^{th} $ node, which should be present in this processor's subset of the mesh data structure.

Implements libMesh::MeshBase.

Definition at line 262 of file parallel_mesh.C.

References libMesh::ParallelMesh::_nodes, and libMesh::libmesh_assert().

{
  libmesh_assert(_nodes[i]);
  libmesh_assert_equal_to (_nodes[i]->id(), i);

  return _nodes[i];
}

non-const Node iterator accessor functions.

Implements libMesh::MeshBase.

Definition at line 1011 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

Referenced by libMesh::MeshCommunication::delete_remote_elements().

{
  Predicates::NotNull<node_iterator_imp> p;
  return node_iterator(_nodes.begin(), _nodes.end(), p);
}

const Node iterator accessor functions.

Implements libMesh::MeshBase.

Definition at line 1051 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotNull<const_node_iterator_imp> p;
  return const_node_iterator(_nodes.begin(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1091 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, and libMesh::mapvector< Val, index_t >::end().

Referenced by libMesh::MeshCommunication::delete_remote_elements().

{
  Predicates::NotNull<node_iterator_imp> p;
  return node_iterator(_nodes.end(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1131 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotNull<const_node_iterator_imp> p;
  return const_node_iterator(_nodes.end(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 57 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotActive<elem_iterator_imp> p;
  return element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 301 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotActive<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 544 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotActive<elem_iterator_imp> p;
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 789 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotActive<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 321 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Ancestor<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 564 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Ancestor<elem_iterator_imp> p;
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 809 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Ancestor<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.end(), _elements.end(), p);
}
ParallelMesh::element_iterator libMesh::ParallelMesh::not_level_elements_begin ( const unsigned int  level) [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 177 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotLevel<elem_iterator_imp> p(level);
  return element_iterator(_elements.begin(), _elements.end(), p);
}
ParallelMesh::const_element_iterator libMesh::ParallelMesh::not_level_elements_begin ( const unsigned int  level) const [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 421 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotLevel<const_elem_iterator_imp> p(level);
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}
ParallelMesh::element_iterator libMesh::ParallelMesh::not_level_elements_end ( const unsigned int  level) [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 664 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotLevel<elem_iterator_imp> p(level);
  return element_iterator(_elements.end(), _elements.end(), p);
}
ParallelMesh::const_element_iterator libMesh::ParallelMesh::not_level_elements_end ( const unsigned int  level) const [virtual, inherited]

Implements libMesh::MeshBase.

Definition at line 909 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotLevel<const_elem_iterator_imp> p(level);
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 869 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::NotLocal<const_elem_iterator_imp> p(this->processor_id());
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 97 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotSubActive<elem_iterator_imp> p;
  return element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 341 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotSubActive<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 584 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotSubActive<elem_iterator_imp> p;
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 829 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::NotSubActive<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.end(), _elements.end(), p);
}
dof_id_type libMesh::ParallelMesh::parallel_n_elem ( ) const [virtual, inherited]

Returns the number of elements in the mesh. The parallel_n_elem() function returns a newly calculated parallel-synchronized value on distributed meshes, and so must be called in parallel only.

Implements libMesh::MeshBase.

Definition at line 165 of file parallel_mesh.C.

References libMesh::ParallelObject::comm(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_unpartitioned_elem(), and libMesh::Parallel::Communicator::sum().

Referenced by libMesh::ParallelMesh::allgather(), libMesh::ParallelMesh::delete_remote_elements(), libMesh::ParallelMesh::renumber_nodes_and_elements(), and libMesh::ParallelMesh::update_parallel_id_counts().

{
  // This function must be run on all processors at once
  parallel_object_only();

  dof_id_type n_local = this->n_local_elem();
  this->comm().sum(n_local);
  n_local += this->n_unpartitioned_elem();
  return n_local;
}
dof_id_type libMesh::ParallelMesh::parallel_n_nodes ( ) const [virtual, inherited]

Returns the number of nodes in the mesh. This function and others must be defined in derived classes since the MeshBase class has no specific storage for nodes or elements. The parallel_n_nodes() function returns a newly calculated parallel-synchronized value on distributed meshes, and so must be called in parallel only.

Implements libMesh::MeshBase.

Definition at line 191 of file parallel_mesh.C.

References libMesh::ParallelObject::comm(), libMesh::MeshBase::n_local_nodes(), libMesh::MeshBase::n_unpartitioned_nodes(), and libMesh::Parallel::Communicator::sum().

Referenced by libMesh::ParallelMesh::allgather(), libMesh::ParallelMesh::delete_remote_elements(), libMesh::ParallelMesh::renumber_nodes_and_elements(), and libMesh::ParallelMesh::update_parallel_id_counts().

{
  // This function must be run on all processors at once
  parallel_object_only();

  dof_id_type n_local = this->n_local_nodes();
  this->comm().sum(n_local);
  n_local += this->n_unpartitioned_nodes();
  return n_local;
}
void libMesh::MeshBase::partition ( const unsigned int  n_parts) [virtual, inherited]

Call the default partitioner (currently metis_partition()).

Definition at line 361 of file mesh_base.C.

References libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::MeshBase::n_unpartitioned_elem(), libMesh::MeshBase::partitioner(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::Partitioner::set_node_processor_ids(), libMesh::MeshBase::skip_partitioning(), and libMesh::MeshBase::update_post_partitioning().

{
  // If we get here and we have unpartitioned elements, we need that
  // fixed.
  if (this->n_unpartitioned_elem() > 0)
    {
      libmesh_assert (partitioner().get());
      libmesh_assert (this->is_serial());
      partitioner()->partition (*this, n_parts);
    }
  // NULL partitioner means don't repartition
  // Non-serial meshes may not be ready for repartitioning here.
  else if(!skip_partitioning() &&
          partitioner().get() &&
          this->is_serial())
    {
      partitioner()->partition (*this, n_parts);
    }
  else
    {
      // Adaptive coarsening may have "orphaned" nodes on processors
      // whose elements no longer share them.  We need to check for
      // and possibly fix that.
      Partitioner::set_node_processor_ids(*this);

      // Make sure locally cached partition count
      this->recalculate_n_partitions();

      // Make sure any other locally cached data is correct
      this->update_post_partitioning();
    }
}

Implements libMesh::MeshBase.

Definition at line 451 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::PID<const_elem_iterator_imp> p(proc_id);
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 694 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

Referenced by libMesh::ParallelMesh::unpartitioned_elements_end().

{
  Predicates::PID<elem_iterator_imp> p(proc_id);
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 938 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::PID<const_elem_iterator_imp> p(proc_id);
  return const_element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1041 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::PID<node_iterator_imp> p(proc_id);
  return node_iterator(_nodes.begin(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1081 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::PID<const_node_iterator_imp> p(proc_id);
  return const_node_iterator(_nodes.begin(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1121 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::PID<node_iterator_imp> p(proc_id);
  return node_iterator(_nodes.end(), _nodes.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 1161 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_nodes, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::PID<const_node_iterator_imp> p(proc_id);
  return const_node_iterator(_nodes.end(), _nodes.end(), p);
}
const Point & libMesh::ParallelMesh::point ( const dof_id_type  i) const [virtual, inherited]

Return a constant reference (for reading only) to the $ i^{th} $ point, which should be present in this processor's subset of the mesh data structure.

Implements libMesh::MeshBase.

Definition at line 217 of file parallel_mesh.C.

References libMesh::ParallelMesh::_nodes, and libMesh::libmesh_assert().

{
  libmesh_assert(_nodes[i]);
  libmesh_assert_equal_to (_nodes[i]->id(), i);

  return (*_nodes[i]);
}
const PointLocatorBase & libMesh::MeshBase::point_locator ( ) const [inherited]

returns a pointer to a PointLocatorBase object for this mesh, constructing a master PointLocator first if necessary. This should never be used in threaded or non-parallel_only code, and so is deprecated.

Definition at line 417 of file mesh_base.C.

References libMesh::MeshBase::_point_locator, libMesh::PointLocatorBase::build(), libMesh::Threads::in_threads, libMesh::libmesh_assert(), and libMesh::TREE_ELEMENTS.

{
  libmesh_deprecated();

  if (_point_locator.get() == NULL)
    {
      // PointLocator construction may not be safe within threads
      libmesh_assert(!Threads::in_threads);

      _point_locator.reset (PointLocatorBase::build(TREE_ELEMENTS, *this).release());
    }

  return *_point_locator;
}
void libMesh::MeshBase::prepare_for_use ( const bool  skip_renumber_nodes_and_elements = false,
const bool  skip_find_neighbors = false 
) [inherited]

Prepare a newly created (or read) mesh for use. This involves 4 steps: 1.) call find_neighbors() 2.) call partition() 3.) call renumber_nodes_and_elements() 4.) call cache_elem_dims()

The argument to skip renumbering is now deprecated - to prevent a mesh from being renumbered, set allow_renumbering(false).

Definition at line 124 of file mesh_base.C.

References libMesh::MeshBase::_is_prepared, libMesh::MeshBase::_skip_renumber_nodes_and_elements, libMesh::MeshBase::allow_renumbering(), libMesh::MeshBase::assign_unique_ids(), libMesh::MeshBase::cache_elem_dims(), libMesh::MeshBase::clear_point_locator(), libMesh::ParallelObject::comm(), libMesh::MeshBase::delete_remote_elements(), libMesh::MeshBase::find_neighbors(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::MeshBase::partition(), libMesh::MeshBase::renumber_nodes_and_elements(), libMesh::MeshBase::update_parallel_id_counts(), and libMesh::Parallel::verify().

Referenced by libMesh::UnstructuredMesh::all_first_order(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Subdivision::all_subdivision(), libMesh::MeshTools::Modification::all_tri(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::MeshRefinement::coarsen_elements(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTools::Modification::flatten(), libMesh::MeshTools::Subdivision::prepare_subdivision_mesh(), libMesh::GMVIO::read(), libMesh::UnstructuredMesh::read(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::SerialMesh::stitching_helper(), libMesh::BoundaryInfo::sync(), libMesh::MeshRefinement::uniformly_coarsen(), and libMesh::MeshRefinement::uniformly_refine().

{
  parallel_object_only();

  libmesh_assert(this->comm().verify(this->is_serial()));

  // A distributed mesh may have processors with no elements (or
  // processors with no elements of higher dimension, if we ever
  // support mixed-dimension meshes), but we want consistent
  // mesh_dimension anyways.
  //
  // cache_elem_dims() should get the elem_dimensions() and
  // mesh_dimension() correct later, and we don't need it earlier.


  // Renumber the nodes and elements so that they in contiguous
  // blocks.  By default, _skip_renumber_nodes_and_elements is false.
  //
  // We may currently change that by passing
  // skip_renumber_nodes_and_elements==true to this function, but we
  // should use the allow_renumbering() accessor instead.
  //
  // Instances where you if prepare_for_use() should not renumber the nodes
  // and elements include reading in e.g. an xda/r or gmv file. In
  // this case, the ordering of the nodes may depend on an accompanying
  // solution, and the node ordering cannot be changed.

  if (skip_renumber_nodes_and_elements)
    {
      libmesh_deprecated();
      this->allow_renumbering(false);
    }

  // Mesh modification operations might not leave us with consistent
  // id counts, but our partitioner might need that consistency.
  if(!_skip_renumber_nodes_and_elements)
    this->renumber_nodes_and_elements();
  else
    this->update_parallel_id_counts();

  // Let all the elements find their neighbors
  if(!skip_find_neighbors)
    this->find_neighbors();

  // Partition the mesh.
  this->partition();

  // If we're using ParallelMesh, we'll want it parallelized.
  this->delete_remote_elements();

#ifdef LIBMESH_ENABLE_UNIQUE_ID
  // Assign DOF object unique ids
  this->assign_unique_ids();
#endif

  if(!_skip_renumber_nodes_and_elements)
    this->renumber_nodes_and_elements();

  // Search the mesh for all the dimensions of the elements
  // and cache them.
  this->cache_elem_dims();

  // Reset our PointLocator.  This needs to happen any time the elements
  // in the underlying elements in the mesh have changed, so we do it here.
  this->clear_point_locator();

  // The mesh is now prepared for use.
  _is_prepared = true;
}
void libMesh::MeshBase::print_info ( std::ostream &  os = libMesh::out) const [inherited]

Prints relevant information about the mesh.

Definition at line 347 of file mesh_base.C.

References libMesh::MeshBase::get_info().

Referenced by libMesh::InfElemBuilder::build_inf_elem(), and libMesh::operator<<().

{
  os << this->get_info()
     << 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(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMap::n_local_dofs(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::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(), libMesh::BoundaryInfo::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()); }
const Elem * libMesh::ParallelMesh::query_elem ( const dof_id_type  i) const [virtual, inherited]

Return a pointer to the $ i^{th} $ element, or NULL if no such element exists in this processor's mesh data structure.

Implements libMesh::MeshBase.

Definition at line 327 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), libMesh::DofObject::id(), and libMesh::libmesh_assert().

{
  std::map<dof_id_type, Elem*>::const_iterator it = _elements.find(i);
  if (it != _elements.end().it)
    {
      const Elem* e = it->second;
      libmesh_assert (!e || e->id() == i);
      return e;
    }

  return NULL;
}
Elem * libMesh::ParallelMesh::query_elem ( const dof_id_type  i) [virtual, inherited]

Return a writeable pointer to the $ i^{th} $ element, or NULL if no such element exists in this processor's mesh data structure.

Implements libMesh::MeshBase.

Definition at line 343 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), libMesh::DofObject::id(), and libMesh::libmesh_assert().

{
  std::map<dof_id_type, Elem*>::const_iterator it = _elements.find(i);
  if (it != _elements.end().it)
    {
      Elem* e = _elements[i];
      libmesh_assert (!e || e->id() == i);
      return e;
    }

  return NULL;
}
const Node * libMesh::ParallelMesh::query_node_ptr ( const dof_id_type  i) const [virtual, inherited]

Return a pointer to the $ i^{th} $ node, or NULL if no such node exists in this processor's mesh data structure.

Implements libMesh::MeshBase.

Definition at line 273 of file parallel_mesh.C.

References libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::end(), libMesh::DofObject::id(), and libMesh::libmesh_assert().

{
  std::map<dof_id_type, Node*>::const_iterator it = _nodes.find(i);
  if (it != _nodes.end().it)
    {
      const Node* n = it->second;
      libmesh_assert (!n || n->id() == i);
      return n;
    }

  return NULL;
}
Node * libMesh::ParallelMesh::query_node_ptr ( const dof_id_type  i) [virtual, inherited]

Return a writeable pointer to the $ i^{th} $ node, or NULL if no such node exists in this processor's mesh data structure.

Implements libMesh::MeshBase.

Definition at line 289 of file parallel_mesh.C.

References libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::end(), libMesh::DofObject::id(), and libMesh::libmesh_assert().

{
  std::map<dof_id_type, Node*>::const_iterator it = _nodes.find(i);
  if (it != _nodes.end().it)
    {
      Node* n = it->second;
      libmesh_assert (!n || n->id() == i);
      return n;
    }

  return NULL;
}
void libMesh::UnstructuredMesh::read ( const std::string &  name,
MeshData mesh_data = NULL,
bool  skip_renumber_nodes_and_elements = false 
) [virtual, inherited]

Reads the file specified by name. Attempts to figure out the proper method by the file extension. This is now the only way to read a mesh. The UnstructuredMesh then initializes its data structures and is ready for use.

In order to read the UNV and TetGen file types, you must also pass a separate pointer to the MeshData object you will use with this mesh, since these read methods expect it.

The skip_renumber_nodes_and_elements argument is now deprecated - to disallow renumbering, set MeshBase::allow_renumbering(false)

Implements libMesh::MeshBase.

Definition at line 484 of file unstructured_mesh.C.

References libMesh::MeshBase::allow_renumbering(), libMesh::MeshBase::prepare_for_use(), libMesh::NameBasedIO::read(), libMesh::TetGenIO::read(), and libMesh::UNVIO::read().

{
  // Set the skip_renumber_nodes_and_elements flag on all processors
  // if necessary.
  // This ensures that renumber_nodes_and_elements is *not* called
  // during prepare_for_use() for certain types of mesh files.
  // This is required in cases where there is an associated solution
  // file which expects a certain ordering of the nodes.
  if(name.rfind(".gmv")+4==name.size())
    {
      skip_renumber_nodes_and_elements =  true;
    }

  if (mesh_data)
    {
      libmesh_deprecated();
      if (name.rfind(".unv") < name.size())
        UNVIO(*this, mesh_data).read (name);
      else if ((name.rfind(".node")  < name.size()) ||
               (name.rfind(".ele")   < name.size()))
        TetGenIO(*this,mesh_data).read (name);
    }
  else
    NameBasedIO(*this).read(name);

  if (skip_renumber_nodes_and_elements)
    {
      // Use MeshBase::allow_renumbering() yourself instead.
      libmesh_deprecated();
      this->allow_renumbering(false);
    }

  // Done reading the mesh.  Now prepare it for use.
  this->prepare_for_use();
}
unsigned int libMesh::MeshBase::recalculate_n_partitions ( ) [inherited]

In a few (very rare) cases, the user may have manually tagged the elements with specific processor IDs by hand, without using a partitioner. In this case, the Mesh will not know that the total number of partitions, _n_parts, has changed, unless you call this function. This is an O(N active elements) calculation. The return value is the number of partitions, and _n_parts is also set by this function.

Definition at line 394 of file mesh_base.C.

References libMesh::MeshBase::_n_parts, libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), libMesh::ParallelObject::comm(), end, std::max(), and libMesh::Parallel::Communicator::max().

Referenced by libMesh::MeshBase::partition().

{
  // This requires an inspection on every processor
  parallel_object_only();

  const_element_iterator el  = this->active_local_elements_begin();
  const_element_iterator end = this->active_local_elements_end();

  unsigned int max_proc_id=0;

  for (; el!=end; ++el)
    max_proc_id = std::max(max_proc_id, static_cast<unsigned int>((*el)->processor_id()));

  // The number of partitions is one more than the max processor ID.
  _n_parts = max_proc_id+1;

  this->comm().max(_n_parts);

  return _n_parts;
}
void libMesh::ParallelMesh::redistribute ( ) [virtual, inherited]

Redistribute elements between processors. This gets called automatically by the Partitioner, and is a no-op in the case of a serialized mesh.

Reimplemented from libMesh::MeshBase.

Definition at line 724 of file parallel_mesh.C.

References libMesh::ParallelMesh::is_serial(), libMesh::MeshCommunication::redistribute(), and libMesh::ParallelMesh::update_parallel_id_counts().

{
  // If this is a truly parallel mesh, go through the redistribution/gather/delete remote steps
  if (!this->is_serial())
    {
      // Construct a MeshCommunication object to actually redistribute the nodes
      // and elements according to the partitioner, and then to re-gather the neighbors.
      MeshCommunication mc;
      mc.redistribute(*this);

      this->update_parallel_id_counts();

      // Is this necessary?  If we are called from prepare_for_use(), this will be called
      // anyway... but users can always call partition directly, in which case we do need
      // to call delete_remote_elements()...
      //
      // Regardless of whether it's necessary, it isn't safe.  We
      // haven't communicated new node processor_ids yet, and we can't
      // delete nodes until we do.
      // this->delete_remote_elements();
    }
}
template<typename T >
dof_id_type libMesh::ParallelMesh::renumber_dof_objects ( mapvector< T *, dof_id_type > &  objects) [inherited]

Renumber a parallel objects container Returns the smallest globally unused id for that container.

Definition at line 857 of file parallel_mesh.C.

References libMesh::mapvector< Val, index_t >::begin(), libMesh::mapvector< Val, index_t >::end(), end, libMesh::mapvector< Val, index_t >::erase(), libMesh::DofObject::invalid_processor_id, libMesh::DofObject::invalid_unique_id, libMesh::libmesh_assert(), libMesh::n_processors(), libMesh::MeshTools::Subdivision::next, libMesh::processor_id(), and libMesh::Parallel::verify().

Referenced by libMesh::ParallelMesh::renumber_nodes_and_elements().

{
  // This function must be run on all processors at once
  parallel_object_only();

  typedef typename mapvector<T*,dof_id_type>::veclike_iterator object_iterator;

  // In parallel we may not know what objects other processors have.
  // Start by figuring out how many
  dof_id_type unpartitioned_objects = 0;

  std::vector<dof_id_type>
    ghost_objects_from_proc(this->n_processors(), 0);

  object_iterator it  = objects.begin();
  object_iterator end = objects.end();

  for (; it != end;)
    {
      T *obj = *it;

      // Remove any NULL container entries while we're here,
      // being careful not to invalidate our iterator
      if (!*it)
        objects.erase(it++);
      else
        {
          processor_id_type obj_procid = obj->processor_id();
          if (obj_procid == DofObject::invalid_processor_id)
            unpartitioned_objects++;
          else
            ghost_objects_from_proc[obj_procid]++;
          ++it;
        }
    }

  std::vector<dof_id_type> objects_on_proc(this->n_processors(), 0);
  this->comm().allgather(ghost_objects_from_proc[this->processor_id()],
                         objects_on_proc);

#ifndef NDEBUG
  libmesh_assert(this->comm().verify(unpartitioned_objects));
  for (processor_id_type p=0; p != this->n_processors(); ++p)
    libmesh_assert_less_equal (ghost_objects_from_proc[p], objects_on_proc[p]);
#endif

  // We'll renumber objects in blocks by processor id
  std::vector<dof_id_type> first_object_on_proc(this->n_processors());
  for (processor_id_type i=1; i != this->n_processors(); ++i)
    first_object_on_proc[i] = first_object_on_proc[i-1] +
      objects_on_proc[i-1];
  dof_id_type next_id = first_object_on_proc[this->processor_id()];
  dof_id_type first_free_id =
    first_object_on_proc[this->n_processors()-1] +
    objects_on_proc[this->n_processors()-1] +
    unpartitioned_objects;

  // First set new local object ids and build request sets
  // for non-local object ids

  // Request sets to send to each processor
  std::vector<std::vector<dof_id_type> >
    requested_ids(this->n_processors());

#ifdef LIBMESH_ENABLE_UNIQUE_ID
  std::vector<std::vector<unique_id_type> >
    requested_unique_ids(this->n_processors());
#endif

  // We know how many objects live on each processor, so reseve() space for
  // each.
  for (processor_id_type p=0; p != this->n_processors(); ++p)
    if (p != this->processor_id())
      {
        requested_ids[p].reserve(ghost_objects_from_proc[p]);
#ifdef LIBMESH_ENABLE_UNIQUE_ID
        requested_unique_ids[p].reserve(ghost_objects_from_proc[p]);
#endif
      }

  end = objects.end();
  for (it = objects.begin(); it != end; ++it)
    {
      T *obj = *it;
      if (obj->processor_id() == this->processor_id())
        obj->set_id(next_id++);
      else if (obj->processor_id() != DofObject::invalid_processor_id)
        {
          requested_ids[obj->processor_id()].push_back(obj->id());
#ifdef LIBMESH_ENABLE_UNIQUE_ID
          // It's possible to have an invalid id for dofs not owned by this process.
          // We'll assert that they match on the receiving end.
          requested_unique_ids[obj->processor_id()].push_back(obj->valid_unique_id() ? obj-> unique_id() : DofObject::invalid_unique_id);
#endif
        }
    }

  // Next set ghost object ids from other processors
  if (this->n_processors() > 1)
    {
      for (processor_id_type p=1; p != this->n_processors(); ++p)
        {
          // Trade my requests with processor procup and procdown
          processor_id_type procup = cast_int<processor_id_type>
            ((this->processor_id() + p) % this->n_processors());
          processor_id_type procdown = cast_int<processor_id_type>
            ((this->n_processors() + this->processor_id() - p) %
             this->n_processors());
          std::vector<dof_id_type> request_to_fill;
          this->comm().send_receive(procup, requested_ids[procup],
                                    procdown, request_to_fill);

#ifdef LIBMESH_ENABLE_UNIQUE_ID
          std::vector<unique_id_type> unique_request_to_fill;
          this->comm().send_receive(procup, requested_unique_ids[procup],
                                    procdown, unique_request_to_fill);
          std::vector<unique_id_type> new_unique_ids(unique_request_to_fill.size());
#endif

          // Fill those requests
          std::vector<dof_id_type> new_ids(request_to_fill.size());
          for (std::size_t i=0; i != request_to_fill.size(); ++i)
            {
              T *obj = objects[request_to_fill[i]];
              libmesh_assert(obj);
              libmesh_assert_equal_to (obj->processor_id(), this->processor_id());
              new_ids[i] = obj->id();
#ifdef LIBMESH_ENABLE_UNIQUE_ID
              new_unique_ids[i] = obj->valid_unique_id() ? obj->unique_id() : DofObject::invalid_unique_id;
#endif

              libmesh_assert_greater_equal (new_ids[i],
                                            first_object_on_proc[this->processor_id()]);
              libmesh_assert_less (new_ids[i],
                                   first_object_on_proc[this->processor_id()] +
                                   objects_on_proc[this->processor_id()]);
            }

          // Trade back the results
          std::vector<dof_id_type> filled_request;
          this->comm().send_receive(procdown, new_ids,
                                    procup, filled_request);

#ifdef LIBMESH_ENABLE_UNIQUE_ID
          std::vector<unique_id_type> unique_filled_request;
          this->comm().send_receive(procdown, new_unique_ids,
                                    procup, unique_filled_request);
#endif

          // And copy the id changes we've now been informed of
          for (std::size_t i=0; i != filled_request.size(); ++i)
            {
              T *obj = objects[requested_ids[procup][i]];
              libmesh_assert (obj);
              libmesh_assert_equal_to (obj->processor_id(), procup);
              libmesh_assert_greater_equal (filled_request[i],
                                            first_object_on_proc[procup]);
              libmesh_assert_less (filled_request[i],
                                   first_object_on_proc[procup] +
                                   objects_on_proc[procup]);
              obj->set_id(filled_request[i]);

#ifdef LIBMESH_ENABLE_UNIQUE_ID
              if (!obj->valid_unique_id() && unique_filled_request[i] != DofObject::invalid_unique_id)
                obj->set_unique_id() = unique_filled_request[i];
#endif
            }
        }
    }

  // Next set unpartitioned object ids
  next_id = 0;
  for (processor_id_type i=0; i != this->n_processors(); ++i)
    next_id += objects_on_proc[i];
  for (it = objects.begin(); it != end; ++it)
    {
      T *obj = *it;
      if (obj->processor_id() == DofObject::invalid_processor_id)
        obj->set_id(next_id++);
    }

  // Finally shuffle around objects so that container indices
  // match ids
  end = objects.end();
  for (it = objects.begin(); it != end;)
    {
      T *obj = *it;
      if (obj) // don't try shuffling already-NULL entries
        {
          T *next = objects[obj->id()];
          // If we have to move this object
          if (next != obj)
            {
              // NULL out its original position for now
              // (our shuffling may put another object there shortly)
              *it = NULL;

              // There may already be another object with this id that
              // needs to be moved itself
              while (next)
                {
                  // We shouldn't be trying to give two objects the
                  // same id
                  libmesh_assert_not_equal_to (next->id(), obj->id());
                  objects[obj->id()] = obj;
                  obj = next;
                  next = objects[obj->id()];
                }
              objects[obj->id()] = obj;
            }
        }
      // Remove any container entries that were left as NULL,
      // being careful not to invalidate our iterator
      if (!*it)
        objects.erase(it++);
      else
        ++it;
    }

  return first_free_id;
}
void libMesh::ParallelMesh::renumber_elem ( dof_id_type  old_id,
dof_id_type  new_id 
) [virtual, inherited]

Changes the id of element old_id, both by changing elem(old_id)->id() and by moving elem(old_id) in the mesh's internal container. No element with the id new_id should already exist.

Implements libMesh::MeshBase.

Definition at line 494 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::erase(), libMesh::DofObject::id(), libMesh::libmesh_assert(), and libMesh::DofObject::set_id().

{
  Elem *el = _elements[old_id];
  libmesh_assert (el);
  libmesh_assert_equal_to (el->id(), old_id);

  el->set_id(new_id);
  libmesh_assert (!_elements[new_id]);
  _elements[new_id] = el;
  _elements.erase(old_id);
}
void libMesh::ParallelMesh::renumber_node ( dof_id_type  old_id,
dof_id_type  new_id 
) [virtual, inherited]

Changes the id of node old_id, both by changing node(old_id)->id() and by moving node(old_id) in the mesh's internal container. No element with the id new_id should already exist.

Implements libMesh::MeshBase.

Definition at line 659 of file parallel_mesh.C.

References libMesh::ParallelMesh::_nodes, libMesh::mapvector< Val, index_t >::erase(), libMesh::DofObject::id(), libMesh::libmesh_assert(), and libMesh::DofObject::set_id().

{
  Node *nd = _nodes[old_id];
  libmesh_assert (nd);
  libmesh_assert_equal_to (nd->id(), old_id);

  nd->set_id(new_id);
  libmesh_assert (!_nodes[new_id]);
  _nodes[new_id] = nd;
  _nodes.erase(old_id);
}

Remove NULL elements from arrays

Implements libMesh::MeshBase.

Definition at line 1080 of file parallel_mesh.C.

References libMesh::ParallelMesh::_elements, libMesh::ParallelMesh::_n_elem, libMesh::ParallelMesh::_n_nodes, libMesh::ParallelMesh::_nodes, libMesh::MeshBase::_skip_renumber_nodes_and_elements, libMesh::mapvector< Val, index_t >::begin(), libMesh::ParallelMesh::elements_begin(), libMesh::ParallelMesh::elements_end(), libMesh::mapvector< Val, index_t >::end(), end, libMesh::mapvector< Val, index_t >::erase(), libMesh::MeshBase::get_boundary_info(), libMesh::DofObject::id(), libMesh::MeshTools::libmesh_assert_valid_elem_ids(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_flags(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_ids(), libMesh::ParallelMesh::max_elem_id(), libMesh::ParallelMesh::max_node_id(), libMesh::ParallelMesh::n_elem(), libMesh::ParallelMesh::n_nodes(), libMesh::Elem::n_nodes(), libMesh::Elem::node(), libMesh::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::parallel_max_node_id(), libMesh::ParallelMesh::parallel_n_elem(), libMesh::ParallelMesh::parallel_n_nodes(), libMesh::BoundaryInfo::remove(), libMesh::ParallelMesh::renumber_dof_objects(), libMesh::START_LOG(), and libMesh::ParallelMesh::update_parallel_id_counts().

{
  parallel_object_only();

  if (_skip_renumber_nodes_and_elements)
    {
      this->update_parallel_id_counts();
      return;
    }

  START_LOG("renumber_nodes_and_elements()", "ParallelMesh");

#ifdef DEBUG
  // Make sure our ids and flags are consistent
  this->libmesh_assert_valid_parallel_ids();
  this->libmesh_assert_valid_parallel_flags();
#endif

  std::set<dof_id_type> used_nodes;

  // flag the nodes we need
  {
    element_iterator  it = elements_begin();
    element_iterator end = elements_end();

    for (; it != end; ++it)
      {
        Elem *el = *it;

        for (unsigned int n=0; n != el->n_nodes(); ++n)
          used_nodes.insert(el->node(n));
      }
  }

  // Nodes not connected to any local elements, and NULL node entries
  // in our container, are deleted
  {
    node_iterator_imp  it = _nodes.begin();
    node_iterator_imp end = _nodes.end();

    for (; it != end;)
      {
        Node *nd = *it;
        if (!nd)
          _nodes.erase(it++);
        else if (!used_nodes.count(nd->id()))
          {
            // remove any boundary information associated with
            // this node
            this->get_boundary_info().remove (nd);

            // delete the node
            delete nd;

            _nodes.erase(it++);
          }
        else
          ++it;
      }
  }

  // Finally renumber all the elements
  _n_elem = this->renumber_dof_objects (this->_elements);

  // and all the remaining nodes
  _n_nodes = this->renumber_dof_objects (this->_nodes);

  // And figure out what IDs we should use when adding new nodes and
  // new elements
  this->update_parallel_id_counts();

  // Make sure our caches are up to date and our
  // DofObjects are well packed
#ifdef DEBUG
  libmesh_assert_equal_to (this->n_nodes(), this->parallel_n_nodes());
  libmesh_assert_equal_to (this->n_elem(), this->parallel_n_elem());
  const dof_id_type pmax_node_id = this->parallel_max_node_id();
  const dof_id_type pmax_elem_id = this->parallel_max_elem_id();
  libmesh_assert_equal_to (this->max_node_id(), pmax_node_id);
  libmesh_assert_equal_to (this->max_elem_id(), pmax_elem_id);
  libmesh_assert_equal_to (this->n_nodes(), this->max_node_id());
  libmesh_assert_equal_to (this->n_elem(), this->max_elem_id());

  // Make sure our ids and flags are consistent
  this->libmesh_assert_valid_parallel_ids();
  this->libmesh_assert_valid_parallel_flags();

  // And make sure we've made our numbering monotonic
  MeshTools::libmesh_assert_valid_elem_ids(*this);
#endif

  STOP_LOG("renumber_nodes_and_elements()", "ParallelMesh");
}
virtual void libMesh::ParallelMesh::reserve_elem ( const dof_id_type  ne) [inline, virtual, inherited]

Reserves space for a known number of elements. Note that this method may or may not do anything, depending on the actual Mesh implementation. If you know the number of elements you will add and call this method before repeatedly calling add_point() the implementation will be more efficient.

Implements libMesh::MeshBase.

Definition at line 188 of file parallel_mesh.h.

{ }
virtual void libMesh::ParallelMesh::reserve_nodes ( const dof_id_type  nn) [inline, virtual, inherited]

Reserves space for a known number of nodes. Note that this method may or may not do anything, depending on the actual Mesh implementation. If you know the number of nodes you will add and call this method before repeatedly calling add_point() the implementation will be more efficient.

Implements libMesh::MeshBase.

Definition at line 184 of file parallel_mesh.h.

{ }

Implements libMesh::MeshBase.

Definition at line 604 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::SemiLocal<elem_iterator_imp> p(this->processor_id());
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 849 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::end(), and libMesh::ParallelObject::processor_id().

{
  Predicates::SemiLocal<const_elem_iterator_imp> p(this->processor_id());
  return const_element_iterator(_elements.end(), _elements.end(), p);
}
unsigned int& libMesh::MeshBase::set_n_partitions ( ) [inline, protected, inherited]

Returns a writeable reference to the number of partitions.

Definition at line 898 of file mesh_base.h.

References libMesh::MeshBase::_n_parts.

Referenced by libMesh::Partitioner::partition(), libMesh::Partitioner::repartition(), and libMesh::BoundaryInfo::sync().

  { return _n_parts; }
void libMesh::MeshBase::set_next_unique_id ( unique_id_type  id) [inline, inherited]

Sets the next unique id to be used.

Definition at line 235 of file mesh_base.h.

References libMesh::MeshBase::_next_unique_id.

{ _next_unique_id = id; }
std::map<subdomain_id_type, std::string>& libMesh::MeshBase::set_subdomain_name_map ( ) [inline, inherited]

Return a writeable reference to the whole subdomain name map

Definition at line 860 of file mesh_base.h.

References libMesh::MeshBase::_block_id_to_name.

Referenced by libMesh::XdrIO::read_serialized_subdomain_names(), and libMesh::CheckpointIO::read_subdomain_names().

  { return _block_id_to_name; }
void libMesh::MeshBase::skip_partitioning ( bool  skip) [inline, inherited]

If true is passed in then this mesh will no longer be (re)partitioned. It would probably be a bad idea to call this on a Serial Mesh _before_ the first partitioning has happened... because no elements would get assigned to your processor pool.

Note that turning on skip_partitioning() can have adverse effects on your performance when using AMR... ie you could get large load imbalances.

However you might still want to use this if the communication and computation of the rebalance and repartition is too high for your application.

Definition at line 566 of file mesh_base.h.

References libMesh::MeshBase::_skip_partitioning.

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

{ _skip_partitioning = skip; }
bool libMesh::MeshBase::skip_partitioning ( ) const [inline, inherited]

Definition at line 567 of file mesh_base.h.

References libMesh::MeshBase::_skip_partitioning.

Referenced by libMesh::MeshBase::partition().

{ return _skip_partitioning; }
unsigned int libMesh::MeshBase::spatial_dimension ( ) const [inline, inherited]

Returns the spatial dimension of the mesh. Note that this is defined at compile time in the header libmesh_common.h.

Definition at line 182 of file mesh_base.h.

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::MeshBase::get_info(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::UNVIO::nodes_out(), libMesh::MeshTools::Modification::scale(), libMesh::MeshTools::subdomain_bounding_box(), and libMesh::Nemesis_IO_Helper::write_exodus_initialization_info().

  { return cast_int<unsigned int>(LIBMESH_DIM); }
UniquePtr< PointLocatorBase > libMesh::MeshBase::sub_point_locator ( ) const [inherited]

returns a pointer to a subordinate PointLocatorBase object for this mesh, constructing a master PointLocator first if necessary. This should not be used in threaded or non-parallel_only code unless the master has already been constructed.

Definition at line 433 of file mesh_base.C.

References libMesh::MeshBase::_point_locator, libMesh::PointLocatorBase::build(), libMesh::Threads::in_threads, libMesh::libmesh_assert(), and libMesh::TREE_ELEMENTS.

Referenced by libMesh::DofMap::create_dof_constraints(), libMesh::MeshFunction::init(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::SerialMesh::stitching_helper(), and libMesh::MeshRefinement::test_level_one().

{
  // If there's no master point locator, then we need one.
  if (_point_locator.get() == NULL)
    {
      // PointLocator construction may not be safe within threads
      libmesh_assert(!Threads::in_threads);

      // And it may require parallel communication
      parallel_object_only();

      _point_locator.reset (PointLocatorBase::build(TREE_ELEMENTS, *this).release());
    }

  // Otherwise there was a master point locator, and we can grab a
  // sub-locator easily.
  return PointLocatorBase::build(TREE_ELEMENTS, *this, _point_locator.get());
}

Implements libMesh::MeshBase.

Definition at line 87 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::SubActive<elem_iterator_imp> p;
  return element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 331 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::SubActive<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 574 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::SubActive<elem_iterator_imp> p;
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 819 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::SubActive<const_elem_iterator_imp> p;
  return const_element_iterator(_elements.end(), _elements.end(), p);
}
void libMesh::MeshBase::subdomain_ids ( std::set< subdomain_id_type > &  ids) const [inherited]

Constructs a list of all subdomain identifiers in the global mesh. Subdomains correspond to separate subsets of the mesh which could correspond e.g. to different materials in a solid mechanics application, or regions where different physical processes are important. The subdomain mapping is independent from the parallel decomposition.

Definition at line 216 of file mesh_base.C.

References libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), libMesh::ParallelObject::comm(), end, and libMesh::Parallel::Communicator::set_union().

Referenced by libMesh::MeshBase::n_subdomains(), and libMesh::TecplotIO::TecplotIO().

{
  // This requires an inspection on every processor
  parallel_object_only();

  ids.clear();

  const_element_iterator el  = this->active_local_elements_begin();
  const_element_iterator end = this->active_local_elements_end();

  for (; el!=end; ++el)
    ids.insert((*el)->subdomain_id());

  // Some subdomains may only live on other processors
  this->comm().set_union(ids);
}
const std::string & libMesh::MeshBase::subdomain_name ( subdomain_id_type  id) const [inherited]

Definition at line 466 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name.

{
  // An empty string to return when no matching subdomain name is found
  static const std::string empty;

  std::map<subdomain_id_type, std::string>::const_iterator iter = _block_id_to_name.find(id);
  if (iter == _block_id_to_name.end())
    return empty;
  else
    return iter->second;
}

Implements libMesh::MeshBase.

Definition at line 217 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Type<elem_iterator_imp> p(type);
  return element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 461 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, libMesh::mapvector< Val, index_t >::begin(), and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Type<const_elem_iterator_imp> p(type);
  return const_element_iterator(_elements.begin(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 704 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Type<elem_iterator_imp> p(type);
  return element_iterator(_elements.end(), _elements.end(), p);
}

Implements libMesh::MeshBase.

Definition at line 948 of file parallel_mesh_iterators.C.

References libMesh::ParallelMesh::_elements, and libMesh::mapvector< Val, index_t >::end().

{
  Predicates::Type<const_elem_iterator_imp> p(type);
  return const_element_iterator(_elements.end(), _elements.end(), p);
}
void libMesh::ParallelMesh::update_parallel_id_counts ( ) [virtual, inherited]

Updates parallel caches so that methods like n_elem() accurately reflect changes on other processors

Implements libMesh::MeshBase.

Definition at line 133 of file parallel_mesh.C.

References libMesh::ParallelMesh::_max_elem_id, libMesh::ParallelMesh::_max_node_id, libMesh::ParallelMesh::_n_elem, libMesh::ParallelMesh::_n_nodes, libMesh::ParallelMesh::_next_free_local_elem_id, libMesh::ParallelMesh::_next_free_local_node_id, libMesh::ParallelMesh::_next_free_unpartitioned_elem_id, libMesh::ParallelMesh::_next_free_unpartitioned_node_id, libMesh::ParallelObject::n_processors(), libMesh::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::parallel_max_node_id(), libMesh::ParallelMesh::parallel_n_elem(), libMesh::ParallelMesh::parallel_n_nodes(), and libMesh::ParallelObject::processor_id().

Referenced by libMesh::ParallelMesh::delete_remote_elements(), libMesh::ParallelMesh::ParallelMesh(), libMesh::ParallelMesh::redistribute(), libMesh::ParallelMesh::renumber_nodes_and_elements(), and libMesh::ParallelMesh::update_post_partitioning().

{
  // This function must be run on all processors at once
  parallel_object_only();

  _n_elem  = this->parallel_n_elem();
  _n_nodes = this->parallel_n_nodes();
  _max_node_id = this->parallel_max_node_id();
  _max_elem_id = this->parallel_max_elem_id();

  if (_next_free_unpartitioned_elem_id < _max_elem_id)
    _next_free_unpartitioned_elem_id =
      ((_max_elem_id-1) / (this->n_processors() + 1) + 1) *
      (this->n_processors() + 1) + this->n_processors();
  if (_next_free_local_elem_id < _max_elem_id)
    _next_free_local_elem_id =
      ((_max_elem_id + this->n_processors() - 1) / (this->n_processors() + 1) + 1) *
      (this->n_processors() + 1) + this->processor_id();

  if (_next_free_unpartitioned_node_id < _max_node_id)
    _next_free_unpartitioned_node_id =
      ((_max_node_id-1) / (this->n_processors() + 1) + 1) *
      (this->n_processors() + 1) + this->n_processors();
  if (_next_free_local_node_id < _max_node_id)
    _next_free_local_node_id =
      ((_max_node_id + this->n_processors() - 1) / (this->n_processors() + 1) + 1) *
      (this->n_processors() + 1) + this->processor_id();
}
void libMesh::ParallelMesh::update_post_partitioning ( ) [virtual, inherited]

Recalculate cached data after elements and nodes have been repartitioned.

Reimplemented from libMesh::MeshBase.

Definition at line 749 of file parallel_mesh.C.

References libMesh::ParallelMesh::update_parallel_id_counts().

{
  // this->recalculate_n_partitions();

  // Partitioning changes our numbers of unpartitioned objects
  this->update_parallel_id_counts();
}
void libMesh::UnstructuredMesh::write ( const std::string &  name,
MeshData mesh_data = NULL 
) [virtual, inherited]

Write the file specified by name. Attempts to figure out the proper method by the file extension.

In order to write the UNV and TetGen file types, you must also pass a separate pointer to the MeshData object you have been using with this mesh, since these write methods expect it.

Implements libMesh::MeshBase.

Definition at line 524 of file unstructured_mesh.C.

References libMesh::START_LOG(), libMesh::NameBasedIO::write(), and libMesh::UNVIO::write().

{
  START_LOG("write()", "Mesh");

  if (mesh_data)
    {
      libmesh_deprecated();
      if (name.rfind(".unv") < name.size())
        UNVIO(*this, mesh_data).write (name);
      else
        libmesh_error_msg("Only UNV output supports MeshData");
    }

  NameBasedIO(*this).write(name);

  STOP_LOG("write()", "Mesh");
}
void libMesh::UnstructuredMesh::write ( const std::string &  name,
const std::vector< Number > &  values,
const std::vector< std::string > &  variable_names 
) [inherited]

Write to the file specified by name. Attempts to figure out the proper method by the file extension. Also writes data.

Definition at line 545 of file unstructured_mesh.C.

References libMesh::START_LOG(), and libMesh::NameBasedIO::write_nodal_data().

{
  START_LOG("write()", "Mesh");

  NameBasedIO(*this).write_nodal_data(name, v, vn);

  STOP_LOG("write()", "Mesh");
}

Friends And Related Function Documentation

friend class BoundaryInfo [friend, inherited]

Make the BoundaryInfo class a friend so that it can create and interact with BoundaryMesh.

Definition at line 983 of file mesh_base.h.

friend class MeshInput< MeshBase > [friend, inherited]

The MeshInput classes are friends so that they can set the number of partitions.

Definition at line 977 of file mesh_base.h.

std::ostream& operator<< ( std::ostream &  os,
const MeshBase m 
) [friend, inherited]

Equivalent to calling print_info() above, but now you can write: Mesh mesh; libMesh::out << mesh << std::endl;

Definition at line 354 of file mesh_base.C.

{
  m.print_info(os);
  return os;
}
friend class Partitioner [friend, inherited]

The partitioner class is a friend so that it can set the number of partitions.

Definition at line 971 of file mesh_base.h.


Member Data Documentation

std::map<subdomain_id_type, std::string> libMesh::MeshBase::_block_id_to_name [protected, inherited]

This structure maintains the mapping of named blocks for file formats that support named blocks. Currently this is only implemented for ExodusII

Definition at line 958 of file mesh_base.h.

Referenced by libMesh::MeshBase::get_id_by_name(), libMesh::MeshBase::get_subdomain_name_map(), libMesh::MeshBase::set_subdomain_name_map(), and libMesh::MeshBase::subdomain_name().

std::set<unsigned char> libMesh::MeshBase::_elem_dims [protected, inherited]

We cache the dimension of the elements present in the mesh. So, if we have a mesh with 1D and 2D elements, this structure will contain 1 and 2.

Definition at line 965 of file mesh_base.h.

Referenced by libMesh::MeshBase::cache_elem_dims(), libMesh::MeshBase::clear(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::MeshBase::elem_dimensions(), libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::MeshBase(), and libMesh::MeshBase::set_mesh_dimension().

The elements in the mesh.

Definition at line 445 of file parallel_mesh.h.

Referenced by libMesh::ParallelMesh::active_elements_begin(), libMesh::ParallelMesh::active_elements_end(), libMesh::ParallelMesh::active_local_elements_begin(), libMesh::ParallelMesh::active_local_elements_end(), libMesh::ParallelMesh::active_local_subdomain_elements_begin(), libMesh::ParallelMesh::active_local_subdomain_elements_end(), libMesh::ParallelMesh::active_not_local_elements_begin(), libMesh::ParallelMesh::active_not_local_elements_end(), libMesh::ParallelMesh::active_pid_elements_begin(), libMesh::ParallelMesh::active_pid_elements_end(), libMesh::ParallelMesh::active_subdomain_elements_begin(), libMesh::ParallelMesh::active_subdomain_elements_end(), libMesh::ParallelMesh::active_type_elements_begin(), libMesh::ParallelMesh::active_type_elements_end(), libMesh::ParallelMesh::add_elem(), libMesh::ParallelMesh::ancestor_elements_begin(), libMesh::ParallelMesh::ancestor_elements_end(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::ParallelMesh::clear(), libMesh::ParallelMesh::delete_elem(), libMesh::ParallelMesh::delete_remote_elements(), libMesh::ParallelMesh::elem(), libMesh::ParallelMesh::elements_begin(), libMesh::ParallelMesh::elements_end(), libMesh::ParallelMesh::facelocal_elements_begin(), libMesh::ParallelMesh::facelocal_elements_end(), libMesh::ParallelMesh::fix_broken_node_and_element_numbering(), libMesh::ParallelMesh::insert_elem(), libMesh::ParallelMesh::level_elements_begin(), libMesh::ParallelMesh::level_elements_end(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_flags(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_ids(), libMesh::ParallelMesh::local_elements_begin(), libMesh::ParallelMesh::local_elements_end(), libMesh::ParallelMesh::local_level_elements_begin(), libMesh::ParallelMesh::local_level_elements_end(), libMesh::ParallelMesh::local_not_level_elements_begin(), libMesh::ParallelMesh::local_not_level_elements_end(), libMesh::ParallelMesh::not_active_elements_begin(), libMesh::ParallelMesh::not_active_elements_end(), libMesh::ParallelMesh::not_ancestor_elements_begin(), libMesh::ParallelMesh::not_ancestor_elements_end(), libMesh::ParallelMesh::not_level_elements_begin(), libMesh::ParallelMesh::not_level_elements_end(), libMesh::ParallelMesh::not_local_elements_begin(), libMesh::ParallelMesh::not_local_elements_end(), libMesh::ParallelMesh::not_subactive_elements_begin(), libMesh::ParallelMesh::not_subactive_elements_end(), libMesh::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::pid_elements_begin(), libMesh::ParallelMesh::pid_elements_end(), libMesh::ParallelMesh::query_elem(), libMesh::ParallelMesh::renumber_elem(), libMesh::ParallelMesh::renumber_nodes_and_elements(), libMesh::ParallelMesh::semilocal_elements_begin(), libMesh::ParallelMesh::semilocal_elements_end(), libMesh::ParallelMesh::subactive_elements_begin(), libMesh::ParallelMesh::subactive_elements_end(), libMesh::ParallelMesh::type_elements_begin(), and libMesh::ParallelMesh::type_elements_end().

std::set<Elem *> libMesh::ParallelMesh::_extra_ghost_elems [protected, inherited]
bool libMesh::ParallelMesh::_is_serial [protected, inherited]

A boolean remembering whether we're serialized or not

Definition at line 450 of file parallel_mesh.h.

Referenced by libMesh::ParallelMesh::allgather(), libMesh::ParallelMesh::clear(), libMesh::ParallelMesh::delete_remote_elements(), and libMesh::ParallelMesh::is_serial().

unsigned int libMesh::MeshBase::_n_parts [protected, inherited]

The number of partitions the mesh has. This is set by the partitioners, and may not be changed directly by the user. **NOTE** The number of partitions *need not* equal this->n_processors(), consider for example the case where you simply want to partition a mesh on one processor and view the result in GMV.

Definition at line 910 of file mesh_base.h.

Referenced by libMesh::MeshBase::clear(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::MeshBase::n_partitions(), libMesh::MeshBase::recalculate_n_partitions(), and libMesh::MeshBase::set_n_partitions().

Guaranteed globally unused IDs for use when adding new nodes or elements.

Definition at line 461 of file parallel_mesh.h.

Referenced by libMesh::ParallelMesh::add_node(), libMesh::ParallelMesh::clear(), libMesh::ParallelMesh::ParallelMesh(), and libMesh::ParallelMesh::update_parallel_id_counts().

UniquePtr<Partitioner> libMesh::MeshBase::_partitioner [protected, inherited]

A partitioner to use at each prepare_for_use().

This will be built in the constructor of each derived class, but can be replaced by the user through the partitioner() accessor.

Definition at line 932 of file mesh_base.h.

Referenced by libMesh::MeshBase::MeshBase(), libMesh::ParallelMesh::ParallelMesh(), libMesh::MeshBase::partitioner(), and libMesh::SerialMesh::SerialMesh().

UniquePtr<PointLocatorBase> libMesh::MeshBase::_point_locator [mutable, protected, inherited]

A PointLocator class for this mesh. This will not actually be built unless needed. Further, since we want our point_locator() method to be const (yet do the dynamic allocating) this needs to be mutable. Since the PointLocatorBase::build() member is used, and it operates on a constant reference to the mesh, this is OK.

Definition at line 924 of file mesh_base.h.

Referenced by libMesh::MeshBase::clear_point_locator(), libMesh::MeshBase::point_locator(), and libMesh::MeshBase::sub_point_locator().

bool libMesh::MeshBase::_skip_partitioning [protected, inherited]

If this is true then no partitioning should be done.

Definition at line 944 of file mesh_base.h.

Referenced by libMesh::MeshBase::skip_partitioning().

If this is true then renumbering will be kept to a miniumum.

This is set when prepare_for_use() is called.

Definition at line 951 of file mesh_base.h.

Referenced by libMesh::MeshBase::allow_renumbering(), libMesh::MeshBase::prepare_for_use(), libMesh::SerialMesh::renumber_nodes_and_elements(), and libMesh::ParallelMesh::renumber_nodes_and_elements().

This class holds the boundary information. It can store nodes, edges, and faces with a corresponding id that facilitates setting boundary conditions.

Direct access to this class will be removed in future libMesh versions. Use the get_boundary_info() accessor instead.

Definition at line 882 of file mesh_base.h.

Referenced by libMesh::MeshBase::get_boundary_info().


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