BoundaryMesh Class Reference

#include <boundary_mesh.h>

Inheritance diagram for BoundaryMesh:

List of all members.

Public Types

typedef Predicates::multi_predicate Predicate

Public Member Functions

 BoundaryMesh (unsigned int d)
 ~BoundaryMesh ()
virtual AutoPtr< MeshBaseclone () const
virtual void clear ()
virtual bool is_serial () const
template<typename T >
void libmesh_assert_valid_parallel_object_ids (const mapvector< T * > &) const
void libmesh_assert_valid_parallel_ids () const
void libmesh_assert_valid_parallel_flags () const
template<typename T >
unsigned int renumber_dof_objects (mapvector< T * > &)
virtual void renumber_nodes_and_elements ()
virtual void allgather ()
virtual void delete_remote_elements ()
virtual unsigned int n_nodes () const
virtual unsigned int max_node_id () const
virtual void reserve_nodes (const unsigned int)
virtual unsigned int n_elem () const
virtual unsigned int n_active_elem () const
virtual unsigned int max_elem_id () const
virtual void reserve_elem (const unsigned int)
virtual void update_parallel_id_counts ()
unsigned int parallel_n_nodes () const
unsigned int parallel_max_node_id () const
unsigned int parallel_n_elem () const
unsigned int parallel_max_elem_id () const
virtual const Pointpoint (const unsigned int i) const
virtual const Nodenode (const unsigned int i) const
virtual Nodenode (const unsigned int i)
virtual const Nodenode_ptr (const unsigned int i) const
virtual Node *& node_ptr (const unsigned int i)
virtual Elemelem (const unsigned int i) const
virtual Nodeadd_point (const Point &p, const unsigned int id=DofObject::invalid_id, const unsigned int 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 (unsigned int old_id, unsigned int new_id)
virtual Elemadd_elem (Elem *e)
virtual Eleminsert_elem (Elem *e)
virtual void delete_elem (Elem *e)
virtual void renumber_elem (unsigned int old_id, unsigned int new_id)
element_iterator elements_begin ()
const_element_iterator elements_begin () const
element_iterator elements_end ()
const_element_iterator elements_end () const
element_iterator active_elements_begin ()
const_element_iterator active_elements_begin () const
element_iterator active_elements_end ()
const_element_iterator active_elements_end () const
element_iterator ancestor_elements_begin ()
const_element_iterator ancestor_elements_begin () const
element_iterator ancestor_elements_end ()
const_element_iterator ancestor_elements_end () const
element_iterator subactive_elements_begin ()
const_element_iterator subactive_elements_begin () const
element_iterator subactive_elements_end ()
const_element_iterator subactive_elements_end () const
element_iterator not_active_elements_begin ()
const_element_iterator not_active_elements_begin () const
element_iterator not_active_elements_end ()
const_element_iterator not_active_elements_end () const
element_iterator not_ancestor_elements_begin ()
const_element_iterator not_ancestor_elements_begin () const
element_iterator not_ancestor_elements_end ()
const_element_iterator not_ancestor_elements_end () const
element_iterator not_subactive_elements_begin ()
const_element_iterator not_subactive_elements_begin () const
element_iterator not_subactive_elements_end ()
const_element_iterator not_subactive_elements_end () const
element_iterator local_elements_begin ()
const_element_iterator local_elements_begin () const
element_iterator local_elements_end ()
const_element_iterator local_elements_end () const
element_iterator not_local_elements_begin ()
const_element_iterator not_local_elements_begin () const
element_iterator not_local_elements_end ()
const_element_iterator not_local_elements_end () const
element_iterator active_local_elements_begin ()
const_element_iterator active_local_elements_begin () const
element_iterator active_local_elements_end ()
const_element_iterator active_local_elements_end () const
element_iterator active_not_local_elements_begin ()
const_element_iterator active_not_local_elements_begin () const
element_iterator active_not_local_elements_end ()
const_element_iterator active_not_local_elements_end () const
element_iterator level_elements_begin (const unsigned int level)
const_element_iterator level_elements_begin (const unsigned int level) const
element_iterator level_elements_end (const unsigned int level)
const_element_iterator level_elements_end (const unsigned int level) const
element_iterator not_level_elements_begin (const unsigned int level)
const_element_iterator not_level_elements_begin (const unsigned int level) const
element_iterator not_level_elements_end (const unsigned int level)
const_element_iterator not_level_elements_end (const unsigned int level) const
element_iterator local_level_elements_begin (const unsigned int level)
const_element_iterator local_level_elements_begin (const unsigned int level) const
element_iterator local_level_elements_end (const unsigned int level)
const_element_iterator local_level_elements_end (const unsigned int level) const
element_iterator local_not_level_elements_begin (const unsigned int level)
const_element_iterator local_not_level_elements_begin (const unsigned int level) const
element_iterator local_not_level_elements_end (const unsigned int level)
const_element_iterator local_not_level_elements_end (const unsigned int level) const
element_iterator pid_elements_begin (const unsigned int proc_id)
const_element_iterator pid_elements_begin (const unsigned int proc_id) const
element_iterator pid_elements_end (const unsigned int proc_id)
const_element_iterator pid_elements_end (const unsigned int proc_id) const
element_iterator type_elements_begin (const ElemType type)
const_element_iterator type_elements_begin (const ElemType type) const
element_iterator type_elements_end (const ElemType type)
const_element_iterator type_elements_end (const ElemType type) const
element_iterator active_type_elements_begin (const ElemType type)
const_element_iterator active_type_elements_begin (const ElemType type) const
element_iterator active_type_elements_end (const ElemType type)
const_element_iterator active_type_elements_end (const ElemType type) const
element_iterator active_pid_elements_begin (const unsigned int proc_id)
const_element_iterator active_pid_elements_begin (const unsigned int proc_id) const
element_iterator active_pid_elements_end (const unsigned int proc_id)
const_element_iterator active_pid_elements_end (const unsigned int proc_id) const
element_iterator unpartitioned_elements_begin ()
const_element_iterator unpartitioned_elements_begin () const
element_iterator unpartitioned_elements_end ()
const_element_iterator unpartitioned_elements_end () const
element_iterator active_local_subdomain_elements_begin (const unsigned int subdomain_id)
const_element_iterator active_local_subdomain_elements_begin (const unsigned int subdomain_id) const
element_iterator active_local_subdomain_elements_end (const unsigned int subdomain_id)
const_element_iterator active_local_subdomain_elements_end (const unsigned int subdomain_id) const
node_iterator nodes_begin ()
const_node_iterator nodes_begin () const
node_iterator nodes_end ()
const_node_iterator nodes_end () const
node_iterator active_nodes_begin ()
const_node_iterator active_nodes_begin () const
node_iterator active_nodes_end ()
const_node_iterator active_nodes_end () const
node_iterator local_nodes_begin ()
const_node_iterator local_nodes_begin () const
node_iterator local_nodes_end ()
const_node_iterator local_nodes_end () const
node_iterator pid_nodes_begin (const unsigned int proc_id)
const_node_iterator pid_nodes_begin (const unsigned int proc_id) const
node_iterator pid_nodes_end (const unsigned int proc_id)
const_node_iterator pid_nodes_end (const unsigned int 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 unsigned int 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
unsigned int mesh_dimension () const
void set_mesh_dimension (unsigned int d)
unsigned int spatial_dimension () const
unsigned int n_nodes_on_proc (const unsigned int proc) const
unsigned int n_local_nodes () const
unsigned int n_unpartitioned_nodes () const
unsigned int n_elem_on_proc (const unsigned int proc) const
unsigned int n_local_elem () const
unsigned int n_unpartitioned_elem () const
unsigned int n_active_elem_on_proc (const unsigned int proc) const
unsigned int n_active_local_elem () const
unsigned int n_sub_elem () const
unsigned int n_active_sub_elem () const
void prepare_for_use (const bool skip_renumber_nodes_and_elements=false)
void partition (const unsigned int n_parts=libMesh::n_processors())
unsigned int n_subdomains () const
unsigned int n_partitions () const
unsigned int n_processors () const
unsigned int processor_id () const
std::string get_info () const
void print_info (std::ostream &os=std::cout) const
unsigned int recalculate_n_partitions ()
const PointLocatorBasepoint_locator () const
void clear_point_locator ()

Public Attributes

AutoPtr< BoundaryInfoboundary_info

Protected Member Functions

unsigned int & set_n_partitions ()

Protected Attributes

mapvector< Node * > _nodes
mapvector< Elem * > _elements
bool _is_serial
unsigned int _n_nodes
unsigned int _n_elem
unsigned int _max_node_id
unsigned int _max_elem_id
unsigned int _next_free_local_node_id
unsigned int _next_free_local_elem_id
unsigned int _next_free_unpartitioned_node_id
unsigned int _next_free_unpartitioned_elem_id
unsigned int _n_parts
unsigned int _dim
bool _is_prepared
AutoPtr< PointLocatorBase_point_locator
AutoPtr< Partitioner_partitioner

Friends

void MeshTools::Private::fix_broken_node_and_element_numbering (ParallelMesh &)
class Partitioner
class BoundaryInfo
std::ostream & operator<< (std::ostream &os, const MeshBase &m)


Detailed Description

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

Definition at line 41 of file boundary_mesh.h.


Member Typedef Documentation

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

Definition at line 495 of file mesh_base.h.


Constructor & Destructor Documentation

BoundaryMesh::BoundaryMesh ( unsigned int  d  ) 

Constructor. Initializes dimenstion and processor id.

Definition at line 31 of file boundary_mesh.C.

00031                                          :
00032   Mesh(d)
00033 {
00034 }

BoundaryMesh::~BoundaryMesh (  ) 

Destructor.

Definition at line 38 of file boundary_mesh.C.

References ParallelMesh::clear().

00039 {
00040   this->clear();
00041 }


Member Function Documentation

ParallelMesh::const_element_iterator ParallelMesh::active_elements_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 261 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::active_elements_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 46 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::active_elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 688 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::active_elements_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 473 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::active_local_elements_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 340 of file parallel_mesh_iterators.C.

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

00341 {
00342   Predicates::ActiveLocal<const_elem_iterator_imp> p;
00343   return const_element_iterator(_elements.begin(), _elements.end(), p);
00344 }

ParallelMesh::element_iterator ParallelMesh::active_local_elements_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 126 of file parallel_mesh_iterators.C.

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

Referenced by ParallelMesh::n_active_elem().

00127 {
00128   Predicates::ActiveLocal<elem_iterator_imp> p;
00129   return element_iterator(_elements.begin(), _elements.end(), p);
00130 }

ParallelMesh::const_element_iterator ParallelMesh::active_local_elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 768 of file parallel_mesh_iterators.C.

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

00769 {
00770   Predicates::ActiveLocal<const_elem_iterator_imp> p;
00771   return const_element_iterator(_elements.end(), _elements.end(), p);
00772 }

ParallelMesh::element_iterator ParallelMesh::active_local_elements_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 553 of file parallel_mesh_iterators.C.

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

Referenced by ParallelMesh::n_active_elem().

00554 {
00555   Predicates::ActiveLocal<elem_iterator_imp> p;
00556   return element_iterator(_elements.end(), _elements.end(), p);
00557 }

ParallelMesh::const_element_iterator ParallelMesh::active_local_subdomain_elements_begin ( const unsigned int  subdomain_id  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 449 of file parallel_mesh_iterators.C.

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

00450 {
00451   Predicates::ActiveLocalSubdomain<const_elem_iterator_imp> p(subdomain_id);
00452   return const_element_iterator(_elements.begin(), _elements.end(), p);
00453 }

ParallelMesh::element_iterator ParallelMesh::active_local_subdomain_elements_begin ( const unsigned int  subdomain_id  )  [virtual, inherited]

Implements MeshBase.

Definition at line 235 of file parallel_mesh_iterators.C.

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

00236 {
00237   Predicates::ActiveLocalSubdomain<elem_iterator_imp> p(subdomain_id);
00238   return element_iterator(_elements.begin(), _elements.end(), p);
00239 }

ParallelMesh::const_element_iterator ParallelMesh::active_local_subdomain_elements_end ( const unsigned int  subdomain_id  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 876 of file parallel_mesh_iterators.C.

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

00877 {
00878   Predicates::ActiveLocalSubdomain<const_elem_iterator_imp> p(subdomain_id);
00879   return const_element_iterator(_elements.end(), _elements.end(), p);
00880 }

ParallelMesh::element_iterator ParallelMesh::active_local_subdomain_elements_end ( const unsigned int  subdomain_id  )  [virtual, inherited]

Implements MeshBase.

Definition at line 662 of file parallel_mesh_iterators.C.

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

00663 {
00664   Predicates::ActiveLocalSubdomain<elem_iterator_imp> p(subdomain_id);
00665   return element_iterator(_elements.end(), _elements.end(), p);
00666 }

ParallelMesh::const_node_iterator ParallelMesh::active_nodes_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 940 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::node_iterator ParallelMesh::active_nodes_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 900 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_node_iterator ParallelMesh::active_nodes_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 1020 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::node_iterator ParallelMesh::active_nodes_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 980 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::active_not_local_elements_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 350 of file parallel_mesh_iterators.C.

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

00351 {
00352   Predicates::ActiveNotLocal<const_elem_iterator_imp> p;
00353   return const_element_iterator(_elements.begin(), _elements.end(), p);
00354 }

ParallelMesh::element_iterator ParallelMesh::active_not_local_elements_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 136 of file parallel_mesh_iterators.C.

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

00137 {
00138   Predicates::ActiveNotLocal<elem_iterator_imp> p;
00139   return element_iterator(_elements.begin(), _elements.end(), p);
00140 }

ParallelMesh::const_element_iterator ParallelMesh::active_not_local_elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 778 of file parallel_mesh_iterators.C.

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

00779 {
00780   Predicates::ActiveNotLocal<const_elem_iterator_imp> p;
00781   return const_element_iterator(_elements.end(), _elements.end(), p);
00782 }

ParallelMesh::element_iterator ParallelMesh::active_not_local_elements_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 563 of file parallel_mesh_iterators.C.

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

00564 {
00565   Predicates::ActiveNotLocal<elem_iterator_imp> p;
00566   return element_iterator(_elements.end(), _elements.end(), p);
00567 }

ParallelMesh::const_element_iterator ParallelMesh::active_pid_elements_begin ( const unsigned int  proc_id  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 430 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::active_pid_elements_begin ( const unsigned int  proc_id  )  [virtual, inherited]

Implements MeshBase.

Definition at line 216 of file parallel_mesh_iterators.C.

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

Referenced by ParallelMesh::n_active_elem().

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

ParallelMesh::const_element_iterator ParallelMesh::active_pid_elements_end ( const unsigned int  proc_id  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 857 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::active_pid_elements_end ( const unsigned int  proc_id  )  [virtual, inherited]

Implements MeshBase.

Definition at line 643 of file parallel_mesh_iterators.C.

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

Referenced by ParallelMesh::n_active_elem().

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

ParallelMesh::const_element_iterator ParallelMesh::active_type_elements_begin ( const ElemType  type  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 420 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::active_type_elements_begin ( const ElemType  type  )  [virtual, inherited]

Implements MeshBase.

Definition at line 206 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::active_type_elements_end ( const ElemType  type  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 847 of file parallel_mesh_iterators.C.

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

00848 {
00849   Predicates::ActiveType<const_elem_iterator_imp> p(type);
00850   return const_element_iterator(_elements.end(), _elements.end(), p);
00851 }

ParallelMesh::element_iterator ParallelMesh::active_type_elements_end ( const ElemType  type  )  [virtual, inherited]

Implements MeshBase.

Definition at line 633 of file parallel_mesh_iterators.C.

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

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

Elem * ParallelMesh::add_elem ( Elem e  )  [virtual, inherited]

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

Implements MeshBase.

Definition at line 225 of file parallel_mesh.C.

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

Referenced by Nemesis_IO::read(), and BoundaryInfo::sync().

00226 {
00227   // Don't try to add NULLs!
00228   libmesh_assert(e);
00229 
00230   const unsigned int elem_procid = e->processor_id();
00231 
00232   if (!e->valid_id())
00233     {
00234       // Use the unpartitioned ids for unpartitioned elems,
00235       // in serial, and temporarily for ghost elems
00236       unsigned int *next_id = &_next_free_unpartitioned_elem_id;
00237       if (elem_procid == libMesh::processor_id() &&
00238           !this->is_serial())
00239         next_id = &_next_free_local_elem_id;
00240       e->set_id (*next_id);
00241       *next_id += libMesh::n_processors() + 1;
00242     }
00243   else
00244     {
00245       if (_next_free_unpartitioned_elem_id <= e->id())
00246         _next_free_unpartitioned_elem_id += libMesh::n_processors() + 1;
00247       if (_next_free_local_elem_id <= e->id())
00248         _next_free_local_elem_id += libMesh::n_processors() + 1;
00249     }
00250 
00251   // Don't try to overwrite existing elems
00252   libmesh_assert (!_elements[e->id()]);
00253 
00254   _elements[e->id()] = e;
00255 
00256   // Make the cached elem data more accurate
00257   _n_elem++;
00258   _max_elem_id = std::max(_max_elem_id, e->id()+1);
00259   
00260 // Unpartitioned elems should be added on every processor
00261 // And shouldn't be added in the same batch as ghost elems
00262 // But we might be just adding on processor 0 to
00263 // broadcast later
00264 #if 0
00265 #ifdef DEBUG
00266   if (elem_procid == DofObject::invalid_processor_id)
00267     {
00268       unsigned int elem_id = e->id();
00269       Parallel::max(elem_id);
00270       libmesh_assert(elem_id == e->id());
00271     }
00272 #endif
00273 #endif
00274 
00275   return e;
00276 }

Node * ParallelMesh::add_node ( Node n  )  [virtual, inherited]

Add Node n to the end of the vertex array.

Implements MeshBase.

Definition at line 353 of file parallel_mesh.C.

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

Referenced by ParallelMesh::add_point().

00354 {
00355   // Don't try to add NULLs!
00356   libmesh_assert(n);
00357 
00358   const unsigned int node_procid = n->processor_id();
00359 
00360   if (!n->valid_id())
00361     {
00362       // Use the unpartitioned ids for unpartitioned nodes,
00363       // in serial, and temporarily for ghost nodes
00364       unsigned int *next_id = &_next_free_unpartitioned_node_id;
00365       if (node_procid == libMesh::processor_id() &&
00366           !this->is_serial())
00367         next_id = &_next_free_local_node_id;
00368       n->set_id (*next_id);
00369       *next_id += libMesh::n_processors() + 1;
00370     }
00371   else
00372     {
00373       if (_next_free_unpartitioned_node_id <= n->id())
00374         _next_free_unpartitioned_node_id += libMesh::n_processors() + 1;
00375       if (_next_free_local_node_id <= n->id())
00376         _next_free_local_node_id += libMesh::n_processors() + 1;
00377     }
00378 
00379   // Don't try to overwrite existing nodes
00380   libmesh_assert (!_nodes[n->id()]);
00381 
00382   _nodes[n->id()] = n;
00383   
00384   // Make the cached elem data more accurate
00385   _n_nodes++;
00386   _max_node_id = std::max(_max_node_id, n->id()+1);
00387   
00388 // Unpartitioned nodes should be added on every processor
00389 // And shouldn't be added in the same batch as ghost nodes
00390 // But we might be just adding on processor 0 to
00391 // broadcast later
00392 #if 0
00393 #ifdef DEBUG
00394   if (node_procid == DofObject::invalid_processor_id)
00395     {
00396       unsigned int node_id = n->id();
00397       Parallel::max(node_id);
00398       libmesh_assert(node_id == n->id());
00399     }
00400 #endif
00401 #endif
00402 
00403   return n;
00404 }

Node * ParallelMesh::add_point ( const Point p,
const unsigned int  id = DofObject::invalid_id,
const unsigned int  proc_id = DofObject::invalid_processor_id 
) [virtual, inherited]

functions for adding /deleting nodes elements.

Implements MeshBase.

Definition at line 329 of file parallel_mesh.C.

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

Referenced by Nemesis_IO::read(), and BoundaryInfo::sync().

00332 {  
00333   if (_nodes.count(id))
00334     {
00335       Node *n = _nodes[id];
00336       libmesh_assert (n);
00337       libmesh_assert (n->id() == id);
00338       
00339       *n = p;
00340       n->processor_id() = proc_id;
00341 
00342       return n;
00343     }
00344 
00345   Node* n = Node::build(p, id).release();
00346   n->processor_id() = proc_id;
00347 
00348   return ParallelMesh::add_node(n);
00349 }

void UnstructuredMesh::all_first_order (  )  [virtual, inherited]

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

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 MeshBase.

Definition at line 233 of file mesh_modification.C.

References MeshBase::_is_prepared, Elem::add_child(), MeshBase::boundary_info, Elem::build(), Elem::child(), MeshBase::elements_begin(), MeshBase::elements_end(), Elem::first_order_equivalent_type(), Elem::get_node(), Elem::has_children(), DofObject::id(), MeshBase::insert_elem(), Elem::n_children(), Elem::n_sides(), Elem::n_vertices(), Elem::p_level(), Elem::p_refinement_flag(), Elem::parent(), MeshBase::prepare_for_use(), DofObject::processor_id(), Elem::refinement_flag(), MeshBase::renumber_nodes_and_elements(), DofObject::set_id(), Elem::set_node(), Elem::set_p_level(), Elem::set_p_refinement_flag(), Elem::set_parent(), Elem::set_refinement_flag(), Elem::subdomain_id(), and Elem::type().

00234 {
00235   /*
00236    * when the mesh is not prepared,
00237    * at least renumber the nodes and 
00238    * elements, so that the node ids
00239    * are correct
00240    */
00241   if (!this->_is_prepared)
00242     this->renumber_nodes_and_elements ();
00243 
00244   START_LOG("all_first_order()", "Mesh");
00245 
00251   const_element_iterator endit = elements_end();
00252   for (const_element_iterator it = elements_begin();
00253        it != endit; ++it)
00254     {
00255       Elem* so_elem = *it;
00256 
00257       libmesh_assert (so_elem != NULL);
00258 
00259       /*
00260        * build the first-order equivalent, add to
00261        * the new_elements list.
00262        */
00263       Elem *newparent = so_elem->parent();
00264       Elem* lo_elem = Elem::build
00265         (Elem::first_order_equivalent_type
00266           (so_elem->type()), newparent).release();
00267 
00268 #ifdef LIBMESH_ENABLE_AMR
00269       /*
00270        * Add this element to it's parent if it has one
00271        */
00272       if (newparent)
00273         newparent->add_child(lo_elem);
00274 
00275       /*
00276        * Reset the parent links of any child elements
00277        */
00278       if (so_elem->has_children())
00279         {
00280           for (unsigned int c=0; c != so_elem->n_children(); ++c)
00281             so_elem->child(c)->set_parent(lo_elem);
00282         }
00283 
00284       /*
00285        * Copy as much data to the new element as makes sense
00286        */
00287       lo_elem->set_p_level(so_elem->p_level());
00288       lo_elem->set_refinement_flag(so_elem->refinement_flag());
00289       lo_elem->set_p_refinement_flag(so_elem->p_refinement_flag());
00290 #endif
00291 
00292       libmesh_assert (lo_elem->n_vertices() == so_elem->n_vertices());
00293 
00294       /*
00295        * By definition the vertices of the linear and
00296        * second order element are identically numbered.
00297        * transfer these.
00298        */
00299       for (unsigned int v=0; v < so_elem->n_vertices(); v++)
00300         lo_elem->set_node(v) = so_elem->get_node(v);
00301 
00308       libmesh_assert (lo_elem->n_sides() == so_elem->n_sides());
00309         
00310       for (unsigned int s=0; s<so_elem->n_sides(); s++)
00311         {
00312           const short int boundary_id =
00313             this->boundary_info->boundary_id (so_elem, s);
00314             
00315           if (boundary_id != this->boundary_info->invalid_id)
00316             this->boundary_info->add_side (lo_elem, s, boundary_id);
00317         }
00318 
00319       /*
00320        * The new first-order element is ready.
00321        * Inserting it into the mesh will replace and delete
00322        * the second-order element.
00323        */
00324       lo_elem->set_id(so_elem->id());
00325       lo_elem->processor_id() = so_elem->processor_id();
00326       lo_elem->subdomain_id() = so_elem->subdomain_id();
00327       this->insert_elem(lo_elem);
00328     }
00329 
00330   STOP_LOG("all_first_order()", "Mesh");
00331 
00332   // delete or renumber nodes, etc
00333   this->prepare_for_use();
00334 }

void UnstructuredMesh::all_second_order ( const bool  full_ordered = true  )  [virtual, inherited]

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

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

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

Implements MeshBase.

Definition at line 338 of file mesh_modification.C.

References MeshBase::_is_prepared, MeshBase::add_point(), MeshBase::boundary_info, Elem::build(), Elem::default_order(), MeshBase::elements_begin(), MeshBase::elements_end(), libMeshEnums::FIRST, Elem::get_node(), DofObject::id(), MeshBase::insert_elem(), DofObject::invalid_id, MeshBase::is_serial(), Elem::level(), std::max(), MeshBase::mesh_dimension(), MeshBase::n_elem(), MeshBase::n_nodes(), Elem::n_sides(), Elem::n_vertices(), MeshBase::node(), MeshBase::point(), MeshBase::prepare_for_use(), DofObject::processor_id(), MeshBase::processor_id(), MeshBase::renumber_nodes_and_elements(), MeshBase::reserve_nodes(), Elem::second_order_equivalent_type(), Elem::subdomain_id(), and Elem::type().

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

00339 {
00340   // This function must be run on all processors at once
00341   parallel_only();
00342 
00343   /*
00344    * when the mesh is not prepared,
00345    * at least renumber the nodes and 
00346    * elements, so that the node ids
00347    * are correct
00348    */
00349   if (!this->_is_prepared)
00350     this->renumber_nodes_and_elements ();
00351 
00352   /*
00353    * If the mesh is empty
00354    * then we have nothing to do
00355    */
00356   if (!this->n_elem())
00357     return;
00358  
00359   /*
00360    * If the mesh is already second order
00361    * then we have nothing to do.
00362    * We have to test for this in a round-about way to avoid
00363    * a bug on distributed parallel meshes with more processors
00364    * than elements.
00365    */
00366   bool already_second_order = false;
00367   if (this->elements_begin() != this->elements_end() &&
00368       (*(this->elements_begin()))->default_order() != FIRST)
00369     already_second_order = true;
00370   Parallel::max(already_second_order);
00371   if (already_second_order)
00372     return;
00373 
00374   START_LOG("all_second_order()", "Mesh");
00375 
00376   /*
00377    * this map helps in identifying second order
00378    * nodes.  Namely, a second-order node:
00379    * - edge node
00380    * - face node
00381    * - bubble node
00382    * is uniquely defined through a set of adjacent
00383    * vertices.  This set of adjacent vertices is
00384    * used to identify already added higher-order
00385    * nodes.  We are safe to use node id's since we
00386    * make sure that these are correctly numbered.
00387    */
00388   std::map<std::vector<unsigned int>, Node*> adj_vertices_to_so_nodes;
00389 
00390   /*
00391    * for speed-up of the \p add_point() method, we
00392    * can reserve memory.  Guess the number of additional
00393    * nodes for different dimensions
00394    */
00395   switch (this->mesh_dimension())
00396   {
00397     case 1:
00398       /*
00399        * in 1D, there can only be order-increase from Edge2
00400        * to Edge3.  Something like 1/2 of n_nodes() have
00401        * to be added
00402        */
00403       this->reserve_nodes(static_cast<unsigned int>(1.5*this->n_nodes()));
00404       break;
00405 
00406     case 2:
00407       /*
00408        * in 2D, either refine from Tri3 to Tri6 (double the nodes)
00409        * or from Quad4 to Quad8 (again, double) or Quad9 (2.25 that much)
00410        */
00411       this->reserve_nodes(static_cast<unsigned int>(2*this->n_nodes()));
00412       break;
00413 
00414 
00415     case 3:
00416       /*
00417        * in 3D, either refine from Tet4 to Tet10 (factor = 2.5) up to
00418        * Hex8 to Hex27 (something  > 3).  Since in 3D there _are_ already
00419        * quite some nodes, and since we do not want to overburden the memory by
00420        * a too conservative guess, use the lower bound
00421        */
00422       this->reserve_nodes(static_cast<unsigned int>(2.5*this->n_nodes()));
00423       break;
00424         
00425     default:
00426       // Hm?
00427       libmesh_error();
00428   }
00429 
00430 
00431 
00432   /*
00433    * form a vector that will hold the node id's of
00434    * the vertices that are adjacent to the son-th
00435    * second-order node.  Pull this outside of the
00436    * loop so that silly compilers don't repeatedly
00437    * create and destroy the vector.
00438    */
00439   std::vector<unsigned int> adjacent_vertices_ids;
00440 
00447   const_element_iterator endit = elements_end();
00448   for (const_element_iterator it = elements_begin();
00449        it != endit; ++it)
00450     {
00451       // the linear-order element
00452       Elem* lo_elem = *it;
00453 
00454       libmesh_assert (lo_elem != NULL);
00455 
00456       // make sure it is linear order
00457       if (lo_elem->default_order() != FIRST)
00458         {         
00459           std::cerr << "ERROR: This is not a linear element: type=" 
00460                     << lo_elem->type() << std::endl;
00461           libmesh_error();
00462         }
00463 
00464       // this does _not_ work for refined elements
00465       libmesh_assert (lo_elem->level () == 0);
00466 
00467       /*
00468        * build the second-order equivalent, add to
00469        * the new_elements list.  Note that this here
00470        * is the only point where \p full_ordered
00471        * is necessary.  The remaining code works well
00472        * for either type of seconrd-order equivalent, e.g.
00473        * Hex20 or Hex27, as equivalents for Hex8
00474        */
00475       Elem* so_elem = 
00476         Elem::build (Elem::second_order_equivalent_type(lo_elem->type(), 
00477                                                         full_ordered) ).release();
00478 
00479       libmesh_assert (lo_elem->n_vertices() == so_elem->n_vertices());
00480 
00481 
00482       /*
00483        * By definition the vertices of the linear and
00484        * second order element are identically numbered.
00485        * transfer these.
00486        */
00487       for (unsigned int v=0; v < lo_elem->n_vertices(); v++)
00488         so_elem->set_node(v) = lo_elem->get_node(v);
00489 
00490       /*
00491        * Now handle the additional mid-side nodes.  This
00492        * is simply handled through a map that remembers
00493        * the already-added nodes.  This map maps the global
00494        * ids of the vertices (that uniquely define this 
00495        * higher-order node) to the new node. 
00496        * Notation: son = second-order node
00497        */
00498       const unsigned int son_begin = so_elem->n_vertices();
00499       const unsigned int son_end   = so_elem->n_nodes();
00500       
00501 
00502       for (unsigned int son=son_begin; son<son_end; son++)
00503         {
00504           const unsigned int n_adjacent_vertices =
00505             so_elem->n_second_order_adjacent_vertices(son);
00506 
00507           adjacent_vertices_ids.resize(n_adjacent_vertices);
00508           
00509           for (unsigned int v=0; v<n_adjacent_vertices; v++)
00510             adjacent_vertices_ids[v] =
00511               so_elem->node( so_elem->second_order_adjacent_vertex(son,v) );
00512 
00513           /*
00514            * \p adjacent_vertices_ids is now in order of the current
00515            * side.  sort it, so that comparisons  with the 
00516            * \p adjacent_vertices_ids created through other elements' 
00517            * sides can match
00518            */
00519           std::sort(adjacent_vertices_ids.begin(),
00520                     adjacent_vertices_ids.end());
00521 
00522 
00523           // does this set of vertices already has a mid-node added?
00524           std::pair<std::map<std::vector<unsigned int>, Node*>::iterator,
00525                     std::map<std::vector<unsigned int>, Node*>::iterator>           
00526             pos = adj_vertices_to_so_nodes.equal_range (adjacent_vertices_ids);
00527 
00528           // no, not added yet
00529           if (pos.first == pos.second)
00530             {
00531               /*
00532                * for this set of vertices, there is no 
00533                * second_order node yet.  Add it.
00534                *
00535                * compute the location of the new node as
00536                * the average over the adjacent vertices.
00537                */
00538               Point new_location = this->point(adjacent_vertices_ids[0]);
00539               for (unsigned int v=1; v<n_adjacent_vertices; v++)
00540                 new_location += this->point(adjacent_vertices_ids[v]);
00541 
00542               new_location /= static_cast<Real>(n_adjacent_vertices);
00543               
00544               /* Add the new point to the mesh, giving it a globally
00545                * well-defined processor id.
00546                */
00547               Node* so_node = this->add_point
00548                 (new_location, DofObject::invalid_id,
00549                 this->node(adjacent_vertices_ids[0]).processor_id());
00550 
00551               /* 
00552                * insert the new node with its defining vertex
00553                * set into the map, and relocate pos to this
00554                * new entry, so that the so_elem can use
00555                * \p pos for inserting the node
00556                */
00557               adj_vertices_to_so_nodes.insert(pos.first,
00558                                               std::make_pair(adjacent_vertices_ids,
00559                                                              so_node));
00560 
00561               so_elem->set_node(son) = so_node;
00562             }
00563           // yes, already added.
00564           else
00565             {
00566               libmesh_assert (pos.first->second != NULL);
00567               
00568               so_elem->set_node(son) = pos.first->second;
00569             }
00570         }
00571 
00572 
00579       libmesh_assert (lo_elem->n_sides() == so_elem->n_sides());
00580         
00581       for (unsigned int s=0; s<lo_elem->n_sides(); s++)
00582         {
00583           const short int boundary_id =
00584             this->boundary_info->boundary_id (lo_elem, s);
00585             
00586           if (boundary_id != this->boundary_info->invalid_id)
00587             this->boundary_info->add_side (so_elem, s, boundary_id);
00588         }
00589 
00590       /*
00591        * The new second-order element is ready.
00592        * Inserting it into the mesh will replace and delete
00593        * the first-order element.
00594        */
00595       so_elem->set_id(lo_elem->id());
00596       so_elem->processor_id() = lo_elem->processor_id();
00597       so_elem->subdomain_id() = lo_elem->subdomain_id();
00598       this->insert_elem(so_elem);
00599     }
00600 
00601   // we can clear the map
00602   adj_vertices_to_so_nodes.clear();
00603 
00604 
00605   STOP_LOG("all_second_order()", "Mesh");
00606 
00607   // In a ParallelMesh our ghost node processor ids may be bad and
00608   // the ids of nodes touching remote elements may be inconsistent.
00609   // Fix them.
00610   if (!this->is_serial())
00611     {
00612       LocationMap<Node> loc_map;
00613       MeshCommunication().make_nodes_parallel_consistent
00614         (*this, loc_map);
00615     }
00616 
00617   // renumber nodes, elements etc
00618   this->prepare_for_use();
00619 }

void ParallelMesh::allgather (  )  [virtual, inherited]

Gathers all elements and nodes of the mesh onto every processor

Reimplemented from MeshBase.

Definition at line 936 of file parallel_mesh.C.

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

Referenced by ParallelMesh::renumber_dof_objects().

00937 {
00938   if (_is_serial)
00939     return;
00940   _is_serial = true;
00941   MeshCommunication().allgather(*this);
00942 
00943 // Make sure our caches are up to date and our
00944 // DofObjects are well packed
00945 #ifdef DEBUG
00946   libmesh_assert(this->n_nodes() == this->parallel_n_nodes());
00947   libmesh_assert(this->n_elem() == this->parallel_n_elem());
00948   libmesh_assert(this->max_node_id() == this->parallel_max_node_id());
00949   libmesh_assert(this->max_elem_id() == this->parallel_max_elem_id());
00950   libmesh_assert(this->n_nodes() == this->max_node_id());
00951   libmesh_assert(this->n_elem() == this->max_elem_id());
00952 
00953 // Make sure our neighbor links are all fine
00954   MeshTools::libmesh_assert_valid_neighbors(*this);
00955 
00956 // Make sure our ids and flags are consistent
00957   this->libmesh_assert_valid_parallel_ids();
00958   this->libmesh_assert_valid_parallel_flags();
00959 #endif
00960 }

ParallelMesh::const_element_iterator ParallelMesh::ancestor_elements_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 280 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::ancestor_elements_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 66 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::ancestor_elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 708 of file parallel_mesh_iterators.C.

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

00709 {
00710   Predicates::Ancestor<const_elem_iterator_imp> p;
00711   return const_element_iterator(_elements.end(), _elements.end(), p);
00712 }

ParallelMesh::element_iterator ParallelMesh::ancestor_elements_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 493 of file parallel_mesh_iterators.C.

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

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

void ParallelMesh::clear (  )  [virtual, inherited]

Clear all internal data.

Reimplemented from MeshBase.

Definition at line 466 of file parallel_mesh.C.

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

Referenced by BoundaryInfo::sync(), ~BoundaryMesh(), and ParallelMesh::~ParallelMesh().

00467 {
00468   // Call parent clear function
00469   MeshBase::clear();
00470 
00471   
00472   // Clear our elements and nodes
00473   {
00474     elem_iterator_imp        it = _elements.begin();
00475     const elem_iterator_imp end = _elements.end();
00476 
00477     // There is no need to remove the elements from
00478     // the BoundaryInfo data structure since we
00479     // already cleared it.
00480     for (; it != end; ++it)
00481       delete *it;
00482 
00483     _elements.clear();
00484   }
00485 
00486   // clear the nodes data structure
00487   {
00488     node_iterator_imp it  = _nodes.begin();
00489     node_iterator_imp end = _nodes.end();
00490 
00491     // There is no need to remove the nodes from
00492     // the BoundaryInfo data structure since we
00493     // already cleared it.
00494     for (; it != end; ++it)
00495       delete *it;
00496     
00497     _nodes.clear();
00498   }
00499 
00500   // We're no longer distributed if we were before
00501   _is_serial = true;
00502 
00503   // Correct our caches
00504   _n_nodes = 0;
00505   _n_elem = 0;
00506   _max_node_id = 0;
00507   _max_elem_id = 0;
00508   _next_free_local_node_id = libMesh::processor_id();
00509   _next_free_local_elem_id = libMesh::processor_id();
00510   _next_free_unpartitioned_node_id = libMesh::n_processors();
00511   _next_free_unpartitioned_elem_id = libMesh::n_processors();
00512 }

void MeshBase::clear_point_locator (  )  [inherited]

Releases the current PointLocator object.

Definition at line 295 of file mesh_base.C.

References MeshBase::_point_locator, and AutoPtr< Tp >::reset().

Referenced by MeshBase::clear(), and MeshBase::prepare_for_use().

00296 {
00297   _point_locator.reset(NULL);
00298 }

virtual AutoPtr<MeshBase> ParallelMesh::clone (  )  const [inline, virtual, inherited]

Virtual copy-constructor, creates a copy of this mesh

Implements MeshBase.

Definition at line 80 of file parallel_mesh.h.

References ParallelMesh::ParallelMesh().

00081     { return AutoPtr<MeshBase>(new ParallelMesh(*this)); }

bool UnstructuredMesh::contract (  )  [virtual, inherited]

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

Implements MeshBase.

Definition at line 936 of file unstructured_mesh.C.

References Elem::active(), Elem::ancestor(), Elem::contract(), MeshBase::delete_elem(), MeshBase::elem(), MeshBase::elements_begin(), MeshBase::elements_end(), Elem::parent(), MeshBase::renumber_nodes_and_elements(), and Elem::subactive().

00937 {
00938   START_LOG ("contract()", "Mesh");
00939 
00940   // Flag indicating if this call actually changes the mesh
00941   bool mesh_changed = false;
00942 
00943   element_iterator in        = elements_begin();
00944   element_iterator out       = elements_begin();
00945   const element_iterator end = elements_end();
00946 
00947 #ifdef DEBUG
00948   for ( ; in != end; ++in)
00949     if (*in != NULL)
00950       {
00951         Elem* elem = *in;
00952         libmesh_assert(elem->active() || elem->subactive() || elem->ancestor());
00953       }
00954   in = elements_begin();
00955 #endif
00956   
00957   // Loop over the elements.   
00958   for ( ; in != end; ++in)
00959     if (*in != NULL)
00960       {
00961         Elem* elem = *in;
00962 
00963         // Delete all the subactive ones
00964         if (elem->subactive())
00965           {
00966             // No level-0 element should be subactive.
00967             // Note that we CAN'T test elem->level(), as that 
00968             // touches elem->parent()->dim(), and elem->parent()
00969             // might have already been deleted!
00970             libmesh_assert (elem->parent() != NULL);
00971 
00972             // Delete the element
00973             // This just sets a pointer to NULL, and doesn't
00974             // invalidate any iterators
00975             this->delete_elem(elem);
00976             
00977             // the mesh has certainly changed
00978             mesh_changed = true;
00979           }
00980         else
00981           {
00982             // Compress all the active ones
00983             if (elem->active())
00984               elem->contract();
00985             else
00986               libmesh_assert (elem->ancestor());
00987           }
00988       }
00989 
00990   // Strip any newly-created NULL voids out of the element array
00991   this->renumber_nodes_and_elements();
00992 
00993   STOP_LOG ("contract()", "Mesh");
00994   
00995   return mesh_changed;
00996 }

void UnstructuredMesh::copy_nodes_and_elements ( const UnstructuredMesh other_mesh  )  [virtual, inherited]

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

Definition at line 94 of file unstructured_mesh.C.

References MeshBase::_dim, MeshBase::_is_prepared, MeshBase::_n_parts, Elem::add_child(), Elem::build(), MeshBase::elements_begin(), MeshBase::elements_end(), DofObject::id(), MeshBase::n_elem(), MeshBase::n_nodes(), Elem::node(), MeshBase::nodes_begin(), MeshBase::nodes_end(), Elem::p_refinement_flag(), Elem::parent(), DofObject::processor_id(), Elem::refinement_flag(), Elem::type(), and Elem::which_child_am_i().

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

00095 {
00096   // We're assuming our subclass data needs no copy
00097   libmesh_assert(_n_parts == other_mesh._n_parts);
00098   libmesh_assert(_dim == other_mesh._dim);
00099   libmesh_assert(_is_prepared == other_mesh._is_prepared);
00100 
00101   //Copy in Nodes
00102   {
00103     //Preallocate Memory if necessary
00104     this->reserve_nodes(other_mesh.n_nodes());
00105     
00106     const_node_iterator it = other_mesh.nodes_begin();
00107     const_node_iterator end = other_mesh.nodes_end();
00108 
00109     for (; it != end; ++it)
00110       {
00111         Node *oldn = *it;
00112 
00113         // Add new nodes in old node Point locations
00114         Node *newn = this->add_point(*oldn);
00115 
00116         // And start them off in the same subdomain
00117         newn->processor_id() = oldn->processor_id();
00118       }
00119   }
00120   
00121   //Copy in Elements
00122   {
00123     //Preallocate Memory if necessary
00124     this->reserve_elem(other_mesh.n_elem());
00125     
00126     // Loop over the elements
00127     MeshBase::const_element_iterator it = other_mesh.elements_begin();
00128     const MeshBase::const_element_iterator end = other_mesh.elements_end();
00129 
00130     // FIXME: Where do we set element IDs??
00131     for (; it != end; ++it)
00132     {
00133       //Look at the old element
00134       Elem *old = *it;
00135       //Build a new element
00136       Elem *newparent = old->parent() ?
00137           this->elem(old->parent()->id()) : NULL;
00138       AutoPtr<Elem> ap = Elem::build(old->type(), newparent);
00139       Elem * elem = ap.release();
00140 
00141 #ifdef LIBMESH_ENABLE_AMR
00142       //Create the parent's child pointers if necessary
00143       if (newparent)
00144         {
00145           // Make sure we have space for those child pointers
00146           newparent->add_child(elem);
00147 
00148           // We'd better be adding these in the correct order
00149           libmesh_assert (newparent->which_child_am_i(elem) ==
00150                   old->parent()->which_child_am_i(old));
00151         }
00152       
00153       // Copy the refinement flags
00154       elem->set_refinement_flag(old->refinement_flag());
00155       elem->set_p_refinement_flag(old->p_refinement_flag());
00156 #endif // #ifdef LIBMESH_ENABLE_AMR
00157 
00158       //Assign all the nodes
00159       for(unsigned int i=0;i<elem->n_nodes();i++)
00160         elem->set_node(i) = &this->node(old->node(i));
00161       
00162       //Hold onto it
00163       this->add_elem(elem);
00164 
00165       // And start it off in the same subdomain
00166       elem->processor_id() = old->processor_id();
00167     }
00168   }
00169   
00170   //Finally prepare the Mesh for use
00171   this->prepare_for_use();
00172 }

void UnstructuredMesh::create_pid_mesh ( UnstructuredMesh pid_mesh,
const unsigned int  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 809 of file unstructured_mesh.C.

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

00811 {
00812 
00813   // Issue a warning if the number the number of processors
00814   // currently available is less that that requested for
00815   // partitioning.  This is not necessarily an error since
00816   // you may run on one processor and still partition the
00817   // mesh into several partitions.
00818 #ifdef DEBUG
00819   if (this->n_processors() < pid)
00820     {
00821       std::cout << "WARNING:  You are creating a "
00822                 << "mesh for a processor id (="
00823                 << pid
00824                 << ") greater than "
00825                 << "the number of processors available for "
00826                 << "the calculation. (="
00827                 << libMesh::n_processors()
00828                 << ")."
00829                 << std::endl;
00830     }
00831 #endif
00832   
00833   // Create iterators to loop over the list of elements
00834 //   const_active_pid_elem_iterator       it(this->elements_begin(),   pid);
00835 //   const const_active_pid_elem_iterator it_end(this->elements_end(), pid);
00836 
00837   const_element_iterator       it     = this->active_pid_elements_begin(pid);
00838   const const_element_iterator it_end = this->active_pid_elements_end(pid);
00839     
00840   this->create_submesh (pid_mesh, it, it_end);
00841 }

void 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 849 of file unstructured_mesh.C.

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

Referenced by UnstructuredMesh::create_pid_mesh().

00852 {
00853   // Just in case the subdomain_mesh already has some information
00854   // in it, get rid of it.
00855   new_mesh.clear();
00856 
00857   // Fail if (*this == new_mesh), we cannot create a submesh inside ourself!
00858   // This may happen if the user accidently passes the original mesh into
00859   // this function!  We will check this by making sure we did not just
00860   // clear ourself.
00861   libmesh_assert (this->n_nodes() != 0);
00862   libmesh_assert (this->n_elem()  != 0); 
00863 
00864   // How the nodes on this mesh will be renumbered to nodes
00865   // on the new_mesh.  
00866   std::vector<unsigned int> new_node_numbers (this->n_nodes());
00867 
00868   std::fill (new_node_numbers.begin(),
00869              new_node_numbers.end(),
00870              libMesh::invalid_uint);
00871 
00872   
00873   
00874   // the number of nodes on the new mesh, will be incremented
00875   unsigned int n_new_nodes = 0;
00876   unsigned int n_new_elem  = 0;
00877     
00878   for (; it != it_end; ++it)
00879     {
00880       // increment the new element counter
00881       n_new_elem++;
00882         
00883       const Elem* old_elem = *it;
00884 
00885       // Add an equivalent element type to the new_mesh
00886       Elem* new_elem = 
00887         new_mesh.add_elem (Elem::build(old_elem->type()).release());
00888 
00889       libmesh_assert (new_elem != NULL);
00890         
00891       // Loop over the nodes on this element.  
00892       for (unsigned int n=0; n<old_elem->n_nodes(); n++)
00893         {
00894           libmesh_assert (old_elem->node(n) < new_node_numbers.size());
00895 
00896           if (new_node_numbers[old_elem->node(n)] == libMesh::invalid_uint)
00897             {
00898               new_node_numbers[old_elem->node(n)] = n_new_nodes;
00899 
00900               // Add this node to the new mesh
00901               new_mesh.add_point (old_elem->point(n));
00902 
00903               // Increment the new node counter
00904               n_new_nodes++;
00905             }
00906 
00907           // Define this element's connectivity on the new mesh
00908           libmesh_assert (new_node_numbers[old_elem->node(n)] < new_mesh.n_nodes());
00909             
00910           new_elem->set_node(n) = new_mesh.node_ptr (new_node_numbers[old_elem->node(n)]);
00911         }
00912 
00913       // Copy ids for this element
00914       new_elem->subdomain_id() = old_elem->subdomain_id();
00915       new_elem->processor_id() = old_elem->processor_id();
00916       
00917       // Maybe add boundary conditions for this element
00918       for (unsigned int s=0; s<old_elem->n_sides(); s++)
00919         if (old_elem->neighbor(s) == NULL)
00920           if (this->boundary_info->boundary_id (old_elem, s) !=
00921               this->boundary_info->invalid_id)
00922             new_mesh.boundary_info->add_side (new_elem,
00923                                              s,
00924                                              this->boundary_info->boundary_id (old_elem, s));
00925     } // end loop over elements
00926   
00927 
00928   // Prepare the new_mesh for use
00929   new_mesh.prepare_for_use();
00930   
00931 }

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

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

Implements MeshBase.

Definition at line 292 of file parallel_mesh.C.

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

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

00293 {
00294   libmesh_assert (e);
00295 
00296   // Delete the element from the BoundaryInfo object
00297   this->boundary_info->remove(e);
00298 
00299   // But not yet from the container; we might invalidate
00300   // an iterator that way!
00301 
00302   //_elements.erase(e->id());
00303 
00304   // Instead, we set it to NULL for now
00305 
00306   _elements[e->id()] = NULL;
00307   
00308   // delete the element
00309   delete e;
00310 }

void ParallelMesh::delete_node ( Node n  )  [virtual, inherited]

Removes the Node n from the mesh.

Implements MeshBase.

Definition at line 434 of file parallel_mesh.C.

References ParallelMesh::_nodes, MeshBase::boundary_info, mapvector< Val >::erase(), and DofObject::id().

00435 {
00436   libmesh_assert (n != NULL);
00437   libmesh_assert (_nodes[n->id()] != NULL);
00438 
00439   // Delete the node from the BoundaryInfo object
00440   this->boundary_info->remove(n);
00441 
00442   // And from the container
00443   _nodes.erase(n->id());
00444   
00445   // delete the node
00446   delete n;
00447 }

void ParallelMesh::delete_remote_elements (  )  [virtual, inherited]

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

Reimplemented from MeshBase.

Definition at line 902 of file parallel_mesh.C.

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

Referenced by Nemesis_IO::read().

00903 {
00904 #ifdef DEBUG
00905 // Make sure our neighbor links are all fine
00906   MeshTools::libmesh_assert_valid_neighbors(*this);
00907 #endif
00908 
00909   _is_serial = false;
00910   MeshCommunication().delete_remote_elements(*this);
00911 
00912 #ifdef DEBUG
00913 // Make sure our caches are up to date and our
00914 // DofObjects are well packed
00915   libmesh_assert(this->n_nodes() == this->parallel_n_nodes());
00916   libmesh_assert(this->n_elem() == this->parallel_n_elem());
00917   libmesh_assert(this->max_node_id() == this->parallel_max_node_id());
00918   libmesh_assert(this->max_elem_id() == this->parallel_max_elem_id());
00919   libmesh_assert(this->n_nodes() == this->max_node_id());
00920   libmesh_assert(this->n_elem() == this->max_elem_id());
00921 
00922 // Make sure our neighbor links are all fine
00923   MeshTools::libmesh_assert_valid_neighbors(*this);
00924 
00925 // Make sure our ids and flags are consistent
00926   this->libmesh_assert_valid_parallel_ids();
00927   this->libmesh_assert_valid_parallel_flags();
00928 
00929 // And make sure our numbering is still monotonic
00930   MeshTools::libmesh_assert_valid_elem_ids(*this);
00931 #endif
00932 }

Elem * ParallelMesh::elem ( const unsigned int  i  )  const [virtual, inherited]

Return a pointer to the $ i^{th} $ element.

Implements MeshBase.

Definition at line 214 of file parallel_mesh.C.

References ParallelMesh::_elements.

Referenced by ParallelMesh::libmesh_assert_valid_parallel_flags(), ParallelMesh::renumber_elem(), and ParallelMesh::renumber_nodes_and_elements().

00215 {
00216 //  libmesh_assert (_elements[i] != NULL);
00217   libmesh_assert (_elements[i] == NULL || _elements[i]->id() == i);
00218   
00219   return _elements[i];
00220 }

ParallelMesh::const_element_iterator ParallelMesh::elements_begin (  )  const [virtual, inherited]

const Elem iterator accessor functions.

Implements MeshBase.

Definition at line 251 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::elements_begin (  )  [virtual, inherited]

Elem iterator accessor functions.

Implements MeshBase.

Definition at line 36 of file parallel_mesh_iterators.C.

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

Referenced by ParallelMesh::renumber_nodes_and_elements().

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

ParallelMesh::const_element_iterator ParallelMesh::elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 678 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::elements_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 463 of file parallel_mesh_iterators.C.

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

Referenced by ParallelMesh::renumber_nodes_and_elements().

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

void UnstructuredMesh::find_neighbors ( const bool  reset_remote_elements = false,
const bool  reset_current_list = true 
) [virtual, inherited]

Other functions from MeshBase requiring re-definition.

Here we look at all of the child elements.

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 be out of date - 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 MeshBase.

Definition at line 185 of file unstructured_mesh.C.

References MeshBase::_dim, Elem::active(), Elem::ancestor(), Elem::centroid(), Elem::child(), MeshBase::elem(), MeshBase::elements_begin(), MeshBase::elements_end(), Elem::has_children(), Elem::hmin(), DofObject::id(), Elem::key(), Elem::level(), MeshBase::level_elements_begin(), MeshBase::level_elements_end(), MeshTools::libmesh_assert_valid_neighbors(), Elem::n_children(), MeshTools::n_levels(), Elem::n_neighbors(), Elem::neighbor(), Elem::parent(), MeshBase::processor_id(), DofObject::processor_id(), remote_elem, Elem::set_neighbor(), Elem::side(), and Elem::subactive().

Referenced by MeshCommunication::allgather().

00187 {
00188   // We might actually want to run this on an empty mesh
00189   // (e.g. the boundary mesh for a nonexistant bcid!)
00190   // libmesh_assert(this->n_nodes() != 0);
00191   // libmesh_assert(this->n_elem()  != 0);
00192 
00193   // This function must be run on all processors at once
00194   parallel_only();
00195 
00196   START_LOG("find_neighbors()", "Mesh");
00197   
00198   
00199   const element_iterator el_end = this->elements_end();
00200       
00201   //TODO:[BSK] This should be removed later?!
00202   if (reset_current_list)
00203     for (element_iterator el = this->elements_begin(); el != el_end; ++el)
00204       {
00205         Elem* elem = *el;
00206         for (unsigned int s=0; s<elem->n_neighbors(); s++)
00207           if (elem->neighbor(s) != remote_elem ||
00208               reset_remote_elements)
00209             elem->set_neighbor(s,NULL);
00210       }
00211   
00212   // Find neighboring elements by first finding elements
00213   // with identical side keys and then check to see if they
00214   // are neighbors
00215   {
00216     // data structures -- Use the hash_multimap if available
00217     typedef unsigned int                    key_type;
00218     typedef std::pair<Elem*, unsigned char> val_type;
00219     typedef std::pair<key_type, val_type>   key_val_pair;
00220     
00221 #if   defined(LIBMESH_HAVE_UNORDERED_MAP)
00222     typedef std::unordered_multimap<key_type, val_type> map_type;    
00223 #elif defined(LIBMESH_HAVE_TR1_UNORDERED_MAP)
00224     typedef std::tr1::unordered_multimap<key_type, val_type> map_type;    
00225 #elif defined(LIBMESH_HAVE_HASH_MAP)    
00226     typedef std::hash_multimap<key_type, val_type> map_type;    
00227 #elif defined(LIBMESH_HAVE_EXT_HASH_MAP)
00228 # if    (__GNUC__ == 3) && (__GNUC_MINOR__ == 0) // gcc 3.0   
00229     typedef std::hash_multimap<key_type, val_type> map_type;
00230 # elif (__GNUC__ >= 3)                          // gcc 3.1 & newer
00231     typedef __gnu_cxx::hash_multimap<key_type, val_type> map_type;
00232 # else
00233 // XLC and who knows what other compilers get here.
00234 // Try the most standard thing we can:
00235     typedef std::multimap<key_type, val_type>  map_type;
00236 # endif
00237 #else
00238     typedef std::multimap<key_type, val_type>  map_type;
00239 #endif
00240     
00241     // A map from side keys to corresponding elements & side numbers  
00242     map_type side_to_elem_map;
00243   
00244 
00245 
00246     for (element_iterator el = this->elements_begin(); el != el_end; ++el)
00247       {
00248         Elem* element = *el;
00249 
00250         for (unsigned int ms=0; ms<element->n_neighbors(); ms++)
00251           {
00252           next_side:
00253             // If we haven't yet found a neighbor on this side, try.
00254             // Even if we think our neighbor is remote, that
00255             // information may be out of date.
00256             if (element->neighbor(ms) == NULL ||
00257                 element->neighbor(ms) == remote_elem)
00258               {
00259                 // Get the key for the side of this element
00260                 const unsigned int key = element->key(ms);
00261                 
00262                 // Look for elements that have an identical side key
00263                 std::pair <map_type::iterator, map_type::iterator>
00264                   bounds = side_to_elem_map.equal_range(key);
00265                 
00266                 // May be multiple keys, check all the possible
00267                 // elements which _might_ be neighbors.
00268                 if (bounds.first != bounds.second)
00269                   {
00270                     // Get the side for this element
00271                     const AutoPtr<DofObject> my_side(element->side(ms));
00272 
00273                     // Look at all the entries with an equivalent key
00274                     while (bounds.first != bounds.second)
00275                       {
00276                         // Get the potential element
00277                         Elem* neighbor = bounds.first->second.first;
00278                         
00279                         // Get the side for the neighboring element
00280                         const unsigned int ns = bounds.first->second.second;
00281                         const AutoPtr<DofObject> their_side(neighbor->side(ns));
00282                         //libmesh_assert (my_side.get() != NULL);
00283                         //libmesh_assert (their_side.get() != NULL);                    
00284 
00285                         // If found a match with my side
00286                         //
00287                         // We need special tests here for 1D:
00288                         // since parents and children have an equal
00289                         // side (i.e. a node), we need to check 
00290                         // ns != ms, and we also check level() to
00291                         // avoid setting our neighbor pointer to
00292                         // any of our neighbor's descendants
00293                         if( (*my_side == *their_side) && 
00294                             (element->level() == neighbor->level()) &&
00295                             ((_dim != 1) || (ns != ms)) )
00296                           {
00297                             // So share a side.  Is this a mixed pair
00298                             // of subactive and active/ancestor
00299                             // elements?
00300                             // If not, then we're neighbors.
00301                             // If so, then the subactive's neighbor is 
00302 
00303                               if (element->subactive() ==
00304                                   neighbor->subactive())
00305                               {
00306                               // an element is only subactive if it has
00307                               // been coarsened but not deleted
00308                                 element->set_neighbor (ms,neighbor);
00309                                 neighbor->set_neighbor(ns,element);
00310                               }
00311                               else if (element->subactive())
00312                               {
00313                                 element->set_neighbor(ms,neighbor);
00314                               }
00315                               else if (neighbor->subactive())
00316                               {
00317                                 neighbor->set_neighbor(ns,element);
00318                               }
00319                               side_to_elem_map.erase (bounds.first);
00320 
00321                               // get out of this nested crap
00322                               goto next_side; 
00323                           }
00324 
00325                         ++bounds.first;
00326                       }
00327                   }
00328                     
00329                 // didn't find a match...
00330                 // Build the map entry for this element
00331                 key_val_pair kvp;
00332                 
00333                 kvp.first         = key;
00334                 kvp.second.first  = element;
00335                 kvp.second.second = ms;
00336                 
00337                 // use the lower bound as a hint for
00338                 // where to put it.
00339 #if defined(LIBMESH_HAVE_UNORDERED_MAP) || defined(LIBMESH_HAVE_TR1_UNORDERED_MAP) || defined(LIBMESH_HAVE_HASH_MAP) || defined(LIBMESH_HAVE_EXT_HASH_MAP)
00340                 side_to_elem_map.insert (kvp);
00341 #else
00342                 side_to_elem_map.insert (bounds.first,kvp);
00343 #endif
00344               }
00345           }
00346       }
00347   }
00348 
00349   
00350   
00351 #ifdef LIBMESH_ENABLE_AMR
00352 
00371   const unsigned int n_levels = MeshTools::n_levels(*this);
00372   for (unsigned int level = 1; level < n_levels; ++level)
00373     {
00374       element_iterator end = this->level_elements_end(level);
00375       for (element_iterator el = this->level_elements_begin(level);
00376            el != end; ++el)
00377         {
00378           Elem* elem = *el;
00379           libmesh_assert(elem);
00380           libmesh_assert(elem->parent());
00381 
00382           for (unsigned int s=0; s < elem->n_neighbors(); s++)
00383             if (elem->neighbor(s) == NULL)
00384 // This currently leads to an infinite loop in ex10?
00385 //            if (elem->neighbor(s) == NULL ||
00386 //              (elem->neighbor(s) == remote_elem &&
00387 //               parent->is_child_on_side(parent->which_child_am_i(elem), s)))
00388             {       
00389               Elem *neigh = elem->parent()->neighbor(s);
00390 
00391               // If neigh was refined and had non-subactive children
00392               // made remote earlier, then a non-subactive elem should
00393               // actually have one of those remote children as a
00394               // neighbor
00395               if (neigh && (neigh->ancestor()) && (!elem->subactive()))
00396                 {
00397 #ifdef DEBUG        
00398                   // Let's make sure that "had children made remote"
00399                   // situation is actually the case
00400                   libmesh_assert(neigh->has_children());
00401                   bool neigh_has_remote_children = false;
00402                   for (unsigned int c = 0; c != neigh->n_children(); ++c)
00403                     {
00404                       if (neigh->child(c) == remote_elem)
00405                         neigh_has_remote_children = true;
00406                     }
00407                   libmesh_assert(neigh_has_remote_children);
00408 
00409                   // And let's double-check that we don't have
00410                   // a remote_elem neighboring a local element
00411                   libmesh_assert(elem->processor_id() !=
00412                                  libMesh::processor_id());
00413 #endif // DEBUG
00414                   neigh = const_cast<RemoteElem*>(remote_elem);
00415                 }
00416 
00417               elem->set_neighbor(s, neigh);
00418 #ifdef DEBUG        
00419               if (neigh != NULL && neigh != remote_elem)
00420                 // We ignore subactive elements here because
00421                 // we don't care about neighbors of subactive element.
00422                 if ((!neigh->active()) && (!elem->subactive()))
00423                 {
00424                   std::cerr << "On processor " << libMesh::processor_id() 
00425                             << std::endl;
00426                   std::cerr << "Bad element ID = " << elem->id() 
00427                     << ", Side " << s << ", Bad neighbor ID = " << neigh->id() << std::endl;
00428                   std::cerr << "Bad element proc_ID = " << elem->processor_id() 
00429                     << ", Bad neighbor proc_ID = " << neigh->processor_id() << std::endl;
00430                   std::cerr << "Bad element size = " << elem->hmin() 
00431                     << ", Bad neighbor size = " << neigh->hmin() << std::endl;
00432                   std::cerr << "Bad element center = " << elem->centroid() 
00433                     << ", Bad neighbor center = " << neigh->centroid() << std::endl;
00434                   std::cerr << "ERROR: " 
00435                     << (elem->active()?"Active":"Ancestor")
00436                     << " Element at level "
00437                     << elem->level() << std::endl;
00438                   std::cerr << "with "
00439                     << (elem->parent()->active()?"active":
00440                         (elem->parent()->subactive()?"subactive":"ancestor"))
00441                     << " parent share "
00442                     << (neigh->subactive()?"subactive":"ancestor")
00443                     << " neighbor at level " << neigh->level()
00444                     << std::endl;
00445                   GMVIO(*this).write ("bad_mesh.gmv");
00446                   libmesh_error();
00447                 }
00448 #endif // DEBUG
00449             }
00450         }
00451     }
00452   
00453 #endif // AMR
00454 
00455 #ifdef DEBUG
00456 MeshTools::libmesh_assert_valid_neighbors(*this);
00457 #endif
00458 
00459   STOP_LOG("find_neighbors()", "Mesh");
00460 }

std::string MeshBase::get_info (  )  const [inherited]

Returns:
a string containing relevant information about the mesh.

Definition at line 221 of file mesh_base.C.

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

Referenced by MeshBase::print_info().

00222 {
00223   std::ostringstream out;
00224 
00225   out << " Mesh Information:"                                  << '\n'
00226       << "  mesh_dimension()="    << this->mesh_dimension()    << '\n'
00227       << "  spatial_dimension()=" << this->spatial_dimension() << '\n'
00228       << "  n_nodes()="           << this->n_nodes()           << '\n'
00229       << "    n_local_nodes()="   << this->n_local_nodes()     << '\n'
00230       << "  n_elem()="            << this->n_elem()            << '\n'
00231       << "    n_local_elem()="    << this->n_local_elem()      << '\n'
00232 #ifdef LIBMESH_ENABLE_AMR
00233       << "    n_active_elem()="   << this->n_active_elem()     << '\n'
00234 #endif
00235       << "  n_subdomains()="      << this->n_subdomains()      << '\n'
00236       << "  n_processors()="      << this->n_processors()      << '\n'
00237       << "  processor_id()="      << this->processor_id()      << '\n';
00238 
00239   return out.str();
00240 }

Elem * ParallelMesh::insert_elem ( Elem e  )  [virtual, inherited]

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

Implements MeshBase.

Definition at line 280 of file parallel_mesh.C.

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

00281 {
00282   if (_elements[e->id()])
00283     this->delete_elem(_elements[e->id()]);
00284 
00285   _elements[e->id()] = e;
00286 
00287   return e;
00288 }

Node * ParallelMesh::insert_node ( Node n  )  [virtual, inherited]

Definition at line 408 of file parallel_mesh.C.

References ParallelMesh::_nodes, and DofObject::id().

00409 {
00410   // If we already have this node we cannot
00411   // simply delete it, because we may have elements
00412   // which are attached to its address.
00413   //
00414   // Instead, call the Node = Point assignment operator
00415   // to overwrite the spatial coordinates (but keep its
00416   // address), delete the provided node, and return the
00417   // address of the one we already had.
00418   if (_nodes.count(n->id()))
00419     {
00420       Node *my_n = _nodes[n->id()];
00421 
00422       *my_n = static_cast<Point>(*n);
00423       delete n;
00424       n = my_n;
00425     }
00426   else
00427     _nodes[n->id()] = n;
00428 
00429   return n;
00430 }

bool MeshBase::is_prepared (  )  const [inline, inherited]

Returns:
true if the mesh has been prepared via a call to prepare_for_use, false otherwise.

Definition at line 114 of file mesh_base.h.

References MeshBase::_is_prepared.

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

00115   { return _is_prepared; }

virtual bool ParallelMesh::is_serial (  )  const [inline, virtual, inherited]

Returns:
true if all elements and nodes of the mesh exist on the current processor, false otherwise

Reimplemented from MeshBase.

Definition at line 97 of file parallel_mesh.h.

References ParallelMesh::_is_serial.

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

00098     { return _is_serial; }

ParallelMesh::const_element_iterator ParallelMesh::level_elements_begin ( const unsigned int  level  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 360 of file parallel_mesh_iterators.C.

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

00361 {
00362   Predicates::Level<const_elem_iterator_imp> p(level);
00363   return const_element_iterator(_elements.begin(), _elements.end(), p);
00364 }

ParallelMesh::element_iterator ParallelMesh::level_elements_begin ( const unsigned int  level  )  [virtual, inherited]

Implements MeshBase.

Definition at line 146 of file parallel_mesh_iterators.C.

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

Referenced by MeshCommunication::delete_remote_elements().

00147 {
00148   Predicates::Level<elem_iterator_imp> p(level);
00149   return element_iterator(_elements.begin(), _elements.end(), p);
00150 }

ParallelMesh::const_element_iterator ParallelMesh::level_elements_end ( const unsigned int  level  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 788 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::level_elements_end ( const unsigned int  level  )  [virtual, inherited]

Implements MeshBase.

Definition at line 573 of file parallel_mesh_iterators.C.

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

Referenced by MeshCommunication::delete_remote_elements().

00574 {
00575   Predicates::Level<elem_iterator_imp> p(level);
00576   return element_iterator(_elements.end(), _elements.end(), p);
00577 }

void ParallelMesh::libmesh_assert_valid_parallel_flags (  )  const [inherited]

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

Definition at line 562 of file parallel_mesh.C.

References ParallelMesh::_elements, ParallelMesh::elem(), libMesh::invalid_uint, std::min(), Elem::p_refinement_flag(), ParallelMesh::parallel_max_elem_id(), and Elem::refinement_flag().

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

00563 {
00564 #ifdef LIBMESH_ENABLE_AMR
00565   // This function must be run on all processors at once
00566   parallel_only();
00567 
00568   unsigned int pmax_elem_id = this->parallel_max_elem_id();
00569 
00570   for (unsigned int i=0; i != pmax_elem_id; ++i)
00571     {
00572       Elem* elem = _elements[i]; // Returns NULL if there's no map entry
00573 
00574       unsigned int refinement_flag   = elem ?
00575         static_cast<unsigned int> (elem->refinement_flag()) : libMesh::invalid_uint;
00576       unsigned int p_refinement_flag = elem ?
00577         static_cast<unsigned int> (elem->p_refinement_flag()) : libMesh::invalid_uint;
00578 
00579       unsigned int min_rflag = refinement_flag;
00580       Parallel::min(min_rflag);
00581       // All processors with this element should agree on flag
00582       libmesh_assert (!elem || min_rflag == refinement_flag);
00583 
00584       unsigned int min_pflag = p_refinement_flag;
00585       // All processors with this element should agree on flag
00586       libmesh_assert (!elem || min_pflag == p_refinement_flag);
00587     }
00588 #endif // LIBMESH_ENABLE_AMR
00589 }

void ParallelMesh::libmesh_assert_valid_parallel_ids (  )  const [inherited]

template<typename T >
void ParallelMesh::libmesh_assert_valid_parallel_object_ids ( const mapvector< T * > &  objects  )  const [inline, inherited]

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

Definition at line 519 of file parallel_mesh.C.

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

Referenced by ParallelMesh::libmesh_assert_valid_parallel_ids().

00520 {
00521   // This function must be run on all processors at once
00522   parallel_only();
00523 
00524   unsigned int pmax_elem_id = this->parallel_max_elem_id();
00525 
00526   for (unsigned int i=0; i != pmax_elem_id; ++i)
00527     {
00528       T* obj = objects[i]; // Returns NULL if there's no map entry
00529 
00530       unsigned int dofid = obj && obj->valid_id() ?
00531         obj->id() : DofObject::invalid_id;
00532       // Local lookups by id should return the requested object
00533       libmesh_assert(!obj || obj->id() == i);
00534 
00535       unsigned int min_dofid = dofid;
00536       Parallel::min(min_dofid);
00537       // All processors with an object should agree on id
00538       libmesh_assert (!obj || dofid == min_dofid);
00539 
00540       unsigned int procid = obj && obj->valid_processor_id() ?
00541         obj->processor_id() : DofObject::invalid_processor_id;
00542 
00543       unsigned int min_procid = procid;
00544       Parallel::min(min_procid);
00545       // All processors with an object should agree on processor id
00546       libmesh_assert (!obj || procid == min_procid);
00547       // I should own any object another processor thinks I do
00548       libmesh_assert (min_procid != libMesh::processor_id() || obj);
00549     }
00550 }

ParallelMesh::const_element_iterator ParallelMesh::local_elements_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 320 of file parallel_mesh_iterators.C.

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

00321 {
00322   Predicates::Local<const_elem_iterator_imp> p;
00323   return const_element_iterator(_elements.begin(), _elements.end(), p);
00324 }

ParallelMesh::element_iterator ParallelMesh::local_elements_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 106 of file parallel_mesh_iterators.C.

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

Referenced by MeshCommunication::delete_remote_elements().

00107 {
00108   Predicates::Local<elem_iterator_imp> p;
00109   return element_iterator(_elements.begin(), _elements.end(), p);
00110 }

ParallelMesh::const_element_iterator ParallelMesh::local_elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 748 of file parallel_mesh_iterators.C.

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

00749 {
00750   Predicates::Local<const_elem_iterator_imp> p;
00751   return const_element_iterator(_elements.end(), _elements.end(), p);
00752 }

ParallelMesh::element_iterator ParallelMesh::local_elements_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 533 of file parallel_mesh_iterators.C.

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

Referenced by MeshCommunication::delete_remote_elements().

00534 {
00535   Predicates::Local<elem_iterator_imp> p;
00536   return element_iterator(_elements.end(), _elements.end(), p);
00537 }

ParallelMesh::const_element_iterator ParallelMesh::local_level_elements_begin ( const unsigned int  level  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 380 of file parallel_mesh_iterators.C.

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

00381 {
00382   Predicates::LocalLevel<const_elem_iterator_imp> p(level);
00383   return const_element_iterator(_elements.begin(), _elements.end(), p);
00384 }

ParallelMesh::element_iterator ParallelMesh::local_level_elements_begin ( const unsigned int  level  )  [virtual, inherited]

Implements MeshBase.

Definition at line 166 of file parallel_mesh_iterators.C.

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

00167 {
00168   Predicates::LocalLevel<elem_iterator_imp> p(level);
00169   return element_iterator(_elements.begin(), _elements.end(), p);
00170 }

ParallelMesh::const_element_iterator ParallelMesh::local_level_elements_end ( const unsigned int  level  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 808 of file parallel_mesh_iterators.C.

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

00809 {
00810   Predicates::LocalLevel<const_elem_iterator_imp> p(level);
00811   return const_element_iterator(_elements.end(), _elements.end(), p);
00812 }

ParallelMesh::element_iterator ParallelMesh::local_level_elements_end ( const unsigned int  level  )  [virtual, inherited]

Implements MeshBase.

Definition at line 593 of file parallel_mesh_iterators.C.

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

00594 {
00595   Predicates::LocalLevel<elem_iterator_imp> p(level);
00596   return element_iterator(_elements.end(), _elements.end(), p);
00597 }

ParallelMesh::const_node_iterator ParallelMesh::local_nodes_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 950 of file parallel_mesh_iterators.C.

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

00951 {
00952   Predicates::Local<const_node_iterator_imp> p;
00953   return const_node_iterator(_nodes.begin(), _nodes.end(), p);
00954 }

ParallelMesh::node_iterator ParallelMesh::local_nodes_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 910 of file parallel_mesh_iterators.C.

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

00911 {
00912   Predicates::Local<node_iterator_imp> p;
00913   return node_iterator(_nodes.begin(), _nodes.end(), p);
00914 }

ParallelMesh::const_node_iterator ParallelMesh::local_nodes_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 1030 of file parallel_mesh_iterators.C.

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

01031 {
01032   Predicates::Local<const_node_iterator_imp> p;
01033   return const_node_iterator(_nodes.end(), _nodes.end(), p);
01034 }

ParallelMesh::node_iterator ParallelMesh::local_nodes_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 990 of file parallel_mesh_iterators.C.

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

00991 {
00992   Predicates::Local<node_iterator_imp> p;
00993   return node_iterator(_nodes.end(), _nodes.end(), p);
00994 }

ParallelMesh::const_element_iterator ParallelMesh::local_not_level_elements_begin ( const unsigned int  level  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 390 of file parallel_mesh_iterators.C.

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

00391 {
00392   Predicates::LocalNotLevel<const_elem_iterator_imp> p(level);
00393   return const_element_iterator(_elements.begin(), _elements.end(), p);
00394 }

ParallelMesh::element_iterator ParallelMesh::local_not_level_elements_begin ( const unsigned int  level  )  [virtual, inherited]

Implements MeshBase.

Definition at line 176 of file parallel_mesh_iterators.C.

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

00177 {
00178   Predicates::LocalNotLevel<elem_iterator_imp> p(level);
00179   return element_iterator(_elements.begin(), _elements.end(), p);
00180 }

ParallelMesh::const_element_iterator ParallelMesh::local_not_level_elements_end ( const unsigned int  level  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 818 of file parallel_mesh_iterators.C.

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

00819 {
00820   Predicates::LocalNotLevel<const_elem_iterator_imp> p(level);
00821   return const_element_iterator(_elements.end(), _elements.end(), p);
00822 }

ParallelMesh::element_iterator ParallelMesh::local_not_level_elements_end ( const unsigned int  level  )  [virtual, inherited]

Implements MeshBase.

Definition at line 603 of file parallel_mesh_iterators.C.

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

00604 {
00605   Predicates::LocalNotLevel<elem_iterator_imp> p(level);
00606   return element_iterator(_elements.end(), _elements.end(), p);
00607 }

virtual unsigned int ParallelMesh::max_elem_id (  )  const [inline, virtual, inherited]

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

Implements MeshBase.

Definition at line 156 of file parallel_mesh.h.

References ParallelMesh::_max_elem_id.

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

00156 { return _max_elem_id; }

virtual unsigned int ParallelMesh::max_node_id (  )  const [inline, virtual, inherited]

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

Implements MeshBase.

Definition at line 152 of file parallel_mesh.h.

References ParallelMesh::_max_node_id.

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

00152 { return _max_node_id; }

unsigned int MeshBase::mesh_dimension (  )  const [inline, inherited]

unsigned int ParallelMesh::n_active_elem (  )  const [virtual, inherited]

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

Implements MeshBase.

Definition at line 881 of file parallel_mesh.C.

References ParallelMesh::active_local_elements_begin(), ParallelMesh::active_local_elements_end(), ParallelMesh::active_pid_elements_begin(), ParallelMesh::active_pid_elements_end(), and DofObject::invalid_processor_id.

00882 {
00883   parallel_only();
00884 
00885   // Get local active elements first
00886   unsigned int active_elements =
00887     static_cast<unsigned int>(std::distance (this->active_local_elements_begin(),
00888                                              this->active_local_elements_end()));
00889   Parallel::sum(active_elements);
00890 
00891   // Then add unpartitioned active elements, which should exist on
00892   // every processor
00893   active_elements +=
00894     static_cast<unsigned int>(std::distance
00895       (this->active_pid_elements_begin(DofObject::invalid_processor_id),
00896        this->active_pid_elements_end(DofObject::invalid_processor_id)));
00897   return active_elements;
00898 }

unsigned int MeshBase::n_active_elem_on_proc ( const unsigned int  proc  )  const [inherited]

Returns the number of active elements on processor proc.

Definition at line 182 of file mesh_base.C.

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

Referenced by MeshBase::n_active_local_elem().

00183 {
00184   libmesh_assert (proc_id < libMesh::n_processors());
00185   return static_cast<unsigned int>(std::distance (this->active_pid_elements_begin(proc_id),
00186                                                   this->active_pid_elements_end  (proc_id)));
00187 }

unsigned int MeshBase::n_active_local_elem (  )  const [inline, inherited]

Returns the number of active elements on the local processor.

Definition at line 253 of file mesh_base.h.

References MeshBase::n_active_elem_on_proc(), and libMesh::processor_id().

Referenced by ParmetisPartitioner::assign_partitioning(), ParmetisPartitioner::build_graph(), and ParmetisPartitioner::initialize().

00254   { return this->n_active_elem_on_proc (libMesh::processor_id()); }

unsigned int MeshBase::n_active_sub_elem (  )  const [inherited]

Same, but only counts active elements.

Definition at line 206 of file mesh_base.C.

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

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

00207 {
00208   unsigned int ne=0;
00209 
00210   const_element_iterator       el  = this->active_elements_begin();
00211   const const_element_iterator end = this->active_elements_end(); 
00212 
00213   for (; el!=end; ++el)
00214     ne += (*el)->n_sub_elem(); 
00215 
00216   return ne;
00217 }

virtual unsigned int ParallelMesh::n_elem (  )  const [inline, virtual, inherited]

Returns the number of elements in the mesh.

Implements MeshBase.

Definition at line 154 of file parallel_mesh.h.

References ParallelMesh::_n_elem.

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

00154 { return _n_elem; }

unsigned int MeshBase::n_elem_on_proc ( const unsigned int  proc  )  const [inherited]

Returns the number of elements on processor proc.

Definition at line 169 of file mesh_base.C.

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

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

00170 {
00171   // We're either counting a processor's elements or unpartitioned
00172   // elements
00173   libmesh_assert (proc_id < libMesh::n_processors() ||
00174           proc_id == DofObject::invalid_processor_id);
00175   
00176   return static_cast<unsigned int>(std::distance (this->pid_elements_begin(proc_id),
00177                                                   this->pid_elements_end  (proc_id)));
00178 }

unsigned int MeshBase::n_local_elem (  )  const [inline, inherited]

Returns the number of elements on the local processor.

Definition at line 236 of file mesh_base.h.

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

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

00237   { return this->n_elem_on_proc (libMesh::processor_id()); }

unsigned int MeshBase::n_local_nodes (  )  const [inline, inherited]

Returns the number of nodes on the local processor.

Definition at line 172 of file mesh_base.h.

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

Referenced by MeshBase::get_info(), ParallelMesh::parallel_n_nodes(), and ParallelMesh::update_parallel_id_counts().

00173   { return this->n_nodes_on_proc (libMesh::processor_id()); }

virtual unsigned int ParallelMesh::n_nodes (  )  const [inline, virtual, inherited]

Returns the number of nodes in the mesh. This function and others must be defined in derived classes since the MeshBase class has no specific storage for nodes or elements.

Implements MeshBase.

Definition at line 151 of file parallel_mesh.h.

References ParallelMesh::_n_nodes.

Referenced by ParallelMesh::allgather(), ParallelMesh::delete_remote_elements(), ParallelMesh::ParallelMesh(), Nemesis_IO::read(), ParallelMesh::renumber_nodes_and_elements(), and BoundaryInfo::sync().

00151 { return _n_nodes; }

unsigned int MeshBase::n_nodes_on_proc ( const unsigned int  proc  )  const [inherited]

Returns the number of nodes on processor proc.

Definition at line 156 of file mesh_base.C.

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

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

00157 {
00158   // We're either counting a processor's nodes or unpartitioned
00159   // nodes
00160   libmesh_assert (proc_id < libMesh::n_processors() ||
00161           proc_id == DofObject::invalid_processor_id);
00162   
00163   return static_cast<unsigned int>(std::distance (this->pid_nodes_begin(proc_id),
00164                                                   this->pid_nodes_end  (proc_id)));
00165 }

unsigned int MeshBase::n_partitions (  )  const [inline, inherited]

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

Definition at line 428 of file mesh_base.h.

References MeshBase::_n_parts.

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

00429   { return _n_parts; }

unsigned int MeshBase::n_processors (  )  const [inline, inherited]

unsigned int 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 191 of file mesh_base.C.

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

00192 {
00193   unsigned int ne=0;
00194 
00195   const_element_iterator       el  = this->elements_begin();
00196   const const_element_iterator end = this->elements_end(); 
00197 
00198   for (; el!=end; ++el)
00199     ne += (*el)->n_sub_elem(); 
00200 
00201   return ne;
00202 }

unsigned int 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 133 of file mesh_base.C.

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

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

00134 {
00135   // This requires an inspection on every processor
00136   parallel_only();
00137 
00138   const_element_iterator       el  = this->active_elements_begin();
00139   const const_element_iterator end = this->active_elements_end(); 
00140 
00141   std::set<unsigned int> subdomain_ids;
00142   
00143   for (; el!=end; ++el)
00144     subdomain_ids.insert((*el)->subdomain_id());
00145 
00146   // Some subdomains may only live on other processors
00147   Parallel::set_union(subdomain_ids, 0);
00148 
00149   unsigned int n_sbd_ids = subdomain_ids.size();
00150   Parallel::broadcast(n_sbd_ids);
00151 
00152   return n_sbd_ids;
00153 }

unsigned int MeshBase::n_unpartitioned_elem (  )  const [inline, inherited]

Returns the number of elements owned by no processor.

Definition at line 242 of file mesh_base.h.

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

Referenced by ParallelMesh::parallel_n_elem(), and ParallelMesh::update_parallel_id_counts().

unsigned int MeshBase::n_unpartitioned_nodes (  )  const [inline, inherited]

Returns the number of nodes owned by no processor.

Definition at line 178 of file mesh_base.h.

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

Referenced by ParallelMesh::parallel_n_nodes(), and ParallelMesh::update_parallel_id_counts().

Node & ParallelMesh::node ( const unsigned int  i  )  [virtual, inherited]

Return a reference to the $ i^{th} $ node.

Implements MeshBase.

Definition at line 182 of file parallel_mesh.C.

References ParallelMesh::_nodes.

00183 {
00184   libmesh_assert (_nodes[i] != NULL);
00185   libmesh_assert (_nodes[i]->id() == i);  
00186 
00187   return (*_nodes[i]);
00188 }

const Node & ParallelMesh::node ( const unsigned int  i  )  const [virtual, inherited]

Return a constant reference (for reading only) to the $ i^{th} $ node.

Implements MeshBase.

Definition at line 170 of file parallel_mesh.C.

References ParallelMesh::_nodes.

Referenced by ParallelMesh::renumber_node(), and ParallelMesh::renumber_nodes_and_elements().

00171 {
00172   libmesh_assert (_nodes[i] != NULL);
00173   libmesh_assert (_nodes[i]->id() == i);  
00174   
00175   return (*_nodes[i]);
00176 }

Node *& ParallelMesh::node_ptr ( const unsigned int  i  )  [virtual, inherited]

Return a pointer to the $ i^{th} $ node.

Implements MeshBase.

Definition at line 203 of file parallel_mesh.C.

References ParallelMesh::_nodes.

00204 {
00205 //  libmesh_assert (_nodes[i] != NULL);
00206   libmesh_assert (_nodes[i] == NULL || _nodes[i]->id() == i);
00207 
00208   return _nodes[i];
00209 }

const Node * ParallelMesh::node_ptr ( const unsigned int  i  )  const [virtual, inherited]

Return a pointer to the $ i^{th} $ node.

Implements MeshBase.

Definition at line 192 of file parallel_mesh.C.

References ParallelMesh::_nodes.

Referenced by Nemesis_IO::read(), and BoundaryInfo::sync().

00193 {
00194 //  libmesh_assert (_nodes[i] != NULL);
00195   libmesh_assert (_nodes[i] == NULL || _nodes[i]->id() == i);  
00196   
00197   return _nodes[i];
00198 }

ParallelMesh::const_node_iterator ParallelMesh::nodes_begin (  )  const [virtual, inherited]

const Node iterator accessor functions.

Implements MeshBase.

Definition at line 930 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::node_iterator ParallelMesh::nodes_begin (  )  [virtual, inherited]

non-const Node iterator accessor functions.

Implements MeshBase.

Definition at line 890 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_node_iterator ParallelMesh::nodes_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 1010 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::node_iterator ParallelMesh::nodes_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 970 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::not_active_elements_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 270 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::not_active_elements_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 56 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::not_active_elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 698 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::not_active_elements_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 483 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::not_ancestor_elements_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 290 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::not_ancestor_elements_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 76 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::not_ancestor_elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 718 of file parallel_mesh_iterators.C.

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

00719 {
00720   Predicates::Ancestor<const_elem_iterator_imp> p;
00721   return const_element_iterator(_elements.end(), _elements.end(), p);
00722 }

ParallelMesh::element_iterator ParallelMesh::not_ancestor_elements_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 503 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::not_level_elements_begin ( const unsigned int  level  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 370 of file parallel_mesh_iterators.C.

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

00371 {
00372   Predicates::NotLevel<const_elem_iterator_imp> p(level);
00373   return const_element_iterator(_elements.begin(), _elements.end(), p);
00374 }

ParallelMesh::element_iterator ParallelMesh::not_level_elements_begin ( const unsigned int  level  )  [virtual, inherited]

Implements MeshBase.

Definition at line 156 of file parallel_mesh_iterators.C.

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

00157 {
00158   Predicates::NotLevel<elem_iterator_imp> p(level);
00159   return element_iterator(_elements.begin(), _elements.end(), p);
00160 }

ParallelMesh::const_element_iterator ParallelMesh::not_level_elements_end ( const unsigned int  level  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 798 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::not_level_elements_end ( const unsigned int  level  )  [virtual, inherited]

Implements MeshBase.

Definition at line 583 of file parallel_mesh_iterators.C.

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

00584 {
00585   Predicates::NotLevel<elem_iterator_imp> p(level);
00586   return element_iterator(_elements.end(), _elements.end(), p);
00587 }

ParallelMesh::const_element_iterator ParallelMesh::not_local_elements_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 330 of file parallel_mesh_iterators.C.

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

00331 {
00332   Predicates::NotLocal<const_elem_iterator_imp> p;
00333   return const_element_iterator(_elements.begin(), _elements.end(), p);
00334 }

ParallelMesh::element_iterator ParallelMesh::not_local_elements_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 116 of file parallel_mesh_iterators.C.

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

Referenced by MeshCommunication::delete_remote_elements().

00117 {
00118   Predicates::NotLocal<elem_iterator_imp> p;
00119   return element_iterator(_elements.begin(), _elements.end(), p);
00120 }

ParallelMesh::const_element_iterator ParallelMesh::not_local_elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 758 of file parallel_mesh_iterators.C.

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

00759 {
00760   Predicates::NotLocal<const_elem_iterator_imp> p;
00761   return const_element_iterator(_elements.end(), _elements.end(), p);
00762 }

ParallelMesh::element_iterator ParallelMesh::not_local_elements_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 543 of file parallel_mesh_iterators.C.

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

Referenced by MeshCommunication::delete_remote_elements().

00544 {
00545   Predicates::NotLocal<elem_iterator_imp> p;
00546   return element_iterator(_elements.end(), _elements.end(), p);
00547 }

ParallelMesh::const_element_iterator ParallelMesh::not_subactive_elements_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 310 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::not_subactive_elements_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 96 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::not_subactive_elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 738 of file parallel_mesh_iterators.C.

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

00739 {
00740   Predicates::NotSubActive<const_elem_iterator_imp> p;
00741   return const_element_iterator(_elements.end(), _elements.end(), p);
00742 }

ParallelMesh::element_iterator ParallelMesh::not_subactive_elements_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 523 of file parallel_mesh_iterators.C.

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

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

unsigned int ParallelMesh::parallel_max_elem_id (  )  const [inherited]

Definition at line 119 of file parallel_mesh.C.

References ParallelMesh::_elements, and std::max().

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

00120 {
00121   // This function must be run on all processors at once
00122   parallel_only();
00123 
00124   unsigned int max_local = _elements.empty() ?
00125     0 : _elements.rbegin()->first + 1;
00126   Parallel::max(max_local);
00127   return max_local;
00128 }

unsigned int ParallelMesh::parallel_max_node_id (  )  const [inherited]

Definition at line 145 of file parallel_mesh.C.

References ParallelMesh::_nodes, and std::max().

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

00146 {
00147   // This function must be run on all processors at once
00148   parallel_only();
00149 
00150   unsigned int max_local = _nodes.empty() ?
00151     0 : _nodes.rbegin()->first + 1;
00152   Parallel::max(max_local);
00153   return max_local;
00154 }

unsigned int ParallelMesh::parallel_n_elem (  )  const [inherited]

Definition at line 106 of file parallel_mesh.C.

References MeshBase::n_local_elem(), and MeshBase::n_unpartitioned_elem().

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

00107 {
00108   // This function must be run on all processors at once
00109   parallel_only();
00110 
00111   unsigned int n_local = this->n_local_elem();
00112   Parallel::sum(n_local);
00113   n_local += this->n_unpartitioned_elem();
00114   return n_local;
00115 }

unsigned int ParallelMesh::parallel_n_nodes (  )  const [inherited]

Definition at line 132 of file parallel_mesh.C.

References MeshBase::n_local_nodes(), and MeshBase::n_unpartitioned_nodes().

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

00133 {
00134   // This function must be run on all processors at once
00135   parallel_only();
00136 
00137   unsigned int n_local = this->n_local_nodes();
00138   Parallel::sum(n_local);
00139   n_local += this->n_unpartitioned_nodes();
00140   return n_local;
00141 }

void MeshBase::partition ( const unsigned int  n_parts = libMesh::n_processors()  )  [inherited]

Call the default partitioner (currently metis_partition()).

Definition at line 259 of file mesh_base.C.

References MeshBase::partitioner().

Referenced by MeshBase::prepare_for_use().

00260 {
00261   if (partitioner().get()) // "NULL" means don't partition
00262     partitioner()->partition (*this, n_parts);
00263 }

virtual AutoPtr<Partitioner>& MeshBase::partitioner (  )  [inline, virtual, inherited]

A partitioner to use at each prepare_for_use()

Definition at line 103 of file mesh_base.h.

References MeshBase::_partitioner.

Referenced by MeshBase::partition(), and BoundaryInfo::sync().

00103 { return _partitioner; }

ParallelMesh::const_element_iterator ParallelMesh::pid_elements_begin ( const unsigned int  proc_id  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 400 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::pid_elements_begin ( const unsigned int  proc_id  )  [virtual, inherited]

Implements MeshBase.

Definition at line 186 of file parallel_mesh_iterators.C.

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

Referenced by ParallelMesh::unpartitioned_elements_begin().

00187 {
00188   Predicates::PID<elem_iterator_imp> p(proc_id);
00189   return element_iterator(_elements.begin(), _elements.end(), p);
00190 }

ParallelMesh::const_element_iterator ParallelMesh::pid_elements_end ( const unsigned int  proc_id  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 827 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::pid_elements_end ( const unsigned int  proc_id  )  [virtual, inherited]

Implements MeshBase.

Definition at line 613 of file parallel_mesh_iterators.C.

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

Referenced by ParallelMesh::unpartitioned_elements_end().

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

ParallelMesh::const_node_iterator ParallelMesh::pid_nodes_begin ( const unsigned int  proc_id  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 960 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::node_iterator ParallelMesh::pid_nodes_begin ( const unsigned int  proc_id  )  [virtual, inherited]

Implements MeshBase.

Definition at line 920 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_node_iterator ParallelMesh::pid_nodes_end ( const unsigned int  proc_id  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 1040 of file parallel_mesh_iterators.C.

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

01041 {
01042   Predicates::PID<const_node_iterator_imp> p(proc_id);
01043   return const_node_iterator(_nodes.end(), _nodes.end(), p);
01044 }

ParallelMesh::node_iterator ParallelMesh::pid_nodes_end ( const unsigned int  proc_id  )  [virtual, inherited]

Implements MeshBase.

Definition at line 1000 of file parallel_mesh_iterators.C.

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

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

const Point & ParallelMesh::point ( const unsigned int  i  )  const [virtual, inherited]

For meshes that don't store points/elems, these functions may be an issue!

Implements MeshBase.

Definition at line 158 of file parallel_mesh.C.

References ParallelMesh::_nodes.

00159 {
00160   libmesh_assert (_nodes[i] != NULL);
00161   libmesh_assert (_nodes[i]->id() == i);  
00162 
00163   return (*_nodes[i]);
00164 }

const PointLocatorBase & MeshBase::point_locator (  )  const [inherited]

returns a reference to a PointLocatorBase object for this mesh.

Definition at line 285 of file mesh_base.C.

References MeshBase::_point_locator, PointLocatorBase::build(), AutoPtr< Tp >::get(), AutoPtr< Tp >::release(), AutoPtr< Tp >::reset(), and MeshEnums::TREE.

Referenced by PeriodicBoundaries::neighbor().

00286 {
00287   if (_point_locator.get() == NULL)
00288     _point_locator.reset (PointLocatorBase::build(TREE, *this).release());
00289 
00290   return *_point_locator;
00291 }

void 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 read_xda_file boolean flag is true when prepare_for_use is called from Mesh::read after reading an xda file. It prevents the renumbering of nodes and elements. In general, leave this at the default value of false.

Definition at line 80 of file mesh_base.C.

References MeshBase::_is_prepared, MeshBase::clear_point_locator(), MeshBase::delete_remote_elements(), MeshBase::find_neighbors(), MeshBase::partition(), and MeshBase::renumber_nodes_and_elements().

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

00081 {  
00082   // Renumber the nodes and elements so that they in contiguous
00083   // blocks.  By default, skip_renumber_nodes_and_elements is false,
00084   // however we may skip this step by passing
00085   // skip_renumber_nodes_and_elements==true to this function.
00086   //
00087   // Instances where you if prepare_for_use() should not renumber the nodes
00088   // and elements include reading in e.g. an xda/r or gmv file. In
00089   // this case, the ordering of the nodes may depend on an accompanying
00090   // solution, and the node ordering cannot be changed.
00091   if(!skip_renumber_nodes_and_elements)
00092     this->renumber_nodes_and_elements();
00093   
00094   // Let all the elements find their neighbors
00095   this->find_neighbors();
00096 
00097   // Partition the mesh.
00098   this->partition();
00099   
00100   // If we're using ParallelMesh, we'll want it parallelized.
00101   this->delete_remote_elements();
00102 
00103   if(!skip_renumber_nodes_and_elements)
00104     this->renumber_nodes_and_elements();
00105 
00106   // Reset our PointLocator.  This needs to happen any time the elements
00107   // in the underlying elements in the mesh have changed, so we do it here.
00108   this->clear_point_locator();
00109 
00110   // The mesh is now prepared for use.
00111   _is_prepared = true;
00112 }

void MeshBase::print_info ( std::ostream &  os = std::cout  )  const [inherited]

Prints relevant information about the mesh.

Definition at line 243 of file mesh_base.C.

References MeshBase::get_info().

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

00244 {
00245   os << this->get_info()
00246      << std::endl;
00247 }

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

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

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

Implements MeshBase.

Definition at line 464 of file unstructured_mesh.C.

References XdrIO::binary(), is_parallel_file_format(), XdrIO::legacy(), MeshBase::prepare_for_use(), libMesh::processor_id(), and XdrIO::read().

00467 {
00468   // See if the file exists.  Perform this check on all processors
00469   // so that the code is terminated properly in the case that the
00470   // file does not exist.
00471   {
00472     std::ifstream in (name.c_str());
00473     
00474     if (!in.good())
00475       {
00476         std::cerr << "ERROR: cannot locate specified file:\n\t"
00477                   << name
00478                   << std::endl;
00479         libmesh_error();
00480       }
00481   }
00482 
00483   // Set the skip_renumber_nodes_and_elements flag on all processors.
00484   // This ensures that renumber_nodes_and_elements is *not* called
00485   // during prepare_for_use() for certain types of mesh files.
00486   // This is required in cases where there is an associated solution
00487   // file which expects a certain ordering of the nodes.
00488   if(name.rfind(".gmv")+4==name.size())
00489     {
00490       skip_renumber_nodes_and_elements =  true;
00491     }
00492   
00493   // Look for parallel formats first
00494   if (is_parallel_file_format(name))
00495     {      
00496       // no need to handling bz2 files here -- the Xdr class does that.
00497       if ((name.rfind(".xda") < name.size()) ||
00498           (name.rfind(".xdr") < name.size()))
00499         {
00500           XdrIO xdr_io(*this);
00501 
00502           // .xda* ==> bzip2/gzip/ASCII flavors
00503           if (name.rfind(".xda") < name.size())
00504             {
00505               xdr_io.binary() = false;
00506               xdr_io.read (name);
00507             }
00508           else // .xdr* ==> true binary XDR file
00509             {
00510               xdr_io.binary() = true;
00511               xdr_io.read (name);
00512             }
00513 
00514           // The xdr_io object gets constructed with legacy() == false.
00515           // if legacy() == true then it means that a legacy file was detected and
00516           // thus processor 0 performed the read. We therefore need to broadcast the
00517           // mesh.  Further, for this flavor of mesh solution data ordering is tied
00518           // to the node ordering, so we better not reorder the nodes!
00519           if (xdr_io.legacy())
00520             {
00521               skip_renumber_nodes_and_elements = true;
00522               MeshCommunication().broadcast(*this);
00523             }
00524         }      
00525     }
00526 
00527   // Serial mesh formats
00528   else
00529     {
00530       START_LOG("read()", "Mesh");  
00531   
00532       // Read the file based on extension.  Only processor 0
00533       // needs to read the mesh.  It will then broadcast it and
00534       // the other processors will pick it up
00535       if (libMesh::processor_id() == 0)
00536         {
00537           // Nasty hack for reading/writing zipped files
00538           std::string new_name = name;
00539           if (name.size() - name.rfind(".bz2") == 4)
00540             {
00541               new_name.erase(new_name.end() - 4, new_name.end());
00542               std::string system_string = "bunzip2 -f -k ";
00543               system_string += name;
00544               START_LOG("system(bunzip2)", "Mesh");
00545               if (std::system(system_string.c_str()))
00546                 libmesh_file_error(system_string);
00547               STOP_LOG("system(bunzip2)", "Mesh");
00548             }
00549 
00550           if (new_name.rfind(".mat") < new_name.size())
00551             MatlabIO(*this).read(new_name);
00552           
00553           else if (new_name.rfind(".ucd") < new_name.size())
00554             UCDIO(*this).read (new_name);
00555           
00556           else if ((new_name.rfind(".off")  < new_name.size()) ||
00557                    (new_name.rfind(".ogl")  < new_name.size()) ||
00558                    (new_name.rfind(".oogl") < new_name.size()))
00559             OFFIO(*this).read (new_name);
00560      
00561           else if (new_name.rfind(".mgf") < new_name.size())
00562             LegacyXdrIO(*this,true).read_mgf (new_name);
00563       
00564           else if (new_name.rfind(".unv") < new_name.size())
00565             {
00566               if (mesh_data == NULL)
00567                 {
00568                   std::cerr << "Error! You must pass a "
00569                             << "valid MeshData pointer to "
00570                             << "read UNV files!" << std::endl;
00571                   libmesh_error();
00572                 }
00573               UNVIO(*this, *mesh_data).read (new_name);
00574             }
00575       
00576           else if ((new_name.rfind(".node")  < new_name.size()) ||
00577                    (new_name.rfind(".ele")   < new_name.size()))
00578             TetGenIO(*this,mesh_data).read (new_name);
00579 
00580           else if (new_name.rfind(".exd") < new_name.size() ||
00581                    new_name.rfind(".e") < new_name.size())
00582             ExodusII_IO(*this).read (new_name);
00583           
00584           else if (new_name.rfind(".msh") < new_name.size())
00585             GmshIO(*this).read (new_name);
00586 
00587           else if (new_name.rfind(".gmv") < new_name.size())
00588             GMVIO(*this).read (new_name);
00589 
00590           else if (new_name.rfind(".vtu") < new_name.size())
00591             VTKIO(*this).read(new_name);
00592       
00593           else
00594             {
00595               std::cerr << " ERROR: Unrecognized file extension: " << name
00596                         << "\n   I understand the following:\n\n"
00597                         << "     *.e    -- Sandia's ExodusII format\n"
00598                         << "     *.exd  -- Sandia's ExodusII format\n"
00599                         << "     *.gmv  -- LANL's General Mesh Viewer format\n"
00600                         << "     *.mat  -- Matlab triangular ASCII file\n"
00601                         << "     *.off  -- OOGL OFF surface format\n"
00602                         << "     *.ucd  -- AVS's ASCII UCD format\n"
00603                         << "     *.unv  -- I-deas Universal format\n"
00604                         << "     *.vtu  -- Paraview VTK format\n"
00605                         << "     *.xda  -- libMesh ASCII format\n"
00606                         << "     *.xdr  -- libMesh binary format\n"
00607                         << "     *.gz   -- any above format gzipped\n"
00608                         << "     *.bz2  -- any above format bzip2'ed\n"
00609 
00610                         << std::endl;
00611               libmesh_error();    
00612             }    
00613           
00614           // If we temporarily decompressed a .bz2 file, remove the
00615           // uncompressed version
00616           if (name.size() - name.rfind(".bz2") == 4)
00617             std::remove(new_name.c_str());
00618         }
00619       
00620   
00621       STOP_LOG("read()", "Mesh");
00622 
00623       // Send the mesh & bcs (which are now only on processor 0) to the other
00624       // processors
00625       MeshCommunication().broadcast (*this);
00626     }
00627 
00628   
00629   // Done reading the mesh.  Now prepare it for use.
00630   this->prepare_for_use(skip_renumber_nodes_and_elements);
00631 
00632 }

unsigned int 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 267 of file mesh_base.C.

References MeshBase::_n_parts, MeshBase::active_elements_begin(), MeshBase::active_elements_end(), and std::max().

00268 {
00269   const_element_iterator       el  = this->active_elements_begin();
00270   const const_element_iterator end = this->active_elements_end(); 
00271 
00272   unsigned int max_proc_id=0;
00273   
00274   for (; el!=end; ++el)
00275     max_proc_id = std::max(max_proc_id, static_cast<unsigned int>((*el)->processor_id()));
00276 
00277   // The number of partitions is one more than the max processor ID.
00278   _n_parts = max_proc_id+1;
00279 
00280   return _n_parts;
00281 }

template<typename T >
unsigned int ParallelMesh::renumber_dof_objects ( mapvector< T * > &  objects  )  [inline, inherited]

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

Definition at line 595 of file parallel_mesh.C.

References ParallelMesh::allgather(), mapvector< Val >::begin(), mapvector< Val >::end(), mapvector< Val >::erase(), DofObject::invalid_processor_id, std::max(), MeshBase::n_processors(), libMesh::n_processors(), MeshBase::processor_id(), and libMesh::processor_id().

Referenced by ParallelMesh::renumber_nodes_and_elements().

00596 {
00597   // This function must be run on all processors at once
00598   parallel_only();
00599 
00600   typedef typename mapvector<T*>::veclike_iterator object_iterator;
00601 
00602   // In parallel we may not know what objects other processors have.
00603   // Start by figuring out how many
00604   unsigned int unpartitioned_objects = 0;
00605 
00606   std::vector<unsigned int>
00607     ghost_objects_from_proc(libMesh::n_processors(), 0);
00608 
00609   object_iterator it  = objects.begin();
00610   object_iterator end = objects.end();
00611 
00612   for (; it != end;)
00613     {
00614       T *obj = *it;
00615 
00616       // Remove any NULL container entries while we're here,
00617       // being careful not to invalidate our iterator
00618       if (!*it)
00619         objects.erase(it++);
00620       else
00621         {
00622           unsigned int obj_procid = obj->processor_id();
00623           if (obj_procid == DofObject::invalid_processor_id)
00624             unpartitioned_objects++;
00625           else
00626             ghost_objects_from_proc[obj_procid]++;
00627           ++it;
00628         }
00629     }
00630 
00631   std::vector<unsigned int> objects_on_proc(libMesh::n_processors(), 0);
00632   Parallel::allgather(ghost_objects_from_proc[libMesh::processor_id()],
00633                       objects_on_proc);
00634 
00635 #ifndef NDEBUG
00636   unsigned int global_unpartitioned_objects = unpartitioned_objects;
00637   Parallel::max(global_unpartitioned_objects);
00638   libmesh_assert(global_unpartitioned_objects == unpartitioned_objects);
00639   for (unsigned int p=0; p != libMesh::n_processors(); ++p)
00640     libmesh_assert(ghost_objects_from_proc[p] <= objects_on_proc[p]);
00641 #endif
00642 
00643   // We'll renumber objects in blocks by processor id
00644   std::vector<unsigned int> first_object_on_proc(libMesh::n_processors());
00645   for (unsigned int i=1; i != libMesh::n_processors(); ++i)
00646     first_object_on_proc[i] = first_object_on_proc[i-1] +
00647                               objects_on_proc[i-1];
00648   unsigned int next_id = first_object_on_proc[libMesh::processor_id()];
00649   unsigned int first_free_id =
00650     first_object_on_proc[libMesh::n_processors()-1] +
00651     objects_on_proc[libMesh::n_processors()-1] + 
00652     unpartitioned_objects;
00653 
00654   // First set new local object ids and build request sets 
00655   // for non-local object ids
00656   
00657   // Request sets to send to each processor
00658   std::vector<std::vector<unsigned int> >
00659     requested_ids(libMesh::n_processors());
00660 
00661   // We know how many objects live on each processor, so reseve() space for
00662   // each.
00663   for (unsigned int p=0; p != libMesh::n_processors(); ++p)
00664     if (p != libMesh::processor_id())
00665       requested_ids[p].reserve(ghost_objects_from_proc[p]);
00666 
00667   end = objects.end();
00668   for (it = objects.begin(); it != end; ++it)
00669     {
00670       T *obj = *it;
00671       if (obj->processor_id() == libMesh::processor_id())
00672         obj->set_id(next_id++);
00673       else if (obj->processor_id() != DofObject::invalid_processor_id)
00674         requested_ids[obj->processor_id()].push_back(obj->id());
00675     }
00676 
00677   // Next set ghost object ids from other processors
00678   if (libMesh::n_processors() > 1)
00679     {
00680       for (unsigned int p=1; p != libMesh::n_processors(); ++p)
00681         {
00682           // Trade my requests with processor procup and procdown
00683           unsigned int procup = (libMesh::processor_id() + p) %
00684                                  libMesh::n_processors();
00685           unsigned int procdown = (libMesh::n_processors() +
00686                                    libMesh::processor_id() - p) %
00687                                    libMesh::n_processors();
00688           std::vector<unsigned int> request_to_fill;
00689           Parallel::send_receive(procup, requested_ids[procup],
00690                                  procdown, request_to_fill);
00691 
00692           // Fill those requests
00693           std::vector<unsigned int> new_ids(request_to_fill.size());
00694           for (unsigned int i=0; i != request_to_fill.size(); ++i)
00695             {
00696               T *obj = objects[request_to_fill[i]];
00697               libmesh_assert(obj);
00698               libmesh_assert(obj->processor_id() == libMesh::processor_id());
00699               new_ids[i] = obj->id();
00700               libmesh_assert(new_ids[i] >=
00701                      first_object_on_proc[libMesh::processor_id()]);
00702               libmesh_assert(new_ids[i] <
00703                      first_object_on_proc[libMesh::processor_id()] +
00704                      objects_on_proc[libMesh::processor_id()]);
00705             }
00706 
00707           // Trade back the results
00708           std::vector<unsigned int> filled_request;
00709           Parallel::send_receive(procdown, new_ids,
00710                                  procup, filled_request);
00711 
00712           // And copy the id changes we've now been informed of
00713           for (unsigned int i=0; i != filled_request.size(); ++i)
00714             {
00715               T *obj = objects[requested_ids[procup][i]];
00716               libmesh_assert (obj);
00717               libmesh_assert (obj->processor_id() == procup);
00718               libmesh_assert(filled_request[i] >=
00719                      first_object_on_proc[procup]);
00720               libmesh_assert(filled_request[i] <
00721                      first_object_on_proc[procup] +
00722                      objects_on_proc[procup]);
00723               obj->set_id(filled_request[i]);
00724             }
00725         }
00726     }
00727 
00728   // Next set unpartitioned object ids
00729   next_id = 0;
00730   for (unsigned int i=0; i != libMesh::n_processors(); ++i)
00731     next_id += objects_on_proc[i];
00732   for (it = objects.begin(); it != end; ++it)
00733     {
00734       T *obj = *it;
00735       if (obj->processor_id() == DofObject::invalid_processor_id)
00736         obj->set_id(next_id++);
00737     }
00738 
00739   // Finally shuffle around objects so that container indices
00740   // match ids
00741   end = objects.end();
00742   for (it = objects.begin(); it != end;)
00743     {
00744       T *obj = *it;
00745       if (obj) // don't try shuffling already-NULL entries
00746         {
00747           T *next = objects[obj->id()];
00748           // If we have to move this object
00749           if (next != obj)
00750             {
00751               // NULL out its original position for now
00752               // (our shuffling may put another object there shortly)
00753               *it = NULL;
00754 
00755               // There may already be another object with this id that
00756               // needs to be moved itself
00757               while (next)
00758                 {
00759                   // We shouldn't be trying to give two objects the
00760                   // same id
00761                   libmesh_assert (next->id() != obj->id());
00762                   objects[obj->id()] = obj;
00763                   obj = next;
00764                   next = objects[obj->id()];
00765                 }
00766               objects[obj->id()] = obj;
00767             }
00768         }
00769       // Remove any container entries that were left as NULL,
00770       // being careful not to invalidate our iterator
00771       if (!*it)
00772         objects.erase(it++);
00773       else
00774         ++it;
00775     }
00776 
00777   return first_free_id;
00778 }

void ParallelMesh::renumber_elem ( unsigned int  old_id,
unsigned int  new_id 
) [virtual, inherited]

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

Implements MeshBase.

Definition at line 314 of file parallel_mesh.C.

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

00316 {
00317   Elem *elem = _elements[old_id];
00318   libmesh_assert (elem);
00319   libmesh_assert (elem->id() == old_id);
00320 
00321   elem->set_id(new_id);
00322   libmesh_assert (!_elements[new_id]);
00323   _elements[new_id] = elem;
00324   _elements.erase(old_id);
00325 }

void ParallelMesh::renumber_node ( unsigned int  old_id,
unsigned int  new_id 
) [virtual, inherited]

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

Implements MeshBase.

Definition at line 451 of file parallel_mesh.C.

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

00453 {
00454   Node *node = _nodes[old_id];
00455   libmesh_assert (node);
00456   libmesh_assert (node->id() == old_id);
00457 
00458   node->set_id(new_id);
00459   libmesh_assert (!_nodes[new_id]);
00460   _nodes[new_id] = node;
00461   _nodes.erase(old_id);
00462 }

void ParallelMesh::renumber_nodes_and_elements (  )  [virtual, inherited]

Remove NULL elements from arrays

Implements MeshBase.

Definition at line 781 of file parallel_mesh.C.

References ParallelMesh::_elements, ParallelMesh::_max_elem_id, ParallelMesh::_max_node_id, ParallelMesh::_n_elem, ParallelMesh::_n_nodes, ParallelMesh::_next_free_local_elem_id, ParallelMesh::_next_free_local_node_id, ParallelMesh::_next_free_unpartitioned_elem_id, ParallelMesh::_next_free_unpartitioned_node_id, ParallelMesh::_nodes, mapvector< Val >::begin(), MeshBase::boundary_info, ParallelMesh::elem(), ParallelMesh::elements_begin(), ParallelMesh::elements_end(), mapvector< Val >::end(), mapvector< Val >::erase(), DofObject::id(), MeshTools::libmesh_assert_valid_elem_ids(), ParallelMesh::libmesh_assert_valid_parallel_flags(), ParallelMesh::libmesh_assert_valid_parallel_ids(), ParallelMesh::max_elem_id(), ParallelMesh::max_node_id(), ParallelMesh::n_elem(), ParallelMesh::n_nodes(), Elem::n_nodes(), MeshBase::n_processors(), ParallelMesh::node(), Elem::node(), ParallelMesh::parallel_max_elem_id(), ParallelMesh::parallel_max_node_id(), ParallelMesh::parallel_n_elem(), ParallelMesh::parallel_n_nodes(), MeshBase::processor_id(), and ParallelMesh::renumber_dof_objects().

Referenced by MeshCommunication::delete_remote_elements().

00782 {
00783   START_LOG("renumber_nodes_and_elements()", "ParallelMesh");
00784 
00785 #ifdef DEBUG
00786 // Make sure our ids and flags are consistent
00787   this->libmesh_assert_valid_parallel_ids();
00788   this->libmesh_assert_valid_parallel_flags();
00789 #endif
00790 
00791   std::set<unsigned int> used_nodes;
00792 
00793   // flag the nodes we need
00794   {      
00795     element_iterator  it = elements_begin();
00796     element_iterator end = elements_end();
00797 
00798     for (; it != end; ++it)
00799       {
00800         Elem *elem = *it;
00801 
00802         for (unsigned int n=0; n != elem->n_nodes(); ++n)
00803           used_nodes.insert(elem->node(n));
00804       }
00805   }
00806 
00807   // Nodes not connected to any local elements are deleted
00808   {
00809     node_iterator_imp  it = _nodes.begin();
00810     node_iterator_imp end = _nodes.end();
00811 
00812     for (; it != end;)
00813       {
00814         Node *node = *it;
00815         if (!used_nodes.count(node->id()))
00816           {
00817             // remove any boundary information associated with
00818             // this node
00819             this->boundary_info->remove (node);
00820 
00821             // delete the node
00822             delete node;
00823 
00824             _nodes.erase(it++);
00825           }
00826         else
00827           ++it;
00828       }
00829   }
00830 
00831   // Finally renumber all the elements
00832   _n_elem = this->renumber_dof_objects (this->_elements);
00833   _max_elem_id = _n_elem;
00834   _next_free_local_elem_id = _n_elem;
00835 
00836   // and all the remaining nodes
00837   _n_nodes = this->renumber_dof_objects (this->_nodes);
00838   _max_node_id = _n_nodes;
00839   _next_free_local_node_id = _n_nodes;
00840 
00841   // And figure out what IDs we should use when adding new nodes and
00842   // new elements
00843   unsigned int cycle = libMesh::n_processors()+1;
00844   unsigned int offset = _next_free_local_elem_id % cycle;
00845   if (offset)
00846     _next_free_local_elem_id += cycle - offset;
00847   _next_free_unpartitioned_elem_id = _next_free_local_elem_id +
00848                                      libMesh::n_processors();
00849   _next_free_local_elem_id += libMesh::processor_id();
00850 
00851   offset = _next_free_local_node_id % cycle;
00852   if (offset)
00853     _next_free_local_node_id += cycle - offset;
00854   _next_free_unpartitioned_node_id = _next_free_local_node_id +
00855                                      libMesh::n_processors();
00856   _next_free_local_node_id += libMesh::processor_id();
00857 
00858 // Make sure our caches are up to date and our
00859 // DofObjects are well packed
00860 #ifdef DEBUG
00861   libmesh_assert(this->n_nodes() == this->parallel_n_nodes());
00862   libmesh_assert(this->n_elem() == this->parallel_n_elem());
00863   libmesh_assert(this->max_node_id() == this->parallel_max_node_id());
00864   libmesh_assert(this->max_elem_id() == this->parallel_max_elem_id());
00865   libmesh_assert(this->n_nodes() == this->max_node_id());
00866   libmesh_assert(this->n_elem() == this->max_elem_id());
00867 
00868 // Make sure our ids and flags are consistent
00869   this->libmesh_assert_valid_parallel_ids();
00870   this->libmesh_assert_valid_parallel_flags();
00871 
00872 // And make sure we've made our numbering monotonic
00873   MeshTools::libmesh_assert_valid_elem_ids(*this);
00874 #endif
00875 
00876   STOP_LOG("renumber_nodes_and_elements()", "ParallelMesh");
00877 }

virtual void ParallelMesh::reserve_elem ( const unsigned  ne  )  [inline, virtual, inherited]

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

Implements MeshBase.

Definition at line 157 of file parallel_mesh.h.

00157 { }

virtual void ParallelMesh::reserve_nodes ( const unsigned  nn  )  [inline, virtual, inherited]

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

Implements MeshBase.

Definition at line 153 of file parallel_mesh.h.

Referenced by BoundaryInfo::sync().

00153 { }

void MeshBase::set_mesh_dimension ( unsigned int  d  )  [inline, inherited]

Resets the logical dimension of the mesh. Should only be called on an empty mesh.

Definition at line 147 of file mesh_base.h.

References MeshBase::_dim, and MeshBase::n_elem().

Referenced by MeshTools::Generation::build_cube(), MeshTools::Generation::build_delaunay_square(), Triangle::copy_tri_to_mesh(), and TriangleInterface::triangulate().

00148   { libmesh_assert(!this->n_elem()); _dim = d; }

unsigned int& MeshBase::set_n_partitions (  )  [inline, protected, inherited]

Returns a writeable reference to the number of partitions.

Definition at line 677 of file mesh_base.h.

References MeshBase::_n_parts.

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

00678   { return _n_parts; }

unsigned int MeshBase::spatial_dimension (  )  const [inline, inherited]

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

Definition at line 154 of file mesh_base.h.

Referenced by MeshBase::get_info(), ExodusII_IO_Helper::initialize(), UNVIO::node_out(), LegacyXdrIO::read_mesh(), MeshTools::Modification::scale(), MeshTools::subdomain_bounding_box(), and LegacyXdrIO::write_mesh().

00155   { return static_cast<unsigned int>(LIBMESH_DIM); }

ParallelMesh::const_element_iterator ParallelMesh::subactive_elements_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 300 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::subactive_elements_begin (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 86 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::subactive_elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 728 of file parallel_mesh_iterators.C.

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

00729 {
00730   Predicates::SubActive<const_elem_iterator_imp> p;
00731   return const_element_iterator(_elements.end(), _elements.end(), p);
00732 }

ParallelMesh::element_iterator ParallelMesh::subactive_elements_end (  )  [virtual, inherited]

Implements MeshBase.

Definition at line 513 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::type_elements_begin ( const ElemType  type  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 410 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::element_iterator ParallelMesh::type_elements_begin ( const ElemType  type  )  [virtual, inherited]

Implements MeshBase.

Definition at line 196 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::type_elements_end ( const ElemType  type  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 837 of file parallel_mesh_iterators.C.

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

00838 {
00839   Predicates::Type<const_elem_iterator_imp> p(type);
00840   return const_element_iterator(_elements.end(), _elements.end(), p);
00841 }

ParallelMesh::element_iterator ParallelMesh::type_elements_end ( const ElemType  type  )  [virtual, inherited]

Implements MeshBase.

Definition at line 623 of file parallel_mesh_iterators.C.

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

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

ParallelMesh::const_element_iterator ParallelMesh::unpartitioned_elements_begin (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 440 of file parallel_mesh_iterators.C.

References DofObject::invalid_processor_id, and ParallelMesh::pid_elements_begin().

00441 {
00442   return this->pid_elements_begin(DofObject::invalid_processor_id);
00443 }

ParallelMesh::element_iterator ParallelMesh::unpartitioned_elements_begin (  )  [virtual, inherited]

ParallelMesh::const_element_iterator ParallelMesh::unpartitioned_elements_end (  )  const [virtual, inherited]

Implements MeshBase.

Definition at line 867 of file parallel_mesh_iterators.C.

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

00868 {
00869   return this->pid_elements_end(DofObject::invalid_processor_id);
00870 }

ParallelMesh::element_iterator ParallelMesh::unpartitioned_elements_end (  )  [virtual, inherited]

void ParallelMesh::update_parallel_id_counts (  )  [virtual, inherited]

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

Implements MeshBase.

Definition at line 81 of file parallel_mesh.C.

References ParallelMesh::_elements, ParallelMesh::_max_elem_id, ParallelMesh::_max_node_id, ParallelMesh::_n_elem, ParallelMesh::_n_nodes, ParallelMesh::_nodes, std::max(), MeshBase::n_local_elem(), MeshBase::n_local_nodes(), MeshBase::n_unpartitioned_elem(), and MeshBase::n_unpartitioned_nodes().

00082 {
00083   // This function must be run on all processors at once
00084   parallel_only();
00085 
00086   _n_elem = this->n_local_elem();
00087   Parallel::sum(_n_elem);
00088   _n_elem += this->n_unpartitioned_elem();
00089 
00090   _max_elem_id = _elements.empty() ?
00091     0 : _elements.rbegin()->first + 1;
00092   Parallel::max(_max_elem_id);
00093 
00094   _n_nodes = this->n_local_nodes();
00095   Parallel::sum(_n_nodes);
00096   _n_nodes += this->n_unpartitioned_nodes();
00097 
00098   _max_node_id = _nodes.empty() ?
00099     0 : _nodes.rbegin()->first + 1;
00100   Parallel::max(_max_node_id);
00101 }

void 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 763 of file unstructured_mesh.C.

References MeshBase::n_subdomains(), GMVIO::partitioning(), and GMVIO::write_nodal_data().

00766 {
00767   START_LOG("write()", "Mesh");
00768 
00769   // Write the file based on extension
00770   if (name.rfind(".dat") < name.size())
00771     TecplotIO(*this).write_nodal_data (name, v, vn);
00772   
00773   else if (name.rfind(".plt") < name.size())
00774     TecplotIO(*this,true).write_nodal_data (name, v, vn);
00775   
00776   else if (name.rfind(".gmv") < name.size())
00777     {
00778       if (n_subdomains() > 1)
00779         GMVIO(*this).write_nodal_data (name, v, vn);
00780       else
00781         {
00782           GMVIO io(*this);
00783           io.partitioning() = false;
00784           io.write_nodal_data (name, v, vn);
00785         }
00786     }    
00787   else if (name.rfind(".pvtu") < name.size())
00788     {
00789       VTKIO(*this).write_nodal_data (name, v, vn);
00790     }
00791   else
00792     {
00793       std::cerr << " ERROR: Unrecognized file extension: " << name
00794                 << "\n   I understand the following:\n\n"
00795                 << "     *.dat  -- Tecplot ASCII file\n"
00796                 << "     *.gmv  -- LANL's GMV (General Mesh Viewer) format\n"
00797                 << "     *.plt  -- Tecplot binary file\n"
00798                 << "     *.pvtu -- Paraview VTK file\n"
00799                 << "\n Exiting without writing output\n";
00800     }
00801 
00802   STOP_LOG("write()", "Mesh");
00803 }

void UnstructuredMesh::write ( const std::string &  name,
MeshData mesh_data = NULL 
) [virtual, inherited]

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

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

Implements MeshBase.

Definition at line 636 of file unstructured_mesh.C.

References is_parallel_file_format(), MeshBase::n_partitions(), GMVIO::partitioning(), libMesh::processor_id(), and GMVIO::write().

00638 {
00639   // parallel formats are special -- they may choose to write
00640   // separate files, let's not try to handle the zipping here.
00641   if (is_parallel_file_format(name))
00642     {   
00643       // no need to handling bz2 files here -- the Xdr class does that.
00644       if (name.rfind(".xda") < name.size())
00645         XdrIO(*this).write(name);
00646         
00647       else if (name.rfind(".xdr") < name.size())
00648         XdrIO(*this,true).write(name);
00649     }
00650 
00651   // serial file formats
00652   else
00653     {
00654       START_LOG("write()", "Mesh");
00655 
00656       // Nasty hack for reading/writing zipped files
00657       std::string new_name = name;
00658       if (name.size() - name.rfind(".bz2") == 4)
00659         new_name.erase(new_name.end() - 4, new_name.end());
00660   
00661       // New scope so that io will close before we try to zip the file
00662       {
00663         // Write the file based on extension
00664         if (new_name.rfind(".dat") < new_name.size())
00665           TecplotIO(*this).write (new_name);
00666         
00667         else if (new_name.rfind(".plt") < new_name.size())
00668           TecplotIO(*this,true).write (new_name);
00669         
00670         else if (new_name.rfind(".ucd") < new_name.size())
00671           UCDIO (*this).write (new_name);
00672         
00673         else if (new_name.rfind(".gmv") < new_name.size())
00674           if (this->n_partitions() > 1)
00675             GMVIO(*this).write (new_name);
00676           else
00677             {
00678               GMVIO io(*this);
00679               io.partitioning() = false;
00680               io.write (new_name);
00681             }
00682         
00683         else if (new_name.rfind(".ugrid") < new_name.size())
00684           DivaIO(*this).write(new_name);
00685         else if (new_name.rfind(".exd") < new_name.size() ||
00686                  new_name.rfind(".e") < new_name.size())
00687           ExodusII_IO(*this).write(new_name);
00688         else if (new_name.rfind(".mgf")  < new_name.size())
00689           LegacyXdrIO(*this,true).write_mgf(new_name);
00690         
00691         else if (new_name.rfind(".unv") < new_name.size())
00692           {
00693             if (mesh_data == NULL)
00694               {
00695                 std::cerr << "Error! You must pass a "
00696                           << "valid MeshData pointer to "
00697                           << "write UNV files!" << std::endl;
00698                 libmesh_error();
00699               }
00700             UNVIO(*this, *mesh_data).write (new_name);
00701           }
00702         
00703         else if (new_name.rfind(".mesh") < new_name.size())
00704           MEDITIO(*this).write (new_name);
00705         
00706         else if (new_name.rfind(".poly") < new_name.size())
00707           TetGenIO(*this).write (new_name);
00708         
00709         else if (new_name.rfind(".msh") < new_name.size())
00710           GmshIO(*this).write (new_name);
00711         
00712         else if (new_name.rfind(".fro") < new_name.size())
00713           FroIO(*this).write (new_name);
00714         
00715         else if (new_name.rfind(".vtu") < new_name.size())
00716           VTKIO(*this).write (new_name);
00717         
00718         else
00719           {
00720             std::cerr << " ERROR: Unrecognized file extension: " << name
00721                       << "\n   I understand the following:\n\n"
00722                       << "     *.dat   -- Tecplot ASCII file\n"
00723                       << "     *.e     -- Sandia's ExodusII format\n"
00724                       << "     *.exd   -- Sandia's ExodusII format\n"
00725                       << "     *.fro   -- ACDL's surface triangulation file\n"
00726                       << "     *.gmv   -- LANL's GMV (General Mesh Viewer) format\n"
00727                       << "     *.mesh  -- MEdit mesh format\n"
00728                       << "     *.mgf   -- MGF binary mesh format\n"
00729                       << "     *.msh   -- GMSH ASCII file\n"
00730                       << "     *.plt   -- Tecplot binary file\n"
00731                       << "     *.poly  -- TetGen ASCII file\n"
00732                       << "     *.ucd   -- AVS's ASCII UCD format\n"
00733                       << "     *.ugrid -- Kelly's DIVA ASCII format\n"
00734                       << "     *.unv   -- I-deas Universal format\n"
00735                       << "     *.xda   -- libMesh ASCII format\n"
00736                       << "     *.xdr   -- libMesh binary format,\n"
00737                       << std::endl
00738                       << "\n Exiting without writing output\n";
00739           }    
00740       }
00741   
00742       // Nasty hack for reading/writing zipped files
00743       if (name.size() - name.rfind(".bz2") == 4)
00744         {
00745           START_LOG("system(bzip2)", "Mesh");
00746           if (libMesh::processor_id() == 0)
00747             {
00748               std::string system_string = "bzip2 -f ";
00749               system_string += new_name;
00750               if (std::system(system_string.c_str()))
00751                 libmesh_file_error(system_string);
00752             }
00753           Parallel::barrier();
00754           STOP_LOG("system(bzip2)", "Mesh");
00755         }
00756       
00757       STOP_LOG("write()", "Mesh");
00758     }  
00759 }


Friends And Related Function Documentation

friend class BoundaryInfo [friend, inherited]

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

Definition at line 728 of file mesh_base.h.

void MeshTools::Private::fix_broken_node_and_element_numbering ( ParallelMesh  )  [friend, inherited]

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

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

Definition at line 250 of file mesh_base.C.

00251 {
00252   m.print_info(os);
00253   return os;
00254 }

friend class Partitioner [friend, inherited]

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

Definition at line 722 of file mesh_base.h.


Member Data Documentation

unsigned int MeshBase::_dim [protected, inherited]

mapvector<Elem*> ParallelMesh::_elements [protected, inherited]

The elements in the mesh.

Definition at line 375 of file parallel_mesh.h.

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

bool MeshBase::_is_prepared [protected, inherited]

bool ParallelMesh::_is_serial [protected, inherited]

A boolean remembering whether we're serialized or not

Definition at line 380 of file parallel_mesh.h.

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

unsigned int ParallelMesh::_n_nodes [protected, inherited]

unsigned int MeshBase::_n_parts [protected, inherited]

The number of partitions the mesh has. This is set by the partitioners, and may not be changed directly by the user. **NOTE** The number of partitions *need not* equal libMesh::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 689 of file mesh_base.h.

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

unsigned int ParallelMesh::_next_free_local_node_id [protected, inherited]

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

Definition at line 391 of file parallel_mesh.h.

Referenced by ParallelMesh::add_node(), ParallelMesh::clear(), and ParallelMesh::renumber_nodes_and_elements().

AutoPtr<Partitioner> MeshBase::_partitioner [protected, inherited]

A partitioner to use at each prepare_for_use().

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

Definition at line 716 of file mesh_base.h.

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

AutoPtr<PointLocatorBase> MeshBase::_point_locator [mutable, protected, inherited]

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

Definition at line 708 of file mesh_base.h.

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


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

Site Created By: libMesh Developers
Last modified: November 25 2009 03:43:56.

Hosted By:
SourceForge.net Logo