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

Public Attributes

AutoPtr< BoundaryInfoboundary_info
 

Protected Member Functions

virtual void assign_unique_ids ()
 
unsigned int & set_n_partitions ()
 

Protected Attributes

std::vector< Node * > _nodes
 
std::vector< Elem * > _elements
 
unsigned int _n_parts
 
unsigned int _dim
 
bool _is_prepared
 
AutoPtr< PointLocatorBase_point_locator
 
AutoPtr< Partitioner_partitioner
 
unique_id_type _next_unique_id
 
bool _skip_partitioning
 
bool _skip_renumber_nodes_and_elements
 
std::map< subdomain_id_type,
std::string > 
_block_id_to_name
 
const Parallel::Communicator_communicator
 

Private Types

typedef std::vector< Elem * >
::iterator 
elem_iterator_imp
 
typedef std::vector< Elem * >
::const_iterator 
const_elem_iterator_imp
 
typedef std::vector< Node * >
::iterator 
node_iterator_imp
 
typedef std::vector< Node * >
::const_iterator 
const_node_iterator_imp
 

Private Member Functions

void stitching_helper (SerialMesh *other_mesh, boundary_id_type boundary_id_1, boundary_id_type boundary_id_2, Real tol, bool clear_stitched_boundary_ids, bool verbose, bool use_binary_search, bool enforce_all_nodes_match_on_boundaries)
 

Detailed Description

The SerialMesh class is derived from the MeshBase class, and currently represents the default Mesh implementation. Most methods for this class are found in MeshBase, and most implementation details are found in UnstructuredMesh.

Definition at line 47 of file serial_mesh.h.

Member Typedef Documentation

typedef std::vector<Elem*>::const_iterator libMesh::SerialMesh::const_elem_iterator_imp
private

Definition at line 431 of file serial_mesh.h.

typedef std::vector<Node*>::const_iterator libMesh::SerialMesh::const_node_iterator_imp
private

Definition at line 438 of file serial_mesh.h.

typedef std::vector<Elem*>::iterator libMesh::SerialMesh::elem_iterator_imp
private

Typedefs for the container implementation. In this case, it's just a std::vector<Elem*>.

Definition at line 430 of file serial_mesh.h.

typedef std::vector<Node*>::iterator libMesh::SerialMesh::node_iterator_imp
private

Typedefs for the container implementation. In this case, it's just a std::vector<Node*>.

Definition at line 437 of file serial_mesh.h.

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

Definition at line 632 of file mesh_base.h.

Constructor & Destructor Documentation

libMesh::SerialMesh::SerialMesh ( const Parallel::Communicator comm,
unsigned int  dim = 1 
)
explicit

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

Definition at line 117 of file serial_mesh.C.

References libMesh::MeshBase::_next_unique_id, and libMesh::MeshBase::_partitioner.

Referenced by clone().

118  :
120 {
121 #ifdef LIBMESH_ENABLE_UNIQUE_ID
122  // In serial we just need to reset the next unique id to zero
123  // here in the constructor.
124  _next_unique_id = 0;
125 #endif
126  _partitioner = AutoPtr<Partitioner>(new MetisPartitioner());
127 }
libMesh::SerialMesh::SerialMesh ( unsigned int  dim = 1)
explicit

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

Definition at line 132 of file serial_mesh.C.

References libMesh::MeshBase::_next_unique_id, and libMesh::MeshBase::_partitioner.

132  :
133  UnstructuredMesh (d)
134 {
135 #ifdef LIBMESH_ENABLE_UNIQUE_ID
136  // In serial we just need to reset the next unique id to zero
137  // here in the constructor.
138  _next_unique_id = 0;
139 #endif
140  _partitioner = AutoPtr<Partitioner>(new MetisPartitioner());
141 }
libMesh::SerialMesh::SerialMesh ( const UnstructuredMesh other_mesh)

Copy-constructor. This should be able to take a serial or parallel mesh.

Definition at line 162 of file serial_mesh.C.

References libMesh::MeshBase::boundary_info, and libMesh::UnstructuredMesh::copy_nodes_and_elements().

162  :
163  UnstructuredMesh (other_mesh)
164 {
165  this->copy_nodes_and_elements(other_mesh);
166  *this->boundary_info = *other_mesh.boundary_info;
167 }
libMesh::SerialMesh::SerialMesh ( const SerialMesh other_mesh)

Copy-constructor, possibly specialized for a serial mesh.

Definition at line 154 of file serial_mesh.C.

References libMesh::MeshBase::boundary_info, and libMesh::UnstructuredMesh::copy_nodes_and_elements().

154  :
155  UnstructuredMesh (other_mesh)
156 {
157  this->copy_nodes_and_elements(other_mesh);
158  *this->boundary_info = *other_mesh.boundary_info;
159 }
libMesh::SerialMesh::~SerialMesh ( )
virtual

Destructor.

Definition at line 145 of file serial_mesh.C.

References clear().

146 {
147  this->clear(); // Free nodes and elements
148 }

Member Function Documentation

SerialMesh::element_iterator libMesh::SerialMesh::active_elements_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 47 of file serial_mesh_iterators.C.

References _elements.

Referenced by n_active_elem().

48 {
49  Predicates::Active<elem_iterator_imp> p;
50  return element_iterator(_elements.begin(), _elements.end(), p);
51 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_elements_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 270 of file serial_mesh_iterators.C.

References _elements.

271 {
272  Predicates::Active<const_elem_iterator_imp> p;
273  return const_element_iterator(_elements.begin(), _elements.end(), p);
274 }
SerialMesh::element_iterator libMesh::SerialMesh::active_elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 493 of file serial_mesh_iterators.C.

References _elements.

Referenced by n_active_elem().

494 {
495  Predicates::Active<elem_iterator_imp> p;
496  return element_iterator(_elements.end(), _elements.end(), p);
497 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 720 of file serial_mesh_iterators.C.

References _elements.

721 {
722  Predicates::Active<const_elem_iterator_imp> p;
723  return const_element_iterator(_elements.end(), _elements.end(), p);
724 }
SerialMesh::element_iterator libMesh::SerialMesh::active_local_elements_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 127 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

128 {
129  Predicates::ActiveLocal<elem_iterator_imp> p(this->processor_id());
130  return element_iterator(_elements.begin(), _elements.end(), p);
131 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_local_elements_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 350 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

351 {
352  Predicates::ActiveLocal<const_elem_iterator_imp> p(this->processor_id());
353  return const_element_iterator(_elements.begin(), _elements.end(), p);
354 }
SerialMesh::element_iterator libMesh::SerialMesh::active_local_elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 573 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

574 {
575  Predicates::ActiveLocal<elem_iterator_imp> p(this->processor_id());
576  return element_iterator(_elements.end(), _elements.end(), p);
577 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_local_elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 800 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

801 {
802  Predicates::ActiveLocal<const_elem_iterator_imp> p(this->processor_id());
803  return const_element_iterator(_elements.end(), _elements.end(), p);
804 }
SerialMesh::element_iterator libMesh::SerialMesh::active_local_subdomain_elements_begin ( const subdomain_id_type  subdomain_id)
virtual

Implements libMesh::MeshBase.

Definition at line 236 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

237 {
238  Predicates::ActiveLocalSubdomain<elem_iterator_imp> p(this->processor_id(),subdomain_id);
239  return element_iterator(_elements.begin(), _elements.end(), p);
240 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_local_subdomain_elements_begin ( const subdomain_id_type  subdomain_id) const
virtual

Implements libMesh::MeshBase.

Definition at line 459 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

460 {
461  Predicates::ActiveLocalSubdomain<const_elem_iterator_imp> p(this->processor_id(),subdomain_id);
462  return const_element_iterator(_elements.begin(), _elements.end(), p);
463 }
SerialMesh::element_iterator libMesh::SerialMesh::active_local_subdomain_elements_end ( const subdomain_id_type  subdomain_id)
virtual

Implements libMesh::MeshBase.

Definition at line 682 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

683 {
684  Predicates::ActiveLocalSubdomain<elem_iterator_imp> p(this->processor_id(),subdomain_id);
685  return element_iterator(_elements.end(), _elements.end(), p);
686 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_local_subdomain_elements_end ( const subdomain_id_type  subdomain_id) const
virtual

Implements libMesh::MeshBase.

Definition at line 909 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

910 {
911  Predicates::ActiveLocalSubdomain<const_elem_iterator_imp> p(this->processor_id(),subdomain_id);
912  return const_element_iterator(_elements.end(), _elements.end(), p);
913 }
SerialMesh::node_iterator libMesh::SerialMesh::active_nodes_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 942 of file serial_mesh_iterators.C.

References _nodes.

943 {
944  Predicates::Active<node_iterator_imp> p;
945  return node_iterator(_nodes.begin(), _nodes.end(), p);
946 }
SerialMesh::const_node_iterator libMesh::SerialMesh::active_nodes_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 982 of file serial_mesh_iterators.C.

References _nodes.

983 {
984  Predicates::Active<const_node_iterator_imp> p;
985  return const_node_iterator(_nodes.begin(), _nodes.end(), p);
986 }
SerialMesh::node_iterator libMesh::SerialMesh::active_nodes_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 1022 of file serial_mesh_iterators.C.

References _nodes.

1023 {
1024  Predicates::Active<node_iterator_imp> p;
1025  return node_iterator(_nodes.end(), _nodes.end(), p);
1026 }
SerialMesh::const_node_iterator libMesh::SerialMesh::active_nodes_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 1062 of file serial_mesh_iterators.C.

References _nodes.

1063 {
1064  Predicates::Active<const_node_iterator_imp> p;
1065  return const_node_iterator(_nodes.end(), _nodes.end(), p);
1066 }
SerialMesh::element_iterator libMesh::SerialMesh::active_not_local_elements_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 137 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

138 {
139  Predicates::ActiveNotLocal<elem_iterator_imp> p(this->processor_id());
140  return element_iterator(_elements.begin(), _elements.end(), p);
141 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_not_local_elements_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 360 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

361 {
362  Predicates::ActiveNotLocal<const_elem_iterator_imp> p(this->processor_id());
363  return const_element_iterator(_elements.begin(), _elements.end(), p);
364 }
SerialMesh::element_iterator libMesh::SerialMesh::active_not_local_elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 583 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

584 {
585  Predicates::ActiveNotLocal<elem_iterator_imp> p(this->processor_id());
586  return element_iterator(_elements.end(), _elements.end(), p);
587 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_not_local_elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 810 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

811 {
812  Predicates::ActiveNotLocal<const_elem_iterator_imp> p(this->processor_id());
813  return const_element_iterator(_elements.end(), _elements.end(), p);
814 }
SerialMesh::element_iterator libMesh::SerialMesh::active_pid_elements_begin ( const processor_id_type  proc_id)
virtual

Implements libMesh::MeshBase.

Definition at line 217 of file serial_mesh_iterators.C.

References _elements.

218 {
219  Predicates::ActivePID<elem_iterator_imp> p(proc_id);
220  return element_iterator(_elements.begin(), _elements.end(), p);
221 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_pid_elements_begin ( const processor_id_type  proc_id) const
virtual

Implements libMesh::MeshBase.

Definition at line 440 of file serial_mesh_iterators.C.

References _elements.

441 {
442  Predicates::ActivePID<const_elem_iterator_imp> p(proc_id);
443  return const_element_iterator(_elements.begin(), _elements.end(), p);
444 }
SerialMesh::element_iterator libMesh::SerialMesh::active_pid_elements_end ( const processor_id_type  proc_id)
virtual

Implements libMesh::MeshBase.

Definition at line 663 of file serial_mesh_iterators.C.

References _elements.

664 {
665  Predicates::ActivePID<elem_iterator_imp> p(proc_id);
666  return element_iterator(_elements.end(), _elements.end(), p);
667 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_pid_elements_end ( const processor_id_type  proc_id) const
virtual

Implements libMesh::MeshBase.

Definition at line 890 of file serial_mesh_iterators.C.

References _elements.

891 {
892  Predicates::ActivePID<const_elem_iterator_imp> p(proc_id);
893  return const_element_iterator(_elements.end(), _elements.end(), p);
894 }
SerialMesh::element_iterator libMesh::SerialMesh::active_subdomain_elements_begin ( const subdomain_id_type  subdomain_id)
virtual

Implements libMesh::MeshBase.

Definition at line 246 of file serial_mesh_iterators.C.

References _elements.

247 {
248  Predicates::ActiveSubdomain<elem_iterator_imp> p(subdomain_id);
249  return element_iterator(_elements.begin(), _elements.end(), p);
250 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_subdomain_elements_begin ( const subdomain_id_type  subdomain_id) const
virtual

Implements libMesh::MeshBase.

Definition at line 469 of file serial_mesh_iterators.C.

References _elements.

470 {
471  Predicates::ActiveSubdomain<const_elem_iterator_imp> p(subdomain_id);
472  return const_element_iterator(_elements.begin(), _elements.end(), p);
473 }
SerialMesh::element_iterator libMesh::SerialMesh::active_subdomain_elements_end ( const subdomain_id_type  subdomain_id)
virtual

Implements libMesh::MeshBase.

Definition at line 692 of file serial_mesh_iterators.C.

References _elements.

693 {
694  Predicates::ActiveSubdomain<elem_iterator_imp> p(subdomain_id);
695  return element_iterator(_elements.end(), _elements.end(), p);
696 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_subdomain_elements_end ( const subdomain_id_type  subdomain_id) const
virtual

Implements libMesh::MeshBase.

Definition at line 919 of file serial_mesh_iterators.C.

References _elements.

920 {
921  Predicates::ActiveSubdomain<const_elem_iterator_imp> p(subdomain_id);
922  return const_element_iterator(_elements.end(), _elements.end(), p);
923 }
SerialMesh::element_iterator libMesh::SerialMesh::active_type_elements_begin ( const ElemType  type)
virtual

Implements libMesh::MeshBase.

Definition at line 207 of file serial_mesh_iterators.C.

References _elements.

208 {
209  Predicates::ActiveType<elem_iterator_imp> p(type);
210  return element_iterator(_elements.begin(), _elements.end(), p);
211 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_type_elements_begin ( const ElemType  type) const
virtual

Implements libMesh::MeshBase.

Definition at line 430 of file serial_mesh_iterators.C.

References _elements.

431 {
432  Predicates::ActiveType<const_elem_iterator_imp> p(type);
433  return const_element_iterator(_elements.begin(), _elements.end(), p);
434 }
SerialMesh::element_iterator libMesh::SerialMesh::active_type_elements_end ( const ElemType  type)
virtual

Implements libMesh::MeshBase.

Definition at line 653 of file serial_mesh_iterators.C.

References _elements.

654 {
655  Predicates::ActiveType<elem_iterator_imp> p(type);
656  return element_iterator(_elements.end(), _elements.end(), p);
657 }
SerialMesh::const_element_iterator libMesh::SerialMesh::active_type_elements_end ( const ElemType  type) const
virtual

Implements libMesh::MeshBase.

Definition at line 880 of file serial_mesh_iterators.C.

References _elements.

881 {
882  Predicates::ActiveType<const_elem_iterator_imp> p(type);
883  return const_element_iterator(_elements.end(), _elements.end(), p);
884 }
Elem * libMesh::SerialMesh::add_elem ( Elem e)
virtual

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

Implements libMesh::MeshBase.

Definition at line 315 of file serial_mesh.C.

References _elements, libMesh::MeshBase::_next_unique_id, 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().

316 {
317  libmesh_assert(e);
318 
319  // We no longer merely append elements with SerialMesh
320 
321  // If the user requests a valid id that doesn't correspond to an
322  // existing element, let's give them that id, resizing the elements
323  // container if necessary.
324  if (!e->valid_id())
325  e->set_id (_elements.size());
326 
327 #ifdef LIBMESH_ENABLE_UNIQUE_ID
328  if (!e->valid_unique_id())
329  e->set_unique_id() = _next_unique_id++;
330 #endif
331 
332  const dof_id_type id = e->id();
333 
334  if (id < _elements.size())
335  {
336  // Overwriting existing elements is still probably a mistake.
338  }
339  else
340  {
341  _elements.resize(id+1, NULL);
342  }
343 
344  _elements[id] = e;
345 
346  return e;
347 }
Node * libMesh::SerialMesh::add_node ( Node n)
virtual

Add Node n to the end of the vertex array.

Implements libMesh::MeshBase.

Definition at line 474 of file serial_mesh.C.

References libMesh::MeshBase::_next_unique_id, _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().

475 {
476  libmesh_assert(n);
477  // We only append points with SerialMesh
478  libmesh_assert(!n->valid_id() || n->id() == _nodes.size());
479 
480  n->set_id (_nodes.size());
481 
482 #ifdef LIBMESH_ENABLE_UNIQUE_ID
483  if (!n->valid_unique_id())
484  n->set_unique_id() = _next_unique_id++;
485 #endif
486 
487  _nodes.push_back(n);
488 
489  return n;
490 }
Node * libMesh::SerialMesh::add_point ( const Point p,
const dof_id_type  id = DofObject::invalid_id,
const processor_id_type  proc_id = DofObject::invalid_processor_id 
)
virtual

functions for adding /deleting nodes elements.

Implements libMesh::MeshBase.

Definition at line 427 of file serial_mesh.C.

References _nodes, libMesh::Node::build(), libMesh::DofObject::invalid_id, libMesh::libmesh_assert(), and libMesh::DofObject::processor_id().

430 {
431 // // We only append points with SerialMesh
432 // libmesh_assert(id == DofObject::invalid_id || id == _nodes.size());
433 // Node *n = Node::build(p, _nodes.size()).release();
434 // n->processor_id() = proc_id;
435 // _nodes.push_back (n);
436 
437  Node *n = NULL;
438 
439  // If the user requests a valid id, either
440  // provide the existing node or resize the container
441  // to fit the new node.
442  if (id != DofObject::invalid_id)
443  if (id < _nodes.size())
444  n = _nodes[id];
445  else
446  _nodes.resize(id+1);
447  else
448  _nodes.push_back (static_cast<Node*>(NULL));
449 
450  // if the node already exists, then assign new (x,y,z) values
451  if (n)
452  *n = p;
453  // otherwise build a new node, put it in the right spot, and return
454  // a valid pointer.
455  else
456  {
457  n = Node::build(p, (id == DofObject::invalid_id) ? _nodes.size()-1 : id).release();
458  n->processor_id() = proc_id;
459 
460  if (id == DofObject::invalid_id)
461  _nodes.back() = n;
462  else
463  _nodes[id] = n;
464  }
465 
466  // better not pass back a NULL pointer.
467  libmesh_assert (n);
468 
469  return n;
470 }
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 254 of file mesh_modification.C.

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

255 {
256  /*
257  * when the mesh is not prepared,
258  * at least renumber the nodes and
259  * elements, so that the node ids
260  * are correct
261  */
262  if (!this->_is_prepared)
264 
265  START_LOG("all_first_order()", "Mesh");
266 
270  std::vector<bool> node_touched_by_me(this->max_node_id(), false);
271 
277  element_iterator endit = elements_end();
278  for (element_iterator it = elements_begin();
279  it != endit; ++it)
280  {
281  Elem* so_elem = *it;
282 
283  libmesh_assert(so_elem);
284 
285  /*
286  * build the first-order equivalent, add to
287  * the new_elements list.
288  */
289  Elem* lo_elem = Elem::build
291  (so_elem->type()), so_elem->parent()).release();
292 
293  for (unsigned int s=0; s != so_elem->n_sides(); ++s)
294  if (so_elem->neighbor(s) == remote_elem)
295  lo_elem->set_neighbor(s, const_cast<RemoteElem*>(remote_elem));
296 
297 #ifdef LIBMESH_ENABLE_AMR
298  /*
299  * Reset the parent links of any child elements
300  */
301  if (so_elem->has_children())
302  for (unsigned int c=0; c != so_elem->n_children(); ++c)
303  {
304  so_elem->child(c)->set_parent(lo_elem);
305  lo_elem->add_child(so_elem->child(c), c);
306  }
307 
308  /*
309  * Reset the child link of any parent element
310  */
311  if (so_elem->parent())
312  {
313  unsigned int c =
314  so_elem->parent()->which_child_am_i(so_elem);
315  lo_elem->parent()->replace_child(lo_elem, c);
316  }
317 
318  /*
319  * Copy as much data to the new element as makes sense
320  */
321  lo_elem->set_p_level(so_elem->p_level());
322  lo_elem->set_refinement_flag(so_elem->refinement_flag());
323  lo_elem->set_p_refinement_flag(so_elem->p_refinement_flag());
324 #endif
325 
326  libmesh_assert_equal_to (lo_elem->n_vertices(), so_elem->n_vertices());
327 
328  /*
329  * By definition the vertices of the linear and
330  * second order element are identically numbered.
331  * transfer these.
332  */
333  for (unsigned int v=0; v < so_elem->n_vertices(); v++)
334  {
335  lo_elem->set_node(v) = so_elem->get_node(v);
336  node_touched_by_me[lo_elem->node(v)] = true;
337  }
338 
345  libmesh_assert_equal_to (lo_elem->n_sides(), so_elem->n_sides());
346 
347  for (unsigned int s=0; s<so_elem->n_sides(); s++)
348  {
349  const std::vector<boundary_id_type> boundary_ids =
350  this->boundary_info->raw_boundary_ids (so_elem, s);
351 
352  this->boundary_info->add_side (lo_elem, s, boundary_ids);
353  }
354 
355  /*
356  * The new first-order element is ready.
357  * Inserting it into the mesh will replace and delete
358  * the second-order element.
359  */
360  lo_elem->set_id(so_elem->id());
361  lo_elem->processor_id() = so_elem->processor_id();
362  lo_elem->subdomain_id() = so_elem->subdomain_id();
363  this->insert_elem(lo_elem);
364  }
365 
366  const MeshBase::node_iterator nd_end = this->nodes_end();
367  MeshBase::node_iterator nd = this->nodes_begin();
368  while (nd != nd_end)
369  {
370  Node *the_node = *nd;
371  ++nd;
372  if (!node_touched_by_me[the_node->id()])
373  this->delete_node(the_node);
374  }
375 
376  STOP_LOG("all_first_order()", "Mesh");
377 
378  // On hanging nodes that used to also be second order nodes, we
379  // might now have an invalid nodal processor_id()
381 
382  // delete or renumber nodes, etc
383  this->prepare_for_use(/*skip_renumber =*/ false);
384 }
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 388 of file mesh_modification.C.

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

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

389 {
390  // This function must be run on all processors at once
391  parallel_object_only();
392 
393  /*
394  * when the mesh is not prepared,
395  * at least renumber the nodes and
396  * elements, so that the node ids
397  * are correct
398  */
399  if (!this->_is_prepared)
401 
402  /*
403  * If the mesh is empty
404  * then we have nothing to do
405  */
406  if (!this->n_elem())
407  return;
408 
409  /*
410  * If the mesh is already second order
411  * then we have nothing to do.
412  * We have to test for this in a round-about way to avoid
413  * a bug on distributed parallel meshes with more processors
414  * than elements.
415  */
416  bool already_second_order = false;
417  if (this->elements_begin() != this->elements_end() &&
418  (*(this->elements_begin()))->default_order() != FIRST)
419  already_second_order = true;
420  this->comm().max(already_second_order);
421  if (already_second_order)
422  return;
423 
424  START_LOG("all_second_order()", "Mesh");
425 
426  /*
427  * this map helps in identifying second order
428  * nodes. Namely, a second-order node:
429  * - edge node
430  * - face node
431  * - bubble node
432  * is uniquely defined through a set of adjacent
433  * vertices. This set of adjacent vertices is
434  * used to identify already added higher-order
435  * nodes. We are safe to use node id's since we
436  * make sure that these are correctly numbered.
437  */
438  std::map<std::vector<dof_id_type>, Node*> adj_vertices_to_so_nodes;
439 
440  /*
441  * for speed-up of the \p add_point() method, we
442  * can reserve memory. Guess the number of additional
443  * nodes for different dimensions
444  */
445  switch (this->mesh_dimension())
446  {
447  case 1:
448  /*
449  * in 1D, there can only be order-increase from Edge2
450  * to Edge3. Something like 1/2 of n_nodes() have
451  * to be added
452  */
453  this->reserve_nodes(static_cast<unsigned int>
454  (1.5*static_cast<double>(this->n_nodes())));
455  break;
456 
457  case 2:
458  /*
459  * in 2D, either refine from Tri3 to Tri6 (double the nodes)
460  * or from Quad4 to Quad8 (again, double) or Quad9 (2.25 that much)
461  */
462  this->reserve_nodes(static_cast<unsigned int>
463  (2*static_cast<double>(this->n_nodes())));
464  break;
465 
466 
467  case 3:
468  /*
469  * in 3D, either refine from Tet4 to Tet10 (factor = 2.5) up to
470  * Hex8 to Hex27 (something > 3). Since in 3D there _are_ already
471  * quite some nodes, and since we do not want to overburden the memory by
472  * a too conservative guess, use the lower bound
473  */
474  this->reserve_nodes(static_cast<unsigned int>
475  (2.5*static_cast<double>(this->n_nodes())));
476  break;
477 
478  default:
479  // Hm?
480  libmesh_error();
481  }
482 
483 
484 
485  /*
486  * form a vector that will hold the node id's of
487  * the vertices that are adjacent to the son-th
488  * second-order node. Pull this outside of the
489  * loop so that silly compilers don't repeatedly
490  * create and destroy the vector.
491  */
492  std::vector<dof_id_type> adjacent_vertices_ids;
493 
500  const_element_iterator endit = elements_end();
501  for (const_element_iterator it = elements_begin();
502  it != endit; ++it)
503  {
504  // the linear-order element
505  const Elem* lo_elem = *it;
506 
507  libmesh_assert(lo_elem);
508 
509  // make sure it is linear order
510  if (lo_elem->default_order() != FIRST)
511  {
512  libMesh::err << "ERROR: This is not a linear element: type="
513  << lo_elem->type() << std::endl;
514  libmesh_error();
515  }
516 
517  // this does _not_ work for refined elements
518  libmesh_assert_equal_to (lo_elem->level (), 0);
519 
520  /*
521  * build the second-order equivalent, add to
522  * the new_elements list. Note that this here
523  * is the only point where \p full_ordered
524  * is necessary. The remaining code works well
525  * for either type of seconrd-order equivalent, e.g.
526  * Hex20 or Hex27, as equivalents for Hex8
527  */
528  Elem* so_elem =
530  full_ordered) ).release();
531 
532  libmesh_assert_equal_to (lo_elem->n_vertices(), so_elem->n_vertices());
533 
534 
535  /*
536  * By definition the vertices of the linear and
537  * second order element are identically numbered.
538  * transfer these.
539  */
540  for (unsigned int v=0; v < lo_elem->n_vertices(); v++)
541  so_elem->set_node(v) = lo_elem->get_node(v);
542 
543  /*
544  * Now handle the additional mid-side nodes. This
545  * is simply handled through a map that remembers
546  * the already-added nodes. This map maps the global
547  * ids of the vertices (that uniquely define this
548  * higher-order node) to the new node.
549  * Notation: son = second-order node
550  */
551  const unsigned int son_begin = so_elem->n_vertices();
552  const unsigned int son_end = so_elem->n_nodes();
553 
554 
555  for (unsigned int son=son_begin; son<son_end; son++)
556  {
557  const unsigned int n_adjacent_vertices =
558  so_elem->n_second_order_adjacent_vertices(son);
559 
560  adjacent_vertices_ids.resize(n_adjacent_vertices);
561 
562  for (unsigned int v=0; v<n_adjacent_vertices; v++)
563  adjacent_vertices_ids[v] =
564  so_elem->node( so_elem->second_order_adjacent_vertex(son,v) );
565 
566  /*
567  * \p adjacent_vertices_ids is now in order of the current
568  * side. sort it, so that comparisons with the
569  * \p adjacent_vertices_ids created through other elements'
570  * sides can match
571  */
572  std::sort(adjacent_vertices_ids.begin(),
573  adjacent_vertices_ids.end());
574 
575 
576  // does this set of vertices already has a mid-node added?
577  std::pair<std::map<std::vector<dof_id_type>, Node*>::iterator,
578  std::map<std::vector<dof_id_type>, Node*>::iterator>
579  pos = adj_vertices_to_so_nodes.equal_range (adjacent_vertices_ids);
580 
581  // no, not added yet
582  if (pos.first == pos.second)
583  {
584  /*
585  * for this set of vertices, there is no
586  * second_order node yet. Add it.
587  *
588  * compute the location of the new node as
589  * the average over the adjacent vertices.
590  */
591  Point new_location = this->point(adjacent_vertices_ids[0]);
592  for (unsigned int v=1; v<n_adjacent_vertices; v++)
593  new_location += this->point(adjacent_vertices_ids[v]);
594 
595  new_location /= static_cast<Real>(n_adjacent_vertices);
596 
597  /* Add the new point to the mesh, giving it a globally
598  * well-defined processor id.
599  */
600  Node* so_node = this->add_point
601  (new_location, DofObject::invalid_id,
602  this->node(adjacent_vertices_ids[0]).processor_id());
603 
604  /*
605  * insert the new node with its defining vertex
606  * set into the map, and relocate pos to this
607  * new entry, so that the so_elem can use
608  * \p pos for inserting the node
609  */
610  adj_vertices_to_so_nodes.insert(pos.first,
611  std::make_pair(adjacent_vertices_ids,
612  so_node));
613 
614  so_elem->set_node(son) = so_node;
615  }
616  // yes, already added.
617  else
618  {
619  libmesh_assert(pos.first->second);
620 
621  so_elem->set_node(son) = pos.first->second;
622  }
623  }
624 
625 
637  libmesh_assert_equal_to (lo_elem->n_sides(), so_elem->n_sides());
638 
639  for (unsigned int s=0; s<lo_elem->n_sides(); s++)
640  {
641  const std::vector<boundary_id_type> boundary_ids =
642  this->boundary_info->raw_boundary_ids (lo_elem, s);
643 
644  this->boundary_info->add_side (so_elem, s, boundary_ids);
645 
646  if (lo_elem->neighbor(s) == remote_elem)
647  so_elem->set_neighbor(s, const_cast<RemoteElem*>(remote_elem));
648  }
649 
650  /*
651  * The new second-order element is ready.
652  * Inserting it into the mesh will replace and delete
653  * the first-order element.
654  */
655  so_elem->set_id(lo_elem->id());
656  so_elem->processor_id() = lo_elem->processor_id();
657  so_elem->subdomain_id() = lo_elem->subdomain_id();
658  this->insert_elem(so_elem);
659  }
660 
661  // we can clear the map
662  adj_vertices_to_so_nodes.clear();
663 
664 
665  STOP_LOG("all_second_order()", "Mesh");
666 
667  // In a ParallelMesh our ghost node processor ids may be bad and
668  // the ids of nodes touching remote elements may be inconsistent.
669  // Fix them.
670  if (!this->is_serial())
671  {
672  LocationMap<Node> loc_map;
673  MeshCommunication().make_nodes_parallel_consistent
674  (*this, loc_map);
675  }
676 
677  // renumber nodes, elements etc
678  this->prepare_for_use(/*skip_renumber =*/ false);
679 }
virtual void libMesh::MeshBase::allgather ( )
inlinevirtualinherited

Gathers all elements and nodes of the mesh onto every processor

Reimplemented in libMesh::ParallelMesh.

Definition at line 140 of file mesh_base.h.

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

140 {}
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 536 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(), and libMesh::ErrorVector::plot_error().

bool libMesh::MeshBase::allow_renumbering ( ) const
inlineinherited
SerialMesh::element_iterator libMesh::SerialMesh::ancestor_elements_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 67 of file serial_mesh_iterators.C.

References _elements.

68 {
69  Predicates::Ancestor<elem_iterator_imp> p;
70  return element_iterator(_elements.begin(), _elements.end(), p);
71 }
SerialMesh::const_element_iterator libMesh::SerialMesh::ancestor_elements_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 290 of file serial_mesh_iterators.C.

References _elements.

291 {
292  Predicates::Ancestor<const_elem_iterator_imp> p;
293  return const_element_iterator(_elements.begin(), _elements.end(), p);
294 }
SerialMesh::element_iterator libMesh::SerialMesh::ancestor_elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 513 of file serial_mesh_iterators.C.

References _elements.

514 {
515  Predicates::Ancestor<elem_iterator_imp> p;
516  return element_iterator(_elements.end(), _elements.end(), p);
517 }
SerialMesh::const_element_iterator libMesh::SerialMesh::ancestor_elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 740 of file serial_mesh_iterators.C.

References _elements.

741 {
742  Predicates::Ancestor<const_elem_iterator_imp> p;
743  return const_element_iterator(_elements.end(), _elements.end(), p);
744 }
void libMesh::SerialMesh::assign_unique_ids ( )
protectedvirtual

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

Implements libMesh::MeshBase.

Definition at line 1273 of file serial_mesh.C.

References _elements, libMesh::MeshBase::_next_unique_id, and _nodes.

1274 {
1275  for (dof_id_type i=0; i<_elements.size(); ++i)
1276  if (_elements[i] && ! _elements[i]->valid_unique_id())
1277  _elements[i]->set_unique_id() = _next_unique_id++;
1278 
1279  for (dof_id_type i=0; i<_nodes.size(); ++i)
1280  if (_nodes[i] && ! _nodes[i]->valid_unique_id())
1281  _nodes[i]->set_unique_id() = _next_unique_id++;
1282 }
void libMesh::SerialMesh::clear ( )
virtual

Clear all internal data.

Reimplemented from libMesh::MeshBase.

Definition at line 591 of file serial_mesh.C.

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

Referenced by ~SerialMesh().

592 {
593  // Call parent clear function
594  MeshBase::clear();
595 
596 
597  // Clear our elements and nodes
598  {
599  std::vector<Elem*>::iterator it = _elements.begin();
600  const std::vector<Elem*>::iterator end = _elements.end();
601 
602  // There is no need to remove the elements from
603  // the BoundaryInfo data structure since we
604  // already cleared it.
605  for (; it != end; ++it)
606  delete *it;
607 
608  _elements.clear();
609  }
610 
611  // clear the nodes data structure
612  {
613  std::vector<Node*>::iterator it = _nodes.begin();
614  const std::vector<Node*>::iterator end = _nodes.end();
615 
616  // There is no need to remove the nodes from
617  // the BoundaryInfo data structure since we
618  // already cleared it.
619  for (; it != end; ++it)
620  delete *it;
621 
622  _nodes.clear();
623  }
624 }
void libMesh::MeshBase::clear_point_locator ( )
inherited

Releases the current PointLocator object.

Definition at line 414 of file mesh_base.C.

References libMesh::MeshBase::_point_locator.

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

415 {
416  _point_locator.reset(NULL);
417 }
virtual AutoPtr<MeshBase> libMesh::SerialMesh::clone ( ) const
inlinevirtual

Virtual copy-constructor, creates a copy of this mesh

Implements libMesh::MeshBase.

Definition at line 86 of file serial_mesh.h.

References SerialMesh().

87  { return AutoPtr<MeshBase>(new SerialMesh(*this)); }
const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inlineinherited
Returns
a reference to the Parallel::Communicator object used by this mesh.

Definition at line 86 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_jacobian(), libMesh::__libmesh_petsc_snes_residual(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::MetisPartitioner::_do_partition(), libMesh::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::ParallelMesh::add_elem(), libMesh::ImplicitSystem::add_matrix(), libMesh::ParallelMesh::add_node(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::bounding_box(), libMesh::System::calculate_norm(), libMesh::MeshRefinement::coarsen_elements(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMLibMeshSetSystem(), DMVariableBounds_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::for(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::LocationMap< T >::init(), libMesh::PetscDiffSolver::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_flags(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshSerializer::MeshSerializer(), libMesh::ParallelMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), libMesh::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::parallel_max_node_id(), libMesh::ParallelMesh::parallel_n_elem(), libMesh::ParallelMesh::parallel_n_nodes(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::System::project_vector(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::MeshRefinement::test_level_one(), libMesh::MeshRefinement::test_unflagged(), libMesh::MeshTools::total_weight(), libMesh::CheckpointIO::write(), libMesh::XdrIO::write(), libMesh::UnstructuredMesh::write(), libMesh::LegacyXdrIO::write_mesh(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), and libMesh::DivaIO::write_stream().

87  { return _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 1099 of file unstructured_mesh.C.

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

1100 {
1101  START_LOG ("contract()", "Mesh");
1102 
1103  // Flag indicating if this call actually changes the mesh
1104  bool mesh_changed = false;
1105 
1106  element_iterator in = elements_begin();
1107  const element_iterator end = elements_end();
1108 
1109 #ifdef DEBUG
1110  for ( ; in != end; ++in)
1111  if (*in != NULL)
1112  {
1113  Elem* el = *in;
1114  libmesh_assert(el->active() || el->subactive() || el->ancestor());
1115  }
1116  in = elements_begin();
1117 #endif
1118 
1119  // Loop over the elements.
1120  for ( ; in != end; ++in)
1121  if (*in != NULL)
1122  {
1123  Elem* el = *in;
1124 
1125  // Delete all the subactive ones
1126  if (el->subactive())
1127  {
1128  // No level-0 element should be subactive.
1129  // Note that we CAN'T test elem->level(), as that
1130  // touches elem->parent()->dim(), and elem->parent()
1131  // might have already been deleted!
1132  libmesh_assert(el->parent());
1133 
1134  // Delete the element
1135  // This just sets a pointer to NULL, and doesn't
1136  // invalidate any iterators
1137  this->delete_elem(el);
1138 
1139  // the mesh has certainly changed
1140  mesh_changed = true;
1141  }
1142  else
1143  {
1144  // Compress all the active ones
1145  if (el->active())
1146  el->contract();
1147  else
1148  libmesh_assert (el->ancestor());
1149  }
1150  }
1151 
1152  // Strip any newly-created NULL voids out of the element array
1154 
1155  // FIXME: Need to understand why deleting subactive children
1156  // invalidates the point locator. For now we will clear it explicitly
1157  this->clear_point_locator();
1158 
1159  STOP_LOG ("contract()", "Mesh");
1160 
1161  return mesh_changed;
1162 }
void libMesh::UnstructuredMesh::copy_nodes_and_elements ( const UnstructuredMesh other_mesh)
virtualinherited

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

Definition at line 104 of file unstructured_mesh.C.

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

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

105 {
106  // We're assuming our subclass data needs no copy
107  libmesh_assert_equal_to (_n_parts, other_mesh._n_parts);
108  libmesh_assert_equal_to (_dim, other_mesh._dim);
109  libmesh_assert_equal_to (_is_prepared, other_mesh._is_prepared);
110 
111  // We're assuming the other mesh has proper element number ordering,
112  // so that we add parents before their children.
113 #ifdef DEBUG
115 #endif
116 
117  //Copy in Nodes
118  {
119  //Preallocate Memory if necessary
120  this->reserve_nodes(other_mesh.n_nodes());
121 
122  const_node_iterator it = other_mesh.nodes_begin();
123  const_node_iterator end = other_mesh.nodes_end();
124 
125  for (; it != end; ++it)
126  {
127  const Node *oldn = *it;
128 
129  // Add new nodes in old node Point locations
130  /*Node *newn =*/ this->add_point(*oldn, oldn->id(), oldn->processor_id());
131 
132  // And start them off in the same subdomain
133 // newn->processor_id() = oldn->processor_id();
134  }
135  }
136 
137  //Copy in Elements
138  {
139  //Preallocate Memory if necessary
140  this->reserve_elem(other_mesh.n_elem());
141 
142  // Loop over the elements
143  MeshBase::const_element_iterator it = other_mesh.elements_begin();
144  const MeshBase::const_element_iterator end = other_mesh.elements_end();
145 
146  // FIXME: Where do we set element IDs??
147  for (; it != end; ++it)
148  {
149  //Look at the old element
150  const Elem *old = *it;
151  //Build a new element
152  Elem *newparent = old->parent() ?
153  this->elem(old->parent()->id()) : NULL;
154  AutoPtr<Elem> ap = Elem::build(old->type(), newparent);
155  Elem * el = ap.release();
156 
157  el->subdomain_id() = old->subdomain_id();
158 
159  for (unsigned int s=0; s != old->n_sides(); ++s)
160  if (old->neighbor(s) == remote_elem)
161  el->set_neighbor(s, const_cast<RemoteElem*>(remote_elem));
162 
163 #ifdef LIBMESH_ENABLE_AMR
164  if (old->has_children())
165  for (unsigned int c=0; c != old->n_children(); ++c)
166  if (old->child(c) == remote_elem)
167  el->add_child(const_cast<RemoteElem*>(remote_elem), c);
168 
169  //Create the parent's child pointers if necessary
170  if (newparent)
171  {
172  unsigned int oldc = old->parent()->which_child_am_i(old);
173  newparent->add_child(el, oldc);
174  }
175 
176  // Copy the refinement flags
177  el->set_refinement_flag(old->refinement_flag());
178  el->set_p_refinement_flag(old->p_refinement_flag());
179 #endif // #ifdef LIBMESH_ENABLE_AMR
180 
181  //Assign all the nodes
182  for(unsigned int i=0;i<el->n_nodes();i++)
183  el->set_node(i) = &this->node(old->node(i));
184 
185  // And start it off in the same subdomain
186  el->processor_id() = old->processor_id();
187 
188  // Give it the same id
189  el->set_id(old->id());
190 
191  //Hold onto it
192  this->add_elem(el);
193  }
194  }
195 
196  //Finally prepare the new Mesh for use. Keep the same numbering and
197  //partitioning but also the same renumbering and partitioning
198  //policies as our source mesh.
199  this->allow_renumbering(false);
200  this->skip_partitioning(true);
201  this->prepare_for_use();
202  this->allow_renumbering(other_mesh.allow_renumbering());
203  this->skip_partitioning(other_mesh.skip_partitioning());
204 }
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 965 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.

967 {
968 
969  // Issue a warning if the number the number of processors
970  // currently available is less that that requested for
971  // partitioning. This is not necessarily an error since
972  // you may run on one processor and still partition the
973  // mesh into several partitions.
974 #ifdef DEBUG
975  if (this->n_processors() < pid)
976  {
977  libMesh::out << "WARNING: You are creating a "
978  << "mesh for a processor id (="
979  << pid
980  << ") greater than "
981  << "the number of processors available for "
982  << "the calculation. (="
983  << this->n_processors()
984  << ")."
985  << std::endl;
986  }
987 #endif
988 
989  // Create iterators to loop over the list of elements
990 // const_active_pid_elem_iterator it(this->elements_begin(), pid);
991 // const const_active_pid_elem_iterator it_end(this->elements_end(), pid);
992 
993  const_element_iterator it = this->active_pid_elements_begin(pid);
994  const const_element_iterator it_end = this->active_pid_elements_end(pid);
995 
996  this->create_submesh (pid_mesh, it, it_end);
997 }
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 1005 of file unstructured_mesh.C.

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

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

1008 {
1009  // Just in case the subdomain_mesh already has some information
1010  // in it, get rid of it.
1011  new_mesh.clear();
1012 
1013  // Fail if (*this == new_mesh), we cannot create a submesh inside ourself!
1014  // This may happen if the user accidently passes the original mesh into
1015  // this function! We will check this by making sure we did not just
1016  // clear ourself.
1017  libmesh_assert_not_equal_to (this->n_nodes(), 0);
1018  libmesh_assert_not_equal_to (this->n_elem(), 0);
1019 
1020  // How the nodes on this mesh will be renumbered to nodes
1021  // on the new_mesh.
1022  std::vector<dof_id_type> new_node_numbers (this->n_nodes());
1023 
1024  std::fill (new_node_numbers.begin(),
1025  new_node_numbers.end(),
1027 
1028 
1029 
1030  // the number of nodes on the new mesh, will be incremented
1031  dof_id_type n_new_nodes = 0;
1032  dof_id_type n_new_elem = 0;
1033 
1034  for (; it != it_end; ++it)
1035  {
1036  // increment the new element counter
1037  n_new_elem++;
1038 
1039  const Elem* old_elem = *it;
1040 
1041  // Add an equivalent element type to the new_mesh
1042  Elem* new_elem =
1043  new_mesh.add_elem (Elem::build(old_elem->type()).release());
1044 
1045  libmesh_assert(new_elem);
1046 
1047  // Loop over the nodes on this element.
1048  for (unsigned int n=0; n<old_elem->n_nodes(); n++)
1049  {
1050  libmesh_assert_less (old_elem->node(n), new_node_numbers.size());
1051 
1052  if (new_node_numbers[old_elem->node(n)] == DofObject::invalid_id)
1053  {
1054  new_node_numbers[old_elem->node(n)] = n_new_nodes;
1055 
1056  // Add this node to the new mesh
1057  new_mesh.add_point (old_elem->point(n));
1058 
1059  // Increment the new node counter
1060  n_new_nodes++;
1061  }
1062 
1063  // Define this element's connectivity on the new mesh
1064  libmesh_assert_less (new_node_numbers[old_elem->node(n)], new_mesh.n_nodes());
1065 
1066  new_elem->set_node(n) = new_mesh.node_ptr (new_node_numbers[old_elem->node(n)]);
1067  }
1068 
1069  // Copy ids for this element
1070  new_elem->subdomain_id() = old_elem->subdomain_id();
1071  new_elem->processor_id() = old_elem->processor_id();
1072 
1073  // Maybe add boundary conditions for this element
1074  for (unsigned int s=0; s<old_elem->n_sides(); s++)
1075 // We're supporting boundary ids on internal sides now
1076 // if (old_elem->neighbor(s) == NULL)
1077  {
1078  const std::vector<boundary_id_type>& bc_ids = this->boundary_info->boundary_ids(old_elem, s);
1079  for (std::vector<boundary_id_type>::const_iterator id_it=bc_ids.begin(); id_it!=bc_ids.end(); ++id_it)
1080  {
1081  const boundary_id_type bc_id = *id_it;
1082  if (bc_id != this->boundary_info->invalid_id)
1083  new_mesh.boundary_info->add_side (new_elem,
1084  s,
1085  bc_id);
1086  }
1087  }
1088  } // end loop over elements
1089 
1090 
1091  // Prepare the new_mesh for use
1092  new_mesh.prepare_for_use(/*skip_renumber =*/false);
1093 
1094 }
void libMesh::SerialMesh::delete_elem ( Elem e)
virtual

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

Implements libMesh::MeshBase.

Definition at line 370 of file serial_mesh.C.

References _elements, libMesh::MeshBase::boundary_info, libMesh::DofObject::id(), and libMesh::libmesh_assert().

Referenced by insert_elem().

371 {
372  libmesh_assert(e);
373 
374  // Initialize an iterator to eventually point to the element we want to delete
375  std::vector<Elem*>::iterator pos = _elements.end();
376 
377  // In many cases, e->id() gives us a clue as to where e
378  // is located in the _elements vector. Try that first
379  // before trying the O(n_elem) search.
380  libmesh_assert_less (e->id(), _elements.size());
381 
382  if (_elements[e->id()] == e)
383  {
384  // We found it!
385  pos = _elements.begin();
386  std::advance(pos, e->id());
387  }
388 
389  else
390  {
391  // This search is O(n_elem)
392  pos = std::find (_elements.begin(),
393  _elements.end(),
394  e);
395  }
396 
397  // Huh? Element not in the vector?
398  libmesh_assert (pos != _elements.end());
399 
400  // Remove the element from the BoundaryInfo object
401  this->boundary_info->remove(e);
402 
403  // delete the element
404  delete e;
405 
406  // explicitly NULL the pointer
407  *pos = NULL;
408 }
void libMesh::SerialMesh::delete_node ( Node n)
virtual

Removes the Node n from the mesh.

Implements libMesh::MeshBase.

Definition at line 537 of file serial_mesh.C.

References _nodes, libMesh::MeshBase::boundary_info, libMesh::DofObject::id(), and libMesh::libmesh_assert().

Referenced by stitching_helper().

538 {
539  libmesh_assert(n);
540  libmesh_assert_less (n->id(), _nodes.size());
541 
542  // Initialize an iterator to eventually point to the element we want
543  // to delete
544  std::vector<Node*>::iterator pos;
545 
546  // In many cases, e->id() gives us a clue as to where e
547  // is located in the _elements vector. Try that first
548  // before trying the O(n_elem) search.
549  if (_nodes[n->id()] == n)
550  {
551  pos = _nodes.begin();
552  std::advance(pos, n->id());
553  }
554  else
555  {
556  pos = std::find (_nodes.begin(),
557  _nodes.end(),
558  n);
559  }
560 
561  // Huh? Node not in the vector?
562  libmesh_assert (pos != _nodes.end());
563 
564  // Delete the node from the BoundaryInfo object
565  this->boundary_info->remove(n);
566 
567  // delete the node
568  delete n;
569 
570  // explicitly NULL the pointer
571  *pos = NULL;
572 }
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::ParallelMesh.

Definition at line 147 of file mesh_base.h.

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

147 {}
const Elem * libMesh::SerialMesh::elem ( const dof_id_type  i) const
virtual

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 265 of file serial_mesh.C.

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

Referenced by stitching_helper().

266 {
267  libmesh_assert_less (i, this->n_elem());
269  libmesh_assert_equal_to (_elements[i]->id(), i); // This will change soon
270 
271  return _elements[i];
272 }
Elem * libMesh::SerialMesh::elem ( const dof_id_type  i)
virtual

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 277 of file serial_mesh.C.

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

278 {
279  libmesh_assert_less (i, this->n_elem());
281  libmesh_assert_equal_to (_elements[i]->id(), i); // This will change soon
282 
283  return _elements[i];
284 }
SerialMesh::element_iterator libMesh::SerialMesh::elements_begin ( )
virtual

Elem iterator accessor functions.

Implements libMesh::MeshBase.

Definition at line 37 of file serial_mesh_iterators.C.

References _elements.

Referenced by stitching_helper().

38 {
39  Predicates::NotNull<elem_iterator_imp> p;
40  return element_iterator(_elements.begin(), _elements.end(), p);
41 }
SerialMesh::const_element_iterator libMesh::SerialMesh::elements_begin ( ) const
virtual

const Elem iterator accessor functions.

Implements libMesh::MeshBase.

Definition at line 260 of file serial_mesh_iterators.C.

References _elements.

261 {
262  Predicates::NotNull<const_elem_iterator_imp> p;
263  return const_element_iterator(_elements.begin(), _elements.end(), p);
264 }
SerialMesh::element_iterator libMesh::SerialMesh::elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 483 of file serial_mesh_iterators.C.

References _elements.

Referenced by stitching_helper().

484 {
485  Predicates::NotNull<elem_iterator_imp> p;
486  return element_iterator(_elements.end(), _elements.end(), p);
487 }
SerialMesh::const_element_iterator libMesh::SerialMesh::elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 710 of file serial_mesh_iterators.C.

References _elements.

711 {
712  Predicates::NotNull<const_elem_iterator_imp> p;
713  return const_element_iterator(_elements.end(), _elements.end(), p);
714 }
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.

Implements libMesh::MeshBase.

Definition at line 219 of file unstructured_mesh.C.

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

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

221 {
222  // We might actually want to run this on an empty mesh
223  // (e.g. the boundary mesh for a nonexistant bcid!)
224  // libmesh_assert_not_equal_to (this->n_nodes(), 0);
225  // libmesh_assert_not_equal_to (this->n_elem(), 0);
226 
227  // This function must be run on all processors at once
228  parallel_object_only();
229 
230  START_LOG("find_neighbors()", "Mesh");
231 
232  const element_iterator el_end = this->elements_end();
233 
234  //TODO:[BSK] This should be removed later?!
235  if (reset_current_list)
236  for (element_iterator el = this->elements_begin(); el != el_end; ++el)
237  {
238  Elem* e = *el;
239  for (unsigned int s=0; s<e->n_neighbors(); s++)
240  if (e->neighbor(s) != remote_elem ||
241  reset_remote_elements)
242  e->set_neighbor(s,NULL);
243  }
244 
245  // Find neighboring elements by first finding elements
246  // with identical side keys and then check to see if they
247  // are neighbors
248  {
249  // data structures -- Use the hash_multimap if available
250  typedef unsigned int key_type;
251  typedef std::pair<Elem*, unsigned char> val_type;
252  typedef std::pair<key_type, val_type> key_val_pair;
253 
254  typedef LIBMESH_BEST_UNORDERED_MULTIMAP<key_type, val_type> map_type;
255 
256  // A map from side keys to corresponding elements & side numbers
257  map_type side_to_elem_map;
258 
259 
260 
261  for (element_iterator el = this->elements_begin(); el != el_end; ++el)
262  {
263  Elem* element = *el;
264 
265  for (unsigned int ms=0; ms<element->n_neighbors(); ms++)
266  {
267  next_side:
268  // If we haven't yet found a neighbor on this side, try.
269  // Even if we think our neighbor is remote, that
270  // information may be out of date.
271  if (element->neighbor(ms) == NULL ||
272  element->neighbor(ms) == remote_elem)
273  {
274  // Get the key for the side of this element
275  const unsigned int key = element->key(ms);
276 
277  // Look for elements that have an identical side key
278  std::pair <map_type::iterator, map_type::iterator>
279  bounds = side_to_elem_map.equal_range(key);
280 
281  // May be multiple keys, check all the possible
282  // elements which _might_ be neighbors.
283  if (bounds.first != bounds.second)
284  {
285  // Get the side for this element
286  const AutoPtr<Elem> my_side(element->side(ms));
287 
288  // Look at all the entries with an equivalent key
289  while (bounds.first != bounds.second)
290  {
291  // Get the potential element
292  Elem* neighbor = bounds.first->second.first;
293 
294  // Get the side for the neighboring element
295  const unsigned int ns = bounds.first->second.second;
296  const AutoPtr<Elem> their_side(neighbor->side(ns));
297  //libmesh_assert(my_side.get());
298  //libmesh_assert(their_side.get());
299 
300  // If found a match with my side
301  //
302  // We need special tests here for 1D:
303  // since parents and children have an equal
304  // side (i.e. a node), we need to check
305  // ns != ms, and we also check level() to
306  // avoid setting our neighbor pointer to
307  // any of our neighbor's descendants
308  if( (*my_side == *their_side) &&
309  (element->level() == neighbor->level()) &&
310  ((_dim != 1) || (ns != ms)) )
311  {
312  // So share a side. Is this a mixed pair
313  // of subactive and active/ancestor
314  // elements?
315  // If not, then we're neighbors.
316  // If so, then the subactive's neighbor is
317 
318  if (element->subactive() ==
319  neighbor->subactive())
320  {
321  // an element is only subactive if it has
322  // been coarsened but not deleted
323  element->set_neighbor (ms,neighbor);
324  neighbor->set_neighbor(ns,element);
325  }
326  else if (element->subactive())
327  {
328  element->set_neighbor(ms,neighbor);
329  }
330  else if (neighbor->subactive())
331  {
332  neighbor->set_neighbor(ns,element);
333  }
334  side_to_elem_map.erase (bounds.first);
335 
336  // get out of this nested crap
337  goto next_side;
338  }
339 
340  ++bounds.first;
341  }
342  }
343 
344  // didn't find a match...
345  // Build the map entry for this element
346  key_val_pair kvp;
347 
348  kvp.first = key;
349  kvp.second.first = element;
350  kvp.second.second = ms;
351 
352  // use the lower bound as a hint for
353  // where to put it.
354 #if defined(LIBMESH_HAVE_UNORDERED_MAP) || defined(LIBMESH_HAVE_TR1_UNORDERED_MAP) || defined(LIBMESH_HAVE_HASH_MAP) || defined(LIBMESH_HAVE_EXT_HASH_MAP)
355  side_to_elem_map.insert (kvp);
356 #else
357  side_to_elem_map.insert (bounds.first,kvp);
358 #endif
359  }
360  }
361  }
362  }
363 
364 #ifdef LIBMESH_ENABLE_AMR
365 
386  const unsigned int n_levels = MeshTools::n_levels(*this);
387  for (unsigned int level = 1; level < n_levels; ++level)
388  {
389  element_iterator end = this->level_elements_end(level);
390  for (element_iterator el = this->level_elements_begin(level);
391  el != end; ++el)
392  {
393  Elem* current_elem = *el;
394  libmesh_assert(current_elem);
395  Elem* parent = current_elem->parent();
396  libmesh_assert(parent);
397  const unsigned int my_child_num = parent->which_child_am_i(current_elem);
398 
399  for (unsigned int s=0; s < current_elem->n_neighbors(); s++)
400  {
401  if (current_elem->neighbor(s) == NULL ||
402  (current_elem->neighbor(s) == remote_elem &&
403  parent->is_child_on_side(my_child_num, s)))
404  {
405  Elem *neigh = parent->neighbor(s);
406 
407  // If neigh was refined and had non-subactive children
408  // made remote earlier, then a non-subactive elem should
409  // actually have one of those remote children as a
410  // neighbor
411  if (neigh && (neigh->ancestor()) && (!current_elem->subactive()))
412  {
413 #ifdef DEBUG
414  // Let's make sure that "had children made remote"
415  // situation is actually the case
416  libmesh_assert(neigh->has_children());
417  bool neigh_has_remote_children = false;
418  for (unsigned int c = 0; c != neigh->n_children(); ++c)
419  {
420  if (neigh->child(c) == remote_elem)
421  neigh_has_remote_children = true;
422  }
423  libmesh_assert(neigh_has_remote_children);
424 
425  // And let's double-check that we don't have
426  // a remote_elem neighboring a local element
427  libmesh_assert_not_equal_to (current_elem->processor_id(),
428  this->processor_id());
429 #endif // DEBUG
430  neigh = const_cast<RemoteElem*>(remote_elem);
431  }
432 
433  current_elem->set_neighbor(s, neigh);
434 #ifdef DEBUG
435  if (neigh != NULL && neigh != remote_elem)
436  // We ignore subactive elements here because
437  // we don't care about neighbors of subactive element.
438  if ((!neigh->active()) && (!current_elem->subactive()))
439  {
440  libMesh::err << "On processor " << this->processor_id()
441  << std::endl;
442  libMesh::err << "Bad element ID = " << current_elem->id()
443  << ", Side " << s << ", Bad neighbor ID = " << neigh->id() << std::endl;
444  libMesh::err << "Bad element proc_ID = " << current_elem->processor_id()
445  << ", Bad neighbor proc_ID = " << neigh->processor_id() << std::endl;
446  libMesh::err << "Bad element size = " << current_elem->hmin()
447  << ", Bad neighbor size = " << neigh->hmin() << std::endl;
448  libMesh::err << "Bad element center = " << current_elem->centroid()
449  << ", Bad neighbor center = " << neigh->centroid() << std::endl;
450  libMesh::err << "ERROR: "
451  << (current_elem->active()?"Active":"Ancestor")
452  << " Element at level "
453  << current_elem->level() << std::endl;
454  libMesh::err << "with "
455  << (parent->active()?"active":
456  (parent->subactive()?"subactive":"ancestor"))
457  << " parent share "
458  << (neigh->subactive()?"subactive":"ancestor")
459  << " neighbor at level " << neigh->level()
460  << std::endl;
461  GMVIO(*this).write ("bad_mesh.gmv");
462  libmesh_error();
463  }
464 #endif // DEBUG
465  }
466  }
467  }
468  }
469 
470 #endif // AMR
471 
472 
473 #ifdef DEBUG
475 #endif
476 
477  STOP_LOG("find_neighbors()", "Mesh");
478 }
void libMesh::SerialMesh::fix_broken_node_and_element_numbering ( )
virtual

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

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

Implements libMesh::MeshBase.

Definition at line 787 of file serial_mesh.C.

References _elements, and _nodes.

788 {
789  // Nodes first
790  for (dof_id_type n=0; n<this->_nodes.size(); n++)
791  if (this->_nodes[n] != NULL)
792  this->_nodes[n]->set_id() = n;
793 
794  // Elements next
795  for (dof_id_type e=0; e<this->_elements.size(); e++)
796  if (this->_elements[e] != NULL)
797  this->_elements[e]->set_id() = e;
798 }
subdomain_id_type libMesh::MeshBase::get_id_by_name ( const std::string &  name) const
inherited

Returns a the id of the requested block by name. Throws an error if a block by name is not found

Definition at line 441 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name, and libMesh::err.

442 {
443  // This function is searching the *values* of the map (linear search)
444  // We might want to make this more efficient...
445  std::map<subdomain_id_type, std::string>::const_iterator
446  iter = _block_id_to_name.begin(),
447  end_iter = _block_id_to_name.end();
448 
449  for ( ; iter != end_iter; ++iter)
450  {
451  if (iter->second == name)
452  return iter->first;
453  }
454 
455  libMesh::err << "Block '" << name << "' does not exist in mesh" << std::endl;
456  libmesh_error();
457 }
std::string libMesh::MeshBase::get_info ( ) const
inherited
Returns
a string containing relevant information about the mesh.

Definition at line 305 of file mesh_base.C.

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

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

306 {
307  std::ostringstream oss;
308 
309  oss << " Mesh Information:" << '\n'
310  << " mesh_dimension()=" << this->mesh_dimension() << '\n'
311  << " spatial_dimension()=" << this->spatial_dimension() << '\n'
312  << " n_nodes()=" << this->n_nodes() << '\n'
313  << " n_local_nodes()=" << this->n_local_nodes() << '\n'
314  << " n_elem()=" << this->n_elem() << '\n'
315  << " n_local_elem()=" << this->n_local_elem() << '\n'
316 #ifdef LIBMESH_ENABLE_AMR
317  << " n_active_elem()=" << this->n_active_elem() << '\n'
318 #endif
319  << " n_subdomains()=" << static_cast<std::size_t>(this->n_subdomains()) << '\n'
320  << " n_partitions()=" << static_cast<std::size_t>(this->n_partitions()) << '\n'
321  << " n_processors()=" << static_cast<std::size_t>(this->n_processors()) << '\n'
322  << " n_threads()=" << static_cast<std::size_t>(libMesh::n_threads()) << '\n'
323  << " processor_id()=" << static_cast<std::size_t>(this->processor_id()) << '\n';
324 
325  return oss.str();
326 }
const std::map<subdomain_id_type, std::string>& libMesh::MeshBase::get_subdomain_name_map ( ) const
inlineinherited
Elem * libMesh::SerialMesh::insert_elem ( Elem e)
virtual

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

Implements libMesh::MeshBase.

Definition at line 351 of file serial_mesh.C.

References _elements, delete_elem(), and libMesh::DofObject::id().

352 {
353  dof_id_type eid = e->id();
354  libmesh_assert_less (eid, _elements.size());
355  Elem *oldelem = _elements[eid];
356 
357  if (oldelem)
358  {
359  libmesh_assert_equal_to (oldelem->id(), eid);
360  this->delete_elem(oldelem);
361  }
362 
363  _elements[e->id()] = e;
364 
365  return e;
366 }
Node * libMesh::SerialMesh::insert_node ( Node n)
virtual

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 SerialMesh::add_node() function, which is only capable of appending nodes at the end of the nodes storage.

Implements libMesh::MeshBase.

Definition at line 494 of file serial_mesh.C.

References _nodes, libMesh::err, libMesh::DofObject::id(), and libMesh::DofObject::invalid_id.

495 {
496  if (!n)
497  {
498  libMesh::err << "Error, attempting to insert NULL node." << std::endl;
499  libmesh_error();
500  }
501 
502  if (n->id() == DofObject::invalid_id)
503  {
504  libMesh::err << "Error, cannot insert node with invalid id." << std::endl;
505  libmesh_error();
506  }
507 
508  if (n->id() < _nodes.size())
509  {
510  // Don't allow inserting on top of an existing Node.
511  if (_nodes[ n->id() ] != NULL)
512  {
513  libMesh::err << "Error, cannot insert node on top of existing node." << std::endl;
514  libmesh_error();
515  }
516  }
517  else
518  {
519  // Allocate just enough space to store the new node. This will
520  // cause highly non-ideal memory allocation behavior if called
521  // repeatedly...
522  _nodes.resize(n->id() + 1);
523  }
524 
525 
526  // We have enough space and this spot isn't already occupied by
527  // another node, so go ahead and add it.
528  _nodes[ n->id() ] = n;
529 
530  // If we made it this far, we just inserted the node the user handed
531  // us, so we can give it right back.
532  return n;
533 }
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 126 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().

127  { return _is_prepared; }
SerialMesh::element_iterator libMesh::SerialMesh::level_elements_begin ( const unsigned int  level)
virtual

Implements libMesh::MeshBase.

Definition at line 147 of file serial_mesh_iterators.C.

References _elements.

148 {
149  Predicates::Level<elem_iterator_imp> p(level);
150  return element_iterator(_elements.begin(), _elements.end(), p);
151 }
SerialMesh::const_element_iterator libMesh::SerialMesh::level_elements_begin ( const unsigned int  level) const
virtual

Implements libMesh::MeshBase.

Definition at line 370 of file serial_mesh_iterators.C.

References _elements.

371 {
372  Predicates::Level<const_elem_iterator_imp> p(level);
373  return const_element_iterator(_elements.begin(), _elements.end(), p);
374 }
SerialMesh::element_iterator libMesh::SerialMesh::level_elements_end ( const unsigned int  level)
virtual

Implements libMesh::MeshBase.

Definition at line 593 of file serial_mesh_iterators.C.

References _elements.

594 {
595  Predicates::Level<elem_iterator_imp> p(level);
596  return element_iterator(_elements.end(), _elements.end(), p);
597 }
SerialMesh::const_element_iterator libMesh::SerialMesh::level_elements_end ( const unsigned int  level) const
virtual

Implements libMesh::MeshBase.

Definition at line 820 of file serial_mesh_iterators.C.

References _elements.

821 {
822  Predicates::Level<const_elem_iterator_imp> p(level);
823  return const_element_iterator(_elements.end(), _elements.end(), p);
824 }
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 ParallelMesh; a serial data structure is much harder to get out of sync.

Reimplemented in libMesh::ParallelMesh.

Definition at line 692 of file mesh_base.h.

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

692 {}
SerialMesh::element_iterator libMesh::SerialMesh::local_elements_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 107 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

108 {
109  Predicates::Local<elem_iterator_imp> p(this->processor_id());
110  return element_iterator(_elements.begin(), _elements.end(), p);
111 }
SerialMesh::const_element_iterator libMesh::SerialMesh::local_elements_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 330 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

331 {
332  Predicates::Local<const_elem_iterator_imp> p(this->processor_id());
333  return const_element_iterator(_elements.begin(), _elements.end(), p);
334 }
SerialMesh::element_iterator libMesh::SerialMesh::local_elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 553 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

554 {
555  Predicates::Local<elem_iterator_imp> p(this->processor_id());
556  return element_iterator(_elements.end(), _elements.end(), p);
557 }
SerialMesh::const_element_iterator libMesh::SerialMesh::local_elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 780 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

781 {
782  Predicates::Local<const_elem_iterator_imp> p(this->processor_id());
783  return const_element_iterator(_elements.end(), _elements.end(), p);
784 }
SerialMesh::element_iterator libMesh::SerialMesh::local_level_elements_begin ( const unsigned int  level)
virtual

Implements libMesh::MeshBase.

Definition at line 167 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

168 {
169  Predicates::LocalLevel<elem_iterator_imp> p(this->processor_id(),level);
170  return element_iterator(_elements.begin(), _elements.end(), p);
171 }
SerialMesh::const_element_iterator libMesh::SerialMesh::local_level_elements_begin ( const unsigned int  level) const
virtual

Implements libMesh::MeshBase.

Definition at line 390 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

391 {
392  Predicates::LocalLevel<const_elem_iterator_imp> p(this->processor_id(),level);
393  return const_element_iterator(_elements.begin(), _elements.end(), p);
394 }
SerialMesh::element_iterator libMesh::SerialMesh::local_level_elements_end ( const unsigned int  level)
virtual

Implements libMesh::MeshBase.

Definition at line 613 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

614 {
615  Predicates::LocalLevel<elem_iterator_imp> p(this->processor_id(),level);
616  return element_iterator(_elements.end(), _elements.end(), p);
617 }
SerialMesh::const_element_iterator libMesh::SerialMesh::local_level_elements_end ( const unsigned int  level) const
virtual

Implements libMesh::MeshBase.

Definition at line 840 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

841 {
842  Predicates::LocalLevel<const_elem_iterator_imp> p(this->processor_id(),level);
843  return const_element_iterator(_elements.end(), _elements.end(), p);
844 }
SerialMesh::node_iterator libMesh::SerialMesh::local_nodes_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 952 of file serial_mesh_iterators.C.

References _nodes, and libMesh::ParallelObject::processor_id().

953 {
954  Predicates::Local<node_iterator_imp> p(this->processor_id());
955  return node_iterator(_nodes.begin(), _nodes.end(), p);
956 }
SerialMesh::const_node_iterator libMesh::SerialMesh::local_nodes_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 992 of file serial_mesh_iterators.C.

References _nodes, and libMesh::ParallelObject::processor_id().

993 {
994  Predicates::Local<const_node_iterator_imp> p(this->processor_id());
995  return const_node_iterator(_nodes.begin(), _nodes.end(), p);
996 }
SerialMesh::node_iterator libMesh::SerialMesh::local_nodes_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 1032 of file serial_mesh_iterators.C.

References _nodes, and libMesh::ParallelObject::processor_id().

1033 {
1034  Predicates::Local<node_iterator_imp> p(this->processor_id());
1035  return node_iterator(_nodes.end(), _nodes.end(), p);
1036 }
SerialMesh::const_node_iterator libMesh::SerialMesh::local_nodes_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 1072 of file serial_mesh_iterators.C.

References _nodes, and libMesh::ParallelObject::processor_id().

1073 {
1074  Predicates::Local<const_node_iterator_imp> p(this->processor_id());
1075  return const_node_iterator(_nodes.end(), _nodes.end(), p);
1076 }
SerialMesh::element_iterator libMesh::SerialMesh::local_not_level_elements_begin ( const unsigned int  level)
virtual

Implements libMesh::MeshBase.

Definition at line 177 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

178 {
179  Predicates::LocalNotLevel<elem_iterator_imp> p(this->processor_id(),level);
180  return element_iterator(_elements.begin(), _elements.end(), p);
181 }
SerialMesh::const_element_iterator libMesh::SerialMesh::local_not_level_elements_begin ( const unsigned int  level) const
virtual

Implements libMesh::MeshBase.

Definition at line 400 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

401 {
402  Predicates::LocalNotLevel<const_elem_iterator_imp> p(this->processor_id(),level);
403  return const_element_iterator(_elements.begin(), _elements.end(), p);
404 }
SerialMesh::element_iterator libMesh::SerialMesh::local_not_level_elements_end ( const unsigned int  level)
virtual

Implements libMesh::MeshBase.

Definition at line 623 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

624 {
625  Predicates::LocalNotLevel<elem_iterator_imp> p(this->processor_id(),level);
626  return element_iterator(_elements.end(), _elements.end(), p);
627 }
SerialMesh::const_element_iterator libMesh::SerialMesh::local_not_level_elements_end ( const unsigned int  level) const
virtual

Implements libMesh::MeshBase.

Definition at line 850 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

851 {
852  Predicates::LocalNotLevel<const_elem_iterator_imp> p(this->processor_id(),level);
853  return const_element_iterator(_elements.end(), _elements.end(), p);
854 }
virtual dof_id_type libMesh::SerialMesh::max_elem_id ( ) const
inlinevirtual

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

Implements libMesh::MeshBase.

Definition at line 124 of file serial_mesh.h.

References _elements.

125  { return libmesh_cast_int<dof_id_type>(_elements.size()); }
virtual dof_id_type libMesh::SerialMesh::max_node_id ( ) const
inlinevirtual

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

Implements libMesh::MeshBase.

Definition at line 110 of file serial_mesh.h.

References _nodes.

111  { return libmesh_cast_int<dof_id_type>(_nodes.size()); }
unsigned int libMesh::MeshBase::mesh_dimension ( ) const
inlineinherited
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 155 of file mesh_base.h.

References libMesh::MeshBase::_dim.

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

156  { return static_cast<unsigned int>(_dim); }
dof_id_type libMesh::SerialMesh::n_active_elem ( ) const
virtual

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

Implements libMesh::MeshBase.

Definition at line 1265 of file serial_mesh.C.

References active_elements_begin(), and active_elements_end().

1266 {
1267  return static_cast<dof_id_type>(std::distance (this->active_elements_begin(),
1268  this->active_elements_end()));
1269 }
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 266 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().

267 {
268  libmesh_assert_less (proc_id, this->n_processors());
269  return static_cast<dof_id_type>(std::distance (this->active_pid_elements_begin(proc_id),
270  this->active_pid_elements_end (proc_id)));
271 }
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 290 of file mesh_base.C.

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

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

291 {
292  dof_id_type ne=0;
293 
294  const_element_iterator el = this->active_elements_begin();
295  const const_element_iterator end = this->active_elements_end();
296 
297  for (; el!=end; ++el)
298  ne += (*el)->n_sub_elem();
299 
300  return ne;
301 }
virtual dof_id_type libMesh::SerialMesh::n_elem ( ) const
inlinevirtual

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 116 of file serial_mesh.h.

References _elements.

Referenced by elem(), query_elem(), and stitching_helper().

117  { return libmesh_cast_int<dof_id_type>(_elements.size()); }
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 253 of file mesh_base.C.

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

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

254 {
255  // We're either counting a processor's elements or unpartitioned
256  // elements
257  libmesh_assert (proc_id < this->n_processors() ||
259 
260  return static_cast<dof_id_type>(std::distance (this->pid_elements_begin(proc_id),
261  this->pid_elements_end (proc_id)));
262 }
dof_id_type libMesh::MeshBase::n_local_elem ( ) const
inlineinherited

Returns the number of elements on the local processor.

Definition at line 283 of file mesh_base.h.

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

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

284  { return this->n_elem_on_proc (this->processor_id()); }
dof_id_type libMesh::MeshBase::n_local_nodes ( ) const
inlineinherited

Returns the number of nodes on the local processor.

Definition at line 197 of file mesh_base.h.

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

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

198  { return this->n_nodes_on_proc (this->processor_id()); }
virtual dof_id_type libMesh::SerialMesh::n_nodes ( ) const
inlinevirtual

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 104 of file serial_mesh.h.

References _nodes.

Referenced by node(), node_ptr(), point(), query_node_ptr(), and stitching_helper().

105  { return libmesh_cast_int<dof_id_type>(_nodes.size()); }
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 240 of file mesh_base.C.

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

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

241 {
242  // We're either counting a processor's nodes or unpartitioned
243  // nodes
244  libmesh_assert (proc_id < this->n_processors() ||
246 
247  return static_cast<dof_id_type>(std::distance (this->pid_nodes_begin(proc_id),
248  this->pid_nodes_end (proc_id)));
249 }
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 578 of file mesh_base.h.

References libMesh::MeshBase::_n_parts.

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

579  { return _n_parts; }
processor_id_type libMesh::ParallelObject::n_processors ( ) const
inlineinherited
Returns
the number of processors in the group.

Definition at line 92 of file parallel_object.h.

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

Referenced by libMesh::ParmetisPartitioner::_do_repartition(), libMesh::ParallelMesh::add_elem(), libMesh::ParallelMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::ParallelMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshBase::get_info(), libMesh::EquationSystems::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshTools::processor_bounding_box(), libMesh::System::project_vector(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::UnstructuredMesh::read(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::Partitioner::repartition(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::BoundaryInfo::sync(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::CheckpointIO::write(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

93  { return libmesh_cast_int<processor_id_type>(_communicator.size()); }
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 275 of file mesh_base.C.

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

276 {
277  dof_id_type ne=0;
278 
279  const_element_iterator el = this->elements_begin();
280  const const_element_iterator end = this->elements_end();
281 
282  for (; el!=end; ++el)
283  ne += (*el)->n_sub_elem();
284 
285  return ne;
286 }
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 225 of file mesh_base.C.

References libMesh::MeshBase::subdomain_ids().

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

226 {
227  // This requires an inspection on every processor
228  parallel_object_only();
229 
230  std::set<subdomain_id_type> ids;
231 
232  this->subdomain_ids (ids);
233 
234  return ids.size();
235 }
dof_id_type libMesh::MeshBase::n_unpartitioned_elem ( ) const
inlineinherited

Returns the number of elements owned by no processor.

Definition at line 289 of file mesh_base.h.

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

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

dof_id_type libMesh::MeshBase::n_unpartitioned_nodes ( ) const
inlineinherited

Returns the number of nodes owned by no processor.

Definition at line 203 of file mesh_base.h.

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

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

unique_id_type libMesh::MeshBase::next_unique_id ( )
inlineinherited

Returns the next unique id to be used.

Definition at line 216 of file mesh_base.h.

References libMesh::MeshBase::_next_unique_id.

216 { return _next_unique_id; }
const Node & libMesh::SerialMesh::node ( const dof_id_type  i) const
virtual

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

Implements libMesh::MeshBase.

Definition at line 183 of file serial_mesh.C.

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

Referenced by stitching_helper().

184 {
185  libmesh_assert_less (i, this->n_nodes());
187  libmesh_assert_equal_to (_nodes[i]->id(), i); // This will change soon
188 
189  return (*_nodes[i]);
190 }
Node & libMesh::SerialMesh::node ( const dof_id_type  i)
virtual

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

Implements libMesh::MeshBase.

Definition at line 196 of file serial_mesh.C.

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

197 {
198  if (i >= this->n_nodes())
199  {
200  libMesh::out << " i=" << i
201  << ", n_nodes()=" << this->n_nodes()
202  << std::endl;
203  libmesh_error();
204  }
205 
206  libmesh_assert_less (i, this->n_nodes());
208  libmesh_assert_equal_to (_nodes[i]->id(), i); // This will change soon
209 
210  return (*_nodes[i]);
211 }
const Node * libMesh::SerialMesh::node_ptr ( const dof_id_type  i) const
virtual

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

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

Referenced by stitching_helper().

216 {
217  libmesh_assert_less (i, this->n_nodes());
219  libmesh_assert_equal_to (_nodes[i]->id(), i); // This will change soon
220 
221  return _nodes[i];
222 }
Node * libMesh::SerialMesh::node_ptr ( const dof_id_type  i)
virtual

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 227 of file serial_mesh.C.

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

228 {
229  libmesh_assert_less (i, this->n_nodes());
231  libmesh_assert_equal_to (_nodes[i]->id(), i); // This will change soon
232 
233  return _nodes[i];
234 }
SerialMesh::node_iterator libMesh::SerialMesh::nodes_begin ( )
virtual

non-const Node iterator accessor functions.

Implements libMesh::MeshBase.

Definition at line 932 of file serial_mesh_iterators.C.

References _nodes.

Referenced by stitching_helper().

933 {
934  Predicates::NotNull<node_iterator_imp> p;
935  return node_iterator(_nodes.begin(), _nodes.end(), p);
936 }
SerialMesh::const_node_iterator libMesh::SerialMesh::nodes_begin ( ) const
virtual

const Node iterator accessor functions.

Implements libMesh::MeshBase.

Definition at line 972 of file serial_mesh_iterators.C.

References _nodes.

973 {
974  Predicates::NotNull<const_node_iterator_imp> p;
975  return const_node_iterator(_nodes.begin(), _nodes.end(), p);
976 }
SerialMesh::node_iterator libMesh::SerialMesh::nodes_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 1012 of file serial_mesh_iterators.C.

References _nodes.

Referenced by stitching_helper().

1013 {
1014  Predicates::NotNull<node_iterator_imp> p;
1015  return node_iterator(_nodes.end(), _nodes.end(), p);
1016 }
SerialMesh::const_node_iterator libMesh::SerialMesh::nodes_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 1052 of file serial_mesh_iterators.C.

References _nodes.

1053 {
1054  Predicates::NotNull<const_node_iterator_imp> p;
1055  return const_node_iterator(_nodes.end(), _nodes.end(), p);
1056 }
SerialMesh::element_iterator libMesh::SerialMesh::not_active_elements_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 57 of file serial_mesh_iterators.C.

References _elements.

58 {
59  Predicates::NotActive<elem_iterator_imp> p;
60  return element_iterator(_elements.begin(), _elements.end(), p);
61 }
SerialMesh::const_element_iterator libMesh::SerialMesh::not_active_elements_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 280 of file serial_mesh_iterators.C.

References _elements.

281 {
282  Predicates::NotActive<const_elem_iterator_imp> p;
283  return const_element_iterator(_elements.begin(), _elements.end(), p);
284 }
SerialMesh::element_iterator libMesh::SerialMesh::not_active_elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 503 of file serial_mesh_iterators.C.

References _elements.

504 {
505  Predicates::NotActive<elem_iterator_imp> p;
506  return element_iterator(_elements.end(), _elements.end(), p);
507 }
SerialMesh::const_element_iterator libMesh::SerialMesh::not_active_elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 730 of file serial_mesh_iterators.C.

References _elements.

731 {
732  Predicates::NotActive<const_elem_iterator_imp> p;
733  return const_element_iterator(_elements.end(), _elements.end(), p);
734 }
SerialMesh::element_iterator libMesh::SerialMesh::not_ancestor_elements_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 77 of file serial_mesh_iterators.C.

References _elements.

78 {
79  Predicates::Ancestor<elem_iterator_imp> p;
80  return element_iterator(_elements.begin(), _elements.end(), p);
81 }
SerialMesh::const_element_iterator libMesh::SerialMesh::not_ancestor_elements_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 300 of file serial_mesh_iterators.C.

References _elements.

301 {
302  Predicates::Ancestor<const_elem_iterator_imp> p;
303  return const_element_iterator(_elements.begin(), _elements.end(), p);
304 }
SerialMesh::element_iterator libMesh::SerialMesh::not_ancestor_elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 523 of file serial_mesh_iterators.C.

References _elements.

524 {
525  Predicates::Ancestor<elem_iterator_imp> p;
526  return element_iterator(_elements.end(), _elements.end(), p);
527 }
SerialMesh::const_element_iterator libMesh::SerialMesh::not_ancestor_elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 750 of file serial_mesh_iterators.C.

References _elements.

751 {
752  Predicates::Ancestor<const_elem_iterator_imp> p;
753  return const_element_iterator(_elements.end(), _elements.end(), p);
754 }
SerialMesh::element_iterator libMesh::SerialMesh::not_level_elements_begin ( const unsigned int  level)
virtual

Implements libMesh::MeshBase.

Definition at line 157 of file serial_mesh_iterators.C.

References _elements.

158 {
159  Predicates::NotLevel<elem_iterator_imp> p(level);
160  return element_iterator(_elements.begin(), _elements.end(), p);
161 }
SerialMesh::const_element_iterator libMesh::SerialMesh::not_level_elements_begin ( const unsigned int  level) const
virtual

Implements libMesh::MeshBase.

Definition at line 380 of file serial_mesh_iterators.C.

References _elements.

381 {
382  Predicates::NotLevel<const_elem_iterator_imp> p(level);
383  return const_element_iterator(_elements.begin(), _elements.end(), p);
384 }
SerialMesh::element_iterator libMesh::SerialMesh::not_level_elements_end ( const unsigned int  level)
virtual

Implements libMesh::MeshBase.

Definition at line 603 of file serial_mesh_iterators.C.

References _elements.

604 {
605  Predicates::NotLevel<elem_iterator_imp> p(level);
606  return element_iterator(_elements.end(), _elements.end(), p);
607 }
SerialMesh::const_element_iterator libMesh::SerialMesh::not_level_elements_end ( const unsigned int  level) const
virtual

Implements libMesh::MeshBase.

Definition at line 830 of file serial_mesh_iterators.C.

References _elements.

831 {
832  Predicates::NotLevel<const_elem_iterator_imp> p(level);
833  return const_element_iterator(_elements.end(), _elements.end(), p);
834 }
SerialMesh::element_iterator libMesh::SerialMesh::not_local_elements_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 117 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

118 {
119  Predicates::NotLocal<elem_iterator_imp> p(this->processor_id());
120  return element_iterator(_elements.begin(), _elements.end(), p);
121 }
SerialMesh::const_element_iterator libMesh::SerialMesh::not_local_elements_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 340 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

341 {
342  Predicates::NotLocal<const_elem_iterator_imp> p(this->processor_id());
343  return const_element_iterator(_elements.begin(), _elements.end(), p);
344 }
SerialMesh::element_iterator libMesh::SerialMesh::not_local_elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 563 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

564 {
565  Predicates::NotLocal<elem_iterator_imp> p(this->processor_id());
566  return element_iterator(_elements.end(), _elements.end(), p);
567 }
SerialMesh::const_element_iterator libMesh::SerialMesh::not_local_elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 790 of file serial_mesh_iterators.C.

References _elements, and libMesh::ParallelObject::processor_id().

791 {
792  Predicates::NotLocal<const_elem_iterator_imp> p(this->processor_id());
793  return const_element_iterator(_elements.end(), _elements.end(), p);
794 }
SerialMesh::element_iterator libMesh::SerialMesh::not_subactive_elements_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 97 of file serial_mesh_iterators.C.

References _elements.

98 {
99  Predicates::NotSubActive<elem_iterator_imp> p;
100  return element_iterator(_elements.begin(), _elements.end(), p);
101 }
SerialMesh::const_element_iterator libMesh::SerialMesh::not_subactive_elements_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 320 of file serial_mesh_iterators.C.

References _elements.

321 {
322  Predicates::NotSubActive<const_elem_iterator_imp> p;
323  return const_element_iterator(_elements.begin(), _elements.end(), p);
324 }
SerialMesh::element_iterator libMesh::SerialMesh::not_subactive_elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 543 of file serial_mesh_iterators.C.

References _elements.

544 {
545  Predicates::NotSubActive<elem_iterator_imp> p;
546  return element_iterator(_elements.end(), _elements.end(), p);
547 }
SerialMesh::const_element_iterator libMesh::SerialMesh::not_subactive_elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 770 of file serial_mesh_iterators.C.

References _elements.

771 {
772  Predicates::NotSubActive<const_elem_iterator_imp> p;
773  return const_element_iterator(_elements.end(), _elements.end(), p);
774 }
virtual dof_id_type libMesh::SerialMesh::parallel_n_elem ( ) const
inlinevirtual

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 119 of file serial_mesh.h.

References _elements.

120  { return libmesh_cast_int<dof_id_type>(_elements.size()); }
virtual dof_id_type libMesh::SerialMesh::parallel_n_nodes ( ) const
inlinevirtual

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 107 of file serial_mesh.h.

References _nodes.

108  { return libmesh_cast_int<dof_id_type>(_nodes.size()); }
void libMesh::MeshBase::partition ( const unsigned int  n_parts)
virtualinherited

Call the default partitioner (currently metis_partition()).

Definition at line 343 of file mesh_base.C.

References libMesh::MeshBase::is_serial(), libMesh::MeshBase::partitioner(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshBase::skip_partitioning(), and libMesh::MeshBase::update_post_partitioning().

344 {
345  // NULL partitioner means don't partition
346  // Non-serial meshes aren't ready for partitioning yet.
347  if(!skip_partitioning() &&
348  partitioner().get() &&
349  this->is_serial())
350  {
351  partitioner()->partition (*this, n_parts);
352  }
353  else
354  {
355  // Make sure locally cached partition count
356  this->recalculate_n_partitions();
357 
358  // Make sure any other locally cached data is correct
359  this->update_post_partitioning();
360  }
361 }
void libMesh::MeshBase::partition ( )
inlineinherited

Definition at line 514 of file mesh_base.h.

References libMesh::ParallelObject::n_processors().

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

515  { this->partition(this->n_processors()); }
virtual AutoPtr<Partitioner>& libMesh::MeshBase::partitioner ( )
inlinevirtualinherited
SerialMesh::element_iterator libMesh::SerialMesh::pid_elements_begin ( const processor_id_type  proc_id)
virtual

Implements libMesh::MeshBase.

Definition at line 187 of file serial_mesh_iterators.C.

References _elements.

Referenced by unpartitioned_elements_begin().

188 {
189  Predicates::PID<elem_iterator_imp> p(proc_id);
190  return element_iterator(_elements.begin(), _elements.end(), p);
191 }
SerialMesh::const_element_iterator libMesh::SerialMesh::pid_elements_begin ( const processor_id_type  proc_id) const
virtual

Implements libMesh::MeshBase.

Definition at line 410 of file serial_mesh_iterators.C.

References _elements.

411 {
412  Predicates::PID<const_elem_iterator_imp> p(proc_id);
413  return const_element_iterator(_elements.begin(), _elements.end(), p);
414 }
SerialMesh::element_iterator libMesh::SerialMesh::pid_elements_end ( const processor_id_type  proc_id)
virtual

Implements libMesh::MeshBase.

Definition at line 633 of file serial_mesh_iterators.C.

References _elements.

Referenced by unpartitioned_elements_end().

634 {
635  Predicates::PID<elem_iterator_imp> p(proc_id);
636  return element_iterator(_elements.end(), _elements.end(), p);
637 }
SerialMesh::const_element_iterator libMesh::SerialMesh::pid_elements_end ( const processor_id_type  proc_id) const
virtual

Implements libMesh::MeshBase.

Definition at line 860 of file serial_mesh_iterators.C.

References _elements.

861 {
862  Predicates::PID<const_elem_iterator_imp> p(proc_id);
863  return const_element_iterator(_elements.end(), _elements.end(), p);
864 }
SerialMesh::node_iterator libMesh::SerialMesh::pid_nodes_begin ( const processor_id_type  proc_id)
virtual

Implements libMesh::MeshBase.

Definition at line 962 of file serial_mesh_iterators.C.

References _nodes.

963 {
964  Predicates::PID<node_iterator_imp> p(proc_id);
965  return node_iterator(_nodes.begin(), _nodes.end(), p);
966 }
SerialMesh::const_node_iterator libMesh::SerialMesh::pid_nodes_begin ( const processor_id_type  proc_id) const
virtual

Implements libMesh::MeshBase.

Definition at line 1002 of file serial_mesh_iterators.C.

References _nodes.

1003 {
1004  Predicates::PID<const_node_iterator_imp> p(proc_id);
1005  return const_node_iterator(_nodes.begin(), _nodes.end(), p);
1006 }
SerialMesh::node_iterator libMesh::SerialMesh::pid_nodes_end ( const processor_id_type  proc_id)
virtual

Implements libMesh::MeshBase.

Definition at line 1042 of file serial_mesh_iterators.C.

References _nodes.

1043 {
1044  Predicates::PID<node_iterator_imp> p(proc_id);
1045  return node_iterator(_nodes.end(), _nodes.end(), p);
1046 }
SerialMesh::const_node_iterator libMesh::SerialMesh::pid_nodes_end ( const processor_id_type  proc_id) const
virtual

Implements libMesh::MeshBase.

Definition at line 1082 of file serial_mesh_iterators.C.

References _nodes.

1083 {
1084  Predicates::PID<const_node_iterator_imp> p(proc_id);
1085  return const_node_iterator(_nodes.end(), _nodes.end(), p);
1086 }
const Point & libMesh::SerialMesh::point ( const dof_id_type  i) const
virtual

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 170 of file serial_mesh.C.

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

Referenced by stitching_helper().

171 {
172  libmesh_assert_less (i, this->n_nodes());
174  libmesh_assert_equal_to (_nodes[i]->id(), i); // This will change soon
175 
176  return (*_nodes[i]);
177 }
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 383 of file mesh_base.C.

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

384 {
385  libmesh_deprecated();
386 
387  if (_point_locator.get() == NULL)
388  {
389  // PointLocator construction may not be safe within threads
391 
392  _point_locator.reset (PointLocatorBase::build(TREE, *this).release());
393  }
394 
395  return *_point_locator;
396 }
void libMesh::MeshBase::prepare_for_use ( const bool  skip_renumber_nodes_and_elements = false)
inherited

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

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

Definition at line 120 of file mesh_base.C.

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

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

121 {
122  parallel_object_only();
123 
124  // A distributed mesh may have processors with no elements (or
125  // processors with no elements of higher dimension, if we ever
126  // support mixed-dimension meshes), but we want consistent
127  // mesh_dimension anyways.
128  libmesh_assert(this->comm().verify(this->is_serial()));
129 
130  if (!this->is_serial())
131  {
132  unsigned int dim = this->mesh_dimension();
133  this->comm().max(dim);
134  this->set_mesh_dimension(dim);
135  }
136 
137  // Renumber the nodes and elements so that they in contiguous
138  // blocks. By default, _skip_renumber_nodes_and_elements is false.
139  //
140  // We may currently change that by passing
141  // skip_renumber_nodes_and_elements==true to this function, but we
142  // should use the allow_renumbering() accessor instead.
143  //
144  // Instances where you if prepare_for_use() should not renumber the nodes
145  // and elements include reading in e.g. an xda/r or gmv file. In
146  // this case, the ordering of the nodes may depend on an accompanying
147  // solution, and the node ordering cannot be changed.
148 
149  if (skip_renumber_nodes_and_elements)
150  {
151  libmesh_deprecated();
152  this->allow_renumbering(false);
153  }
154 
155  // Mesh modification operations might not leave us with consistent
156  // id counts, but our partitioner might need that consistency.
159  else
161 
162  // Let all the elements find their neighbors
163  this->find_neighbors();
164 
165  // Partition the mesh.
166  this->partition();
167 
168  // If we're using ParallelMesh, we'll want it parallelized.
169  this->delete_remote_elements();
170 
171 #ifdef LIBMESH_ENABLE_UNIQUE_ID
172  // Assign DOF object unique ids
173  this->assign_unique_ids();
174 #endif
175 
178 
179  // Reset our PointLocator. This needs to happen any time the elements
180  // in the underlying elements in the mesh have changed, so we do it here.
181  this->clear_point_locator();
182 
183  // The mesh is now prepared for use.
184  _is_prepared = true;
185 }
void libMesh::MeshBase::print_info ( std::ostream &  os = libMesh::out) const
inherited

Prints relevant information about the mesh.

Definition at line 329 of file mesh_base.C.

References libMesh::MeshBase::get_info().

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

330 {
331  os << this->get_info()
332  << std::endl;
333 }
processor_id_type libMesh::ParallelObject::processor_id ( ) const
inlineinherited
Returns
the rank of this processor in the group.

Definition at line 98 of file parallel_object.h.

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

Referenced by libMesh::MetisPartitioner::_do_partition(), libMesh::EquationSystems::_read_impl(), active_local_elements_begin(), libMesh::ParallelMesh::active_local_elements_begin(), active_local_elements_end(), libMesh::ParallelMesh::active_local_elements_end(), active_local_subdomain_elements_begin(), libMesh::ParallelMesh::active_local_subdomain_elements_begin(), active_local_subdomain_elements_end(), libMesh::ParallelMesh::active_local_subdomain_elements_end(), active_not_local_elements_begin(), libMesh::ParallelMesh::active_not_local_elements_begin(), active_not_local_elements_end(), libMesh::ParallelMesh::active_not_local_elements_end(), libMesh::ParallelMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::ParallelMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::DofMap::build_sparsity(), libMesh::ParallelMesh::clear(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO_Helper::create(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMap::first_dof(), libMesh::DofMap::first_old_dof(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::MeshBase::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::MeshFunction::gradient(), libMesh::MeshFunction::hessian(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_discontinuous(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), local_elements_begin(), libMesh::ParallelMesh::local_elements_begin(), local_elements_end(), libMesh::ParallelMesh::local_elements_end(), local_level_elements_begin(), libMesh::ParallelMesh::local_level_elements_begin(), local_level_elements_end(), libMesh::ParallelMesh::local_level_elements_end(), local_nodes_begin(), libMesh::ParallelMesh::local_nodes_begin(), local_nodes_end(), libMesh::ParallelMesh::local_nodes_end(), local_not_level_elements_begin(), libMesh::ParallelMesh::local_not_level_elements_begin(), local_not_level_elements_end(), libMesh::ParallelMesh::local_not_level_elements_end(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMap::n_local_dofs(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), not_local_elements_begin(), libMesh::ParallelMesh::not_local_elements_begin(), not_local_elements_end(), libMesh::ParallelMesh::not_local_elements_end(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::MeshFunction::operator()(), libMesh::ParallelMesh::ParallelMesh(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::System::project_vector(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::UnstructuredMesh::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::MeshData::read_xdr(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::BoundaryInfo::sync(), libMesh::MeshTools::total_weight(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::MeshTools::weight(), libMesh::ExodusII_IO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::write(), libMesh::UnstructuredMesh::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_Helper::write_elements_discontinuous(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates_discontinuous(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().

99  { return libmesh_cast_int<processor_id_type>(_communicator.rank()); }
const Elem * libMesh::SerialMesh::query_elem ( const dof_id_type  i) const
virtual

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 289 of file serial_mesh.C.

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

290 {
291  if (i >= this->n_elem())
292  return NULL;
293  libmesh_assert (_elements[i] == NULL ||
294  _elements[i]->id() == i); // This will change soon
295 
296  return _elements[i];
297 }
Elem * libMesh::SerialMesh::query_elem ( const dof_id_type  i)
virtual

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 302 of file serial_mesh.C.

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

303 {
304  if (i >= this->n_elem())
305  return NULL;
306  libmesh_assert (_elements[i] == NULL ||
307  _elements[i]->id() == i); // This will change soon
308 
309  return _elements[i];
310 }
const Node * libMesh::SerialMesh::query_node_ptr ( const dof_id_type  i) const
virtual

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 239 of file serial_mesh.C.

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

240 {
241  if (i >= this->n_nodes())
242  return NULL;
243  libmesh_assert (_nodes[i] == NULL ||
244  _nodes[i]->id() == i); // This will change soon
245 
246  return _nodes[i];
247 }
Node * libMesh::SerialMesh::query_node_ptr ( const dof_id_type  i)
virtual

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 252 of file serial_mesh.C.

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

253 {
254  if (i >= this->n_nodes())
255  return NULL;
256  libmesh_assert (_nodes[i] == NULL ||
257  _nodes[i]->id() == i); // This will change soon
258 
259  return _nodes[i];
260 }
void libMesh::UnstructuredMesh::read ( const std::string &  name,
MeshData mesh_data = NULL,
bool  skip_renumber_nodes_and_elements = 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.

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

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

Implements libMesh::MeshBase.

Definition at line 482 of file unstructured_mesh.C.

References libMesh::MeshBase::allow_renumbering(), libMesh::XdrIO::binary(), libMesh::MeshCommunication::broadcast(), libMesh::err, libMesh::XdrIO::legacy(), libMesh::ParallelObject::n_processors(), libMesh::Quality::name(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::AbaqusIO::read(), libMesh::OFFIO::read(), libMesh::UCDIO::read(), libMesh::TetGenIO::read(), libMesh::UNVIO::read(), libMesh::ExodusII_IO::read(), libMesh::Nemesis_IO::read(), libMesh::GmshIO::read(), libMesh::GMVIO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::VTKIO::read(), libMesh::MatlabIO::read(), libMesh::LegacyXdrIO::read_mgf(), libMesh::START_LOG(), and libMesh::STOP_LOG().

485 {
486  // See if the file exists. Perform this check on all processors
487  // so that the code is terminated properly in the case that the
488  // file does not exist.
489 
490  // For Nemesis files, the name we try to read will have suffixes
491  // identifying processor rank
492  if (name.rfind(".nem") + 4 == name.size() ||
493  name.rfind(".n") + 2 == name.size())
494  {
495  std::ostringstream full_name;
496 
497  // Find the length of a string which represents the highest processor ID
498  full_name << (this->n_processors());
499  unsigned field_width = full_name.str().size();
500 
501  // reset the string stream
502  full_name.str("");
503 
504  // And build up the full filename
505  full_name << name
506  << '.' << this->n_processors()
507  << '.' << std::setfill('0') << std::setw(field_width) << this->processor_id();
508 
509  std::ifstream in (full_name.str().c_str());
510 
511  if (!in.good())
512  {
513  libMesh::err << "ERROR: cannot locate specified file:\n\t"
514  << full_name.str()
515  << std::endl;
516  libmesh_error();
517  }
518  }
519  else if(name.rfind(".cp")) {} // Do error checking in the reader
520  else
521  {
522  std::ifstream in (name.c_str());
523 
524  if (!in.good())
525  {
526  libMesh::err << "ERROR: cannot locate specified file:\n\t"
527  << name
528  << std::endl;
529  libmesh_error();
530  }
531  }
532 
533  // Set the skip_renumber_nodes_and_elements flag on all processors.
534  // This ensures that renumber_nodes_and_elements is *not* called
535  // during prepare_for_use() for certain types of mesh files.
536  // This is required in cases where there is an associated solution
537  // file which expects a certain ordering of the nodes.
538  if(name.rfind(".gmv")+4==name.size())
539  {
540  skip_renumber_nodes_and_elements = true;
541  }
542 
543  // Look for parallel formats first
544  if (is_parallel_file_format(name))
545  {
546  // no need to handle bz2 files here -- the Xdr class does that.
547  if ((name.rfind(".xda") < name.size()) ||
548  (name.rfind(".xdr") < name.size()))
549  {
550  XdrIO xdr_io(*this);
551 
552  // .xda* ==> bzip2/gzip/ASCII flavors
553  if (name.rfind(".xda") < name.size())
554  {
555  xdr_io.binary() = false;
556  xdr_io.read (name);
557  }
558  else // .xdr* ==> true binary XDR file
559  {
560  xdr_io.binary() = true;
561  xdr_io.read (name);
562  }
563 
564  // The xdr_io object gets constructed with legacy() == false.
565  // if legacy() == true then it means that a legacy file was detected and
566  // thus processor 0 performed the read. We therefore need to broadcast the
567  // mesh. Further, for this flavor of mesh solution data ordering is tied
568  // to the node ordering, so we better not reorder the nodes!
569  if (xdr_io.legacy())
570  {
571  this->allow_renumbering(false);
572  MeshCommunication().broadcast(*this);
573  }
574 
575  // libHilbert-enabled libMesh builds should construct files
576  // with a canonical node ordering, which libHilbert-enabled
577  // builds will be able to read in again regardless of any
578  // renumbering. So in that case we're free to renumber.
579  // However, if either the writer or the reader of this file
580  // don't have libHilbert, then we'll have to skip
581  // renumbering because we need the numbering to remain
582  // consistent with any solution file we read in next.
583 #ifdef LIBMESH_HAVE_LIBHILBERT
584  // if (!xdr_io.libhilbert_ordering())
585  // skip_renumber_nodes_and_elements = true;
586 #else
587  this->allow_renumbering(false);
588 #endif
589  }
590  else if (name.rfind(".nem") < name.size() ||
591  name.rfind(".n") < name.size())
592  Nemesis_IO(*this).read (name);
593  else if (name.rfind(".cp") < name.size())
594  {
595  if(name.rfind(".cpa") < name.size())
596  CheckpointIO(*this, false).read(name);
597  else
598  CheckpointIO(*this, true).read(name);
599  }
600  }
601 
602  // Serial mesh formats
603  else
604  {
605  START_LOG("read()", "Mesh");
606 
607  // Read the file based on extension. Only processor 0
608  // needs to read the mesh. It will then broadcast it and
609  // the other processors will pick it up
610  if (this->processor_id() == 0)
611  {
612  std::ostringstream pid_suffix;
613  pid_suffix << '_' << getpid();
614  // Nasty hack for reading/writing zipped files
615  std::string new_name = name;
616  if (name.size() - name.rfind(".bz2") == 4)
617  {
618 #ifdef LIBMESH_HAVE_BZIP
619  new_name.erase(new_name.end() - 4, new_name.end());
620  new_name += pid_suffix.str();
621  std::string system_string = "bunzip2 -f -k -c ";
622  system_string += name + " > " + new_name;
623  START_LOG("system(bunzip2)", "Mesh");
624  if (std::system(system_string.c_str()))
625  libmesh_file_error(system_string);
626  STOP_LOG("system(bunzip2)", "Mesh");
627 #else
628  libMesh::err << "ERROR: need bzip2/bunzip2 to open .bz2 file "
629  << name << std::endl;
630  libmesh_error();
631 #endif
632  }
633  else if (name.size() - name.rfind(".xz") == 3)
634  {
635 #ifdef LIBMESH_HAVE_XZ
636  new_name.erase(new_name.end() - 3, new_name.end());
637  new_name += pid_suffix.str();
638  std::string system_string = "xz -f -d -k -c ";
639  system_string += name + " > " + new_name;
640  START_LOG("system(xz -d)", "XdrIO");
641  if (std::system(system_string.c_str()))
642  libmesh_file_error(system_string);
643  STOP_LOG("system(xz -d)", "XdrIO");
644 #else
645  libMesh::err << "ERROR: need xz to open .xz file "
646  << name << std::endl;
647  libmesh_error();
648 #endif
649  }
650 
651  if (new_name.rfind(".mat") < new_name.size())
652  MatlabIO(*this).read(new_name);
653 
654  else if (new_name.rfind(".ucd") < new_name.size())
655  UCDIO(*this).read (new_name);
656 
657  else if ((new_name.rfind(".off") < new_name.size()) ||
658  (new_name.rfind(".ogl") < new_name.size()) ||
659  (new_name.rfind(".oogl") < new_name.size()))
660  OFFIO(*this).read (new_name);
661 
662  else if (new_name.rfind(".mgf") < new_name.size())
663  LegacyXdrIO(*this,true).read_mgf (new_name);
664 
665  else if (new_name.rfind(".unv") < new_name.size())
666  {
667  if (mesh_data == NULL)
668  {
669  libMesh::err << "Error! You must pass a "
670  << "valid MeshData pointer to "
671  << "read UNV files!" << std::endl;
672  libmesh_error();
673  }
674  UNVIO(*this, *mesh_data).read (new_name);
675  }
676 
677  else if ((new_name.rfind(".node") < new_name.size()) ||
678  (new_name.rfind(".ele") < new_name.size()))
679  TetGenIO(*this,mesh_data).read (new_name);
680 
681  else if (new_name.rfind(".exd") < new_name.size() ||
682  new_name.rfind(".e") < new_name.size())
683  ExodusII_IO(*this).read (new_name);
684 
685  else if (new_name.rfind(".msh") < new_name.size())
686  GmshIO(*this).read (new_name);
687 
688  else if (new_name.rfind(".gmv") < new_name.size())
689  GMVIO(*this).read (new_name);
690 
691  else if (new_name.rfind(".vtu") < new_name.size())
692  VTKIO(*this).read(new_name);
693 
694  else if (new_name.rfind(".inp") < new_name.size())
695  AbaqusIO(*this).read(new_name);
696 
697  else
698  {
699  libMesh::err << " ERROR: Unrecognized file extension: " << name
700  << "\n I understand the following:\n\n"
701  << " *.e -- Sandia's ExodusII format\n"
702  << " *.exd -- Sandia's ExodusII format\n"
703  << " *.gmv -- LANL's General Mesh Viewer format\n"
704  << " *.mat -- Matlab triangular ASCII file\n"
705  << " *.n -- Sandia's Nemesis format\n"
706  << " *.nem -- Sandia's Nemesis format\n"
707  << " *.off -- OOGL OFF surface format\n"
708  << " *.ucd -- AVS's ASCII UCD format\n"
709  << " *.unv -- I-deas Universal format\n"
710  << " *.vtu -- Paraview VTK format\n"
711  << " *.inp -- Abaqus .inp format\n"
712  << " *.xda -- libMesh ASCII format\n"
713  << " *.xdr -- libMesh binary format\n"
714  << " *.gz -- any above format gzipped\n"
715  << " *.bz2 -- any above format bzip2'ed\n"
716  << " *.xz -- any above format xzipped\n"
717  << " *.cpa -- libMesh Checkpoint ASCII format\n"
718  << " *.cpr -- libMesh Checkpoint binary format\n"
719 
720  << std::endl;
721  libmesh_error();
722  }
723 
724  // If we temporarily decompressed a file, remove the
725  // uncompressed version
726  if (name.size() - name.rfind(".bz2") == 4)
727  std::remove(new_name.c_str());
728  if (name.size() - name.rfind(".xz") == 3)
729  std::remove(new_name.c_str());
730  }
731 
732 
733  STOP_LOG("read()", "Mesh");
734 
735  // Send the mesh & bcs (which are now only on processor 0) to the other
736  // processors
737  MeshCommunication().broadcast (*this);
738  }
739 
740  if (skip_renumber_nodes_and_elements)
741  {
742  // Use MeshBase::allow_renumbering() yourself instead.
743  libmesh_deprecated();
744  this->allow_renumbering(false);
745  }
746 
747  // Done reading the mesh. Now prepare it for use.
748  this->prepare_for_use();
749 }
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 363 of file mesh_base.C.

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

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

364 {
365  const_element_iterator el = this->active_elements_begin();
366  const const_element_iterator end = this->active_elements_end();
367 
368  unsigned int max_proc_id=0;
369 
370  for (; el!=end; ++el)
371  max_proc_id = std::max(max_proc_id, static_cast<unsigned int>((*el)->processor_id()));
372 
373  // The number of partitions is one more than the max processor ID.
374  _n_parts = max_proc_id+1;
375 
376  this->comm().max(_n_parts);
377 
378  return _n_parts;
379 }
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 SerialMesh or serialized ParallelMesh

Reimplemented in libMesh::ParallelMesh.

Definition at line 522 of file mesh_base.h.

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

522 {}
void libMesh::SerialMesh::renumber_elem ( dof_id_type  old_id,
dof_id_type  new_id 
)
virtual

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 412 of file serial_mesh.C.

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

414 {
415  // This doesn't get used in serial yet
416  Elem *el = _elements[old_id];
417  libmesh_assert (el);
418 
419  el->set_id(new_id);
420  libmesh_assert (!_elements[new_id]);
421  _elements[new_id] = el;
422  _elements[old_id] = NULL;
423 }
void libMesh::SerialMesh::renumber_node ( dof_id_type  old_id,
dof_id_type  new_id 
)
virtual

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 576 of file serial_mesh.C.

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

578 {
579  // This doesn't get used in serial yet
580  Node *nd = _nodes[old_id];
581  libmesh_assert (nd);
582 
583  nd->set_id(new_id);
584  libmesh_assert (!_nodes[new_id]);
585  _nodes[new_id] = nd;
586  _nodes[old_id] = NULL;
587 }
void libMesh::SerialMesh::renumber_nodes_and_elements ( )
virtual

Remove NULL elements from arrays

Implements libMesh::MeshBase.

Definition at line 628 of file serial_mesh.C.

References _elements, _nodes, libMesh::MeshBase::_skip_renumber_nodes_and_elements, libMesh::MeshBase::boundary_info, end, libMesh::Elem::get_node(), libMesh::libmesh_assert(), libMesh::Elem::n_nodes(), libMesh::Elem::node(), libMesh::DofObject::set_id(), libMesh::START_LOG(), libMesh::STOP_LOG(), and swap().

629 {
630 
631  START_LOG("renumber_nodes_and_elem()", "Mesh");
632 
633  // node and element id counters
634  dof_id_type next_free_elem = 0;
635  dof_id_type next_free_node = 0;
636 
637  // Will hold the set of nodes that are currently connected to elements
638  LIBMESH_BEST_UNORDERED_SET<Node*> connected_nodes;
639 
640  // Loop over the elements. Note that there may
641  // be NULLs in the _elements vector from the coarsening
642  // process. Pack the elements in to a contiguous array
643  // and then trim any excess.
644  {
645  std::vector<Elem*>::iterator in = _elements.begin();
646  std::vector<Elem*>::iterator out_iter = _elements.begin();
647  const std::vector<Elem*>::iterator end = _elements.end();
648 
649  for (; in != end; ++in)
650  if (*in != NULL)
651  {
652  Elem* el = *in;
653 
654  *out_iter = *in;
655  ++out_iter;
656 
657  // Increment the element counter
658  el->set_id (next_free_elem++);
659 
661  {
662  // Add this elements nodes to the connected list
663  for (unsigned int n=0; n<el->n_nodes(); n++)
664  connected_nodes.insert(el->get_node(n));
665  }
666  else // We DO want node renumbering
667  {
668  // Loop over this element's nodes. Number them,
669  // if they have not been numbered already. Also,
670  // position them in the _nodes vector so that they
671  // are packed contiguously from the beginning.
672  for (unsigned int n=0; n<el->n_nodes(); n++)
673  if (el->node(n) == next_free_node) // don't need to process
674  next_free_node++; // [(src == dst) below]
675 
676  else if (el->node(n) > next_free_node) // need to process
677  {
678  // The source and destination indices
679  // for this node
680  const dof_id_type src_idx = el->node(n);
681  const dof_id_type dst_idx = next_free_node++;
682 
683  // ensure we want to swap a valid nodes
684  libmesh_assert(_nodes[src_idx]);
685 
686  // Swap the source and destination nodes
687  std::swap(_nodes[src_idx],
688  _nodes[dst_idx] );
689 
690  // Set proper indices where that makes sense
691  if (_nodes[src_idx] != NULL)
692  _nodes[src_idx]->set_id (src_idx);
693  _nodes[dst_idx]->set_id (dst_idx);
694  }
695  }
696  }
697 
698  // Erase any additional storage. These elements have been
699  // copied into NULL voids by the procedure above, and are
700  // thus repeated and unnecessary.
701  _elements.erase (out_iter, end);
702  }
703 
704 
706  {
707  // Loop over the nodes. Note that there may
708  // be NULLs in the _nodes vector from the coarsening
709  // process. Pack the nodes in to a contiguous array
710  // and then trim any excess.
711 
712  std::vector<Node*>::iterator in = _nodes.begin();
713  std::vector<Node*>::iterator out_iter = _nodes.begin();
714  const std::vector<Node*>::iterator end = _nodes.end();
715 
716  for (; in != end; ++in)
717  if (*in != NULL)
718  {
719  // This is a reference so that if we change the pointer it will change in the vector
720  Node* & nd = *in;
721 
722  // If this node is still connected to an elem, put it in the list
723  if(connected_nodes.find(nd) != connected_nodes.end())
724  {
725  *out_iter = nd;
726  ++out_iter;
727 
728  // Increment the node counter
729  nd->set_id (next_free_node++);
730  }
731  else // This node is orphaned, delete it!
732  {
733  this->boundary_info->remove (nd);
734 
735  // delete the node
736  delete nd;
737  nd = NULL;
738  }
739  }
740 
741  // Erase any additional storage. Whatever was
742  _nodes.erase (out_iter, end);
743  }
744  else // We really DO want node renumbering
745  {
746  // Any nodes in the vector >= _nodes[next_free_node]
747  // are not connected to any elements and may be deleted
748  // if desired.
749 
750  // (This code block will erase the unused nodes)
751  // Now, delete the unused nodes
752  {
753  std::vector<Node*>::iterator nd = _nodes.begin();
754  const std::vector<Node*>::iterator end = _nodes.end();
755 
756  std::advance (nd, next_free_node);
757 
758  for (std::vector<Node*>::iterator it=nd;
759  it != end; ++it)
760  {
761  // Mesh modification code might have already deleted some
762  // nodes
763  if (*it == NULL)
764  continue;
765 
766  // remove any boundary information associated with
767  // this node
768  this->boundary_info->remove (*it);
769 
770  // delete the node
771  delete *it;
772  *it = NULL;
773  }
774 
775  _nodes.erase (nd, end);
776  }
777  }
778 
779  libmesh_assert_equal_to (next_free_elem, _elements.size());
780  libmesh_assert_equal_to (next_free_node, _nodes.size());
781 
782  STOP_LOG("renumber_nodes_and_elem()", "Mesh");
783 }
virtual void libMesh::SerialMesh::reserve_elem ( const dof_id_type  ne)
inlinevirtual

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

Implements libMesh::MeshBase.

Definition at line 127 of file serial_mesh.h.

References _elements.

127 { _elements.reserve (ne); }
virtual void libMesh::SerialMesh::reserve_nodes ( const dof_id_type  nn)
inlinevirtual

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

Implements libMesh::MeshBase.

Definition at line 113 of file serial_mesh.h.

References _nodes.

114  { _nodes.reserve (nn); }
unsigned int& libMesh::MeshBase::set_n_partitions ( )
inlineprotectedinherited

Returns a writeable reference to the number of partitions.

Definition at line 859 of file mesh_base.h.

References libMesh::MeshBase::_n_parts.

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

860  { return _n_parts; }
void libMesh::MeshBase::set_next_unique_id ( unique_id_type  id)
inlineinherited

Sets the next unique id to be used.

Definition at line 221 of file mesh_base.h.

References libMesh::MeshBase::_next_unique_id.

221 { _next_unique_id = id; }
std::map<subdomain_id_type, std::string>& libMesh::MeshBase::set_subdomain_name_map ( )
inlineinherited

Return a writeable reference to the whole subdomain name map

Definition at line 841 of file mesh_base.h.

References libMesh::MeshBase::_block_id_to_name.

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

842  { return _block_id_to_name; }
void libMesh::MeshBase::skip_partitioning ( bool  skip)
inlineinherited

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

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

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

Definition at line 551 of file mesh_base.h.

References libMesh::MeshBase::_skip_partitioning.

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

551 { _skip_partitioning = skip; }
bool libMesh::MeshBase::skip_partitioning ( ) const
inlineinherited

Definition at line 552 of file mesh_base.h.

References libMesh::MeshBase::_skip_partitioning.

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

552 { return _skip_partitioning; }
unsigned int libMesh::MeshBase::spatial_dimension ( ) const
inlineinherited
void libMesh::SerialMesh::stitch_meshes ( SerialMesh 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 
)

Stitch other_mesh to this mesh so that this mesh is the union of the two meshes. this_mesh_boundary and other_mesh_boundary are used to specify a dim-1 dimensional surface on which we seek to merge any "overlapping" nodes, where we use the parameter tol as a relative tolerance (relative to the smallest edge length on the surfaces being stitched) to determine whether or not nodes are overlapping. If clear_stitched_boundary_ids==true, this function clears boundary_info IDs in this mesh associated this_mesh_boundary and other_mesh_boundary. If use_binary_search is true, we use an optimized "sort then binary search" algorithm for finding matching nodes. Otherwise we use a N^2 algorithm (which can be more reliable at dealing with slightly misaligned meshes). If enforce_all_nodes_match_on_boundaries is true, we throw an error if the number of nodes on the specified boundaries don't match the number of nodes that were merged. This is a helpful error check in some cases.

Definition at line 801 of file serial_mesh.C.

References stitching_helper().

809 {
810  stitching_helper(&other_mesh,
811  this_mesh_boundary_id,
812  other_mesh_boundary_id,
813  tol,
814  clear_stitched_boundary_ids,
815  verbose,
816  use_binary_search,
817  enforce_all_nodes_match_on_boundaries);
818 }
void libMesh::SerialMesh::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 
)

Similar to stitch_meshes, except that we stitch two adjacent surfaces within this mesh.

Definition at line 820 of file serial_mesh.C.

References stitching_helper().

827 {
828  stitching_helper(NULL,
829  boundary_id_1,
830  boundary_id_2,
831  tol,
832  clear_stitched_boundary_ids,
833  verbose,
834  use_binary_search,
835  enforce_all_nodes_match_on_boundaries);
836 }
void libMesh::SerialMesh::stitching_helper ( SerialMesh other_mesh,
boundary_id_type  boundary_id_1,
boundary_id_type  boundary_id_2,
Real  tol,
bool  clear_stitched_boundary_ids,
bool  verbose,
bool  use_binary_search,
bool  enforce_all_nodes_match_on_boundaries 
)
private

Helper function for stitch_meshes and stitch_surfaces that does the mesh stitching.

Definition at line 838 of file serial_mesh.C.

References libMesh::TypeVector< T >::absolute_fuzzy_equals(), libMesh::Utility::binary_find(), libMesh::MeshBase::boundary_info, libMesh::Elem::build_side(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), delete_node(), elem(), elements_begin(), elements_end(), end, libMesh::Elem::get_node(), libMesh::DofObject::id(), libMesh::BoundaryInfo::invalid_id, libMesh::Elem::local_node(), std::max(), std::min(), libMesh::Elem::n_edges(), n_elem(), n_nodes(), libMesh::Elem::n_nodes(), libMesh::Elem::n_sides(), libMesh::Elem::neighbor(), libMesh::Elem::node(), node(), node_ptr(), nodes_begin(), nodes_end(), libMesh::out, point(), libMesh::MeshBase::prepare_for_use(), libMesh::Real, libMesh::DofObject::set_id(), libMesh::Elem::set_node(), side, and libMesh::TOLERANCE.

Referenced by stitch_meshes(), and stitch_surfaces().

846 {
847  std::map<dof_id_type, dof_id_type> node_to_node_map, other_to_this_node_map; // The second is the inverse map of the first
848  std::map<dof_id_type, std::vector<dof_id_type> > node_to_elems_map;
849  // If there is only one mesh (i.e. other_mesh==NULL), then loop over this mesh twice
850  if(!other_mesh)
851  {
852  other_mesh = this;
853  }
854 
855  if( (this_mesh_boundary_id != BoundaryInfo::invalid_id) &&
856  (other_mesh_boundary_id != BoundaryInfo::invalid_id) )
857  {
858  // While finding nodes on the boundary, also find the minimum edge length
859  // of all faces on both boundaries. This will later be used in relative
860  // distance checks when stitching nodes.
862 
863  // Loop below fills in these sets for the two meshes.
864  std::set<dof_id_type> this_boundary_node_ids, other_boundary_node_ids;
865  {
866  // Make temporary fixed-size arrays for loop
867  boundary_id_type id_array[2] = {this_mesh_boundary_id, other_mesh_boundary_id};
868  std::set<dof_id_type>* set_array[2] = {&this_boundary_node_ids, &other_boundary_node_ids};
869  SerialMesh* mesh_array[2] = {this, other_mesh};
870 
871  for (unsigned i=0; i<2; ++i)
872  {
873  MeshBase::element_iterator elem_it = mesh_array[i]->elements_begin();
874  MeshBase::element_iterator elem_end = mesh_array[i]->elements_end();
875  for ( ; elem_it != elem_end; ++elem_it)
876  {
877  Elem *el = *elem_it;
878 
879  // Now check whether elem has a face on the specified boundary
880  for (unsigned int side_id=0; side_id<el->n_sides(); ++side_id)
881  if (el->neighbor(side_id) == NULL)
882  {
883  // Get *all* boundary IDs, not just the first one!
884  std::vector<boundary_id_type> bc_ids = mesh_array[i]->boundary_info->boundary_ids (el, side_id);
885 
886  if (std::count(bc_ids.begin(), bc_ids.end(), id_array[i]))
887  {
888  AutoPtr<Elem> side (el->build_side(side_id));
889  for (unsigned int node_id=0; node_id<side->n_nodes(); ++node_id)
890  set_array[i]->insert( side->node(node_id) );
891 
892  h_min = std::min(h_min, side->hmin());
893  }
894  }
895  }
896  }
897  }
898 
899  if (verbose)
900  {
901  libMesh::out << "In SerialMesh::stitch_meshes:\n"
902  << "This mesh has " << this_boundary_node_ids.size()
903  << " nodes on boundary " << this_mesh_boundary_id << ".\n"
904  << "Other mesh has " << other_boundary_node_ids.size()
905  << " nodes on boundary " << other_mesh_boundary_id << ".\n"
906  << "Minimum edge length on both surfaces is " << h_min << ".\n"
907  << std::endl;
908  }
909 
910 
911  if(use_binary_search)
912  {
913  // Store points from both stitched faces in sorted vectors for faster
914  // searching later.
915  typedef std::vector< std::pair<Point, dof_id_type> > PointVector;
916  PointVector
917  this_sorted_bndry_nodes(this_boundary_node_ids.size()),
918  other_sorted_bndry_nodes(other_boundary_node_ids.size());
919 
920  // Comparison object that will be used later. So far, I've had reasonable success
921  // with TOLERANCE...
922  FuzzyPointCompare mein_comp(TOLERANCE);
923 
924  // Create and sort the vectors we will use to do the geometric searching
925  {
926  std::set<dof_id_type>* set_array[2] = {&this_boundary_node_ids, &other_boundary_node_ids};
927  SerialMesh* mesh_array[2] = {this, other_mesh};
928  PointVector* vec_array[2] = {&this_sorted_bndry_nodes, &other_sorted_bndry_nodes};
929 
930  for (unsigned i=0; i<2; ++i)
931  {
932  std::set<dof_id_type>::iterator
933  set_it = set_array[i]->begin(),
934  set_it_end = set_array[i]->end();
935 
936  // Fill up the vector with the contents of the set...
937  for (unsigned ctr=0; set_it != set_it_end; ++set_it, ++ctr)
938  {
939  (*vec_array[i])[ctr] = std::make_pair( mesh_array[i]->point(*set_it), // The geometric point
940  *set_it ); // Its ID
941  }
942 
943  // Sort the vectors based on the FuzzyPointCompare struct op()
944  std::sort(vec_array[i]->begin(), vec_array[i]->end(), mein_comp);
945  }
946  }
947 
948  // Build up the node_to_node_map and node_to_elems_map using the sorted vectors of Points.
949  for (unsigned i=0; i<this_sorted_bndry_nodes.size(); ++i)
950  {
951  // Current point we're working on
952  Point this_point = this_sorted_bndry_nodes[i].first;
953 
954  // FuzzyPointCompare does a fuzzy equality comparison internally to handle
955  // slight differences between the list of nodes on each mesh.
956  PointVector::iterator other_iter = Utility::binary_find(other_sorted_bndry_nodes.begin(),
957  other_sorted_bndry_nodes.end(),
958  this_point,
959  mein_comp);
960 
961  // Not every node on this_sorted_bndry_nodes will necessarily be stitched, so
962  // if its pair is not found on other_mesh, just continue.
963  if (other_iter != other_sorted_bndry_nodes.end())
964  {
965  // Check that the points do indeed match - should not be necessary unless something
966  // is wrong with binary_find. To be on the safe side, we'll check.
967  {
968  // Grab the other point from the iterator
969  Point other_point = other_iter->first;
970 
971  if (!this_point.absolute_fuzzy_equals(other_point, tol*h_min))
972  {
973  libMesh::out << "Error: mismatched points: " << this_point << " and " << other_point << std::endl;
974  libmesh_error();
975  }
976  }
977 
978 
979  // Associate these two nodes in both the node_to_node_map and the other_to_this_node_map
981  this_node_id = this_sorted_bndry_nodes[i].second,
982  other_node_id = other_iter->second;
983  node_to_node_map[this_node_id] = other_node_id;
984  other_to_this_node_map[other_node_id] = this_node_id;
985  }
986 
987  }
988  }
989  else
990  {
991  // Otherwise, use a simple N^2 search to find the closest matching points. This can be helpful
992  // in the case that we have tolerance issues which cause mismatch between the two surfaces
993  // that are being stitched.
994 
995  std::set<dof_id_type>::iterator set_it = this_boundary_node_ids.begin();
996  std::set<dof_id_type>::iterator set_it_end = this_boundary_node_ids.end();
997  for( ; set_it != set_it_end; ++set_it)
998  {
999  dof_id_type this_node_id = *set_it;
1000  Node& this_node = this->node(this_node_id);
1001 
1002  bool found_matching_nodes = false;
1003 
1004  std::set<dof_id_type>::iterator other_set_it = other_boundary_node_ids.begin();
1005  std::set<dof_id_type>::iterator other_set_it_end = other_boundary_node_ids.end();
1006  for( ; other_set_it != other_set_it_end; ++other_set_it)
1007  {
1008  dof_id_type other_node_id = *other_set_it;
1009  Node& other_node = other_mesh->node(other_node_id);
1010 
1011  Real node_distance = (this_node - other_node).size();
1012 
1013  if(node_distance < tol*h_min)
1014  {
1015  // Make sure we didn't already find a matching node!
1016  if(found_matching_nodes)
1017  {
1018  libMesh::out << "Error: Found multiple matching nodes in stitch_meshes" << std::endl;
1019  libmesh_error();
1020  }
1021 
1022  node_to_node_map[this_node_id] = other_node_id;
1023  other_to_this_node_map[other_node_id] = this_node_id;
1024 
1025  found_matching_nodes = true;
1026  }
1027  }
1028  }
1029  }
1030 
1031  // Build up the node_to_elems_map, using only one loop over other_mesh
1032  {
1033  MeshBase::element_iterator other_elem_it = other_mesh->elements_begin();
1034  MeshBase::element_iterator other_elem_end = other_mesh->elements_end();
1035  for (; other_elem_it != other_elem_end; ++other_elem_it)
1036  {
1037  Elem *el = *other_elem_it;
1038 
1039  // For each node on the element, find the corresponding node
1040  // on "this" Mesh, 'this_node_id', if it exists, and push
1041  // the current element ID back onto node_to_elems_map[this_node_id].
1042  // For that we will use the reverse mapping we created at
1043  // the same time as the forward mapping.
1044  for (unsigned n=0; n<el->n_nodes(); ++n)
1045  {
1046  dof_id_type other_node_id = el->node(n);
1047  std::map<dof_id_type, dof_id_type>::iterator it =
1048  other_to_this_node_map.find(other_node_id);
1049 
1050  if (it != other_to_this_node_map.end())
1051  {
1052  dof_id_type this_node_id = it->second;
1053  node_to_elems_map[this_node_id].push_back( el->id() );
1054  }
1055  }
1056  }
1057  }
1058 
1059  if(verbose)
1060  {
1061  libMesh::out << "In SerialMesh::stitch_meshes:\n"
1062  << "Found " << node_to_node_map.size()
1063  << " matching nodes.\n"
1064  << std::endl;
1065  }
1066 
1067  if(enforce_all_nodes_match_on_boundaries)
1068  {
1069  unsigned int n_matching_nodes = node_to_node_map.size();
1070  unsigned int this_mesh_n_nodes = this_boundary_node_ids.size();
1071  unsigned int other_mesh_n_nodes = other_boundary_node_ids.size();
1072  if( (n_matching_nodes != this_mesh_n_nodes) ||
1073  (n_matching_nodes != other_mesh_n_nodes) )
1074  {
1075  libMesh::out << "Error: We expected the number of nodes to match."
1076  << std::endl;
1077  libmesh_error();
1078  }
1079  }
1080  }
1081  else
1082  {
1083  if(verbose)
1084  {
1085  libMesh::out << "Skip node merging in SerialMesh::stitch_meshes:" << std::endl;
1086  }
1087  }
1088 
1089 
1090 
1091  dof_id_type node_delta = this->n_nodes();
1092  dof_id_type elem_delta = this->n_elem();
1093 
1094  // If other_mesh!=NULL, then we have to do a bunch of work
1095  // in order to copy it to this mesh
1096  if(this!=other_mesh)
1097  {
1098  // need to increment node and element IDs of other_mesh before copying to this mesh
1099  MeshBase::node_iterator node_it = other_mesh->nodes_begin();
1100  MeshBase::node_iterator node_end = other_mesh->nodes_end();
1101  for (; node_it != node_end; ++node_it)
1102  {
1103  Node *nd = *node_it;
1104  dof_id_type new_id = nd->id() + node_delta;
1105  nd->set_id(new_id);
1106  }
1107 
1108  MeshBase::element_iterator elem_it = other_mesh->elements_begin();
1109  MeshBase::element_iterator elem_end = other_mesh->elements_end();
1110  for (; elem_it != elem_end; ++elem_it)
1111  {
1112  Elem *el = *elem_it;
1113  dof_id_type new_id = el->id() + elem_delta;
1114  el->set_id(new_id);
1115  }
1116 
1117  // Also, increment the node_to_node_map and node_to_elems_map
1118  std::map<dof_id_type, dof_id_type>::iterator node_map_it = node_to_node_map.begin();
1119  std::map<dof_id_type, dof_id_type>::iterator node_map_it_end = node_to_node_map.end();
1120  for( ; node_map_it != node_map_it_end; ++node_map_it)
1121  {
1122  node_map_it->second += node_delta;
1123  }
1124  std::map<dof_id_type, std::vector<dof_id_type> >::iterator elem_map_it = node_to_elems_map.begin();
1125  std::map<dof_id_type, std::vector<dof_id_type> >::iterator elem_map_it_end = node_to_elems_map.end();
1126  for( ; elem_map_it != elem_map_it_end; ++elem_map_it)
1127  {
1128  dof_id_type n_elems = elem_map_it->second.size();
1129  for(dof_id_type i=0; i<n_elems; i++)
1130  {
1131  (elem_map_it->second)[i] += elem_delta;
1132  }
1133  }
1134 
1135  // Copy mesh data
1136  this->copy_nodes_and_elements(*other_mesh);
1137 
1138  // Decrement node IDs of mesh to return to original state
1139  node_it = other_mesh->nodes_begin();
1140  node_end = other_mesh->nodes_end();
1141  for (; node_it != node_end; ++node_it)
1142  {
1143  Node *nd = *node_it;
1144  dof_id_type new_id = nd->id() - node_delta;
1145  nd->set_id(new_id);
1146  }
1147 
1148  elem_it = other_mesh->elements_begin();
1149  elem_end = other_mesh->elements_end();
1150  for (; elem_it != elem_end; ++elem_it)
1151  {
1152  Elem *other_elem = *elem_it;
1153 
1154  // Find the corresponding element on this mesh
1155  Elem* this_elem = this->elem(other_elem->id());
1156 
1157  // Decrement elem IDs of other_mesh to return it to original state
1158  dof_id_type new_id = other_elem->id() - elem_delta;
1159  other_elem->set_id(new_id);
1160 
1161  unsigned int n_nodes = other_elem->n_nodes();
1162  for (unsigned int n=0; n != n_nodes; ++n)
1163  {
1164  const std::vector<boundary_id_type>& ids =
1165  other_mesh->boundary_info->boundary_ids(other_elem->get_node(n));
1166  if (!ids.empty())
1167  {
1168  this->boundary_info->add_node(this_elem->get_node(n), ids);
1169  }
1170  }
1171 
1172  // Copy edge boundary info
1173  unsigned int n_edges = other_elem->n_edges();
1174  for (unsigned int edge=0; edge != n_edges; ++edge)
1175  {
1176  const std::vector<boundary_id_type>& ids =
1177  other_mesh->boundary_info->edge_boundary_ids(other_elem, edge);
1178  if (!ids.empty())
1179  {
1180  this->boundary_info->add_edge( this_elem, edge, ids);
1181  }
1182  }
1183 
1184  unsigned int n_sides = other_elem->n_sides();
1185  for (unsigned int s=0; s != n_sides; ++s)
1186  {
1187  const std::vector<boundary_id_type>& ids =
1188  other_mesh->boundary_info->boundary_ids(other_elem, s);
1189  if (!ids.empty())
1190  {
1191  this->boundary_info->add_side( this_elem, s, ids);
1192  }
1193  }
1194 
1195  }
1196 
1197  } // end if(other_mesh)
1198 
1199  // Finally, we need to "merge" the overlapping nodes
1200  // We do this by iterating over node_to_elems_map and updating
1201  // the elements so that they "point" to the nodes that came
1202  // from this mesh, rather than from other_mesh.
1203  // Then we iterate over node_to_node_map and delete the
1204  // duplicate nodes that came from other_mesh.
1205  std::map<dof_id_type, std::vector<dof_id_type> >::iterator elem_map_it = node_to_elems_map.begin();
1206  std::map<dof_id_type, std::vector<dof_id_type> >::iterator elem_map_it_end = node_to_elems_map.end();
1207  for( ; elem_map_it != elem_map_it_end; ++elem_map_it)
1208  {
1209  dof_id_type target_node_id = elem_map_it->first;
1210  dof_id_type other_node_id = node_to_node_map[target_node_id];
1211  Node& target_node = this->node(target_node_id);
1212 
1213  dof_id_type n_elems = elem_map_it->second.size();
1214  for(unsigned int i=0; i<n_elems; i++)
1215  {
1216  dof_id_type elem_id = elem_map_it->second[i];
1217  Elem* el = this->elem(elem_id);
1218 
1219  // find the local node index that we want to update
1220  unsigned int local_node_index = el->local_node(other_node_id);
1221 
1222  el->set_node(local_node_index) = &target_node;
1223  }
1224  }
1225 
1226  std::map<dof_id_type, dof_id_type>::iterator node_map_it = node_to_node_map.begin();
1227  std::map<dof_id_type, dof_id_type>::iterator node_map_it_end = node_to_node_map.end();
1228  for( ; node_map_it != node_map_it_end; ++node_map_it)
1229  {
1230  dof_id_type node_id = node_map_it->second;
1231  this->delete_node( this->node_ptr(node_id) );
1232  }
1233 
1234  this->prepare_for_use( /*skip_renumber_nodes_and_elements= */ false);
1235 
1236  // After the stitching, we may want to clear boundary IDs from element
1237  // faces that are now internal to the mesh
1238  if(clear_stitched_boundary_ids)
1239  {
1240  MeshBase::element_iterator elem_it = this->elements_begin();
1241  MeshBase::element_iterator elem_end = this->elements_end();
1242  for (; elem_it != elem_end; ++elem_it)
1243  {
1244  Elem *el = *elem_it;
1245 
1246  for (unsigned int side_id=0; side_id<el->n_sides(); side_id++)
1247  {
1248  if (el->neighbor(side_id) != NULL)
1249  {
1250  // Completely remove the side from the boundary_info object if it has either
1251  // this_mesh_boundary_id or other_mesh_boundary_id.
1252  std::vector<boundary_id_type> bc_ids = this->boundary_info->boundary_ids (el, side_id);
1253 
1254  if (std::count(bc_ids.begin(), bc_ids.end(), this_mesh_boundary_id) ||
1255  std::count(bc_ids.begin(), bc_ids.end(), other_mesh_boundary_id))
1256  this->boundary_info->remove_side(el, side_id);
1257  }
1258  }
1259  }
1260  }
1261 
1262 }
AutoPtr< PointLocatorBase > libMesh::MeshBase::sub_point_locator ( ) const
inherited

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

Definition at line 399 of file mesh_base.C.

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

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

400 {
401  if (_point_locator.get() == NULL)
402  {
403  // PointLocator construction may not be safe within threads
405 
406  _point_locator.reset (PointLocatorBase::build(TREE, *this).release());
407  }
408 
409  return PointLocatorBase::build(TREE, *this, _point_locator.get());
410 }
SerialMesh::element_iterator libMesh::SerialMesh::subactive_elements_begin ( )
virtual

Implements libMesh::MeshBase.

Definition at line 87 of file serial_mesh_iterators.C.

References _elements.

88 {
89  Predicates::SubActive<elem_iterator_imp> p;
90  return element_iterator(_elements.begin(), _elements.end(), p);
91 }
SerialMesh::const_element_iterator libMesh::SerialMesh::subactive_elements_begin ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 310 of file serial_mesh_iterators.C.

References _elements.

311 {
312  Predicates::SubActive<const_elem_iterator_imp> p;
313  return const_element_iterator(_elements.begin(), _elements.end(), p);
314 }
SerialMesh::element_iterator libMesh::SerialMesh::subactive_elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 533 of file serial_mesh_iterators.C.

References _elements.

534 {
535  Predicates::SubActive<elem_iterator_imp> p;
536  return element_iterator(_elements.end(), _elements.end(), p);
537 }
SerialMesh::const_element_iterator libMesh::SerialMesh::subactive_elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 760 of file serial_mesh_iterators.C.

References _elements.

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

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

Definition at line 206 of file mesh_base.C.

References libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), libMesh::ParallelObject::comm(), end, and libMesh::Parallel::Communicator::set_union().

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

207 {
208  // This requires an inspection on every processor
209  parallel_object_only();
210 
211  ids.clear();
212 
213  const_element_iterator el = this->active_elements_begin();
214  const const_element_iterator end = this->active_elements_end();
215 
216  for (; el!=end; ++el)
217  ids.insert((*el)->subdomain_id());
218 
219  // Some subdomains may only live on other processors
220  this->comm().set_union(ids);
221 }
std::string & libMesh::MeshBase::subdomain_name ( subdomain_id_type  id)
inherited

Returns a writable reference for getting/setting an optional name for a subdomain.

Definition at line 421 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name.

Referenced by DMLibMeshSetSystem(), libMesh::ExodusII_IO::read(), libMesh::TecplotIO::write_binary(), and libMesh::ExodusII_IO_Helper::write_elements().

422 {
423  return _block_id_to_name[id];
424 }
const std::string & libMesh::MeshBase::subdomain_name ( subdomain_id_type  id) const
inherited

Definition at line 426 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name.

427 {
428  // An empty string to return when no matching subdomain name is found
429  static const std::string empty;
430 
431  std::map<subdomain_id_type, std::string>::const_iterator iter = _block_id_to_name.find(id);
432  if (iter == _block_id_to_name.end())
433  return empty;
434  else
435  return iter->second;
436 }
SerialMesh::element_iterator libMesh::SerialMesh::type_elements_begin ( const ElemType  type)
virtual

Implements libMesh::MeshBase.

Definition at line 197 of file serial_mesh_iterators.C.

References _elements.

198 {
199  Predicates::Type<elem_iterator_imp> p(type);
200  return element_iterator(_elements.begin(), _elements.end(), p);
201 }
SerialMesh::const_element_iterator libMesh::SerialMesh::type_elements_begin ( const ElemType  type) const
virtual

Implements libMesh::MeshBase.

Definition at line 420 of file serial_mesh_iterators.C.

References _elements.

421 {
422  Predicates::Type<const_elem_iterator_imp> p(type);
423  return const_element_iterator(_elements.begin(), _elements.end(), p);
424 }
SerialMesh::element_iterator libMesh::SerialMesh::type_elements_end ( const ElemType  type)
virtual

Implements libMesh::MeshBase.

Definition at line 643 of file serial_mesh_iterators.C.

References _elements.

644 {
645  Predicates::Type<elem_iterator_imp> p(type);
646  return element_iterator(_elements.end(), _elements.end(), p);
647 }
SerialMesh::const_element_iterator libMesh::SerialMesh::type_elements_end ( const ElemType  type) const
virtual

Implements libMesh::MeshBase.

Definition at line 870 of file serial_mesh_iterators.C.

References _elements.

871 {
872  Predicates::Type<const_elem_iterator_imp> p(type);
873  return const_element_iterator(_elements.end(), _elements.end(), p);
874 }
SerialMesh::element_iterator libMesh::SerialMesh::unpartitioned_elements_begin ( )
virtual
SerialMesh::const_element_iterator libMesh::SerialMesh::unpartitioned_elements_begin ( ) const
virtual
SerialMesh::element_iterator libMesh::SerialMesh::unpartitioned_elements_end ( )
virtual

Implements libMesh::MeshBase.

Definition at line 673 of file serial_mesh_iterators.C.

References libMesh::DofObject::invalid_processor_id, and pid_elements_end().

674 {
676 }
SerialMesh::const_element_iterator libMesh::SerialMesh::unpartitioned_elements_end ( ) const
virtual

Implements libMesh::MeshBase.

Definition at line 900 of file serial_mesh_iterators.C.

References libMesh::DofObject::invalid_processor_id, and pid_elements_end().

901 {
903 }
virtual void libMesh::SerialMesh::update_parallel_id_counts ( )
inlinevirtual

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

Implements libMesh::MeshBase.

Definition at line 130 of file serial_mesh.h.

130 {}
virtual void libMesh::MeshBase::update_post_partitioning ( )
inlinevirtualinherited

Recalculate any cached data after elements and nodes have been repartitioned.

Reimplemented in libMesh::ParallelMesh.

Definition at line 528 of file mesh_base.h.

Referenced by libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), and libMesh::Nemesis_IO::read().

528 {}
void libMesh::UnstructuredMesh::write ( const std::string &  name,
MeshData mesh_data = NULL 
)
virtualinherited

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

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

Implements libMesh::MeshBase.

Definition at line 753 of file unstructured_mesh.C.

References libMesh::Parallel::Communicator::barrier(), libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::err, libMesh::MeshBase::n_partitions(), libMesh::Quality::name(), libMesh::GMVIO::partitioning(), libMesh::ParallelObject::processor_id(), libMesh::START_LOG(), libMesh::STOP_LOG(), libMesh::FroIO::write(), libMesh::DivaIO::write(), libMesh::TecplotIO::write(), libMesh::MEDITIO::write(), libMesh::GMVIO::write(), libMesh::UCDIO::write(), libMesh::TetGenIO::write(), libMesh::UNVIO::write(), libMesh::ExodusII_IO::write(), libMesh::Nemesis_IO::write(), libMesh::GmshIO::write(), libMesh::XdrIO::write(), libMesh::VTKIO::write(), and libMesh::LegacyXdrIO::write_mgf().

755 {
756  // parallel formats are special -- they may choose to write
757  // separate files, let's not try to handle the zipping here.
758  if (is_parallel_file_format(name))
759  {
760  // no need to handle bz2 files here -- the Xdr class does that.
761  if (name.rfind(".xda") < name.size())
762  XdrIO(*this).write(name);
763 
764  else if (name.rfind(".xdr") < name.size())
765  XdrIO(*this,true).write(name);
766 
767  else if (name.rfind(".nem") < name.size() ||
768  name.rfind(".n") < name.size())
769  Nemesis_IO(*this).write(name);
770  }
771 
772  // serial file formats
773  else
774  {
775  START_LOG("write()", "Mesh");
776 
777  // Nasty hack for reading/writing zipped files
778  std::string new_name = name;
779  processor_id_type pid_0 = 0;
780  if (this->processor_id() == 0)
781  pid_0 = getpid();
782  this->comm().broadcast(pid_0);
783  std::ostringstream pid_suffix;
784  pid_suffix << '_' << pid_0;
785 
786  if (name.size() - name.rfind(".bz2") == 4)
787  {
788  new_name.erase(new_name.end() - 4, new_name.end());
789  new_name += pid_suffix.str();
790  }
791  else if (name.size() - name.rfind(".xz") == 3)
792  {
793  new_name.erase(new_name.end() - 3, new_name.end());
794  new_name += pid_suffix.str();
795  }
796 
797  // New scope so that io will close before we try to zip the file
798  {
799  // Write the file based on extension
800  if (new_name.rfind(".dat") < new_name.size())
801  TecplotIO(*this).write (new_name);
802 
803  else if (new_name.rfind(".plt") < new_name.size())
804  TecplotIO(*this,true).write (new_name);
805 
806  else if (new_name.rfind(".ucd") < new_name.size())
807  UCDIO (*this).write (new_name);
808 
809  else if (new_name.rfind(".gmv") < new_name.size())
810  if (this->n_partitions() > 1)
811  GMVIO(*this).write (new_name);
812  else
813  {
814  GMVIO io(*this);
815  io.partitioning() = false;
816  io.write (new_name);
817  }
818 
819  else if (new_name.rfind(".ugrid") < new_name.size())
820  DivaIO(*this).write(new_name);
821  else if (new_name.rfind(".exd") < new_name.size() ||
822  new_name.rfind(".e") < new_name.size())
823  ExodusII_IO(*this).write(new_name);
824  else if (new_name.rfind(".mgf") < new_name.size())
825  LegacyXdrIO(*this,true).write_mgf(new_name);
826 
827  else if (new_name.rfind(".unv") < new_name.size())
828  {
829  if (mesh_data == NULL)
830  {
831  libMesh::err << "Error! You must pass a "
832  << "valid MeshData pointer to "
833  << "write UNV files!" << std::endl;
834  libmesh_error();
835  }
836  UNVIO(*this, *mesh_data).write (new_name);
837  }
838 
839  else if (new_name.rfind(".mesh") < new_name.size())
840  MEDITIO(*this).write (new_name);
841 
842  else if (new_name.rfind(".poly") < new_name.size())
843  TetGenIO(*this).write (new_name);
844 
845  else if (new_name.rfind(".msh") < new_name.size())
846  GmshIO(*this).write (new_name);
847 
848  else if (new_name.rfind(".fro") < new_name.size())
849  FroIO(*this).write (new_name);
850 
851  else if (new_name.rfind(".vtu") < new_name.size())
852  VTKIO(*this).write (new_name);
853 
854  else
855  {
857  << " ERROR: Unrecognized file extension: " << name
858  << "\n I understand the following:\n\n"
859  << " *.dat -- Tecplot ASCII file\n"
860  << " *.e -- Sandia's ExodusII format\n"
861  << " *.exd -- Sandia's ExodusII format\n"
862  << " *.fro -- ACDL's surface triangulation file\n"
863  << " *.gmv -- LANL's GMV (General Mesh Viewer) format\n"
864  << " *.mesh -- MEdit mesh format\n"
865  << " *.mgf -- MGF binary mesh format\n"
866  << " *.msh -- GMSH ASCII file\n"
867  << " *.n -- Sandia's Nemesis format\n"
868  << " *.nem -- Sandia's Nemesis format\n"
869  << " *.plt -- Tecplot binary file\n"
870  << " *.poly -- TetGen ASCII file\n"
871  << " *.ucd -- AVS's ASCII UCD format\n"
872  << " *.ugrid -- Kelly's DIVA ASCII format\n"
873  << " *.unv -- I-deas Universal format\n"
874  << " *.vtu -- VTK (paraview-readable) format\n"
875  << " *.xda -- libMesh ASCII format\n"
876  << " *.xdr -- libMesh binary format,\n"
877  << std::endl
878  << "\n Exiting without writing output\n";
879  }
880  }
881 
882  // Nasty hack for reading/writing zipped files
883  if (name.size() - name.rfind(".bz2") == 4)
884  {
885  START_LOG("system(bzip2)", "Mesh");
886  if (this->processor_id() == 0)
887  {
888  std::string system_string = "bzip2 -f -c ";
889  system_string += new_name + " > " + name;
890  if (std::system(system_string.c_str()))
891  libmesh_file_error(system_string);
892  std::remove(new_name.c_str());
893  }
894  this->comm().barrier();
895  STOP_LOG("system(bzip2)", "Mesh");
896  }
897  if (name.size() - name.rfind(".xz") == 3)
898  {
899  START_LOG("system(xz)", "Mesh");
900  if (this->processor_id() == 0)
901  {
902  std::string system_string = "xz -f -c ";
903  system_string += new_name + " > " + name;
904  if (std::system(system_string.c_str()))
905  libmesh_file_error(system_string);
906  std::remove(new_name.c_str());
907  }
908  this->comm().barrier();
909  STOP_LOG("system(xz)", "Mesh");
910  }
911 
912  STOP_LOG("write()", "Mesh");
913  }
914 }
void libMesh::UnstructuredMesh::write ( const std::string &  name,
const std::vector< Number > &  values,
const std::vector< std::string > &  variable_names 
)
inherited

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

Definition at line 918 of file unstructured_mesh.C.

References libMesh::err, libMesh::MeshBase::n_subdomains(), libMesh::GMVIO::partitioning(), libMesh::START_LOG(), libMesh::STOP_LOG(), libMesh::TecplotIO::write_nodal_data(), libMesh::VTKIO::write_nodal_data(), and libMesh::GMVIO::write_nodal_data().

921 {
922  START_LOG("write()", "Mesh");
923 
924  // Write the file based on extension
925  if (name.rfind(".dat") < name.size())
926  TecplotIO(*this).write_nodal_data (name, v, vn);
927 
928  else if (name.rfind(".plt") < name.size())
929  TecplotIO(*this,true).write_nodal_data (name, v, vn);
930 
931  else if (name.rfind(".gmv") < name.size())
932  {
933  if (n_subdomains() > 1)
934  GMVIO(*this).write_nodal_data (name, v, vn);
935  else
936  {
937  GMVIO io(*this);
938  io.partitioning() = false;
939  io.write_nodal_data (name, v, vn);
940  }
941  }
942  else if (name.rfind(".pvtu") < name.size())
943  {
944  VTKIO(*this).write_nodal_data (name, v, vn);
945  }
946  else
947  {
949  << " ERROR: Unrecognized file extension: " << name
950  << "\n I understand the following:\n\n"
951  << " *.dat -- Tecplot ASCII file\n"
952  << " *.gmv -- LANL's GMV (General Mesh Viewer) format\n"
953  << " *.plt -- Tecplot binary file\n"
954  << " *.pvtu -- Paraview VTK file\n"
955  << "\n Exiting without writing output\n";
956  }
957 
958  STOP_LOG("write()", "Mesh");
959 }

Member Data Documentation

std::map<subdomain_id_type, std::string> libMesh::MeshBase::_block_id_to_name
protectedinherited

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

Definition at line 924 of file mesh_base.h.

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

unsigned int libMesh::MeshBase::_dim
protectedinherited
std::vector<Elem*> libMesh::SerialMesh::_elements
protected
bool libMesh::MeshBase::_is_prepared
protectedinherited
unsigned int libMesh::MeshBase::_n_parts
protectedinherited

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

Definition at line 871 of file mesh_base.h.

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

AutoPtr<Partitioner> libMesh::MeshBase::_partitioner
protectedinherited

A partitioner to use at each prepare_for_use().

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

Definition at line 898 of file mesh_base.h.

Referenced by libMesh::MeshBase::MeshBase(), libMesh::ParallelMesh::ParallelMesh(), libMesh::MeshBase::partitioner(), and SerialMesh().

AutoPtr<PointLocatorBase> libMesh::MeshBase::_point_locator
mutableprotectedinherited

A PointLocator class for this mesh. This will not actually be built unless needed. Further, since we want our point_locator() method to be const (yet do the dynamic allocating) this needs to be mutable. Since the PointLocatorBase::build() member is used, and it operates on a constant reference to the mesh, this is OK.

Definition at line 890 of file mesh_base.h.

Referenced by libMesh::MeshBase::clear_point_locator(), libMesh::MeshBase::point_locator(), and libMesh::MeshBase::sub_point_locator().

bool libMesh::MeshBase::_skip_partitioning
protectedinherited

If this is true then no partitioning should be done.

Definition at line 910 of file mesh_base.h.

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

bool libMesh::MeshBase::_skip_renumber_nodes_and_elements
protectedinherited

If this is true then renumbering will be kept to a miniumum.

This is set when prepare_for_use() is called.

Definition at line 917 of file mesh_base.h.

Referenced by libMesh::MeshBase::allow_renumbering(), libMesh::MeshBase::prepare_for_use(), renumber_nodes_and_elements(), and libMesh::ParallelMesh::renumber_nodes_and_elements().

AutoPtr<BoundaryInfo> libMesh::MeshBase::boundary_info
inherited

This class holds the boundary information. It can store nodes, edges, and faces with a corresponding id that facilitates setting boundary conditions.

Definition at line 110 of file mesh_base.h.

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


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

Site Created By: libMesh Developers
Last modified: February 07 2014 16:58:02 UTC

Hosted By:
SourceForge.net Logo