libMesh::SerialMesh Class Reference

#include <serial_mesh.h>

Inheritance diagram for libMesh::SerialMesh:

Public Types

typedef Predicates::multi_predicate Predicate
 

Public Member Functions

 SerialMesh (const Parallel::Communicator &comm_in, unsigned char dim=1)
 
 SerialMesh (unsigned char dim=1)
 
 SerialMesh (const UnstructuredMesh &other_mesh)
 
virtual UniquePtr< MeshBaseclone () const libmesh_override
 
 ~SerialMesh ()
 
virtual void clear () libmesh_override
 
virtual void renumber_nodes_and_elements () libmesh_override
 
virtual dof_id_type n_nodes () const libmesh_override
 
virtual dof_id_type parallel_n_nodes () const libmesh_override
 
virtual dof_id_type max_node_id () const libmesh_override
 
virtual void reserve_nodes (const dof_id_type nn) libmesh_override
 
virtual dof_id_type n_elem () const libmesh_override
 
virtual dof_id_type parallel_n_elem () const libmesh_override
 
virtual dof_id_type n_active_elem () const libmesh_override
 
virtual dof_id_type max_elem_id () const libmesh_override
 
virtual unique_id_type parallel_max_unique_id () const libmesh_override
 
virtual void reserve_elem (const dof_id_type ne) libmesh_override
 
virtual void update_parallel_id_counts () libmesh_override
 
virtual const Pointpoint (const dof_id_type i) const libmesh_override
 
virtual const Nodenode_ptr (const dof_id_type i) const libmesh_override
 
virtual Nodenode_ptr (const dof_id_type i) libmesh_override
 
virtual const Nodequery_node_ptr (const dof_id_type i) const libmesh_override
 
virtual Nodequery_node_ptr (const dof_id_type i) libmesh_override
 
virtual const Elemelem_ptr (const dof_id_type i) const libmesh_override
 
virtual Elemelem_ptr (const dof_id_type i) libmesh_override
 
virtual const Elemquery_elem_ptr (const dof_id_type i) const libmesh_override
 
virtual Elemquery_elem_ptr (const dof_id_type i) libmesh_override
 
virtual Nodeadd_point (const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id) libmesh_override
 
virtual Nodeadd_node (Node *n) libmesh_override
 
virtual Nodeinsert_node (Node *n) libmesh_override
 
virtual void delete_node (Node *n) libmesh_override
 
virtual void renumber_node (dof_id_type old_id, dof_id_type new_id) libmesh_override
 
virtual Elemadd_elem (Elem *e) libmesh_override
 
virtual Eleminsert_elem (Elem *e) libmesh_override
 
virtual void delete_elem (Elem *e) libmesh_override
 
virtual void renumber_elem (dof_id_type old_id, dof_id_type new_id) libmesh_override
 
virtual void fix_broken_node_and_element_numbering () libmesh_override
 
void stitch_meshes (ReplicatedMesh &other_mesh, boundary_id_type this_mesh_boundary, boundary_id_type other_mesh_boundary, Real tol=TOLERANCE, bool clear_stitched_boundary_ids=false, bool verbose=true, bool use_binary_search=true, bool enforce_all_nodes_match_on_boundaries=false)
 
void stitch_surfaces (boundary_id_type boundary_id_1, boundary_id_type boundary_id_2, Real tol=TOLERANCE, bool clear_stitched_boundary_ids=false, bool verbose=true, bool use_binary_search=true, bool enforce_all_nodes_match_on_boundaries=false)
 
virtual element_iterator elements_begin () libmesh_override
 
virtual const_element_iterator elements_begin () const libmesh_override
 
virtual element_iterator elements_end () libmesh_override
 
virtual const_element_iterator elements_end () const libmesh_override
 
virtual element_iterator active_elements_begin () libmesh_override
 
virtual const_element_iterator active_elements_begin () const libmesh_override
 
virtual element_iterator active_elements_end () libmesh_override
 
virtual const_element_iterator active_elements_end () const libmesh_override
 
virtual element_iterator ancestor_elements_begin () libmesh_override
 
virtual const_element_iterator ancestor_elements_begin () const libmesh_override
 
virtual element_iterator ancestor_elements_end () libmesh_override
 
virtual const_element_iterator ancestor_elements_end () const libmesh_override
 
virtual element_iterator subactive_elements_begin () libmesh_override
 
virtual const_element_iterator subactive_elements_begin () const libmesh_override
 
virtual element_iterator subactive_elements_end () libmesh_override
 
virtual const_element_iterator subactive_elements_end () const libmesh_override
 
virtual element_iterator not_active_elements_begin () libmesh_override
 
virtual const_element_iterator not_active_elements_begin () const libmesh_override
 
virtual element_iterator not_active_elements_end () libmesh_override
 
virtual const_element_iterator not_active_elements_end () const libmesh_override
 
virtual element_iterator not_ancestor_elements_begin () libmesh_override
 
virtual const_element_iterator not_ancestor_elements_begin () const libmesh_override
 
virtual element_iterator not_ancestor_elements_end () libmesh_override
 
virtual const_element_iterator not_ancestor_elements_end () const libmesh_override
 
virtual element_iterator not_subactive_elements_begin () libmesh_override
 
virtual const_element_iterator not_subactive_elements_begin () const libmesh_override
 
virtual element_iterator not_subactive_elements_end () libmesh_override
 
virtual const_element_iterator not_subactive_elements_end () const libmesh_override
 
virtual element_iterator local_elements_begin () libmesh_override
 
virtual const_element_iterator local_elements_begin () const libmesh_override
 
virtual element_iterator local_elements_end () libmesh_override
 
virtual const_element_iterator local_elements_end () const libmesh_override
 
virtual element_iterator semilocal_elements_begin () libmesh_override
 
virtual const_element_iterator semilocal_elements_begin () const libmesh_override
 
virtual element_iterator semilocal_elements_end () libmesh_override
 
virtual const_element_iterator semilocal_elements_end () const libmesh_override
 
virtual element_iterator active_semilocal_elements_begin () libmesh_override
 
virtual const_element_iterator active_semilocal_elements_begin () const libmesh_override
 
virtual element_iterator active_semilocal_elements_end () libmesh_override
 
virtual const_element_iterator active_semilocal_elements_end () const libmesh_override
 
virtual element_iterator facelocal_elements_begin () libmesh_override
 
virtual const_element_iterator facelocal_elements_begin () const libmesh_override
 
virtual element_iterator facelocal_elements_end () libmesh_override
 
virtual const_element_iterator facelocal_elements_end () const libmesh_override
 
virtual element_iterator not_local_elements_begin () libmesh_override
 
virtual const_element_iterator not_local_elements_begin () const libmesh_override
 
virtual element_iterator not_local_elements_end () libmesh_override
 
virtual const_element_iterator not_local_elements_end () const libmesh_override
 
virtual element_iterator active_local_elements_begin () libmesh_override
 
virtual const_element_iterator active_local_elements_begin () const libmesh_override
 
virtual element_iterator active_local_elements_end () libmesh_override
 
virtual const_element_iterator active_local_elements_end () const libmesh_override
 
virtual element_iterator active_not_local_elements_begin () libmesh_override
 
virtual const_element_iterator active_not_local_elements_begin () const libmesh_override
 
virtual element_iterator active_not_local_elements_end () libmesh_override
 
virtual const_element_iterator active_not_local_elements_end () const libmesh_override
 
virtual element_iterator level_elements_begin (unsigned int level) libmesh_override
 
virtual const_element_iterator level_elements_begin (unsigned int level) const libmesh_override
 
virtual element_iterator level_elements_end (unsigned int level) libmesh_override
 
virtual const_element_iterator level_elements_end (unsigned int level) const libmesh_override
 
virtual element_iterator not_level_elements_begin (unsigned int level) libmesh_override
 
virtual const_element_iterator not_level_elements_begin (unsigned int level) const libmesh_override
 
virtual element_iterator not_level_elements_end (unsigned int level) libmesh_override
 
virtual const_element_iterator not_level_elements_end (unsigned int level) const libmesh_override
 
virtual element_iterator local_level_elements_begin (unsigned int level) libmesh_override
 
virtual const_element_iterator local_level_elements_begin (unsigned int level) const libmesh_override
 
virtual element_iterator local_level_elements_end (unsigned int level) libmesh_override
 
virtual const_element_iterator local_level_elements_end (unsigned int level) const libmesh_override
 
virtual element_iterator local_not_level_elements_begin (unsigned int level) libmesh_override
 
virtual const_element_iterator local_not_level_elements_begin (unsigned int level) const libmesh_override
 
virtual element_iterator local_not_level_elements_end (unsigned int level) libmesh_override
 
virtual const_element_iterator local_not_level_elements_end (unsigned int level) const libmesh_override
 
virtual element_iterator pid_elements_begin (processor_id_type proc_id) libmesh_override
 
virtual const_element_iterator pid_elements_begin (processor_id_type proc_id) const libmesh_override
 
virtual element_iterator pid_elements_end (processor_id_type proc_id) libmesh_override
 
virtual const_element_iterator pid_elements_end (processor_id_type proc_id) const libmesh_override
 
virtual element_iterator type_elements_begin (ElemType type) libmesh_override
 
virtual const_element_iterator type_elements_begin (ElemType type) const libmesh_override
 
virtual element_iterator type_elements_end (ElemType type) libmesh_override
 
virtual const_element_iterator type_elements_end (ElemType type) const libmesh_override
 
virtual element_iterator active_type_elements_begin (ElemType type) libmesh_override
 
virtual const_element_iterator active_type_elements_begin (ElemType type) const libmesh_override
 
virtual element_iterator active_type_elements_end (ElemType type) libmesh_override
 
virtual const_element_iterator active_type_elements_end (ElemType type) const libmesh_override
 
virtual element_iterator active_pid_elements_begin (processor_id_type proc_id) libmesh_override
 
virtual const_element_iterator active_pid_elements_begin (processor_id_type proc_id) const libmesh_override
 
virtual element_iterator active_pid_elements_end (processor_id_type proc_id) libmesh_override
 
virtual const_element_iterator active_pid_elements_end (processor_id_type proc_id) const libmesh_override
 
virtual element_iterator unpartitioned_elements_begin () libmesh_override
 
virtual const_element_iterator unpartitioned_elements_begin () const libmesh_override
 
virtual element_iterator unpartitioned_elements_end () libmesh_override
 
virtual const_element_iterator unpartitioned_elements_end () const libmesh_override
 
virtual element_iterator active_unpartitioned_elements_begin () libmesh_override
 
virtual const_element_iterator active_unpartitioned_elements_begin () const libmesh_override
 
virtual element_iterator active_unpartitioned_elements_end () libmesh_override
 
virtual const_element_iterator active_unpartitioned_elements_end () const libmesh_override
 
virtual element_iterator active_local_subdomain_elements_begin (subdomain_id_type subdomain_id) libmesh_override
 
virtual const_element_iterator active_local_subdomain_elements_begin (subdomain_id_type subdomain_id) const libmesh_override
 
virtual element_iterator active_local_subdomain_elements_end (subdomain_id_type subdomain_id) libmesh_override
 
virtual const_element_iterator active_local_subdomain_elements_end (subdomain_id_type subdomain_id) const libmesh_override
 
virtual element_iterator active_subdomain_elements_begin (subdomain_id_type subdomain_id) libmesh_override
 
virtual const_element_iterator active_subdomain_elements_begin (subdomain_id_type subdomain_id) const libmesh_override
 
virtual element_iterator active_subdomain_elements_end (subdomain_id_type subdomain_id) libmesh_override
 
virtual const_element_iterator active_subdomain_elements_end (subdomain_id_type subdomain_id) const libmesh_override
 
virtual element_iterator active_subdomain_set_elements_begin (std::set< subdomain_id_type > ss) libmesh_override
 
virtual const_element_iterator active_subdomain_set_elements_begin (std::set< subdomain_id_type > ss) const libmesh_override
 
virtual element_iterator active_subdomain_set_elements_end (std::set< subdomain_id_type > ss) libmesh_override
 
virtual const_element_iterator active_subdomain_set_elements_end (std::set< subdomain_id_type > ss) const libmesh_override
 
virtual element_iterator ghost_elements_begin () libmesh_override
 
virtual const_element_iterator ghost_elements_begin () const libmesh_override
 
virtual element_iterator ghost_elements_end () libmesh_override
 
virtual const_element_iterator ghost_elements_end () const libmesh_override
 
virtual element_iterator evaluable_elements_begin (const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint) libmesh_override
 
virtual const_element_iterator evaluable_elements_begin (const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint) const libmesh_override
 
virtual element_iterator evaluable_elements_end (const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint) libmesh_override
 
virtual const_element_iterator evaluable_elements_end (const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint) const libmesh_override
 
virtual element_iterator flagged_elements_begin (unsigned char rflag) libmesh_override
 
virtual const_element_iterator flagged_elements_begin (unsigned char rflag) const libmesh_override
 
virtual element_iterator flagged_elements_end (unsigned char rflag) libmesh_override
 
virtual const_element_iterator flagged_elements_end (unsigned char rflag) const libmesh_override
 
virtual element_iterator flagged_pid_elements_begin (unsigned char rflag, processor_id_type pid) libmesh_override
 
virtual const_element_iterator flagged_pid_elements_begin (unsigned char rflag, processor_id_type pid) const libmesh_override
 
virtual element_iterator flagged_pid_elements_end (unsigned char rflag, processor_id_type pid) libmesh_override
 
virtual const_element_iterator flagged_pid_elements_end (unsigned char rflag, processor_id_type pid) const libmesh_override
 
virtual node_iterator nodes_begin () libmesh_override
 
virtual const_node_iterator nodes_begin () const libmesh_override
 
virtual node_iterator nodes_end () libmesh_override
 
virtual const_node_iterator nodes_end () const libmesh_override
 
virtual node_iterator active_nodes_begin () libmesh_override
 
virtual const_node_iterator active_nodes_begin () const libmesh_override
 
virtual node_iterator active_nodes_end () libmesh_override
 
virtual const_node_iterator active_nodes_end () const libmesh_override
 
virtual node_iterator local_nodes_begin () libmesh_override
 
virtual const_node_iterator local_nodes_begin () const libmesh_override
 
virtual node_iterator local_nodes_end () libmesh_override
 
virtual const_node_iterator local_nodes_end () const libmesh_override
 
virtual node_iterator pid_nodes_begin (processor_id_type proc_id) libmesh_override
 
virtual const_node_iterator pid_nodes_begin (processor_id_type proc_id) const libmesh_override
 
virtual node_iterator pid_nodes_end (processor_id_type proc_id) libmesh_override
 
virtual const_node_iterator pid_nodes_end (processor_id_type proc_id) const libmesh_override
 
virtual node_iterator bid_nodes_begin (boundary_id_type bndry_id) libmesh_override
 
virtual const_node_iterator bid_nodes_begin (boundary_id_type bndry_id) const libmesh_override
 
virtual node_iterator bid_nodes_end (boundary_id_type bndry_id) libmesh_override
 
virtual const_node_iterator bid_nodes_end (boundary_id_type bndry_id) const libmesh_override
 
virtual node_iterator bnd_nodes_begin () libmesh_override
 
virtual const_node_iterator bnd_nodes_begin () const libmesh_override
 
virtual node_iterator bnd_nodes_end () libmesh_override
 
virtual const_node_iterator bnd_nodes_end () const libmesh_override
 
virtual node_iterator evaluable_nodes_begin (const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint) libmesh_override
 
virtual const_node_iterator evaluable_nodes_begin (const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint) const libmesh_override
 
virtual node_iterator evaluable_nodes_end (const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint) libmesh_override
 
virtual const_node_iterator evaluable_nodes_end (const DofMap &dof_map, unsigned int var_num=libMesh::invalid_uint) const libmesh_override
 
virtual void read (const std::string &name, void *mesh_data=libmesh_nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false) libmesh_override
 
virtual void write (const std::string &name) libmesh_override
 
void write (const std::string &name, const std::vector< Number > &values, const std::vector< std::string > &variable_names)
 
virtual void all_first_order () libmesh_override
 
virtual void all_second_order (const bool full_ordered=true) libmesh_override
 
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) libmesh_override
 
virtual bool contract () libmesh_override
 
virtual UniquePtr< Partitioner > & partitioner ()
 
const BoundaryInfoget_boundary_info () const
 
BoundaryInfoget_boundary_info ()
 
bool is_prepared () const
 
virtual bool is_serial () const
 
virtual bool is_replicated () const
 
virtual void allgather ()
 
virtual void gather_to_zero ()
 
virtual void delete_remote_elements ()
 
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
 
void set_spatial_dimension (unsigned char d)
 
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
 
virtual const Nodenode_ref (const dof_id_type i) const
 
virtual Nodenode_ref (const dof_id_type i)
 
virtual const Nodenode (const dof_id_type i) const
 
virtual Nodenode (const dof_id_type i)
 
virtual const Elemelem_ref (const dof_id_type i) const
 
virtual Elemelem_ref (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)
 
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 ()
 
virtual void redistribute ()
 
virtual void update_post_partitioning ()
 
void allow_renumbering (bool allow)
 
bool allow_renumbering () const
 
void allow_remote_element_removal (bool allow)
 
bool allow_remote_element_removal () const
 
void skip_partitioning (bool skip)
 
bool skip_partitioning () const
 
void add_ghosting_functor (GhostingFunctor &ghosting_functor)
 
void remove_ghosting_functor (GhostingFunctor &ghosting_functor)
 
std::set< GhostingFunctor * >::const_iterator ghosting_functors_begin () const
 
std::set< GhostingFunctor * >::const_iterator ghosting_functors_end () 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 ()
 
void set_count_lower_dim_elems_in_point_locator (bool count_lower_dim_elems)
 
bool get_count_lower_dim_elems_in_point_locator () const
 
virtual void libmesh_assert_valid_parallel_ids () const
 
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 ()
 
void detect_interior_parents ()
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Public Attributes

UniquePtr< BoundaryInfoboundary_info
 

Protected Member Functions

unsigned int & set_n_partitions ()
 

Protected Attributes

std::vector< Node * > _nodes
 
std::vector< Elem * > _elements
 
unsigned int _n_parts
 
bool _is_prepared
 
UniquePtr< PointLocatorBase_point_locator
 
bool _count_lower_dim_elems_in_point_locator
 
UniquePtr< Partitioner_partitioner
 
unique_id_type _next_unique_id
 
bool _skip_partitioning
 
bool _skip_renumber_nodes_and_elements
 
bool _allow_remote_element_removal
 
std::map< subdomain_id_type, std::string > _block_id_to_name
 
std::set< unsigned char > _elem_dims
 
unsigned char _spatial_dimension
 
UniquePtr< GhostingFunctor_default_ghosting
 
std::set< GhostingFunctor * > _ghosting_functors
 
const Parallel::Communicator_communicator
 

Detailed Description

Definition at line 34 of file serial_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 844 of file mesh_base.h.

Constructor & Destructor Documentation

libMesh::SerialMesh::SerialMesh ( const Parallel::Communicator comm_in,
unsigned char  dim = 1 
)
inlineexplicit

Definition at line 38 of file serial_mesh.h.

Referenced by clone().

40  : ReplicatedMesh(comm_in,dim) {}
ReplicatedMesh(const Parallel::Communicator &comm_in, unsigned char dim=1)
libMesh::SerialMesh::SerialMesh ( unsigned char  dim = 1)
inlineexplicit

Definition at line 44 of file serial_mesh.h.

45  : ReplicatedMesh(dim)
46  {
47  libmesh_deprecated();
48  }
ReplicatedMesh(const Parallel::Communicator &comm_in, unsigned char dim=1)
libMesh::SerialMesh::SerialMesh ( const UnstructuredMesh other_mesh)
inline

Definition at line 51 of file serial_mesh.h.

51 : ReplicatedMesh(other_mesh) {}
ReplicatedMesh(const Parallel::Communicator &comm_in, unsigned char dim=1)
libMesh::SerialMesh::~SerialMesh ( )
inline

Definition at line 56 of file serial_mesh.h.

56 {}

Member Function Documentation

virtual element_iterator libMesh::ReplicatedMesh::active_elements_begin ( )
virtualinherited

Active, local, and negation forms of the element iterators described above. An "active" element is an element without children (i.e. has not been refined). A "local" element is one whose processor_id() matches the current processor.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::n_active_elem(), libMesh::ReplicatedMesh::reserve_elem(), and libMesh::ReplicatedMesh::stitching_helper().

virtual const_element_iterator libMesh::ReplicatedMesh::active_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_local_elements_begin ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_local_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_local_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_local_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_local_subdomain_elements_begin ( subdomain_id_type  subdomain_id)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_local_subdomain_elements_begin ( subdomain_id_type  subdomain_id) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_local_subdomain_elements_end ( subdomain_id_type  subdomain_id)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_local_subdomain_elements_end ( subdomain_id_type  subdomain_id) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::active_nodes_begin ( )
virtualinherited

Iterate over only the active nodes in the Mesh.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_node_iterator libMesh::ReplicatedMesh::active_nodes_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::active_nodes_end ( )
virtualinherited
virtual const_node_iterator libMesh::ReplicatedMesh::active_nodes_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_not_local_elements_begin ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_not_local_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_not_local_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_not_local_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_pid_elements_begin ( processor_id_type  proc_id)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_pid_elements_begin ( processor_id_type  proc_id) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_pid_elements_end ( processor_id_type  proc_id)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_pid_elements_end ( processor_id_type  proc_id) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_semilocal_elements_begin ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_semilocal_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_semilocal_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_semilocal_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_subdomain_elements_begin ( subdomain_id_type  subdomain_id)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_subdomain_elements_begin ( subdomain_id_type  subdomain_id) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_subdomain_elements_end ( subdomain_id_type  subdomain_id)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_subdomain_elements_end ( subdomain_id_type  subdomain_id) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_subdomain_set_elements_begin ( std::set< subdomain_id_type ss)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_subdomain_set_elements_begin ( std::set< subdomain_id_type ss) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_subdomain_set_elements_end ( std::set< subdomain_id_type ss)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_subdomain_set_elements_end ( std::set< subdomain_id_type ss) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_type_elements_begin ( ElemType  type)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_type_elements_begin ( ElemType  type) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_type_elements_end ( ElemType  type)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_type_elements_end ( ElemType  type) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_unpartitioned_elements_begin ( )
virtualinherited

Iterate over active unpartitioned elements in the Mesh.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_element_iterator libMesh::ReplicatedMesh::active_unpartitioned_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::active_unpartitioned_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::active_unpartitioned_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

Elem * libMesh::ReplicatedMesh::add_elem ( Elem e)
virtualinherited

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.

Users should call MeshBase::prepare_for_use() after elements are added to and/or deleted from the mesh.

Implements libMesh::MeshBase.

Definition at line 286 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_elements, libMesh::MeshBase::_next_unique_id, libMesh::DofObject::id(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::DofObject::set_id(), libMesh::DofObject::set_unique_id(), libMesh::DofObject::valid_id(), and libMesh::DofObject::valid_unique_id().

Referenced by libMesh::ReplicatedMesh::reserve_elem().

287 {
288  libmesh_assert(e);
289 
290  // We no longer merely append elements with ReplicatedMesh
291 
292  // If the user requests a valid id that doesn't correspond to an
293  // existing element, let's give them that id, resizing the elements
294  // container if necessary.
295  if (!e->valid_id())
296  e->set_id (cast_int<dof_id_type>(_elements.size()));
297 
298 #ifdef LIBMESH_ENABLE_UNIQUE_ID
299  if (!e->valid_unique_id())
301 #endif
302 
303  const dof_id_type id = e->id();
304 
305  if (id < _elements.size())
306  {
307  // Overwriting existing elements is still probably a mistake.
309  }
310  else
311  {
312  _elements.resize(id+1, libmesh_nullptr);
313  }
314 
315  _elements[id] = e;
316 
317  return e;
318 }
unique_id_type & set_unique_id()
Definition: dof_object.h:654
bool valid_id() const
Definition: dof_object.h:666
std::vector< Elem * > _elements
const class libmesh_nullptr_t libmesh_nullptr
dof_id_type & set_id()
Definition: dof_object.h:633
bool valid_unique_id() const
Definition: dof_object.h:674
libmesh_assert(j)
unique_id_type _next_unique_id
Definition: mesh_base.h:1310
dof_id_type id() const
Definition: dof_object.h:624
uint8_t dof_id_type
Definition: id_types.h:64
void libMesh::MeshBase::add_ghosting_functor ( GhostingFunctor ghosting_functor)
inlineinherited

Adds a functor which can specify ghosting requirements for use on distributed meshes. Multiple ghosting functors can be added; any element which is required by any functor will be ghosted.

GhostingFunctor memory must be managed by the code which calls this function; the GhostingFunctor lifetime is expected to extend until either the functor is removed or the Mesh is destructed.

Definition at line 743 of file mesh_base.h.

References libMesh::MeshBase::_ghosting_functors, and libMesh::MeshBase::remove_ghosting_functor().

Referenced by libMesh::DofMap::add_algebraic_ghosting_functor(), and libMesh::DofMap::add_coupling_functor().

744  { _ghosting_functors.insert(&ghosting_functor); }
std::set< GhostingFunctor * > _ghosting_functors
Definition: mesh_base.h:1367
Node * libMesh::ReplicatedMesh::add_node ( Node n)
virtualinherited

Add Node n to the end of the vertex array.

Implements libMesh::MeshBase.

Definition at line 456 of file replicated_mesh.C.

References libMesh::MeshBase::_next_unique_id, libMesh::ReplicatedMesh::_nodes, libMesh::DofObject::id(), libMesh::libmesh_assert(), libMesh::DofObject::set_id(), libMesh::DofObject::set_unique_id(), libMesh::DofObject::valid_id(), and libMesh::DofObject::valid_unique_id().

Referenced by libMesh::ReplicatedMesh::reserve_elem().

457 {
458  libmesh_assert(n);
459  // We only append points with ReplicatedMesh
460  libmesh_assert(!n->valid_id() || n->id() == _nodes.size());
461 
462  n->set_id (cast_int<dof_id_type>(_nodes.size()));
463 
464 #ifdef LIBMESH_ENABLE_UNIQUE_ID
465  if (!n->valid_unique_id())
467 #endif
468 
469  _nodes.push_back(n);
470 
471  return n;
472 }
unique_id_type & set_unique_id()
Definition: dof_object.h:654
bool valid_id() const
Definition: dof_object.h:666
dof_id_type & set_id()
Definition: dof_object.h:633
bool valid_unique_id() const
Definition: dof_object.h:674
libmesh_assert(j)
unique_id_type _next_unique_id
Definition: mesh_base.h:1310
std::vector< Node * > _nodes
dof_id_type id() const
Definition: dof_object.h:624
Node * libMesh::ReplicatedMesh::add_point ( const Point p,
const dof_id_type  id = DofObject::invalid_id,
const processor_id_type  proc_id = DofObject::invalid_processor_id 
)
virtualinherited

functions for adding /deleting nodes elements.

Implements libMesh::MeshBase.

Definition at line 403 of file replicated_mesh.C.

References libMesh::MeshBase::_next_unique_id, libMesh::ReplicatedMesh::_nodes, libMesh::Node::build(), libMesh::DofObject::invalid_id, libMesh::libmesh_assert(), libmesh_nullptr, libMesh::DofObject::processor_id(), libMesh::DofObject::set_unique_id(), and libMesh::DofObject::valid_unique_id().

Referenced by libMesh::ReplicatedMesh::reserve_elem().

406 {
407  // // We only append points with ReplicatedMesh
408  // libmesh_assert(id == DofObject::invalid_id || id == _nodes.size());
409  // Node *n = Node::build(p, _nodes.size()).release();
410  // n->processor_id() = proc_id;
411  // _nodes.push_back (n);
412 
413  Node * n = libmesh_nullptr;
414 
415  // If the user requests a valid id, either
416  // provide the existing node or resize the container
417  // to fit the new node.
418  if (id != DofObject::invalid_id)
419  if (id < _nodes.size())
420  n = _nodes[id];
421  else
422  _nodes.resize(id+1);
423  else
424  _nodes.push_back (static_cast<Node *>(libmesh_nullptr));
425 
426  // if the node already exists, then assign new (x,y,z) values
427  if (n)
428  *n = p;
429  // otherwise build a new node, put it in the right spot, and return
430  // a valid pointer.
431  else
432  {
433  n = Node::build(p, (id == DofObject::invalid_id) ?
434  cast_int<dof_id_type>(_nodes.size()-1) : id).release();
435  n->processor_id() = proc_id;
436 
437 #ifdef LIBMESH_ENABLE_UNIQUE_ID
438  if (!n->valid_unique_id())
440 #endif
441 
442  if (id == DofObject::invalid_id)
443  _nodes.back() = n;
444  else
445  _nodes[id] = n;
446  }
447 
448  // better not pass back a NULL pointer.
449  libmesh_assert (n);
450 
451  return n;
452 }
unique_id_type & set_unique_id()
Definition: dof_object.h:654
A geometric point in (x,y,z) space associated with a DOF.
Definition: node.h:52
const class libmesh_nullptr_t libmesh_nullptr
static UniquePtr< Node > build(const Node &n)
Definition: node.h:284
bool valid_unique_id() const
Definition: dof_object.h:674
libmesh_assert(j)
unique_id_type _next_unique_id
Definition: mesh_base.h:1310
static const dof_id_type invalid_id
Definition: dof_object.h:335
std::vector< Node * > _nodes
processor_id_type processor_id() const
Definition: dof_object.h:686
void libMesh::UnstructuredMesh::all_first_order ( )
virtualinherited

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 303 of file mesh_modification.C.

References libMesh::MeshBase::_is_prepared, libMesh::Elem::add_child(), libMesh::Elem::build(), libMesh::Elem::child_ptr(), libMesh::BoundaryInfo::copy_boundary_ids(), 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::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::neighbor_ptr(), libMesh::Elem::node_id(), libMesh::Elem::node_ptr(), 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::Elem::refinement_flag(), libMesh::BoundaryInfo::regenerate_id_sets(), 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::DofObject::set_unique_id(), libMesh::Elem::subdomain_id(), libMesh::Elem::type(), libMesh::DofObject::unique_id(), and libMesh::Elem::which_child_am_i().

304 {
305  /*
306  * when the mesh is not prepared,
307  * at least renumber the nodes and
308  * elements, so that the node ids
309  * are correct
310  */
311  if (!this->_is_prepared)
313 
314  START_LOG("all_first_order()", "Mesh");
315 
319  std::vector<bool> node_touched_by_me(this->max_node_id(), false);
320 
326  element_iterator endit = elements_end();
327  for (element_iterator it = elements_begin();
328  it != endit; ++it)
329  {
330  Elem * so_elem = *it;
331 
332  libmesh_assert(so_elem);
333 
334  /*
335  * build the first-order equivalent, add to
336  * the new_elements list.
337  */
338  Elem * lo_elem = Elem::build
340  (so_elem->type()), so_elem->parent()).release();
341 
342  for (unsigned int s=0; s != so_elem->n_sides(); ++s)
343  if (so_elem->neighbor_ptr(s) == remote_elem)
344  lo_elem->set_neighbor(s, const_cast<RemoteElem *>(remote_elem));
345 
346 #ifdef LIBMESH_ENABLE_AMR
347  /*
348  * Reset the parent links of any child elements
349  */
350  if (so_elem->has_children())
351  for (unsigned int c=0; c != so_elem->n_children(); ++c)
352  {
353  so_elem->child_ptr(c)->set_parent(lo_elem);
354  lo_elem->add_child(so_elem->child_ptr(c), c);
355  }
356 
357  /*
358  * Reset the child link of any parent element
359  */
360  if (so_elem->parent())
361  {
362  unsigned int c =
363  so_elem->parent()->which_child_am_i(so_elem);
364  lo_elem->parent()->replace_child(lo_elem, c);
365  }
366 
367  /*
368  * Copy as much data to the new element as makes sense
369  */
370  lo_elem->set_p_level(so_elem->p_level());
371  lo_elem->set_refinement_flag(so_elem->refinement_flag());
372  lo_elem->set_p_refinement_flag(so_elem->p_refinement_flag());
373 #endif
374 
375  libmesh_assert_equal_to (lo_elem->n_vertices(), so_elem->n_vertices());
376 
377  /*
378  * By definition the vertices of the linear and
379  * second order element are identically numbered.
380  * transfer these.
381  */
382  for (unsigned int v=0; v < so_elem->n_vertices(); v++)
383  {
384  lo_elem->set_node(v) = so_elem->node_ptr(v);
385  node_touched_by_me[lo_elem->node_id(v)] = true;
386  }
387 
388  /*
389  * find_neighbors relies on remote_elem neighbor links being
390  * properly maintained.
391  */
392  for (unsigned short s=0; s<so_elem->n_sides(); s++)
393  {
394  if (so_elem->neighbor(s) == remote_elem)
395  lo_elem->set_neighbor(s, const_cast<RemoteElem*>(remote_elem));
396  }
397 
405  (this->get_boundary_info(), so_elem, lo_elem);
406 
407  /*
408  * The new first-order element is ready.
409  * Inserting it into the mesh will replace and delete
410  * the second-order element.
411  */
412  lo_elem->set_id(so_elem->id());
413 #ifdef LIBMESH_ENABLE_UNIQUE_ID
414  lo_elem->set_unique_id() = so_elem->unique_id();
415 #endif
416  lo_elem->processor_id() = so_elem->processor_id();
417  lo_elem->subdomain_id() = so_elem->subdomain_id();
418  this->insert_elem(lo_elem);
419  }
420 
421  const MeshBase::node_iterator nd_end = this->nodes_end();
422  MeshBase::node_iterator nd = this->nodes_begin();
423  while (nd != nd_end)
424  {
425  Node * the_node = *nd;
426  ++nd;
427  if (!node_touched_by_me[the_node->id()])
428  this->delete_node(the_node);
429  }
430 
431  // If crazy people applied boundary info to non-vertices and then
432  // deleted those non-vertices, we should make sure their boundary id
433  // caches are correct.
435 
436  STOP_LOG("all_first_order()", "Mesh");
437 
438  // On hanging nodes that used to also be second order nodes, we
439  // might now have an invalid nodal processor_id()
441 
442  // delete or renumber nodes, etc
443  this->prepare_for_use(/*skip_renumber =*/ false);
444 }
const BoundaryInfo & get_boundary_info() const
Definition: mesh_base.h:111
static UniquePtr< Elem > build(const ElemType type, Elem *p=libmesh_nullptr)
Definition: elem.C:234
static void set_node_processor_ids(MeshBase &mesh)
Definition: partitioner.C:431
virtual dof_id_type max_node_id() const =0
libmesh_assert(j)
virtual node_iterator nodes_begin()=0
virtual element_iterator elements_begin()=0
virtual element_iterator elements_end()=0
virtual void delete_node(Node *n)=0
void prepare_for_use(const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false)
Definition: mesh_base.C:174
virtual Elem * insert_elem(Elem *e)=0
virtual node_iterator nodes_end()=0
void copy_boundary_ids(const BoundaryInfo &old_boundary_info, const Elem *const old_elem, const Elem *const new_elem)
static ElemType first_order_equivalent_type(const ElemType et)
Definition: elem.C:2573
virtual void renumber_nodes_and_elements()=0
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::UnstructuredMesh::all_second_order ( const bool  full_ordered = true)
virtualinherited

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 448 of file mesh_modification.C.

References libMesh::MeshBase::_is_prepared, libMesh::MeshBase::add_point(), libMesh::Elem::build(), libMesh::ParallelObject::comm(), libMesh::BoundaryInfo::copy_boundary_ids(), libMesh::Elem::default_order(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::FIRST, libMesh::MeshBase::get_boundary_info(), 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_ptr(), libMesh::Elem::node_ptr(), libMesh::MeshBase::point(), libMesh::MeshBase::prepare_for_use(), libMesh::DofObject::processor_id(), libMesh::Real, libMesh::remote_elem, libMesh::MeshBase::renumber_nodes_and_elements(), libMesh::MeshBase::reserve_nodes(), libMesh::Elem::second_order_equivalent_type(), libMesh::Elem::subdomain_id(), libMesh::Elem::type(), and libMesh::DofObject::unique_id().

Referenced by libMesh::MeshTools::Generation::build_cube(), and libMesh::MeshTools::Generation::build_sphere().

449 {
450  // This function must be run on all processors at once
451  parallel_object_only();
452 
453  /*
454  * when the mesh is not prepared,
455  * at least renumber the nodes and
456  * elements, so that the node ids
457  * are correct
458  */
459  if (!this->_is_prepared)
461 
462  /*
463  * If the mesh is empty
464  * then we have nothing to do
465  */
466  if (!this->n_elem())
467  return;
468 
469  /*
470  * If the mesh is already second order
471  * then we have nothing to do.
472  * We have to test for this in a round-about way to avoid
473  * a bug on distributed parallel meshes with more processors
474  * than elements.
475  */
476  bool already_second_order = false;
477  if (this->elements_begin() != this->elements_end() &&
478  (*(this->elements_begin()))->default_order() != FIRST)
479  already_second_order = true;
480  this->comm().max(already_second_order);
481  if (already_second_order)
482  return;
483 
484  START_LOG("all_second_order()", "Mesh");
485 
486  /*
487  * this map helps in identifying second order
488  * nodes. Namely, a second-order node:
489  * - edge node
490  * - face node
491  * - bubble node
492  * is uniquely defined through a set of adjacent
493  * vertices. This set of adjacent vertices is
494  * used to identify already added higher-order
495  * nodes. We are safe to use node id's since we
496  * make sure that these are correctly numbered.
497  */
498  std::map<std::vector<dof_id_type>, Node *> adj_vertices_to_so_nodes;
499 
500  /*
501  * for speed-up of the \p add_point() method, we
502  * can reserve memory. Guess the number of additional
503  * nodes for different dimensions
504  */
505  switch (this->mesh_dimension())
506  {
507  case 1:
508  /*
509  * in 1D, there can only be order-increase from Edge2
510  * to Edge3. Something like 1/2 of n_nodes() have
511  * to be added
512  */
513  this->reserve_nodes(static_cast<unsigned int>
514  (1.5*static_cast<double>(this->n_nodes())));
515  break;
516 
517  case 2:
518  /*
519  * in 2D, either refine from Tri3 to Tri6 (double the nodes)
520  * or from Quad4 to Quad8 (again, double) or Quad9 (2.25 that much)
521  */
522  this->reserve_nodes(static_cast<unsigned int>
523  (2*static_cast<double>(this->n_nodes())));
524  break;
525 
526 
527  case 3:
528  /*
529  * in 3D, either refine from Tet4 to Tet10 (factor = 2.5) up to
530  * Hex8 to Hex27 (something > 3). Since in 3D there _are_ already
531  * quite some nodes, and since we do not want to overburden the memory by
532  * a too conservative guess, use the lower bound
533  */
534  this->reserve_nodes(static_cast<unsigned int>
535  (2.5*static_cast<double>(this->n_nodes())));
536  break;
537 
538  default:
539  // Hm?
540  libmesh_error_msg("Unknown mesh dimension " << this->mesh_dimension());
541  }
542 
543 
544 
545  /*
546  * form a vector that will hold the node id's of
547  * the vertices that are adjacent to the son-th
548  * second-order node. Pull this outside of the
549  * loop so that silly compilers don't repeatedly
550  * create and destroy the vector.
551  */
552  std::vector<dof_id_type> adjacent_vertices_ids;
553 
560  element_iterator
561  it = elements_begin(),
562  endit = elements_end();
563 
564  for (; it != endit; ++it)
565  {
566  // the linear-order element
567  Elem * lo_elem = *it;
568 
569  libmesh_assert(lo_elem);
570 
571  // make sure it is linear order
572  if (lo_elem->default_order() != FIRST)
573  libmesh_error_msg("ERROR: This is not a linear element: type=" << lo_elem->type());
574 
575  // this does _not_ work for refined elements
576  libmesh_assert_equal_to (lo_elem->level (), 0);
577 
578  /*
579  * build the second-order equivalent, add to
580  * the new_elements list. Note that this here
581  * is the only point where \p full_ordered
582  * is necessary. The remaining code works well
583  * for either type of seconrd-order equivalent, e.g.
584  * Hex20 or Hex27, as equivalents for Hex8
585  */
586  Elem * so_elem =
588  full_ordered) ).release();
589 
590  libmesh_assert_equal_to (lo_elem->n_vertices(), so_elem->n_vertices());
591 
592 
593  /*
594  * By definition the vertices of the linear and
595  * second order element are identically numbered.
596  * transfer these.
597  */
598  for (unsigned int v=0; v < lo_elem->n_vertices(); v++)
599  so_elem->set_node(v) = lo_elem->node_ptr(v);
600 
601  /*
602  * Now handle the additional mid-side nodes. This
603  * is simply handled through a map that remembers
604  * the already-added nodes. This map maps the global
605  * ids of the vertices (that uniquely define this
606  * higher-order node) to the new node.
607  * Notation: son = second-order node
608  */
609  const unsigned int son_begin = so_elem->n_vertices();
610  const unsigned int son_end = so_elem->n_nodes();
611 
612 
613  for (unsigned int son=son_begin; son<son_end; son++)
614  {
615  const unsigned int n_adjacent_vertices =
616  so_elem->n_second_order_adjacent_vertices(son);
617 
618  adjacent_vertices_ids.resize(n_adjacent_vertices);
619 
620  for (unsigned int v=0; v<n_adjacent_vertices; v++)
621  adjacent_vertices_ids[v] =
622  so_elem->node_id( so_elem->second_order_adjacent_vertex(son,v) );
623 
624  /*
625  * \p adjacent_vertices_ids is now in order of the current
626  * side. sort it, so that comparisons with the
627  * \p adjacent_vertices_ids created through other elements'
628  * sides can match
629  */
630  std::sort(adjacent_vertices_ids.begin(),
631  adjacent_vertices_ids.end());
632 
633 
634  // does this set of vertices already has a mid-node added?
635  std::pair<std::map<std::vector<dof_id_type>, Node *>::iterator,
636  std::map<std::vector<dof_id_type>, Node *>::iterator>
637  pos = adj_vertices_to_so_nodes.equal_range (adjacent_vertices_ids);
638 
639  // no, not added yet
640  if (pos.first == pos.second)
641  {
642  /*
643  * for this set of vertices, there is no
644  * second_order node yet. Add it.
645  *
646  * compute the location of the new node as
647  * the average over the adjacent vertices.
648  */
649  Point new_location = this->point(adjacent_vertices_ids[0]);
650  for (unsigned int v=1; v<n_adjacent_vertices; v++)
651  new_location += this->point(adjacent_vertices_ids[v]);
652 
653  new_location /= static_cast<Real>(n_adjacent_vertices);
654 
655  /* Add the new point to the mesh.
656  * If we are on a serialized mesh, then we're doing this
657  * all in sync, and the node processor_id will be
658  * consistent between processors.
659  * If we are on a distributed mesh, we can fix
660  * inconsistent processor ids later, but only if every
661  * processor gives new nodes a *locally* consistent
662  * processor id, so we'll give the new node the
663  * processor id of an adjacent element for now and then
664  * we'll update that later if appropriate.
665  */
666  Node * so_node = this->add_point
667  (new_location, DofObject::invalid_id,
668  lo_elem->processor_id());
669 
670  /*
671  * insert the new node with its defining vertex
672  * set into the map, and relocate pos to this
673  * new entry, so that the so_elem can use
674  * \p pos for inserting the node
675  */
676  adj_vertices_to_so_nodes.insert(pos.first,
677  std::make_pair(adjacent_vertices_ids,
678  so_node));
679 
680  so_elem->set_node(son) = so_node;
681  }
682  // yes, already added.
683  else
684  {
685  Node *so_node = pos.first->second;
686  libmesh_assert(so_node);
687 
688  so_elem->set_node(son) = so_node;
689 
690  // We need to ensure that the processor who should own a
691  // node *knows* they own the node.
692  if (so_node->processor_id() > lo_elem->processor_id())
693  so_node->processor_id() = lo_elem->processor_id();
694  }
695  }
696 
697  /*
698  * find_neighbors relies on remote_elem neighbor links being
699  * properly maintained.
700  */
701  for (unsigned short s=0; s<lo_elem->n_sides(); s++)
702  {
703  if (lo_elem->neighbor_ptr(s) == remote_elem)
704  so_elem->set_neighbor(s, const_cast<RemoteElem*>(remote_elem));
705  }
706 
719  (this->get_boundary_info(), lo_elem, so_elem);
720 
721  /*
722  * The new second-order element is ready.
723  * Inserting it into the mesh will replace and delete
724  * the first-order element.
725  */
726  so_elem->set_id(lo_elem->id());
727 #ifdef LIBMESH_ENABLE_UNIQUE_ID
728  so_elem->set_unique_id() = lo_elem->unique_id();
729 #endif
730  so_elem->processor_id() = lo_elem->processor_id();
731  so_elem->subdomain_id() = lo_elem->subdomain_id();
732  this->insert_elem(so_elem);
733  }
734 
735  // we can clear the map
736  adj_vertices_to_so_nodes.clear();
737 
738 
739  STOP_LOG("all_second_order()", "Mesh");
740 
741  // In a DistributedMesh our ghost node processor ids may be bad,
742  // the ids of nodes touching remote elements may be inconsistent,
743  // and unique_ids of newly added non-local nodes remain unset.
744  // make_nodes_parallel_consistent() will fix all this.
745  if (!this->is_serial())
746  MeshCommunication().make_nodes_parallel_consistent (*this);
747 
748  // renumber nodes, elements etc
749  this->prepare_for_use(/*skip_renumber =*/ false);
750 }
const BoundaryInfo & get_boundary_info() const
Definition: mesh_base.h:111
virtual void reserve_nodes(const dof_id_type nn)=0
virtual bool is_serial() const
Definition: mesh_base.h:134
virtual const Point & point(const dof_id_type i) const =0
static UniquePtr< Elem > build(const ElemType type, Elem *p=libmesh_nullptr)
Definition: elem.C:234
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
libmesh_assert(j)
virtual element_iterator elements_begin()=0
virtual element_iterator elements_end()=0
static const dof_id_type invalid_id
Definition: dof_object.h:335
void prepare_for_use(const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false)
Definition: mesh_base.C:174
static ElemType second_order_equivalent_type(const ElemType et, const bool full_ordered=true)
Definition: elem.C:2631
virtual Elem * insert_elem(Elem *e)=0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void copy_boundary_ids(const BoundaryInfo &old_boundary_info, const Elem *const old_elem, const Elem *const new_elem)
const Parallel::Communicator & comm() const
unsigned int mesh_dimension() const
Definition: mesh_base.C:148
virtual dof_id_type n_nodes() const =0
virtual dof_id_type n_elem() const =0
virtual void renumber_nodes_and_elements()=0
const RemoteElem * remote_elem
Definition: remote_elem.C:57
virtual void libMesh::MeshBase::allgather ( )
inlinevirtualinherited

Gathers all elements and nodes of the mesh onto every processor

Reimplemented in libMesh::DistributedMesh.

Definition at line 148 of file mesh_base.h.

Referenced by libMesh::EquationSystems::allgather(), and libMesh::MeshSerializer::MeshSerializer().

148 {}
void libMesh::MeshBase::allow_remote_element_removal ( bool  allow)
inlineinherited

If false is passed in then this mesh will no longer have remote elements deleted when being prepared for use; i.e. even a DistributedMesh will remain (if it is already) serialized. This may adversely affect performance and memory use.

Definition at line 716 of file mesh_base.h.

References libMesh::MeshBase::_allow_remote_element_removal.

bool _allow_remote_element_removal
Definition: mesh_base.h:1331
bool libMesh::MeshBase::allow_remote_element_removal ( ) const
inlineinherited

Definition at line 717 of file mesh_base.h.

References libMesh::MeshBase::_allow_remote_element_removal.

bool _allow_remote_element_removal
Definition: mesh_base.h:1331
void libMesh::MeshBase::allow_renumbering ( bool  allow)
inlineinherited

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 707 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(), libMesh::NameBasedIO::read(), and libMesh::GMVIO::read().

bool _skip_renumber_nodes_and_elements
Definition: mesh_base.h:1323
bool libMesh::MeshBase::allow_renumbering ( ) const
inlineinherited
virtual element_iterator libMesh::ReplicatedMesh::ancestor_elements_begin ( )
virtualinherited

Iterate over elements for which elem->ancestor() returns true.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_element_iterator libMesh::ReplicatedMesh::ancestor_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::ancestor_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::ancestor_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::bid_nodes_begin ( boundary_id_type  bndry_id)
virtualinherited

Iterate over nodes for which BoundaryInfo::has_boundary_id(node, bndry_id) returns true.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_node_iterator libMesh::ReplicatedMesh::bid_nodes_begin ( boundary_id_type  bndry_id) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::bid_nodes_end ( boundary_id_type  bndry_id)
virtualinherited
virtual const_node_iterator libMesh::ReplicatedMesh::bid_nodes_end ( boundary_id_type  bndry_id) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::bnd_nodes_begin ( )
virtualinherited

Iterate over nodes for which BoundaryInfo::n_boundary_ids(node) > 0.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_node_iterator libMesh::ReplicatedMesh::bnd_nodes_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::bnd_nodes_end ( )
virtualinherited
virtual const_node_iterator libMesh::ReplicatedMesh::bnd_nodes_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

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 609 of file mesh_base.C.

References libMesh::MeshBase::_elem_dims, libMesh::MeshBase::_spatial_dimension, libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), libMesh::ParallelObject::comm(), end, libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::node(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), and libMesh::Parallel::Communicator::set_union().

Referenced by libMesh::MeshCommunication::broadcast(), libMesh::MeshBase::get_subdomain_name_map(), and libMesh::MeshBase::prepare_for_use().

610 {
611  // This requires an inspection on every processor
612  parallel_object_only();
613 
614  // Need to clear _elem_dims first in case all elements of a
615  // particular dimension have been deleted.
616  _elem_dims.clear();
617 
618  const_element_iterator el = this->active_elements_begin();
619  const_element_iterator end = this->active_elements_end();
620 
621  for (; el!=end; ++el)
622  _elem_dims.insert((*el)->dim());
623 
624  // Some different dimension elements may only live on other processors
625  this->comm().set_union(_elem_dims);
626 
627  // If the largest element dimension found is larger than the current
628  // _spatial_dimension, increase _spatial_dimension.
629  unsigned int max_dim = this->mesh_dimension();
630  if (max_dim > _spatial_dimension)
631  _spatial_dimension = cast_int<unsigned char>(max_dim);
632 
633  // _spatial_dimension may need to increase from 1->2 or 2->3 if the
634  // mesh is full of 1D elements but they are not x-aligned, or the
635  // mesh is full of 2D elements but they are not in the x-y plane.
636  // If the mesh is x-aligned or x-y planar, we will end up checking
637  // every node's coordinates and not breaking out of the loop
638  // early...
639  if (_spatial_dimension < 3)
640  {
641  const_node_iterator node_it = this->nodes_begin();
642  const_node_iterator node_end = this->nodes_end();
643  for (; node_it != node_end; ++node_it)
644  {
645  Node & node = **node_it;
646 
647 #if LIBMESH_DIM > 1
648  // Note: the exact floating point comparison is intentional,
649  // we don't want to get tripped up by tolerances.
650  if (node(1) != 0.)
651  {
652  _spatial_dimension = 2;
653 #if LIBMESH_DIM == 2
654  // If libmesh is compiled in 2D mode, this is the
655  // largest spatial dimension possible so we can break
656  // out.
657  break;
658 #endif
659  }
660 #endif
661 
662 #if LIBMESH_DIM > 2
663  if (node(2) != 0.)
664  {
665  // Spatial dimension can't get any higher than this, so
666  // we can break out.
667  _spatial_dimension = 3;
668  break;
669  }
670 #endif
671  }
672  }
673 }
IterBase * end
unsigned char _spatial_dimension
Definition: mesh_base.h:1351
virtual node_iterator nodes_begin()=0
std::set< unsigned char > _elem_dims
Definition: mesh_base.h:1345
virtual element_iterator active_elements_begin()=0
virtual element_iterator active_elements_end()=0
virtual node_iterator nodes_end()=0
const Parallel::Communicator & comm() const
unsigned int mesh_dimension() const
Definition: mesh_base.C:148
virtual const Node & node(const dof_id_type i) const
Definition: mesh_base.h:405
void set_union(T &data, const unsigned int root_id) const
void libMesh::ReplicatedMesh::clear ( )
virtualinherited

Clear all internal data.

Reimplemented from libMesh::MeshBase.

Definition at line 573 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_elements, libMesh::ReplicatedMesh::_nodes, libMesh::MeshBase::clear(), and end.

Referenced by libMesh::ReplicatedMesh::clone(), and libMesh::ReplicatedMesh::~ReplicatedMesh().

574 {
575  // Call parent clear function
576  MeshBase::clear();
577 
578 
579  // Clear our elements and nodes
580  {
581  std::vector<Elem *>::iterator it = _elements.begin();
582  const std::vector<Elem *>::iterator end = _elements.end();
583 
584  // There is no need to remove the elements from
585  // the BoundaryInfo data structure since we
586  // already cleared it.
587  for (; it != end; ++it)
588  delete *it;
589 
590  _elements.clear();
591  }
592 
593  // clear the nodes data structure
594  {
595  std::vector<Node *>::iterator it = _nodes.begin();
596  const std::vector<Node *>::iterator end = _nodes.end();
597 
598  // There is no need to remove the nodes from
599  // the BoundaryInfo data structure since we
600  // already cleared it.
601  for (; it != end; ++it)
602  delete *it;
603 
604  _nodes.clear();
605  }
606 }
std::vector< Elem * > _elements
IterBase * end
std::vector< Node * > _nodes
virtual void clear()
Definition: mesh_base.C:283
virtual UniquePtr<MeshBase> libMesh::SerialMesh::clone ( ) const
inlinevirtual

Virtual copy-constructor, creates a copy of this mesh

Reimplemented from libMesh::ReplicatedMesh.

Definition at line 53 of file serial_mesh.h.

References SerialMesh().

54  { return UniquePtr<MeshBase>(new SerialMesh(*this)); }
SerialMesh(const Parallel::Communicator &comm_in, unsigned char dim=1)
Definition: serial_mesh.h:38
const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inlineinherited
Returns
a reference to the Parallel::Communicator object used by this mesh.

Definition at line 87 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_jacobian(), libMesh::__libmesh_petsc_snes_postcheck(), libMesh::__libmesh_petsc_snes_residual(), libMesh::__libmesh_tao_equality_constraints(), libMesh::__libmesh_tao_equality_constraints_jacobian(), libMesh::__libmesh_tao_gradient(), libMesh::__libmesh_tao_hessian(), libMesh::__libmesh_tao_inequality_constraints(), libMesh::__libmesh_tao_inequality_constraints_jacobian(), libMesh::__libmesh_tao_objective(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::ImplicitSystem::add_matrix(), libMesh::System::add_vector(), libMesh::EigenSparseLinearSolver< T >::adjoint_solve(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::Parallel::BinSorter< KeyType, IdxType >::binsort(), libMesh::Parallel::Sort< KeyType, IdxType >::binsort(), libMesh::MeshTools::bounding_box(), libMesh::MeshCommunication::broadcast(), libMesh::SparseMatrix< T >::build(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::Parallel::Histogram< KeyType, IdxType >::build_histogram(), libMesh::PetscNonlinearSolver< T >::build_mat_null_space(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::DistributedVector< T >::clone(), libMesh::EigenSparseVector< T >::clone(), libMesh::LaspackVector< T >::clone(), libMesh::EpetraVector< T >::clone(), libMesh::PetscVector< T >::clone(), libMesh::EpetraVector< T >::close(), libMesh::Parallel::Sort< KeyType, IdxType >::communicate_bins(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::EpetraVector< T >::EpetraVector(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::EquationSystems::get_solution(), libMesh::LocationMap< T >::init(), libMesh::PetscDiffSolver::init(), libMesh::TimeSolver::init(), libMesh::TopologyMap::init(), libMesh::TaoOptimizationSolver< T >::init(), libMesh::PetscNonlinearSolver< T >::init(), libMesh::DistributedVector< T >::init(), libMesh::EpetraVector< T >::init(), libMesh::PetscVector< T >::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::DistributedVector< T >::max(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshSerializer::MeshSerializer(), libMesh::DistributedVector< T >::min(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), 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::BoundaryInfo::n_shellface_conds(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::ReplicatedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_n_elem(), libMesh::DistributedMesh::parallel_n_nodes(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::MeshTools::paranoid_n_levels(), libMesh::Partitioner::partition(), libMesh::MetisPartitioner::partition_range(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::SparseMatrix< T >::print(), libMesh::MeshTools::processor_bounding_box(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::Parallel::Sort< KeyType, IdxType >::sort(), libMesh::MeshTools::subdomain_bounding_box(), libMesh::MeshBase::subdomain_ids(), 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::XdrIO::write(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::DistributedVector< T >::zero_clone(), libMesh::LaspackVector< T >::zero_clone(), libMesh::EigenSparseVector< T >::zero_clone(), libMesh::EpetraVector< T >::zero_clone(), and libMesh::PetscVector< T >::zero_clone().

88  { return _communicator; }
const Parallel::Communicator & _communicator
bool libMesh::UnstructuredMesh::contract ( )
virtualinherited

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 747 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::MeshBase::ghosting_functors_begin(), libMesh::MeshBase::ghosting_functors_end(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::GhostingFunctor::mesh_reinit(), libMesh::Elem::parent(), libMesh::MeshBase::renumber_nodes_and_elements(), and libMesh::Elem::subactive().

748 {
749  LOG_SCOPE ("contract()", "Mesh");
750 
751  // Flag indicating if this call actually changes the mesh
752  bool mesh_changed = false;
753 
754  element_iterator in = elements_begin();
755  const element_iterator end = elements_end();
756 
757 #ifdef DEBUG
758  for ( ; in != end; ++in)
759  if (*in != libmesh_nullptr)
760  {
761  Elem * el = *in;
762  libmesh_assert(el->active() || el->subactive() || el->ancestor());
763  }
764  in = elements_begin();
765 #endif
766 
767  // Loop over the elements.
768  for ( ; in != end; ++in)
769  if (*in != libmesh_nullptr)
770  {
771  Elem * el = *in;
772 
773  // Delete all the subactive ones
774  if (el->subactive())
775  {
776  // No level-0 element should be subactive.
777  // Note that we CAN'T test elem->level(), as that
778  // touches elem->parent()->dim(), and elem->parent()
779  // might have already been deleted!
780  libmesh_assert(el->parent());
781 
782  // Delete the element
783  // This just sets a pointer to NULL, and doesn't
784  // invalidate any iterators
785  this->delete_elem(el);
786 
787  // the mesh has certainly changed
788  mesh_changed = true;
789  }
790  else
791  {
792  // Compress all the active ones
793  if (el->active())
794  el->contract();
795  else
796  libmesh_assert (el->ancestor());
797  }
798  }
799 
800  // Strip any newly-created NULL voids out of the element array
802 
803  // FIXME: Need to understand why deleting subactive children
804  // invalidates the point locator. For now we will clear it explicitly
805  this->clear_point_locator();
806 
807  // Allow our GhostingFunctor objects to reinit if necessary.
808  std::set<GhostingFunctor *>::iterator gf_it = this->ghosting_functors_begin();
809  const std::set<GhostingFunctor *>::iterator gf_end = this->ghosting_functors_end();
810  for (; gf_it != gf_end; ++gf_it)
811  {
812  GhostingFunctor *gf = *gf_it;
813  libmesh_assert(gf);
814  gf->mesh_reinit();
815  }
816 
817  return mesh_changed;
818 }
const class libmesh_nullptr_t libmesh_nullptr
IterBase * end
libmesh_assert(j)
std::set< GhostingFunctor * >::const_iterator ghosting_functors_end() const
Definition: mesh_base.h:761
virtual element_iterator elements_begin()=0
virtual void delete_elem(Elem *e)=0
virtual element_iterator elements_end()=0
void clear_point_locator()
Definition: mesh_base.C:552
std::set< GhostingFunctor * >::const_iterator ghosting_functors_begin() const
Definition: mesh_base.h:755
virtual void renumber_nodes_and_elements()=0
void libMesh::UnstructuredMesh::copy_nodes_and_elements ( const UnstructuredMesh other_mesh,
const bool  skip_find_neighbors = false 
)
virtualinherited

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

Definition at line 71 of file unstructured_mesh.C.

References libMesh::MeshBase::_is_prepared, libMesh::MeshBase::_n_parts, libMesh::Elem::add_child(), libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::MeshBase::allow_renumbering(), libMesh::Elem::build(), libMesh::Elem::child_ptr(), libMesh::MeshBase::elem_ptr(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), end, libMesh::Elem::has_children(), libMesh::DofObject::id(), libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids(), libmesh_nullptr, libMesh::Elem::n_children(), libMesh::MeshBase::n_elem(), libMesh::Elem::n_neighbors(), libMesh::MeshBase::n_nodes(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::node_id(), libMesh::MeshBase::node_ptr(), 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::Elem::refinement_flag(), libMesh::remote_elem, libMesh::MeshBase::reserve_elem(), libMesh::MeshBase::reserve_nodes(), libMesh::Elem::set_neighbor(), libMesh::DofObject::set_unique_id(), libMesh::MeshBase::skip_partitioning(), libMesh::Elem::subdomain_id(), libMesh::Elem::type(), libMesh::DofObject::unique_id(), and libMesh::Elem::which_child_am_i().

Referenced by libMesh::DistributedMesh::DistributedMesh(), libMesh::ReplicatedMesh::ReplicatedMesh(), and libMesh::ReplicatedMesh::stitching_helper().

73 {
74  // We're assuming our subclass data needs no copy
75  libmesh_assert_equal_to (_n_parts, other_mesh._n_parts);
76  libmesh_assert_equal_to (_is_prepared, other_mesh._is_prepared);
77 
78  // We're assuming the other mesh has proper element number ordering,
79  // so that we add parents before their children.
80 #ifdef DEBUG
82 #endif
83 
84  //Copy in Nodes
85  {
86  //Preallocate Memory if necessary
87  this->reserve_nodes(other_mesh.n_nodes());
88 
89  const_node_iterator it = other_mesh.nodes_begin();
90  const_node_iterator end = other_mesh.nodes_end();
91 
92  for (; it != end; ++it)
93  {
94  const Node * oldn = *it;
95 
96  // Add new nodes in old node Point locations
97 #ifdef LIBMESH_ENABLE_UNIQUE_ID
98  Node *newn =
99 #endif
100  this->add_point(*oldn, oldn->id(), oldn->processor_id());
101 
102 #ifdef LIBMESH_ENABLE_UNIQUE_ID
103  newn->set_unique_id() = oldn->unique_id();
104 #endif
105  }
106  }
107 
108  //Copy in Elements
109  {
110  //Preallocate Memory if necessary
111  this->reserve_elem(other_mesh.n_elem());
112 
113  // Declare a map linking old and new elements, needed to copy the neighbor lists
114  std::map<const Elem *, Elem *> old_elems_to_new_elems;
115 
116  // Loop over the elements
117  MeshBase::const_element_iterator it = other_mesh.elements_begin();
118  const MeshBase::const_element_iterator end = other_mesh.elements_end();
119 
120  // FIXME: Where do we set element IDs??
121  for (; it != end; ++it)
122  {
123  //Look at the old element
124  const Elem * old = *it;
125  //Build a new element
126  Elem * newparent = old->parent() ?
127  this->elem_ptr(old->parent()->id()) : libmesh_nullptr;
128  UniquePtr<Elem> ap = Elem::build(old->type(), newparent);
129  Elem * el = ap.release();
130 
131  el->subdomain_id() = old->subdomain_id();
132 
133  for (unsigned int s=0; s != old->n_sides(); ++s)
134  if (old->neighbor_ptr(s) == remote_elem)
135  el->set_neighbor(s, const_cast<RemoteElem *>(remote_elem));
136 
137 #ifdef LIBMESH_ENABLE_AMR
138  if (old->has_children())
139  for (unsigned int c=0; c != old->n_children(); ++c)
140  if (old->child_ptr(c) == remote_elem)
141  el->add_child(const_cast<RemoteElem *>(remote_elem), c);
142 
143  //Create the parent's child pointers if necessary
144  if (newparent)
145  {
146  unsigned int oldc = old->parent()->which_child_am_i(old);
147  newparent->add_child(el, oldc);
148  }
149 
150  // Copy the refinement flags
151  el->set_refinement_flag(old->refinement_flag());
152 
153  // Use hack_p_level since we may not have sibling elements
154  // added yet
155  el->hack_p_level(old->p_level());
156 
157  el->set_p_refinement_flag(old->p_refinement_flag());
158 #endif // #ifdef LIBMESH_ENABLE_AMR
159 
160  //Assign all the nodes
161  for(unsigned int i=0;i<el->n_nodes();i++)
162  el->set_node(i) = this->node_ptr(old->node_id(i));
163 
164  // And start it off in the same subdomain
165  el->processor_id() = old->processor_id();
166 
167  // Give it the same ids
168  el->set_id(old->id());
169 
170 #ifdef LIBMESH_ENABLE_UNIQUE_ID
171  el->set_unique_id() = old->unique_id();
172 #endif
173 
174  //Hold onto it
175  if(!skip_find_neighbors)
176  {
177  this->add_elem(el);
178  }
179  else
180  {
181  Elem * new_el = this->add_elem(el);
182  old_elems_to_new_elems[old] = new_el;
183  }
184 
185  // Add the link between the original element and this copy to the map
186  if(skip_find_neighbors)
187  old_elems_to_new_elems[old] = el;
188  }
189 
190  // Loop (again) over the elements to fill in the neighbors
191  if(skip_find_neighbors)
192  {
193  it = other_mesh.elements_begin();
194  for (; it != end; ++it)
195  {
196  Elem * old_elem = *it;
197  Elem * new_elem = old_elems_to_new_elems[old_elem];
198  for (unsigned int s=0; s != old_elem->n_neighbors(); ++s)
199  {
200  const Elem * old_neighbor = old_elem->neighbor_ptr(s);
201  Elem * new_neighbor = old_elems_to_new_elems[old_neighbor];
202  new_elem->set_neighbor(s, new_neighbor);
203  }
204  }
205  }
206  }
207 
208  //Finally prepare the new Mesh for use. Keep the same numbering and
209  //partitioning but also the same renumbering and partitioning
210  //policies as our source mesh.
211  this->allow_renumbering(false);
212  this->skip_partitioning(true);
213  this->prepare_for_use(false, skip_find_neighbors);
214  this->allow_renumbering(other_mesh.allow_renumbering());
215  this->skip_partitioning(other_mesh.skip_partitioning());
216 }
unique_id_type & set_unique_id()
Definition: dof_object.h:654
virtual void reserve_nodes(const dof_id_type nn)=0
static UniquePtr< Elem > build(const ElemType type, Elem *p=libmesh_nullptr)
Definition: elem.C:234
bool skip_partitioning() const
Definition: mesh_base.h:732
const class libmesh_nullptr_t libmesh_nullptr
virtual const Node * node_ptr(const dof_id_type i) const =0
IterBase * end
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
unsigned int _n_parts
Definition: mesh_base.h:1276
virtual Elem * add_elem(Elem *e)=0
void libmesh_assert_valid_amr_elem_ids(const MeshBase &mesh)
Definition: mesh_tools.C:1119
void prepare_for_use(const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false)
Definition: mesh_base.C:174
bool allow_renumbering() const
Definition: mesh_base.h:708
virtual const Elem * elem_ptr(const dof_id_type i) const =0
virtual void reserve_elem(const dof_id_type ne)=0
processor_id_type processor_id() const
Definition: dof_object.h:686
const RemoteElem * remote_elem
Definition: remote_elem.C:57
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 626 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.

628 {
629 
630  // Issue a warning if the number the number of processors
631  // currently available is less that that requested for
632  // partitioning. This is not necessarily an error since
633  // you may run on one processor and still partition the
634  // mesh into several partitions.
635 #ifdef DEBUG
636  if (this->n_processors() < pid)
637  {
638  libMesh::out << "WARNING: You are creating a "
639  << "mesh for a processor id (="
640  << pid
641  << ") greater than "
642  << "the number of processors available for "
643  << "the calculation. (="
644  << this->n_processors()
645  << ")."
646  << std::endl;
647  }
648 #endif
649 
650  // Create iterators to loop over the list of elements
651  // const_active_pid_elem_iterator it(this->elements_begin(), pid);
652  // const const_active_pid_elem_iterator it_end(this->elements_end(), pid);
653 
654  const_element_iterator it = this->active_pid_elements_begin(pid);
655  const const_element_iterator it_end = this->active_pid_elements_end(pid);
656 
657  this->create_submesh (pid_mesh, it, it_end);
658 }
processor_id_type n_processors() const
void create_submesh(UnstructuredMesh &new_mesh, const_element_iterator &it, const const_element_iterator &it_end) const
virtual element_iterator active_pid_elements_begin(processor_id_type proc_id)=0
virtual element_iterator active_pid_elements_end(processor_id_type proc_id)=0
OStreamProxy out(std::cout)
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 666 of file unstructured_mesh.C.

References libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::BoundaryInfo::add_side(), libMesh::BoundaryInfo::boundary_ids(), libMesh::Elem::build(), libMesh::MeshBase::clear(), libMesh::MeshBase::delete_remote_elements(), libMesh::MeshBase::get_boundary_info(), libMesh::DofObject::id(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::Elem::n_nodes(), libMesh::Elem::n_sides(), libMesh::Elem::node_id(), libMesh::Elem::node_ptr(), libMesh::MeshBase::node_ptr(), libMesh::Elem::point(), libMesh::MeshBase::prepare_for_use(), libMesh::DofObject::processor_id(), libMesh::MeshBase::query_node_ptr(), libMesh::DofObject::set_id(), libMesh::Elem::set_node(), libMesh::DofObject::set_unique_id(), libMesh::Elem::subdomain_id(), libMesh::Elem::type(), and libMesh::DofObject::unique_id().

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

669 {
670  // Just in case the subdomain_mesh already has some information
671  // in it, get rid of it.
672  new_mesh.clear();
673 
674  // If we're not serial, our submesh isn't either.
675  // There are no remote elements to delete on an empty mesh, but
676  // calling the method to do so marks the mesh as parallel.
677  if (!this->is_serial())
678  new_mesh.delete_remote_elements();
679 
680  // Fail if (*this == new_mesh), we cannot create a submesh inside ourself!
681  // This may happen if the user accidently passes the original mesh into
682  // this function! We will check this by making sure we did not just
683  // clear ourself.
684  libmesh_assert_not_equal_to (this->n_nodes(), 0);
685  libmesh_assert_not_equal_to (this->n_elem(), 0);
686 
687  // Container to catch boundary IDs handed back by BoundaryInfo
688  std::vector<boundary_id_type> bc_ids;
689 
690  for (; it != it_end; ++it)
691  {
692  const Elem * old_elem = *it;
693 
694  // Add an equivalent element type to the new_mesh.
695  // Copy ids for this element.
696  Elem * new_elem = Elem::build(old_elem->type()).release();
697  new_elem->set_id() = old_elem->id();
698 #ifdef LIBMESH_ENABLE_UNIQUE_ID
699  new_elem->set_unique_id() = old_elem->unique_id();
700 #endif
701  new_elem->subdomain_id() = old_elem->subdomain_id();
702  new_elem->processor_id() = old_elem->processor_id();
703 
704  new_mesh.add_elem (new_elem);
705 
706  libmesh_assert(new_elem);
707 
708  // Loop over the nodes on this element.
709  for (unsigned int n=0; n<old_elem->n_nodes(); n++)
710  {
711  const dof_id_type this_node_id = old_elem->node_id(n);
712 
713  // Add this node to the new mesh if it's not there already
714  if (!new_mesh.query_node_ptr(this_node_id))
715  {
716 #ifdef LIBMESH_ENABLE_UNIQUE_ID
717  Node *newn =
718 #endif
719  new_mesh.add_point (old_elem->point(n),
720  this_node_id,
721  old_elem->node_ptr(n)->processor_id());
722 
723 #ifdef LIBMESH_ENABLE_UNIQUE_ID
724  newn->set_unique_id() = old_elem->node_ptr(n)->unique_id();
725 #endif
726  }
727 
728  // Define this element's connectivity on the new mesh
729  new_elem->set_node(n) = new_mesh.node_ptr(this_node_id);
730  }
731 
732  // Maybe add boundary conditions for this element
733  for (unsigned short s=0; s<old_elem->n_sides(); s++)
734  {
735  this->get_boundary_info().boundary_ids(old_elem, s, bc_ids);
736  new_mesh.get_boundary_info().add_side (new_elem, s, bc_ids);
737  }
738  } // end loop over elements
739 
740  // Prepare the new_mesh for use
741  new_mesh.prepare_for_use(/*skip_renumber =*/false);
742 }
const BoundaryInfo & get_boundary_info() const
Definition: mesh_base.h:111
virtual bool is_serial() const
Definition: mesh_base.h:134
static UniquePtr< Elem > build(const ElemType type, Elem *p=libmesh_nullptr)
Definition: elem.C:234
libmesh_assert(j)
std::vector< boundary_id_type > boundary_ids(const Node *node) const
virtual dof_id_type n_nodes() const =0
virtual dof_id_type n_elem() const =0
uint8_t dof_id_type
Definition: id_types.h:64
void libMesh::ReplicatedMesh::delete_elem ( Elem e)
virtualinherited

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.

Users should call MeshBase::prepare_for_use() after elements are added to and/or deleted from the mesh.

Implements libMesh::MeshBase.

Definition at line 346 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_elements, libMesh::MeshBase::get_boundary_info(), libMesh::DofObject::id(), libMesh::libmesh_assert(), libmesh_nullptr, and libMesh::BoundaryInfo::remove().

Referenced by libMesh::ReplicatedMesh::insert_elem(), and libMesh::ReplicatedMesh::reserve_elem().

347 {
348  libmesh_assert(e);
349 
350  // Initialize an iterator to eventually point to the element we want to delete
351  std::vector<Elem *>::iterator pos = _elements.end();
352 
353  // In many cases, e->id() gives us a clue as to where e
354  // is located in the _elements vector. Try that first
355  // before trying the O(n_elem) search.
356  libmesh_assert_less (e->id(), _elements.size());
357 
358  if (_elements[e->id()] == e)
359  {
360  // We found it!
361  pos = _elements.begin();
362  std::advance(pos, e->id());
363  }
364 
365  else
366  {
367  // This search is O(n_elem)
368  pos = std::find (_elements.begin(),
369  _elements.end(),
370  e);
371  }
372 
373  // Huh? Element not in the vector?
374  libmesh_assert (pos != _elements.end());
375 
376  // Remove the element from the BoundaryInfo object
377  this->get_boundary_info().remove(e);
378 
379  // delete the element
380  delete e;
381 
382  // explicitly NULL the pointer
383  *pos = libmesh_nullptr;
384 }
const BoundaryInfo & get_boundary_info() const
Definition: mesh_base.h:111
std::vector< Elem * > _elements
void remove(const Node *node)
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
dof_id_type id() const
Definition: dof_object.h:624
void libMesh::ReplicatedMesh::delete_node ( Node n)
virtualinherited

Removes the Node n from the mesh.

Implements libMesh::MeshBase.

Definition at line 519 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_nodes, libMesh::MeshBase::get_boundary_info(), libMesh::DofObject::id(), libMesh::libmesh_assert(), libmesh_nullptr, and libMesh::BoundaryInfo::remove().

Referenced by libMesh::ReplicatedMesh::reserve_elem(), and libMesh::ReplicatedMesh::stitching_helper().

520 {
521  libmesh_assert(n);
522  libmesh_assert_less (n->id(), _nodes.size());
523 
524  // Initialize an iterator to eventually point to the element we want
525  // to delete
526  std::vector<Node *>::iterator pos;
527 
528  // In many cases, e->id() gives us a clue as to where e
529  // is located in the _elements vector. Try that first
530  // before trying the O(n_elem) search.
531  if (_nodes[n->id()] == n)
532  {
533  pos = _nodes.begin();
534  std::advance(pos, n->id());
535  }
536  else
537  {
538  pos = std::find (_nodes.begin(),
539  _nodes.end(),
540  n);
541  }
542 
543  // Huh? Node not in the vector?
544  libmesh_assert (pos != _nodes.end());
545 
546  // Delete the node from the BoundaryInfo object
547  this->get_boundary_info().remove(n);
548 
549  // delete the node
550  delete n;
551 
552  // explicitly NULL the pointer
553  *pos = libmesh_nullptr;
554 }
const BoundaryInfo & get_boundary_info() const
Definition: mesh_base.h:111
void remove(const Node *node)
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
std::vector< Node * > _nodes
dof_id_type id() const
Definition: dof_object.h:624
virtual void libMesh::MeshBase::delete_remote_elements ( )
inlinevirtualinherited

When supported, 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 in libMesh::DistributedMesh.

Definition at line 161 of file mesh_base.h.

References libMesh::MeshBase::mesh_dimension().

Referenced by libMesh::MeshTools::Generation::build_extrusion(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshBase::prepare_for_use(), libMesh::Nemesis_IO::read(), libMesh::BoundaryInfo::sync(), and libMesh::MeshSerializer::~MeshSerializer().

161 {}
void libMesh::MeshBase::detect_interior_parents ( )
inherited

Search the mesh for elements that have a neighboring element of dim+1 and set that element as the interior parent

Definition at line 675 of file mesh_base.C.

References libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), libMesh::Elem::dim(), libMesh::MeshBase::elem(), libMesh::MeshBase::elem_dimensions(), libMesh::MeshBase::elem_ptr(), libMesh::MeshBase::elem_ref(), libMesh::MeshBase::elements_begin(), end, libMesh::DofObject::id(), libMesh::Elem::interior_parent(), libMesh::MeshBase::max_elem_id(), libMesh::Elem::n_vertices(), libMesh::Elem::node_id(), and libMesh::Elem::set_interior_parent().

Referenced by libMesh::MeshBase::get_subdomain_name_map(), and libMesh::MeshBase::prepare_for_use().

676 {
677  // This requires an inspection on every processor
678  parallel_object_only();
679 
680  // Check if the mesh contains mixed dimensions. If so, then set interior parents, otherwise return.
681  if (this->elem_dimensions().size() == 1)
682  return;
683 
684  //This map will be used to set interior parents
685  LIBMESH_BEST_UNORDERED_MAP<dof_id_type, std::vector<dof_id_type> > node_to_elem;
686 
687  const_element_iterator el = this->active_elements_begin();
688  const_element_iterator end = this->active_elements_end();
689 
690  for (; el!=end; ++el)
691  {
692  const Elem * elem = *el;
693 
694  // Populating the node_to_elem map, same as MeshTools::build_nodes_to_elem_map
695  for (unsigned int n=0; n<elem->n_vertices(); n++)
696  {
697  libmesh_assert_less (elem->id(), this->max_elem_id());
698 
699  node_to_elem[elem->node_id(n)].push_back(elem->id());
700  }
701  }
702 
703  // Automatically set interior parents
704  el = this->elements_begin();
705  for (; el!=end; ++el)
706  {
707  Elem * element = *el;
708 
709  // Ignore an 3D element or an element that already has an interior parent
710  if (element->dim()>=LIBMESH_DIM || element->interior_parent())
711  continue;
712 
713  // Start by generating a SET of elements that are dim+1 to the current
714  // element at each vertex of the current element, thus ignoring interior nodes.
715  // If one of the SET of elements is empty, then we will not have an interior parent
716  // since an interior parent must be connected to all vertices of the current element
717  std::vector< std::set<dof_id_type> > neighbors( element->n_vertices() );
718 
719  bool found_interior_parents = false;
720 
721  for (dof_id_type n=0; n < element->n_vertices(); n++)
722  {
723  std::vector<dof_id_type> & element_ids = node_to_elem[element->node_id(n)];
724  for (std::vector<dof_id_type>::iterator e_it = element_ids.begin();
725  e_it != element_ids.end(); e_it++)
726  {
727  dof_id_type eid = *e_it;
728  if (this->elem_ref(eid).dim() == element->dim()+1)
729  neighbors[n].insert(eid);
730  }
731  if (neighbors[n].size()>0)
732  {
733  found_interior_parents = true;
734  }
735  else
736  {
737  // We have found an empty set, no reason to continue
738  // Ensure we set this flag to false before the break since it could have
739  // been set to true for previous vertex
740  found_interior_parents = false;
741  break;
742  }
743  }
744 
745  // If we have successfully generated a set of elements for each vertex, we will compare
746  // the set for vertex 0 will the sets for the vertices until we find a id that exists in
747  // all sets. If found, this is our an interior parent id. The interior parent id found
748  // will be the lowest element id if there is potential for multiple interior parents.
749  if (found_interior_parents)
750  {
751  std::set<dof_id_type> & neighbors_0 = neighbors[0];
752  for (std::set<dof_id_type>::iterator e_it = neighbors_0.begin();
753  e_it != neighbors_0.end(); e_it++)
754  {
755  found_interior_parents=false;
756  dof_id_type interior_parent_id = *e_it;
757  for (dof_id_type n=1; n < element->n_vertices(); n++)
758  {
759  if (neighbors[n].find(interior_parent_id)!=neighbors[n].end())
760  {
761  found_interior_parents=true;
762  }
763  else
764  {
765  found_interior_parents=false;
766  break;
767  }
768  }
769  if (found_interior_parents)
770  {
771  element->set_interior_parent(this->elem_ptr(interior_parent_id));
772  break;
773  }
774  }
775  }
776  }
777 }
virtual const Elem * elem(const dof_id_type i) const
Definition: mesh_base.h:486
IterBase * end
virtual element_iterator elements_begin()=0
virtual dof_id_type max_elem_id() const =0
const std::set< unsigned char > & elem_dimensions() const
Definition: mesh_base.h:184
virtual element_iterator active_elements_begin()=0
virtual element_iterator active_elements_end()=0
virtual const Elem & elem_ref(const dof_id_type i) const
Definition: mesh_base.h:453
virtual unsigned int dim() const =0
virtual const Elem * elem_ptr(const dof_id_type i) const =0
uint8_t dof_id_type
Definition: id_types.h:64
virtual const Elem* libMesh::MeshBase::elem ( const dof_id_type  i) const
inlinevirtualinherited

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

This method is deprecated; use the less confusingly-named elem_ptr() instead.

Definition at line 486 of file mesh_base.h.

References libMesh::MeshBase::elem_ptr().

Referenced by libMesh::MeshBase::detect_interior_parents(), and libMesh::MeshTools::Modification::smooth().

487  {
488  libmesh_deprecated();
489  return this->elem_ptr(i);
490  }
virtual const Elem * elem_ptr(const dof_id_type i) const =0
virtual Elem* libMesh::MeshBase::elem ( const dof_id_type  i)
inlinevirtualinherited

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

This method is deprecated; use the less confusingly-named elem_ptr() instead.

Definition at line 500 of file mesh_base.h.

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

501  {
502  libmesh_deprecated();
503  return this->elem_ptr(i);
504  }
virtual const Elem * elem_ptr(const dof_id_type i) const =0
const std::set<unsigned char>& libMesh::MeshBase::elem_dimensions ( ) const
inlineinherited
const Elem * libMesh::ReplicatedMesh::elem_ptr ( const dof_id_type  i) const
virtualinherited

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 236 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_elements, libMesh::libmesh_assert(), and libMesh::ReplicatedMesh::n_elem().

Referenced by libMesh::ReplicatedMesh::reserve_elem(), and libMesh::ReplicatedMesh::stitching_helper().

237 {
238  libmesh_assert_less (i, this->n_elem());
240  libmesh_assert_equal_to (_elements[i]->id(), i); // This will change soon
241 
242  return _elements[i];
243 }
std::vector< Elem * > _elements
libmesh_assert(j)
virtual dof_id_type n_elem() const libmesh_override
Elem * libMesh::ReplicatedMesh::elem_ptr ( const dof_id_type  i)
virtualinherited

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 248 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_elements, libMesh::libmesh_assert(), and libMesh::ReplicatedMesh::n_elem().

249 {
250  libmesh_assert_less (i, this->n_elem());
252  libmesh_assert_equal_to (_elements[i]->id(), i); // This will change soon
253 
254  return _elements[i];
255 }
std::vector< Elem * > _elements
libmesh_assert(j)
virtual dof_id_type n_elem() const libmesh_override
virtual Elem& libMesh::MeshBase::elem_ref ( const dof_id_type  i)
inlinevirtualinherited

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

Definition at line 462 of file mesh_base.h.

References libMesh::MeshBase::elem_ptr().

462  {
463  return *this->elem_ptr(i);
464  }
virtual const Elem * elem_ptr(const dof_id_type i) const =0
virtual element_iterator libMesh::ReplicatedMesh::elements_begin ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::evaluable_elements_begin ( const DofMap dof_map,
unsigned int  var_num = libMesh::invalid_uint 
)
virtualinherited

Iterate over elements in the Mesh where the solution (as distributed by the given DofMap) can be evaluated, for the given variable var_num, or for all variables by default.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_element_iterator libMesh::ReplicatedMesh::evaluable_elements_begin ( const DofMap dof_map,
unsigned int  var_num = libMesh::invalid_uint 
) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::evaluable_elements_end ( const DofMap dof_map,
unsigned int  var_num = libMesh::invalid_uint 
)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::evaluable_elements_end ( const DofMap dof_map,
unsigned int  var_num = libMesh::invalid_uint 
) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::evaluable_nodes_begin ( const DofMap dof_map,
unsigned int  var_num = libMesh::invalid_uint 
)
virtualinherited

Iterate over nodes in the Mesh where the solution (as distributed by the given DofMap) can be evaluated, for the given variable var_num, or for all variables by default.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_node_iterator libMesh::ReplicatedMesh::evaluable_nodes_begin ( const DofMap dof_map,
unsigned int  var_num = libMesh::invalid_uint 
) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::evaluable_nodes_end ( const DofMap dof_map,
unsigned int  var_num = libMesh::invalid_uint 
)
virtualinherited
virtual const_node_iterator libMesh::ReplicatedMesh::evaluable_nodes_end ( const DofMap dof_map,
unsigned int  var_num = libMesh::invalid_uint 
) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::facelocal_elements_begin ( )
virtualinherited

Iterate over elements which are on or have a neighbor on the current processor.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_element_iterator libMesh::ReplicatedMesh::facelocal_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::facelocal_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::facelocal_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

void libMesh::UnstructuredMesh::find_neighbors ( const bool  reset_remote_elements = false,
const bool  reset_current_list = true 
)
virtualinherited

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.

We also need to look through children ordered by increasing refinement level in order to add new interior_parent() links in boundary elements which have just been generated by refinement, and fix links in boundary elements whose previous interior_parent() has just been coarsened away.

Implements libMesh::MeshBase.

Definition at line 231 of file unstructured_mesh.C.

References libMesh::TypeVector< T >::absolute_fuzzy_equals(), libMesh::Elem::active(), libMesh::Elem::ancestor(), libMesh::Elem::centroid(), libMesh::Elem::child_ptr(), 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::interior_parent(), 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_amr_interior_parents(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libmesh_nullptr, libMesh::Elem::n_children(), libMesh::MeshTools::n_levels(), libMesh::Elem::n_neighbors(), libMesh::Elem::n_nodes(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), libMesh::Elem::point(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::Real, libMesh::remote_elem, libMesh::Elem::set_interior_parent(), libMesh::Elem::set_neighbor(), libMesh::Elem::side_ptr(), libMesh::Elem::subactive(), libMesh::TOLERANCE, libMesh::Elem::which_child_am_i(), and libMesh::NameBasedIO::write().

Referenced by libMesh::TriangleWrapper::copy_tri_to_mesh(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), and libMesh::DistributedMesh::redistribute().

233 {
234  // We might actually want to run this on an empty mesh
235  // (e.g. the boundary mesh for a nonexistant bcid!)
236  // libmesh_assert_not_equal_to (this->n_nodes(), 0);
237  // libmesh_assert_not_equal_to (this->n_elem(), 0);
238 
239  // This function must be run on all processors at once
240  parallel_object_only();
241 
242  LOG_SCOPE("find_neighbors()", "Mesh");
243 
244  const element_iterator el_end = this->elements_end();
245 
246  //TODO:[BSK] This should be removed later?!
247  if (reset_current_list)
248  for (element_iterator el = this->elements_begin(); el != el_end; ++el)
249  {
250  Elem * e = *el;
251  for (unsigned int s=0; s<e->n_neighbors(); s++)
252  if (e->neighbor_ptr(s) != remote_elem ||
253  reset_remote_elements)
254  e->set_neighbor(s, libmesh_nullptr);
255  }
256 
257  // Find neighboring elements by first finding elements
258  // with identical side keys and then check to see if they
259  // are neighbors
260  {
261  // data structures -- Use the hash_multimap if available
262  typedef unsigned int key_type;
263  typedef std::pair<Elem *, unsigned char> val_type;
264  typedef std::pair<key_type, val_type> key_val_pair;
265 
266  typedef LIBMESH_BEST_UNORDERED_MULTIMAP<key_type, val_type> map_type;
267 
268  // A map from side keys to corresponding elements & side numbers
269  map_type side_to_elem_map;
270 
271 
272 
273  for (element_iterator el = this->elements_begin(); el != el_end; ++el)
274  {
275  Elem * element = *el;
276 
277  for (unsigned char ms=0; ms<element->n_neighbors(); ms++)
278  {
279  next_side:
280  // If we haven't yet found a neighbor on this side, try.
281  // Even if we think our neighbor is remote, that
282  // information may be out of date.
283  if (element->neighbor_ptr(ms) == libmesh_nullptr ||
284  element->neighbor_ptr(ms) == remote_elem)
285  {
286  // Get the key for the side of this element
287  const unsigned int key = element->key(ms);
288 
289  // Look for elements that have an identical side key
290  std::pair <map_type::iterator, map_type::iterator>
291  bounds = side_to_elem_map.equal_range(key);
292 
293  // May be multiple keys, check all the possible
294  // elements which _might_ be neighbors.
295  if (bounds.first != bounds.second)
296  {
297  // Get the side for this element
298  const UniquePtr<Elem> my_side(element->side_ptr(ms));
299 
300  // Look at all the entries with an equivalent key
301  while (bounds.first != bounds.second)
302  {
303  // Get the potential element
304  Elem * neighbor = bounds.first->second.first;
305 
306  // Get the side for the neighboring element
307  const unsigned int ns = bounds.first->second.second;
308  const UniquePtr<Elem> their_side(neighbor->side_ptr(ns));
309  //libmesh_assert(my_side.get());
310  //libmesh_assert(their_side.get());
311 
312  // If found a match with my side
313  //
314  // We need special tests here for 1D:
315  // since parents and children have an equal
316  // side (i.e. a node), we need to check
317  // ns != ms, and we also check level() to
318  // avoid setting our neighbor pointer to
319  // any of our neighbor's descendants
320  if( (*my_side == *their_side) &&
321  (element->level() == neighbor->level()) &&
322  ((element->dim() != 1) || (ns != ms)) )
323  {
324  // So share a side. Is this a mixed pair
325  // of subactive and active/ancestor
326  // elements?
327  // If not, then we're neighbors.
328  // If so, then the subactive's neighbor is
329 
330  if (element->subactive() ==
331  neighbor->subactive())
332  {
333  // an element is only subactive if it has
334  // been coarsened but not deleted
335  element->set_neighbor (ms,neighbor);
336  neighbor->set_neighbor(ns,element);
337  }
338  else if (element->subactive())
339  {
340  element->set_neighbor(ms,neighbor);
341  }
342  else if (neighbor->subactive())
343  {
344  neighbor->set_neighbor(ns,element);
345  }
346  side_to_elem_map.erase (bounds.first);
347 
348  // get out of this nested crap
349  goto next_side;
350  }
351 
352  ++bounds.first;
353  }
354  }
355 
356  // didn't find a match...
357  // Build the map entry for this element
358  key_val_pair kvp;
359 
360  kvp.first = key;
361  kvp.second.first = element;
362  kvp.second.second = ms;
363 
364  // use the lower bound as a hint for
365  // where to put it.
366 #if defined(LIBMESH_HAVE_UNORDERED_MAP) || defined(LIBMESH_HAVE_TR1_UNORDERED_MAP) || defined(LIBMESH_HAVE_HASH_MAP) || defined(LIBMESH_HAVE_EXT_HASH_MAP)
367  side_to_elem_map.insert (kvp);
368 #else
369  side_to_elem_map.insert (bounds.first,kvp);
370 #endif
371  }
372  }
373  }
374  }
375 
376 #ifdef LIBMESH_ENABLE_AMR
377 
405  const unsigned int n_levels = MeshTools::n_levels(*this);
406  for (unsigned int level = 1; level < n_levels; ++level)
407  {
408  element_iterator end = this->level_elements_end(level);
409  for (element_iterator el = this->level_elements_begin(level);
410  el != end; ++el)
411  {
412  Elem * current_elem = *el;
413  libmesh_assert(current_elem);
414  Elem * parent = current_elem->parent();
415  libmesh_assert(parent);
416  const unsigned int my_child_num = parent->which_child_am_i(current_elem);
417 
418  for (unsigned int s=0; s < current_elem->n_neighbors(); s++)
419  {
420  if (current_elem->neighbor_ptr(s) == libmesh_nullptr ||
421  (current_elem->neighbor_ptr(s) == remote_elem &&
422  parent->is_child_on_side(my_child_num, s)))
423  {
424  Elem * neigh = parent->neighbor_ptr(s);
425 
426  // If neigh was refined and had non-subactive children
427  // made remote earlier, then a non-subactive elem should
428  // actually have one of those remote children as a
429  // neighbor
430  if (neigh && (neigh->ancestor()) && (!current_elem->subactive()))
431  {
432 #ifdef DEBUG
433  // Let's make sure that "had children made remote"
434  // situation is actually the case
435  libmesh_assert(neigh->has_children());
436  bool neigh_has_remote_children = false;
437  for (unsigned int c = 0; c != neigh->n_children(); ++c)
438  {
439  if (neigh->child_ptr(c) == remote_elem)
440  neigh_has_remote_children = true;
441  }
442  libmesh_assert(neigh_has_remote_children);
443 
444  // And let's double-check that we don't have
445  // a remote_elem neighboring an active local element
446  if (current_elem->active())
447  libmesh_assert_not_equal_to (current_elem->processor_id(),
448  this->processor_id());
449 #endif // DEBUG
450  neigh = const_cast<RemoteElem *>(remote_elem);
451  }
452 
453  if (!current_elem->subactive())
454  current_elem->set_neighbor(s, neigh);
455 #ifdef DEBUG
456  if (neigh != libmesh_nullptr && neigh != remote_elem)
457  // We ignore subactive elements here because
458  // we don't care about neighbors of subactive element.
459  if ((!neigh->active()) && (!current_elem->subactive()))
460  {
461  libMesh::err << "On processor " << this->processor_id()
462  << std::endl;
463  libMesh::err << "Bad element ID = " << current_elem->id()
464  << ", Side " << s << ", Bad neighbor ID = " << neigh->id() << std::endl;
465  libMesh::err << "Bad element proc_ID = " << current_elem->processor_id()
466  << ", Bad neighbor proc_ID = " << neigh->processor_id() << std::endl;
467  libMesh::err << "Bad element size = " << current_elem->hmin()
468  << ", Bad neighbor size = " << neigh->hmin() << std::endl;
469  libMesh::err << "Bad element center = " << current_elem->centroid()
470  << ", Bad neighbor center = " << neigh->centroid() << std::endl;
471  libMesh::err << "ERROR: "
472  << (current_elem->active()?"Active":"Ancestor")
473  << " Element at level "
474  << current_elem->level() << std::endl;
475  libMesh::err << "with "
476  << (parent->active()?"active":
477  (parent->subactive()?"subactive":"ancestor"))
478  << " parent share "
479  << (neigh->subactive()?"subactive":"ancestor")
480  << " neighbor at level " << neigh->level()
481  << std::endl;
482  NameBasedIO(*this).write ("bad_mesh.gmv");
483  libmesh_error_msg("Problematic mesh written to bad_mesh.gmv.");
484  }
485 #endif // DEBUG
486  }
487  }
488 
489  // We can skip to the next element if we're full-dimension
490  // and therefore don't have any interior parents
491  if (current_elem->dim() >= LIBMESH_DIM)
492  continue;
493 
494  // We have no interior parents unless we can find one later
495  current_elem->set_interior_parent(libmesh_nullptr);
496 
497  Elem * pip = parent->interior_parent();
498 
499  if (!pip)
500  continue;
501 
502  // If there's no interior_parent children, whether due to a
503  // remote element or a non-conformity, then there's no
504  // children to search.
505  if (pip == remote_elem || pip->active())
506  {
507  current_elem->set_interior_parent(pip);
508  continue;
509  }
510 
511  // For node comparisons we'll need a sensible tolerance
512  Real node_tolerance = current_elem->hmin() * TOLERANCE;
513 
514  // Otherwise our interior_parent should be a child of our
515  // parent's interior_parent.
516  for (unsigned int c=0; c != pip->n_children(); ++c)
517  {
518  Elem * child = pip->child_ptr(c);
519 
520  // If we have a remote_elem, that might be our
521  // interior_parent. We'll set it provisionally now and
522  // keep trying to find something better.
523  if (child == remote_elem)
524  {
525  current_elem->set_interior_parent
526  (const_cast<RemoteElem *>(remote_elem));
527  continue;
528  }
529 
530  bool child_contains_our_nodes = true;
531  for (unsigned int n=0; n != current_elem->n_nodes();
532  ++n)
533  {
534  bool child_contains_this_node = false;
535  for (unsigned int cn=0; cn != child->n_nodes();
536  ++cn)
537  if (child->point(cn).absolute_fuzzy_equals
538  (current_elem->point(n), node_tolerance))
539  {
540  child_contains_this_node = true;
541  break;
542  }
543  if (!child_contains_this_node)
544  {
545  child_contains_our_nodes = false;
546  break;
547  }
548  }
549  if (child_contains_our_nodes)
550  {
551  current_elem->set_interior_parent(child);
552  break;
553  }
554  }
555 
556  // We should have found *some* interior_parent at this
557  // point, whether semilocal or remote.
558  libmesh_assert(current_elem->interior_parent());
559  }
560  }
561 
562 #endif // AMR
563 
564 
565 #ifdef DEBUG
567  !reset_remote_elements);
569 #endif
570 }
void libmesh_assert_valid_amr_interior_parents(const MeshBase &mesh)
Definition: mesh_tools.C:1141
bool active() const
Definition: elem.h:1984
virtual element_iterator level_elements_begin(unsigned int level)=0
const class libmesh_nullptr_t libmesh_nullptr
static const Real TOLERANCE
IterBase * end
libmesh_assert(j)
virtual element_iterator elements_begin()=0
virtual element_iterator level_elements_end(unsigned int level)=0
virtual bool is_child_on_side(const unsigned int, const unsigned int) const libmesh_override
Definition: remote_elem.h:136
virtual element_iterator elements_end()=0
unsigned int n_levels(const MeshBase &mesh)
Definition: mesh_tools.C:568
OStreamProxy err(std::cerr)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void libmesh_assert_valid_neighbors(const MeshBase &mesh, bool assert_valid_remote_elems=true)
Definition: mesh_tools.C:1686
processor_id_type processor_id() const
const RemoteElem * remote_elem
Definition: remote_elem.C:57
void libMesh::ReplicatedMesh::fix_broken_node_and_element_numbering ( )
virtualinherited

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_ref(n).id() == n.

Implements libMesh::MeshBase.

Definition at line 791 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_elements, libMesh::ReplicatedMesh::_nodes, and libmesh_nullptr.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

792 {
793  // Nodes first
794  for (std::size_t n=0; n<this->_nodes.size(); n++)
795  if (this->_nodes[n] != libmesh_nullptr)
796  this->_nodes[n]->set_id() = cast_int<dof_id_type>(n);
797 
798  // Elements next
799  for (std::size_t e=0; e<this->_elements.size(); e++)
800  if (this->_elements[e] != libmesh_nullptr)
801  this->_elements[e]->set_id() = cast_int<dof_id_type>(e);
802 }
std::vector< Elem * > _elements
const class libmesh_nullptr_t libmesh_nullptr
std::vector< Node * > _nodes
virtual element_iterator libMesh::ReplicatedMesh::flagged_elements_begin ( unsigned char  rflag)
virtualinherited

Iterate over all elements with a specified refinement flag.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_element_iterator libMesh::ReplicatedMesh::flagged_elements_begin ( unsigned char  rflag) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::flagged_elements_end ( unsigned char  rflag)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::flagged_elements_end ( unsigned char  rflag) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::flagged_pid_elements_begin ( unsigned char  rflag,
processor_id_type  pid 
)
virtualinherited

Iterate over all elements with a specified refinement flag on a specified processor.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_element_iterator libMesh::ReplicatedMesh::flagged_pid_elements_begin ( unsigned char  rflag,
processor_id_type  pid 
) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::flagged_pid_elements_end ( unsigned char  rflag,
processor_id_type  pid 
)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::flagged_pid_elements_end ( unsigned char  rflag,
processor_id_type  pid 
) const
virtualinherited

Implements libMesh::MeshBase.

virtual void libMesh::MeshBase::gather_to_zero ( )
inlinevirtualinherited

Gathers all elements and nodes of the mesh onto processor zero

Reimplemented in libMesh::DistributedMesh.

Definition at line 154 of file mesh_base.h.

Referenced by libMesh::MeshSerializer::MeshSerializer().

154 {}
const BoundaryInfo& libMesh::MeshBase::get_boundary_info ( ) const
inlineinherited

The information about boundary ids on the mesh

Definition at line 111 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::MeshCommunication::broadcast(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshTools::Generation::build_sphere(), libMesh::MeshTools::Modification::change_boundary_id(), libMesh::DofMap::check_dirichlet_bcid_consistency(), 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::TetGenMeshInterface::delete_2D_hull_elements(), libMesh::ReplicatedMesh::delete_elem(), libMesh::DistributedMesh::delete_elem(), libMesh::ReplicatedMesh::delete_node(), libMesh::DistributedMesh::delete_node(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DistributedMesh::DistributedMesh(), libMesh::MeshTools::Modification::flatten(), libMesh::UNVIO::groups_in(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::BoundaryProjectSolution::operator()(), libMesh::Parallel::Packing< const Node * >::pack(), libMesh::Parallel::Packing< const Elem * >::pack(), libMesh::Parallel::Packing< const Node * >::packable_size(), libMesh::Parallel::Packing< const Elem * >::packable_size(), libMesh::TetGenMeshInterface::pointset_convexhull(), libMesh::Nemesis_IO::prepare_to_write_nodal_data(), libMesh::AbaqusIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_bcs(), libMesh::CheckpointIO::read_nodesets(), libMesh::ReplicatedMesh::renumber_nodes_and_elements(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::ReplicatedMesh::ReplicatedMesh(), libMesh::ReplicatedMesh::stitching_helper(), libMesh::Elem::topological_neighbor(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::FroIO::write(), libMesh::Nemesis_IO::write(), libMesh::ExodusII_IO::write(), libMesh::XdrIO::write(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), and libMesh::ExodusII_IO_Helper::write_sidesets().

111 { return *boundary_info; }
UniquePtr< BoundaryInfo > boundary_info
Definition: mesh_base.h:1256
BoundaryInfo& libMesh::MeshBase::get_boundary_info ( )
inlineinherited

Writeable information about boundary ids on the mesh

Definition at line 116 of file mesh_base.h.

References libMesh::MeshBase::boundary_info, and libMesh::MeshBase::clear().

116 { return *boundary_info; }
UniquePtr< BoundaryInfo > boundary_info
Definition: mesh_base.h:1256
bool libMesh::MeshBase::get_count_lower_dim_elems_in_point_locator ( ) const
inherited

Get the current value of _count_lower_dim_elems_in_point_locator.

Definition at line 566 of file mesh_base.C.

References libMesh::MeshBase::_count_lower_dim_elems_in_point_locator.

Referenced by libMesh::TreeNode< N >::insert().

567 {
569 }
bool _count_lower_dim_elems_in_point_locator
Definition: mesh_base.h:1296
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 593 of file mesh_base.C.

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

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

594 {
595  // Linear search over the map values.
596  std::map<subdomain_id_type, std::string>::const_iterator
597  iter = _block_id_to_name.begin(),
598  end_iter = _block_id_to_name.end();
599 
600  for ( ; iter != end_iter; ++iter)
601  if (iter->second == name)
602  return iter->first;
603 
604  // If we made it here without returning, we don't have a subdomain
605  // with the requested name, so return Elem::invalid_subdomain_id.
607 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:39
static const subdomain_id_type invalid_subdomain_id
Definition: elem.h:215
std::map< subdomain_id_type, std::string > _block_id_to_name
Definition: mesh_base.h:1338
std::string libMesh::MeshBase::get_info ( ) const
inherited
Returns
a string containing relevant information about the mesh.

Definition at line 412 of file mesh_base.C.

References libMesh::MeshBase::_elem_dims, 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::n_partitions(), and libMesh::MeshBase::print_info().

413 {
414  std::ostringstream oss;
415 
416  oss << " Mesh Information:" << '\n';
417 
418  if (!_elem_dims.empty())
419  {
420  oss << " elem_dimensions()={";
421  std::copy(_elem_dims.begin(),
422  --_elem_dims.end(), // --end() is valid if the set is non-empty
423  std::ostream_iterator<unsigned int>(oss, ", "));
424  oss << cast_int<unsigned int>(*_elem_dims.rbegin());
425  oss << "}\n";
426  }
427 
428  oss << " spatial_dimension()=" << this->spatial_dimension() << '\n'
429  << " n_nodes()=" << this->n_nodes() << '\n'
430  << " n_local_nodes()=" << this->n_local_nodes() << '\n'
431  << " n_elem()=" << this->n_elem() << '\n'
432  << " n_local_elem()=" << this->n_local_elem() << '\n'
433 #ifdef LIBMESH_ENABLE_AMR
434  << " n_active_elem()=" << this->n_active_elem() << '\n'
435 #endif
436  << " n_subdomains()=" << static_cast<std::size_t>(this->n_subdomains()) << '\n'
437  << " n_partitions()=" << static_cast<std::size_t>(this->n_partitions()) << '\n'
438  << " n_processors()=" << static_cast<std::size_t>(this->n_processors()) << '\n'
439  << " n_threads()=" << static_cast<std::size_t>(libMesh::n_threads()) << '\n'
440  << " processor_id()=" << static_cast<std::size_t>(this->processor_id()) << '\n';
441 
442  return oss.str();
443 }
virtual dof_id_type n_active_elem() const =0
unsigned int n_threads()
Definition: libmesh_base.h:125
dof_id_type n_local_nodes() const
Definition: mesh_base.h:245
unsigned int n_partitions() const
Definition: mesh_base.h:788
processor_id_type n_processors() const
std::set< unsigned char > _elem_dims
Definition: mesh_base.h:1345
unsigned int spatial_dimension() const
Definition: mesh_base.C:157
dof_id_type n_local_elem() const
Definition: mesh_base.h:339
subdomain_id_type n_subdomains() const
Definition: mesh_base.C:332
virtual dof_id_type n_nodes() const =0
virtual dof_id_type n_elem() const =0
processor_id_type processor_id() const
const std::map<subdomain_id_type, std::string>& libMesh::MeshBase::get_subdomain_name_map ( ) const
inlineinherited
virtual element_iterator libMesh::ReplicatedMesh::ghost_elements_begin ( )
virtualinherited

Iterate over "ghost" elements in the Mesh. A ghost element is one which is not local, but is semilocal.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_element_iterator libMesh::ReplicatedMesh::ghost_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::ghost_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::ghost_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

std::set<GhostingFunctor *>::const_iterator libMesh::MeshBase::ghosting_functors_begin ( ) const
inlineinherited
std::set<GhostingFunctor *>::const_iterator libMesh::MeshBase::ghosting_functors_end ( ) const
inlineinherited
Elem * libMesh::ReplicatedMesh::insert_elem ( Elem e)
virtualinherited

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

Users should call MeshBase::prepare_for_use() after elements are added to and/or deleted from the mesh.

Implements libMesh::MeshBase.

Definition at line 322 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_elements, libMesh::MeshBase::_next_unique_id, libMesh::ReplicatedMesh::delete_elem(), libMesh::DofObject::id(), libMesh::DofObject::set_unique_id(), and libMesh::DofObject::valid_unique_id().

Referenced by libMesh::ReplicatedMesh::reserve_elem().

323 {
324 #ifdef LIBMESH_ENABLE_UNIQUE_ID
325  if (!e->valid_unique_id())
327 #endif
328 
329  dof_id_type eid = e->id();
330  libmesh_assert_less (eid, _elements.size());
331  Elem * oldelem = _elements[eid];
332 
333  if (oldelem)
334  {
335  libmesh_assert_equal_to (oldelem->id(), eid);
336  this->delete_elem(oldelem);
337  }
338 
339  _elements[e->id()] = e;
340 
341  return e;
342 }
unique_id_type & set_unique_id()
Definition: dof_object.h:654
std::vector< Elem * > _elements
virtual void delete_elem(Elem *e) libmesh_override
The base class for all geometric element types.
Definition: elem.h:86
bool valid_unique_id() const
Definition: dof_object.h:674
unique_id_type _next_unique_id
Definition: mesh_base.h:1310
dof_id_type id() const
Definition: dof_object.h:624
uint8_t dof_id_type
Definition: id_types.h:64
Node * libMesh::ReplicatedMesh::insert_node ( Node n)
virtualinherited

Insert Node n into the Mesh at a location consistent with n->id(), allocating extra storage if necessary. Throws an error if: .) n==NULL .) n->id() == DofObject::invalid_id .) A node already exists in position n->id().

This function differs from the ReplicatedMesh::add_node() function, which is only capable of appending nodes at the end of the nodes storage.

Implements libMesh::MeshBase.

Definition at line 476 of file replicated_mesh.C.

References libMesh::MeshBase::_next_unique_id, libMesh::ReplicatedMesh::_nodes, libMesh::DofObject::id(), libMesh::DofObject::invalid_id, libmesh_nullptr, libMesh::DofObject::set_unique_id(), and libMesh::DofObject::valid_unique_id().

Referenced by libMesh::ReplicatedMesh::reserve_elem().

477 {
478  if (!n)
479  libmesh_error_msg("Error, attempting to insert NULL node.");
480 
481  if (n->id() == DofObject::invalid_id)
482  libmesh_error_msg("Error, cannot insert node with invalid id.");
483 
484  if (n->id() < _nodes.size())
485  {
486  // Don't allow inserting on top of an existing Node.
487 
488  // Doing so doesn't have to be *error*, in the case where a
489  // redundant insert is done, but when that happens we ought to
490  // always be able to make the code more efficient by avoiding
491  // the redundant insert, so let's keep screaming "Error" here.
492  if (_nodes[ n->id() ] != libmesh_nullptr)
493  libmesh_error_msg("Error, cannot insert node on top of existing node.");
494  }
495  else
496  {
497  // Allocate just enough space to store the new node. This will
498  // cause highly non-ideal memory allocation behavior if called
499  // repeatedly...
500  _nodes.resize(n->id() + 1);
501  }
502 
503 #ifdef LIBMESH_ENABLE_UNIQUE_ID
504  if (!n->valid_unique_id())
506 #endif
507 
508  // We have enough space and this spot isn't already occupied by
509  // another node, so go ahead and add it.
510  _nodes[ n->id() ] = n;
511 
512  // If we made it this far, we just inserted the node the user handed
513  // us, so we can give it right back.
514  return n;
515 }
unique_id_type & set_unique_id()
Definition: dof_object.h:654
const class libmesh_nullptr_t libmesh_nullptr
bool valid_unique_id() const
Definition: dof_object.h:674
unique_id_type _next_unique_id
Definition: mesh_base.h:1310
static const dof_id_type invalid_id
Definition: dof_object.h:335
std::vector< Node * > _nodes
dof_id_type id() const
Definition: dof_object.h:624
bool libMesh::MeshBase::is_prepared ( ) const
inlineinherited
Returns
true if the mesh has been prepared via a call to prepare_for_use, false otherwise.

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

128  { return _is_prepared; }
virtual bool libMesh::MeshBase::is_replicated ( ) const
inlinevirtualinherited
Returns
true if new elements and nodes can and should be created in synchronization on all processors, false otherwise

Reimplemented in libMesh::DistributedMesh.

Definition at line 141 of file mesh_base.h.

Referenced by libMesh::MeshRefinement::_refine_elements(), libMesh::CheckpointIO::read(), and libMesh::CheckpointIO::write().

142  { return true; }
virtual bool libMesh::MeshBase::is_serial ( ) const
inlinevirtualinherited
Returns
true if all elements and nodes of the mesh exist on the current processor, false otherwise

Reimplemented in libMesh::DistributedMesh.

Definition at line 134 of file mesh_base.h.

Referenced by libMesh::MeshRefinement::_coarsen_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::BoundaryInfo::add_elements(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::EquationSystems::allgather(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::DofMap::create_dof_constraints(), libMesh::UnstructuredMesh::create_submesh(), libMesh::LocationMap< T >::init(), libMesh::TopologyMap::init(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshSerializer::MeshSerializer(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::MeshBase::partition(), libMesh::MetisPartitioner::partition_range(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::Nemesis_IO::read(), libMesh::DofMap::scatter_constraints(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::BoundaryInfo::sync(), libMesh::MeshTools::total_weight(), and libMesh::XdrIO::write_parallel().

135  { return true; }
virtual element_iterator libMesh::ReplicatedMesh::level_elements_begin ( unsigned int  level)
virtualinherited

Iterate over elements of a given level.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_element_iterator libMesh::ReplicatedMesh::level_elements_begin ( unsigned int  level) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::level_elements_end ( unsigned int  level)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::level_elements_end ( unsigned int  level) const
virtualinherited

Implements libMesh::MeshBase.

virtual void libMesh::MeshBase::libmesh_assert_valid_parallel_ids ( ) const
inlinevirtualinherited

Verify id and processor_id consistency of our elements and nodes containers. Calls libmesh_assert() on each possible failure. Currently only implemented on DistributedMesh; a serial data structure is much harder to get out of sync.

Reimplemented in libMesh::DistributedMesh.

Definition at line 916 of file mesh_base.h.

References libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), libMesh::MeshBase::active_local_subdomain_elements_begin(), libMesh::MeshBase::active_local_subdomain_elements_end(), libMesh::MeshBase::active_nodes_begin(), libMesh::MeshBase::active_nodes_end(), libMesh::MeshBase::active_not_local_elements_begin(), libMesh::MeshBase::active_not_local_elements_end(), libMesh::MeshBase::active_pid_elements_begin(), libMesh::MeshBase::active_pid_elements_end(), libMesh::MeshBase::active_semilocal_elements_begin(), libMesh::MeshBase::active_semilocal_elements_end(), libMesh::MeshBase::active_subdomain_elements_begin(), libMesh::MeshBase::active_subdomain_elements_end(), libMesh::MeshBase::active_subdomain_set_elements_begin(), libMesh::MeshBase::active_subdomain_set_elements_end(), libMesh::MeshBase::active_type_elements_begin(), libMesh::MeshBase::active_type_elements_end(), libMesh::MeshBase::active_unpartitioned_elements_begin(), libMesh::MeshBase::active_unpartitioned_elements_end(), libMesh::MeshBase::ancestor_elements_begin(), libMesh::MeshBase::ancestor_elements_end(), libMesh::MeshBase::bid_nodes_begin(), libMesh::MeshBase::bid_nodes_end(), libMesh::MeshBase::bnd_nodes_begin(), libMesh::MeshBase::bnd_nodes_end(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::MeshBase::evaluable_elements_begin(), libMesh::MeshBase::evaluable_elements_end(), libMesh::MeshBase::evaluable_nodes_begin(), libMesh::MeshBase::evaluable_nodes_end(), libMesh::MeshBase::facelocal_elements_begin(), libMesh::MeshBase::facelocal_elements_end(), libMesh::MeshBase::flagged_elements_begin(), libMesh::MeshBase::flagged_elements_end(), libMesh::MeshBase::flagged_pid_elements_begin(), libMesh::MeshBase::flagged_pid_elements_end(), libMesh::MeshBase::get_id_by_name(), libMesh::MeshBase::ghost_elements_begin(), libMesh::MeshBase::ghost_elements_end(), libMesh::invalid_uint, libMesh::MeshBase::level_elements_begin(), libMesh::MeshBase::level_elements_end(), libMesh::MeshBase::local_elements_begin(), libMesh::MeshBase::local_elements_end(), libMesh::MeshBase::local_level_elements_begin(), libMesh::MeshBase::local_level_elements_end(), libMesh::MeshBase::local_nodes_begin(), libMesh::MeshBase::local_nodes_end(), libMesh::MeshBase::local_not_level_elements_begin(), libMesh::MeshBase::local_not_level_elements_end(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), libMesh::MeshBase::not_active_elements_begin(), libMesh::MeshBase::not_active_elements_end(), libMesh::MeshBase::not_ancestor_elements_begin(), libMesh::MeshBase::not_ancestor_elements_end(), libMesh::MeshBase::not_level_elements_begin(), libMesh::MeshBase::not_level_elements_end(), libMesh::MeshBase::not_local_elements_begin(), libMesh::MeshBase::not_local_elements_end(), libMesh::MeshBase::not_subactive_elements_begin(), libMesh::MeshBase::not_subactive_elements_end(), libMesh::MeshBase::pid_elements_begin(), libMesh::MeshBase::pid_elements_end(), libMesh::MeshBase::pid_nodes_begin(), libMesh::MeshBase::pid_nodes_end(), libMesh::MeshBase::semilocal_elements_begin(), libMesh::MeshBase::semilocal_elements_end(), libMesh::MeshBase::subactive_elements_begin(), libMesh::MeshBase::subactive_elements_end(), libMesh::MeshBase::subdomain_name(), libMesh::MeshBase::type_elements_begin(), libMesh::MeshBase::type_elements_end(), libMesh::MeshBase::unpartitioned_elements_begin(), and libMesh::MeshBase::unpartitioned_elements_end().

Referenced by libMesh::MeshRefinement::_refine_elements(), libMesh::InfElemBuilder::build_inf_elem(), and libMesh::MeshRefinement::refine_and_coarsen_elements().

916 {}
virtual element_iterator libMesh::ReplicatedMesh::local_elements_begin ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::local_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::local_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::local_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::local_level_elements_begin ( unsigned int  level)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::local_level_elements_begin ( unsigned int  level) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::local_level_elements_end ( unsigned int  level)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::local_level_elements_end ( unsigned int  level) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::local_nodes_begin ( )
virtualinherited

Iterate over local nodes (nodes whose processor_id() matches the current processor).

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_node_iterator libMesh::ReplicatedMesh::local_nodes_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::local_nodes_end ( )
virtualinherited
virtual const_node_iterator libMesh::ReplicatedMesh::local_nodes_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::local_not_level_elements_begin ( unsigned int  level)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::local_not_level_elements_begin ( unsigned int  level) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::local_not_level_elements_end ( unsigned int  level)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::local_not_level_elements_end ( unsigned int  level) const
virtualinherited

Implements libMesh::MeshBase.

virtual dof_id_type libMesh::ReplicatedMesh::max_elem_id ( ) const
inlinevirtualinherited

Returns a number greater than or equal to the maximum element id in the mesh.

Implements libMesh::MeshBase.

Definition at line 122 of file replicated_mesh.h.

References libMesh::ReplicatedMesh::_elements, and libMesh::ReplicatedMesh::parallel_max_unique_id().

123  { return cast_int<dof_id_type>(_elements.size()); }
std::vector< Elem * > _elements
virtual dof_id_type libMesh::ReplicatedMesh::max_node_id ( ) const
inlinevirtualinherited

Returns a number greater than or equal to the maximum node id in the mesh.

Implements libMesh::MeshBase.

Definition at line 108 of file replicated_mesh.h.

References libMesh::ReplicatedMesh::_nodes.

109  { return cast_int<dof_id_type>(_nodes.size()); }
std::vector< Node * > _nodes
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 148 of file mesh_base.C.

References libMesh::MeshBase::_elem_dims.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::HPCoarsenTest::add_projection(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::MeshTools::Generation::build_cube(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshTools::Generation::build_sphere(), libMesh::EquationSystems::build_variable_names(), libMesh::MeshBase::cache_elem_dims(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshBase::delete_remote_elements(), libMesh::MeshTools::Modification::distort(), 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::BoundaryProjectSolution::operator()(), libMesh::GMVIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::VTKIO::read(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::HPCoarsenTest::select_refinement(), libMesh::MeshTools::Modification::smooth(), libMesh::DofMap::use_coupled_neighbor_dofs(), libMesh::PostscriptIO::write(), libMesh::CheckpointIO::write(), 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(), and libMesh::EnsightIO::write_vector_ascii().

149 {
150  if (!_elem_dims.empty())
151  return cast_int<unsigned int>(*_elem_dims.rbegin());
152  return 0;
153 }
std::set< unsigned char > _elem_dims
Definition: mesh_base.h:1345
dof_id_type libMesh::ReplicatedMesh::n_active_elem ( ) const
virtualinherited

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

Implements libMesh::MeshBase.

Definition at line 1469 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::active_elements_begin(), and libMesh::ReplicatedMesh::active_elements_end().

Referenced by libMesh::ReplicatedMesh::parallel_n_elem().

1470 {
1471  return static_cast<dof_id_type>(std::distance (this->active_elements_begin(),
1472  this->active_elements_end()));
1473 }
virtual element_iterator active_elements_begin() libmesh_override
virtual element_iterator active_elements_end() libmesh_override
uint8_t dof_id_type
Definition: id_types.h:64
dof_id_type libMesh::MeshBase::n_active_elem_on_proc ( const processor_id_type  proc) const
inherited

Returns the number of active elements on processor proc.

Definition at line 373 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(), and libMesh::MeshBase::n_unpartitioned_elem().

374 {
375  libmesh_assert_less (proc_id, this->n_processors());
376  return static_cast<dof_id_type>(std::distance (this->active_pid_elements_begin(proc_id),
377  this->active_pid_elements_end (proc_id)));
378 }
processor_id_type n_processors() const
virtual element_iterator active_pid_elements_begin(processor_id_type proc_id)=0
virtual element_iterator active_pid_elements_end(processor_id_type proc_id)=0
uint8_t dof_id_type
Definition: id_types.h:64
dof_id_type libMesh::MeshBase::n_active_local_elem ( ) const
inlineinherited
dof_id_type libMesh::MeshBase::n_active_sub_elem ( ) const
inherited

Same, but only counts active elements.

Definition at line 397 of file mesh_base.C.

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

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

398 {
399  dof_id_type ne=0;
400 
401  const_element_iterator el = this->active_elements_begin();
402  const const_element_iterator end = this->active_elements_end();
403 
404  for (; el!=end; ++el)
405  ne += (*el)->n_sub_elem();
406 
407  return ne;
408 }
IterBase * end
virtual element_iterator active_elements_begin()=0
virtual element_iterator active_elements_end()=0
uint8_t dof_id_type
Definition: id_types.h:64
virtual dof_id_type libMesh::ReplicatedMesh::n_elem ( ) const
inlinevirtualinherited

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 114 of file replicated_mesh.h.

References libMesh::ReplicatedMesh::_elements.

Referenced by libMesh::ReplicatedMesh::elem_ptr(), libMesh::ReplicatedMesh::query_elem_ptr(), and libMesh::ReplicatedMesh::stitching_helper().

115  { return cast_int<dof_id_type>(_elements.size()); }
std::vector< Elem * > _elements
dof_id_type libMesh::MeshBase::n_elem_on_proc ( const processor_id_type  proc) const
inherited

Returns the number of elements on processor proc.

Definition at line 360 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(), libMesh::MeshBase::n_unpartitioned_elem(), and libMesh::MeshBase::set_next_unique_id().

361 {
362  // We're either counting a processor's elements or unpartitioned
363  // elements
364  libmesh_assert (proc_id < this->n_processors() ||
366 
367  return static_cast<dof_id_type>(std::distance (this->pid_elements_begin(proc_id),
368  this->pid_elements_end (proc_id)));
369 }
processor_id_type n_processors() const
libmesh_assert(j)
static const processor_id_type invalid_processor_id
Definition: dof_object.h:346
virtual element_iterator pid_elements_begin(processor_id_type proc_id)=0
uint8_t dof_id_type
Definition: id_types.h:64
virtual element_iterator pid_elements_end(processor_id_type proc_id)=0
dof_id_type libMesh::MeshBase::n_local_elem ( ) const
inlineinherited

Returns the number of elements on the local processor.

Definition at line 339 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::DistributedMesh::parallel_n_elem().

340  { return this->n_elem_on_proc (this->processor_id()); }
dof_id_type n_elem_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:360
processor_id_type processor_id() const
dof_id_type libMesh::MeshBase::n_local_nodes ( ) const
inlineinherited

Returns the number of nodes on the local processor.

Definition at line 245 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::DistributedMesh::parallel_n_nodes().

246  { return this->n_nodes_on_proc (this->processor_id()); }
dof_id_type n_nodes_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:347
processor_id_type processor_id() const
virtual dof_id_type libMesh::ReplicatedMesh::n_nodes ( ) const
inlinevirtualinherited

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 102 of file replicated_mesh.h.

References libMesh::ReplicatedMesh::_nodes.

Referenced by libMesh::ReplicatedMesh::node_ptr(), libMesh::ReplicatedMesh::query_node_ptr(), and libMesh::ReplicatedMesh::stitching_helper().

103  { return cast_int<dof_id_type>(_nodes.size()); }
std::vector< Node * > _nodes
dof_id_type libMesh::MeshBase::n_nodes_on_proc ( const processor_id_type  proc) const
inherited

Returns the number of nodes on processor proc.

Definition at line 347 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::elem_dimensions(), libMesh::MeshBase::n_local_nodes(), and libMesh::MeshBase::n_unpartitioned_nodes().

348 {
349  // We're either counting a processor's nodes or unpartitioned
350  // nodes
351  libmesh_assert (proc_id < this->n_processors() ||
353 
354  return static_cast<dof_id_type>(std::distance (this->pid_nodes_begin(proc_id),
355  this->pid_nodes_end (proc_id)));
356 }
virtual node_iterator pid_nodes_end(processor_id_type proc_id)=0
processor_id_type n_processors() const
libmesh_assert(j)
static const processor_id_type invalid_processor_id
Definition: dof_object.h:346
virtual node_iterator pid_nodes_begin(processor_id_type proc_id)=0
uint8_t dof_id_type
Definition: id_types.h:64
unsigned int libMesh::MeshBase::n_partitions ( ) const
inlineinherited

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 788 of file mesh_base.h.

References libMesh::MeshBase::_n_parts, libMesh::MeshBase::all_first_order(), libMesh::MeshBase::all_second_order(), libMesh::MeshBase::get_info(), libmesh_nullptr, libMesh::Quality::name(), libMesh::MeshBase::operator<<, libMesh::out, libMesh::MeshBase::print_info(), libMesh::MeshBase::read(), and libMesh::MeshBase::write().

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

789  { return _n_parts; }
unsigned int _n_parts
Definition: mesh_base.h:1276
processor_id_type libMesh::ParallelObject::n_processors ( ) const
inlineinherited
Returns
the number of processors in the group.

Definition at line 93 of file parallel_object.h.

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

Referenced by libMesh::ParmetisPartitioner::_do_repartition(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::DistributedMesh::add_elem(), libMesh::DistributedMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::MeshCommunication::broadcast(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::DistributedMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::MeshBase::get_info(), libMesh::EquationSystems::get_solution(), libMesh::DistributedVector< T >::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::SparseMatrix< T >::print(), libMesh::MeshTools::processor_bounding_box(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Parallel::Sort< KeyType, IdxType >::sort(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

94  { return cast_int<processor_id_type>(_communicator.size()); }
unsigned int size() const
Definition: parallel.h:679
const Parallel::Communicator & _communicator
dof_id_type libMesh::MeshBase::n_sub_elem ( ) const
inherited

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 382 of file mesh_base.C.

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

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

383 {
384  dof_id_type ne=0;
385 
386  const_element_iterator el = this->elements_begin();
387  const const_element_iterator end = this->elements_end();
388 
389  for (; el!=end; ++el)
390  ne += (*el)->n_sub_elem();
391 
392  return ne;
393 }
IterBase * end
virtual element_iterator elements_begin()=0
virtual element_iterator elements_end()=0
uint8_t dof_id_type
Definition: id_types.h:64
subdomain_id_type libMesh::MeshBase::n_subdomains ( ) const
inherited

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 332 of file mesh_base.C.

References libMesh::MeshBase::subdomain_ids().

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

333 {
334  // This requires an inspection on every processor
335  parallel_object_only();
336 
337  std::set<subdomain_id_type> ids;
338 
339  this->subdomain_ids (ids);
340 
341  return cast_int<subdomain_id_type>(ids.size());
342 }
void subdomain_ids(std::set< subdomain_id_type > &ids) const
Definition: mesh_base.C:313
dof_id_type libMesh::MeshBase::n_unpartitioned_elem ( ) const
inlineinherited

Returns the number of elements owned by no processor.

Definition at line 345 of file mesh_base.h.

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

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

dof_id_type n_elem_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:360
static const processor_id_type invalid_processor_id
Definition: dof_object.h:346
dof_id_type libMesh::MeshBase::n_unpartitioned_nodes ( ) const
inlineinherited

Returns the number of nodes owned by no processor.

Definition at line 251 of file mesh_base.h.

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

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

dof_id_type n_nodes_on_proc(const processor_id_type proc) const
Definition: mesh_base.C:347
static const processor_id_type invalid_processor_id
Definition: dof_object.h:346
unique_id_type libMesh::MeshBase::next_unique_id ( )
inlineinherited

Returns the next unique id to be used.

Definition at line 264 of file mesh_base.h.

References libMesh::MeshBase::_next_unique_id.

264 { return _next_unique_id; }
unique_id_type _next_unique_id
Definition: mesh_base.h:1310
virtual const Node& libMesh::MeshBase::node ( const dof_id_type  i) const
inlinevirtualinherited

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.

This method is deprecated; use the less confusingly-named node_ref() instead.

Definition at line 405 of file mesh_base.h.

References libMesh::MeshBase::node_ptr().

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

406  {
407  libmesh_deprecated();
408  return *this->node_ptr(i);
409  }
virtual const Node * node_ptr(const dof_id_type i) const =0
virtual Node& libMesh::MeshBase::node ( const dof_id_type  i)
inlinevirtualinherited

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

This method is deprecated; use the less confusingly-named node_ref() instead.

Definition at line 418 of file mesh_base.h.

References libMesh::MeshBase::node_ptr(), and libMesh::MeshBase::query_node_ptr().

419  {
420  libmesh_deprecated();
421  return *this->node_ptr(i);
422  }
virtual const Node * node_ptr(const dof_id_type i) const =0
const Node * libMesh::ReplicatedMesh::node_ptr ( const dof_id_type  i) const
virtualinherited

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 186 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_nodes, libMesh::libmesh_assert(), and libMesh::ReplicatedMesh::n_nodes().

Referenced by libMesh::ReplicatedMesh::reserve_elem(), and libMesh::ReplicatedMesh::stitching_helper().

187 {
188  libmesh_assert_less (i, this->n_nodes());
190  libmesh_assert_equal_to (_nodes[i]->id(), i); // This will change soon
191 
192  return _nodes[i];
193 }
libmesh_assert(j)
std::vector< Node * > _nodes
virtual dof_id_type n_nodes() const libmesh_override
Node * libMesh::ReplicatedMesh::node_ptr ( const dof_id_type  i)
virtualinherited

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 198 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_nodes, libMesh::libmesh_assert(), and libMesh::ReplicatedMesh::n_nodes().

199 {
200  libmesh_assert_less (i, this->n_nodes());
202  libmesh_assert_equal_to (_nodes[i]->id(), i); // This will change soon
203 
204  return _nodes[i];
205 }
libmesh_assert(j)
std::vector< Node * > _nodes
virtual dof_id_type n_nodes() const libmesh_override
virtual const Node& libMesh::MeshBase::node_ref ( const dof_id_type  i) const
inlinevirtualinherited
virtual Node& libMesh::MeshBase::node_ref ( const dof_id_type  i)
inlinevirtualinherited

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

Definition at line 393 of file mesh_base.h.

References libMesh::MeshBase::node_ptr().

393  {
394  return *this->node_ptr(i);
395  }
virtual const Node * node_ptr(const dof_id_type i) const =0
virtual node_iterator libMesh::ReplicatedMesh::nodes_begin ( )
virtualinherited
virtual const_node_iterator libMesh::ReplicatedMesh::nodes_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::nodes_end ( )
virtualinherited
virtual const_node_iterator libMesh::ReplicatedMesh::nodes_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::not_active_elements_begin ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::not_active_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::not_active_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::not_active_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::not_ancestor_elements_begin ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::not_ancestor_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::not_ancestor_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::not_ancestor_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::not_level_elements_begin ( unsigned int  level)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::not_level_elements_begin ( unsigned int  level) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::not_level_elements_end ( unsigned int  level)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::not_level_elements_end ( unsigned int  level) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::not_local_elements_begin ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::not_local_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::not_local_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::not_local_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::not_subactive_elements_begin ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::not_subactive_elements_begin ( ) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::not_subactive_elements_end ( )
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::not_subactive_elements_end ( ) const
virtualinherited

Implements libMesh::MeshBase.

unique_id_type libMesh::ReplicatedMesh::parallel_max_unique_id ( ) const
virtualinherited

Returns a number greater than or equal to the maximum unique_id in the mesh.

Implements libMesh::MeshBase.

Definition at line 620 of file replicated_mesh.C.

References libMesh::MeshBase::_next_unique_id, libMesh::ParallelObject::comm(), and libMesh::Parallel::Communicator::max().

Referenced by libMesh::ReplicatedMesh::max_elem_id(), and libMesh::ReplicatedMesh::update_parallel_id_counts().

621 {
622  // This function must be run on all processors at once
623  parallel_object_only();
624 
625  unique_id_type max_local = _next_unique_id;
626  this->comm().max(max_local);
627  return max_local;
628 }
unique_id_type _next_unique_id
Definition: mesh_base.h:1310
const Parallel::Communicator & comm() const
uint8_t unique_id_type
Definition: id_types.h:79
virtual dof_id_type libMesh::ReplicatedMesh::parallel_n_elem ( ) const
inlinevirtualinherited

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 117 of file replicated_mesh.h.

References libMesh::ReplicatedMesh::_elements, and libMesh::ReplicatedMesh::n_active_elem().

118  { return cast_int<dof_id_type>(_elements.size()); }
std::vector< Elem * > _elements
virtual dof_id_type libMesh::ReplicatedMesh::parallel_n_nodes ( ) const
inlinevirtualinherited

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 105 of file replicated_mesh.h.

References libMesh::ReplicatedMesh::_nodes.

106  { return cast_int<dof_id_type>(_nodes.size()); }
std::vector< Node * > _nodes
void libMesh::MeshBase::partition ( const unsigned int  n_parts)
virtualinherited

Call the default partitioner (currently metis_partition()).

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

461 {
462  // If we get here and we have unpartitioned elements, we need that
463  // fixed.
464  if (this->n_unpartitioned_elem() > 0)
465  {
466  libmesh_assert (partitioner().get());
467  libmesh_assert (this->is_serial());
468  partitioner()->partition (*this, n_parts);
469  }
470  // NULL partitioner means don't repartition
471  // Non-serial meshes may not be ready for repartitioning here.
472  else if(!skip_partitioning() &&
473  partitioner().get())
474  {
475  partitioner()->partition (*this, n_parts);
476  }
477  else
478  {
479  // Adaptive coarsening may have "orphaned" nodes on processors
480  // whose elements no longer share them. We need to check for
481  // and possibly fix that.
483 
484  // Make sure locally cached partition count
485  this->recalculate_n_partitions();
486 
487  // Make sure any other locally cached data is correct
488  this->update_post_partitioning();
489  }
490 }
virtual bool is_serial() const
Definition: mesh_base.h:134
bool skip_partitioning() const
Definition: mesh_base.h:732
static void set_node_processor_ids(MeshBase &mesh)
Definition: partitioner.C:431
dof_id_type n_unpartitioned_elem() const
Definition: mesh_base.h:345
libmesh_assert(j)
unsigned int recalculate_n_partitions()
Definition: mesh_base.C:492
virtual UniquePtr< Partitioner > & partitioner()
Definition: mesh_base.h:106
virtual void update_post_partitioning()
Definition: mesh_base.h:699
void libMesh::MeshBase::partition ( )
inlineinherited

Definition at line 685 of file mesh_base.h.

References libMesh::ParallelObject::n_processors().

Referenced by libMesh::MeshBase::prepare_for_use(), and libMesh::MeshBase::query_elem().

686  { this->partition(this->n_processors()); }
processor_id_type n_processors() const
virtual UniquePtr<Partitioner>& libMesh::MeshBase::partitioner ( )
inlinevirtualinherited
virtual element_iterator libMesh::ReplicatedMesh::pid_elements_begin ( processor_id_type  proc_id)
virtualinherited

Iterate over all elements with a specified processor id.

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_element_iterator libMesh::ReplicatedMesh::pid_elements_begin ( processor_id_type  proc_id) const
virtualinherited

Implements libMesh::MeshBase.

virtual element_iterator libMesh::ReplicatedMesh::pid_elements_end ( processor_id_type  proc_id)
virtualinherited
virtual const_element_iterator libMesh::ReplicatedMesh::pid_elements_end ( processor_id_type  proc_id) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::pid_nodes_begin ( processor_id_type  proc_id)
virtualinherited

Iterate over nodes with processor_id() == proc_id

Implements libMesh::MeshBase.

Referenced by libMesh::ReplicatedMesh::reserve_elem().

virtual const_node_iterator libMesh::ReplicatedMesh::pid_nodes_begin ( processor_id_type  proc_id) const
virtualinherited

Implements libMesh::MeshBase.

virtual node_iterator libMesh::ReplicatedMesh::pid_nodes_end ( processor_id_type  proc_id)
virtualinherited
virtual const_node_iterator libMesh::ReplicatedMesh::pid_nodes_end ( processor_id_type  proc_id) const
virtualinherited

Implements libMesh::MeshBase.

const Point & libMesh::ReplicatedMesh::point ( const dof_id_type  i) const
virtualinherited

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 178 of file replicated_mesh.C.

References libMesh::MeshBase::node_ref().

Referenced by libMesh::ReplicatedMesh::reserve_elem(), and libMesh::ReplicatedMesh::stitching_helper().

179 {
180  return this->node_ref(i);
181 }
virtual const Node & node_ref(const dof_id_type i) const
Definition: mesh_base.h:385
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 515 of file mesh_base.C.

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

516 {
517  libmesh_deprecated();
518 
519  if (_point_locator.get() == libmesh_nullptr)
520  {
521  // PointLocator construction may not be safe within threads
523 
524  _point_locator.reset (PointLocatorBase::build(TREE_ELEMENTS, *this).release());
525  }
526 
527  return *_point_locator;
528 }
UniquePtr< PointLocatorBase > _point_locator
Definition: mesh_base.h:1290
const class libmesh_nullptr_t libmesh_nullptr
bool in_threads
Definition: threads.C:31
libmesh_assert(j)
static UniquePtr< PointLocatorBase > build(PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=libmesh_nullptr)
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).

If this is a distributed mesh, local copies of remote elements will be deleted here - to keep those elements replicated during preparation, set allow_remote_element_removal(false).

Definition at line 174 of file mesh_base.C.

References libMesh::MeshBase::_allow_remote_element_removal, libMesh::MeshBase::_is_prepared, libMesh::MeshBase::_skip_renumber_nodes_and_elements, libMesh::MeshBase::allow_renumbering(), libMesh::MeshBase::cache_elem_dims(), libMesh::MeshBase::clear_point_locator(), libMesh::ParallelObject::comm(), libMesh::MeshBase::delete_remote_elements(), libMesh::MeshBase::detect_interior_parents(), libMesh::MeshBase::find_neighbors(), libMesh::MeshBase::ghosting_functors_begin(), libMesh::MeshBase::ghosting_functors_end(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::GhostingFunctor::mesh_reinit(), 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::MeshTools::Generation::build_sphere(), libMesh::MeshRefinement::coarsen_elements(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::UnstructuredMesh::create_submesh(), libMesh::MeshTools::Modification::flatten(), libMesh::MeshTools::Subdivision::prepare_subdivision_mesh(), libMesh::MeshBase::query_elem(), libMesh::GMVIO::read(), libMesh::UnstructuredMesh::read(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::ReplicatedMesh::stitching_helper(), libMesh::BoundaryInfo::sync(), libMesh::TriangleInterface::triangulate(), libMesh::MeshRefinement::uniformly_coarsen(), and libMesh::MeshRefinement::uniformly_refine().

175 {
176  parallel_object_only();
177 
178  libmesh_assert(this->comm().verify(this->is_serial()));
179 
180  // A distributed mesh may have processors with no elements (or
181  // processors with no elements of higher dimension, if we ever
182  // support mixed-dimension meshes), but we want consistent
183  // mesh_dimension anyways.
184  //
185  // cache_elem_dims() should get the elem_dimensions() and
186  // mesh_dimension() correct later, and we don't need it earlier.
187 
188 
189  // Renumber the nodes and elements so that they in contiguous
190  // blocks. By default, _skip_renumber_nodes_and_elements is false.
191  //
192  // We may currently change that by passing
193  // skip_renumber_nodes_and_elements==true to this function, but we
194  // should use the allow_renumbering() accessor instead.
195  //
196  // Instances where you if prepare_for_use() should not renumber the nodes
197  // and elements include reading in e.g. an xda/r or gmv file. In
198  // this case, the ordering of the nodes may depend on an accompanying
199  // solution, and the node ordering cannot be changed.
200 
201  if (skip_renumber_nodes_and_elements)
202  {
203  libmesh_deprecated();
204  this->allow_renumbering(false);
205  }
206 
207  // Mesh modification operations might not leave us with consistent
208  // id counts, but our partitioner might need that consistency.
211  else
213 
214  // Let all the elements find their neighbors
215  if(!skip_find_neighbors)
216  this->find_neighbors();
217 
218  // The user may have set boundary conditions. We require that the
219  // boundary conditions were set consistently. Because we examine
220  // neighbors when evaluating non-raw boundary condition IDs, this
221  // assert is only valid when our neighbor links are in place.
222 #ifdef DEBUG
224 #endif
225 
226  // Search the mesh for all the dimensions of the elements
227  // and cache them.
228  this->cache_elem_dims();
229 
230  // Search the mesh for elements that have a neighboring element
231  // of dim+1 and set that element as the interior parent
232  this->detect_interior_parents();
233 
234  // Fix up node unique ids in case mesh generation code didn't take
235  // exceptional care to do so.
236  // MeshCommunication().make_node_unique_ids_parallel_consistent(*this);
237 
238  // We're going to still require that mesh generation code gets
239  // element unique ids consistent.
240 #if defined(DEBUG) && defined(LIBMESH_ENABLE_UNIQUE_ID)
242 #endif
243 
244  // Reset our PointLocator. Any old locator is invalidated any time
245  // the elements in the underlying elements in the mesh have changed,
246  // so we clear it here.
247  this->clear_point_locator();
248 
249  // Allow our GhostingFunctor objects to reinit if necessary.
250  // Do this before partitioning and redistributing, and before
251  // deleting remote elements.
252  std::set<GhostingFunctor *>::iterator gf_it = this->ghosting_functors_begin();
253  const std::set<GhostingFunctor *>::iterator gf_end = this->ghosting_functors_end();
254  for (; gf_it != gf_end; ++gf_it)
255  {
256  GhostingFunctor *gf = *gf_it;
257  libmesh_assert(gf);
258  gf->mesh_reinit();
259  }
260 
261  // Partition the mesh.
262  this->partition();
263 
264  // If we're using DistributedMesh, we'll probably want it
265  // parallelized.
267  this->delete_remote_elements();
268 
271 
272  // The mesh is now prepared for use.
273  _is_prepared = true;
274 
275 #if defined(DEBUG) && defined(LIBMESH_ENABLE_UNIQUE_ID)
278 #endif
279 }
bool _skip_renumber_nodes_and_elements
Definition: mesh_base.h:1323
virtual bool is_serial() const
Definition: mesh_base.h:134
void detect_interior_parents()
Definition: mesh_base.C:675
bool _allow_remote_element_removal
Definition: mesh_base.h:1331
libmesh_assert(j)
std::set< GhostingFunctor * >::const_iterator ghosting_functors_end() const
Definition: mesh_base.h:761
virtual void find_neighbors(const bool reset_remote_elements=false, const bool reset_current_list=true)=0
virtual void update_parallel_id_counts()=0
void clear_point_locator()
Definition: mesh_base.C:552
void libmesh_assert_valid_boundary_ids(const MeshBase &mesh)
Definition: mesh_tools.C:1210
std::set< GhostingFunctor * >::const_iterator ghosting_functors_begin() const
Definition: mesh_base.h:755
bool verify(const T &r, const Communicator &comm=Communicator_World)
const Parallel::Communicator & comm() const
bool allow_renumbering() const
Definition: mesh_base.h:708
virtual void delete_remote_elements()
Definition: mesh_base.h:161
void cache_elem_dims()
Definition: mesh_base.C:609
void libmesh_assert_valid_unique_ids(const MeshBase &mesh)
Definition: mesh_tools.C:1360
virtual void renumber_nodes_and_elements()=0
void libMesh::MeshBase::print_info ( std::ostream &  os = libMesh::out) const
inherited

Prints relevant information about the mesh.

Definition at line 446 of file mesh_base.C.

References libMesh::MeshBase::get_info().

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

447 {
448  os << this->get_info()
449  << std::endl;
450 }
std::string get_info() const
Definition: mesh_base.C:412
processor_id_type libMesh::ParallelObject::processor_id ( ) const
inlineinherited
Returns
the rank of this processor in the group.

Definition at line 99 of file parallel_object.h.

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

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::EquationSystems::_read_impl(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::MeshRefinement::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::MeshCommunication::broadcast(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::DofMap::build_sparsity(), libMesh::DistributedMesh::clear(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::DistributedMesh::delete_node(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::MeshBase::get_info(), libMesh::DofMap::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::EquationSystems::get_solution(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::DistributedVector< T >::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::DofMap::is_evaluable(), libMesh::SparsityPattern::Build::join(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::MetisPartitioner::partition_range(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::SparseMatrix< T >::print(), libMesh::NumericVector< T >::print_global(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshTools::total_weight(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::MeshTools::weight(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().

100  { return cast_int<processor_id_type>(_communicator.rank()); }
const Parallel::Communicator & _communicator
unsigned int rank() const
Definition: parallel.h:677
virtual const Elem* libMesh::MeshBase::query_elem ( const dof_id_type  i) const
inlinevirtualinherited

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

This method is deprecated; use the less confusingly-named query_elem_ptr() instead.

Definition at line 525 of file mesh_base.h.

References libMesh::MeshBase::query_elem_ptr().

526  {
527  libmesh_deprecated();
528  return this->query_elem_ptr(i);
529  }
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
virtual Elem* libMesh::MeshBase::query_elem ( const dof_id_type  i)
inlinevirtualinherited
const Elem * libMesh::ReplicatedMesh::query_elem_ptr ( const dof_id_type  i) const
virtualinherited

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 260 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_elements, libMesh::libmesh_assert(), libmesh_nullptr, and libMesh::ReplicatedMesh::n_elem().

Referenced by libMesh::ReplicatedMesh::reserve_elem().

261 {
262  if (i >= this->n_elem())
263  return libmesh_nullptr;
265  _elements[i]->id() == i); // This will change soon
266 
267  return _elements[i];
268 }
std::vector< Elem * > _elements
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
virtual dof_id_type n_elem() const libmesh_override
Elem * libMesh::ReplicatedMesh::query_elem_ptr ( const dof_id_type  i)
virtualinherited

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 273 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_elements, libMesh::libmesh_assert(), libmesh_nullptr, and libMesh::ReplicatedMesh::n_elem().

274 {
275  if (i >= this->n_elem())
276  return libmesh_nullptr;
278  _elements[i]->id() == i); // This will change soon
279 
280  return _elements[i];
281 }
std::vector< Elem * > _elements
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
virtual dof_id_type n_elem() const libmesh_override
const Node * libMesh::ReplicatedMesh::query_node_ptr ( const dof_id_type  i) const
virtualinherited

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 210 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_nodes, libMesh::libmesh_assert(), libmesh_nullptr, and libMesh::ReplicatedMesh::n_nodes().

Referenced by libMesh::ReplicatedMesh::reserve_elem().

211 {
212  if (i >= this->n_nodes())
213  return libmesh_nullptr;
215  _nodes[i]->id() == i); // This will change soon
216 
217  return _nodes[i];
218 }
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
std::vector< Node * > _nodes
virtual dof_id_type n_nodes() const libmesh_override
Node * libMesh::ReplicatedMesh::query_node_ptr ( const dof_id_type  i)
virtualinherited

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 223 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_nodes, libMesh::libmesh_assert(), libmesh_nullptr, and libMesh::ReplicatedMesh::n_nodes().

224 {
225  if (i >= this->n_nodes())
226  return libmesh_nullptr;
228  _nodes[i]->id() == i); // This will change soon
229 
230  return _nodes[i];
231 }
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
std::vector< Node * > _nodes
virtual dof_id_type n_nodes() const libmesh_override
void libMesh::UnstructuredMesh::read ( const std::string &  name,
void *  mesh_data = libmesh_nullptr,
bool  skip_renumber_nodes_and_elements = false,
bool  skip_find_neighbors = false 
)
virtualinherited

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.

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

Set skip_find_neighbors=true to skip the find-neighbors operation during prepare_for_use. This operation isn't always necessary and it can be time-consuming, which is why we provide an option to skip it.

Implements libMesh::MeshBase.

Definition at line 574 of file unstructured_mesh.C.

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

578 {
579  // Set the skip_renumber_nodes_and_elements flag on all processors
580  // if necessary.
581  // This ensures that renumber_nodes_and_elements is *not* called
582  // during prepare_for_use() for certain types of mesh files.
583  // This is required in cases where there is an associated solution
584  // file which expects a certain ordering of the nodes.
585  if (name.rfind(".gmv") + 4 == name.size())
586  this->allow_renumbering(false);
587 
588  NameBasedIO(*this).read(name);
589 
590  if (skip_renumber_nodes_and_elements)
591  {
592  // Use MeshBase::allow_renumbering() yourself instead.
593  libmesh_deprecated();
594  this->allow_renumbering(false);
595  }
596 
597  // Done reading the mesh. Now prepare it for use.
598  this->prepare_for_use(/*skip_renumber (deprecated)*/ false,
599  skip_find_neighbors);
600 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:39
void prepare_for_use(const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false)
Definition: mesh_base.C:174
bool allow_renumbering() const
Definition: mesh_base.h:708
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 492 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().

493 {
494  // This requires an inspection on every processor
495  parallel_object_only();
496 
497  const_element_iterator el = this->active_local_elements_begin();
498  const_element_iterator end = this->active_local_elements_end();
499 
500  unsigned int max_proc_id=0;
501 
502  for (; el!=end; ++el)
503  max_proc_id = std::max(max_proc_id, static_cast<unsigned int>((*el)->processor_id()));
504 
505  // The number of partitions is one more than the max processor ID.
506  _n_parts = max_proc_id+1;
507 
508  this->comm().max(_n_parts);
509 
510  return _n_parts;
511 }
IterBase * end
long double max(long double a, double b)
unsigned int _n_parts
Definition: mesh_base.h:1276
virtual element_iterator active_local_elements_begin()=0
const Parallel::Communicator & comm() const
virtual element_iterator active_local_elements_end()=0
virtual void libMesh::MeshBase::redistribute ( )
inlinevirtualinherited

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

Reimplemented in libMesh::DistributedMesh.

Definition at line 693 of file mesh_base.h.

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

693 {}
void libMesh::MeshBase::remove_ghosting_functor ( GhostingFunctor ghosting_functor)
inherited

Removes a functor which was previously added to the set of ghosting functors.

Definition at line 303 of file mesh_base.C.

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

Referenced by libMesh::MeshBase::add_ghosting_functor(), libMesh::DofMap::clear(), libMesh::DofMap::remove_algebraic_ghosting_functor(), libMesh::DofMap::remove_coupling_functor(), and libMesh::DofMap::~DofMap().

304 {
305  // We should only be trying to remove ghosting functors we actually
306  // have
307  libmesh_assert(_ghosting_functors.count(&ghosting_functor));
308  _ghosting_functors.erase(&ghosting_functor);
309 }
libmesh_assert(j)
std::set< GhostingFunctor * > _ghosting_functors
Definition: mesh_base.h:1367
void libMesh::ReplicatedMesh::renumber_elem ( dof_id_type  old_id,
dof_id_type  new_id 
)
virtualinherited

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 388 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_elements, libMesh::libmesh_assert(), libmesh_nullptr, and libMesh::DofObject::set_id().

Referenced by libMesh::ReplicatedMesh::reserve_elem().

390 {
391  // This doesn't get used in serial yet
392  Elem * el = _elements[old_id];
393  libmesh_assert (el);
394 
395  el->set_id(new_id);
396  libmesh_assert (!_elements[new_id]);
397  _elements[new_id] = el;
398  _elements[old_id] = libmesh_nullptr;
399 }
std::vector< Elem * > _elements
The base class for all geometric element types.
Definition: elem.h:86
const class libmesh_nullptr_t libmesh_nullptr
dof_id_type & set_id()
Definition: dof_object.h:633
libmesh_assert(j)
void libMesh::ReplicatedMesh::renumber_node ( dof_id_type  old_id,
dof_id_type  new_id 
)
virtualinherited

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 558 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_nodes, libMesh::libmesh_assert(), libmesh_nullptr, and libMesh::DofObject::set_id().

Referenced by libMesh::ReplicatedMesh::reserve_elem().

560 {
561  // This doesn't get used in serial yet
562  Node * nd = _nodes[old_id];
563  libmesh_assert (nd);
564 
565  nd->set_id(new_id);
566  libmesh_assert (!_nodes[new_id]);
567  _nodes[new_id] = nd;
568  _nodes[old_id] = libmesh_nullptr;
569 }
A geometric point in (x,y,z) space associated with a DOF.
Definition: node.h:52
const class libmesh_nullptr_t libmesh_nullptr
dof_id_type & set_id()
Definition: dof_object.h:633
libmesh_assert(j)
std::vector< Node * > _nodes
void libMesh::ReplicatedMesh::renumber_nodes_and_elements ( )
virtualinherited

Remove NULL elements from arrays

Implements libMesh::MeshBase.

Definition at line 633 of file replicated_mesh.C.

References libMesh::ReplicatedMesh::_elements, libMesh::ReplicatedMesh::_nodes, libMesh::MeshBase::_skip_renumber_nodes_and_elements, end, libMesh::MeshBase::get_boundary_info(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::Elem::n_nodes(), libMesh::Elem::node_id(), libMesh::Elem::node_ptr(), libMesh::BoundaryInfo::remove(), libMesh::DofObject::set_id(), swap(), and libMesh::ReplicatedMesh::update_parallel_id_counts().

Referenced by libMesh::ReplicatedMesh::clone().

634 {
635  LOG_SCOPE("renumber_nodes_and_elem()", "Mesh");
636 
637  // node and element id counters
638  dof_id_type next_free_elem = 0;
639  dof_id_type next_free_node = 0;
640 
641  // Will hold the set of nodes that are currently connected to elements
642  LIBMESH_BEST_UNORDERED_SET<Node *> connected_nodes;
643 
644  // Loop over the elements. Note that there may
645  // be NULLs in the _elements vector from the coarsening
646  // process. Pack the elements in to a contiguous array
647  // and then trim any excess.
648  {
649  std::vector<Elem *>::iterator in = _elements.begin();
650  std::vector<Elem *>::iterator out_iter = _elements.begin();
651  const std::vector<Elem *>::iterator end = _elements.end();
652 
653  for (; in != end; ++in)
654  if (*in != libmesh_nullptr)
655  {
656  Elem * el = *in;
657 
658  *out_iter = *in;
659  ++out_iter;
660 
661  // Increment the element counter
662  el->set_id (next_free_elem++);
663 
665  {
666  // Add this elements nodes to the connected list
667  for (unsigned int n=0; n<el->n_nodes(); n++)
668  connected_nodes.insert(el->node_ptr(n));
669  }
670  else // We DO want node renumbering
671  {
672  // Loop over this element's nodes. Number them,
673  // if they have not been numbered already. Also,
674  // position them in the _nodes vector so that they
675  // are packed contiguously from the beginning.
676  for (unsigned int n=0; n<el->n_nodes(); n++)