libMesh::UnstructuredMesh Class Reference

#include <unstructured_mesh.h>

Inheritance diagram for libMesh::UnstructuredMesh:

List of all members.

Public Types

typedef Predicates::multi_predicate Predicate

Public Member Functions

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

Public Attributes

AutoPtr< BoundaryInfoboundary_info

Protected Member Functions

unsigned int & set_n_partitions ()

Protected Attributes

unsigned int _n_parts
unsigned int _dim
bool _is_prepared
AutoPtr< PointLocatorBase_point_locator
AutoPtr< Partitioner_partitioner
bool _skip_partitioning
bool _skip_renumber_nodes_and_elements
std::map< subdomain_id_type,
std::string > 
_block_id_to_name

Friends

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

Detailed Description

The UnstructuredMesh class is derived from the MeshBase class. The user will typically want to instantiate and use the Mesh class in her applications, which is currently a simple derived class of UnstructuredMesh. In order to use the adaptive mesh refinment capabilities of the library, first instantiate a MeshRefinement object with a reference to this class. Then call the appropriate refinement functions from that object. To interact with the boundary, instantiate a BoundaryMesh with a reference to this class, and then use that object's functionality.

Definition at line 51 of file unstructured_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 610 of file mesh_base.h.


Constructor & Destructor Documentation

libMesh::UnstructuredMesh::UnstructuredMesh ( unsigned int  dim = 1  )  [explicit]

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

Definition at line 81 of file unstructured_mesh.C.

References libMesh::initialized().

00081                                                   :
00082   MeshBase (d)
00083 {
00084   libmesh_assert (libMesh::initialized());
00085 }

libMesh::UnstructuredMesh::~UnstructuredMesh (  )  [virtual]

Destructor.

Definition at line 194 of file unstructured_mesh.C.

References libMesh::closed().

00195 {
00196 //  this->clear ();  // Nothing to clear at this level
00197 
00198   libmesh_assert (!libMesh::closed());
00199 }


Member Function Documentation

virtual const_element_iterator libMesh::MeshBase::active_elements_begin (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_elements_begin (  )  [pure virtual, inherited]

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::SFCPartitioner::_do_partition(), libMesh::MetisPartitioner::_do_partition(), libMesh::LinearPartitioner::_do_partition(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_side_list_from_node_list(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::Modification::distort(), DMLibMeshSetSystem(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::PointLocatorTree::enable_out_of_mesh_mode(), libMesh::LocationMap< T >::fill(), libMesh::MeshTools::find_boundary_nodes(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshTools::Modification::flatten(), libMesh::PointLocatorList::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_discontinuous(), libMesh::DofMap::invalidate_dofs(), libMesh::MeshTools::libmesh_assert_valid_elem_ids(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::MeshBase::n_active_sub_elem(), libMesh::PointLocatorTree::operator()(), libMesh::System::read_legacy_data(), libMesh::GmshIO::read_mesh(), libMesh::VariationalMeshSmoother::readgr(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::DofMap::reinit(), libMesh::Partitioner::set_node_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshBase::subdomain_ids(), libMesh::Tree< N >::Tree(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::MeshRefinement::uniformly_p_coarsen(), libMesh::MeshRefinement::uniformly_p_refine(), libMesh::MeshRefinement::uniformly_refine(), libMesh::TetGenIO::write(), libMesh::PostscriptIO::write(), libMesh::FroIO::write(), libMesh::TecplotIO::write_ascii(), libMesh::MEDITIO::write_ascii(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::TecplotIO::write_binary(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elements_discontinuous(), libMesh::GmshIO::write_mesh(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates_discontinuous(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::GmshIO::write_post(), and libMesh::GnuPlotIO::write_solution().

virtual const_element_iterator libMesh::MeshBase::active_elements_end (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_elements_end (  )  [pure virtual, inherited]

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::SFCPartitioner::_do_partition(), libMesh::MetisPartitioner::_do_partition(), libMesh::LinearPartitioner::_do_partition(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_side_list_from_node_list(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::Modification::distort(), DMLibMeshSetSystem(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::PointLocatorTree::enable_out_of_mesh_mode(), libMesh::LocationMap< T >::fill(), libMesh::MeshTools::find_boundary_nodes(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshTools::Modification::flatten(), libMesh::PointLocatorList::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_discontinuous(), libMesh::DofMap::invalidate_dofs(), libMesh::MeshTools::libmesh_assert_valid_elem_ids(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::MeshBase::n_active_sub_elem(), libMesh::PointLocatorTree::operator()(), libMesh::System::read_legacy_data(), libMesh::GmshIO::read_mesh(), libMesh::VariationalMeshSmoother::readgr(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::DofMap::reinit(), libMesh::Partitioner::set_node_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshBase::subdomain_ids(), libMesh::Tree< N >::Tree(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::MeshRefinement::uniformly_p_coarsen(), libMesh::MeshRefinement::uniformly_p_refine(), libMesh::MeshRefinement::uniformly_refine(), libMesh::TetGenIO::write(), libMesh::PostscriptIO::write(), libMesh::FroIO::write(), libMesh::TecplotIO::write_ascii(), libMesh::MEDITIO::write_ascii(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::TecplotIO::write_binary(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elements_discontinuous(), libMesh::GmshIO::write_mesh(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates_discontinuous(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::GmshIO::write_post(), and libMesh::GnuPlotIO::write_solution().

virtual const_element_iterator libMesh::MeshBase::active_local_elements_begin (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_local_elements_begin (  )  [pure virtual, inherited]

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::FEMSystem::assemble_qoi(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::EquationSystems::build_solution_vector(), libMesh::DofMap::build_sparsity(), libMesh::System::calculate_norm(), libMesh::VTKIO::cells_to_vtk(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::MeshTools::find_hanging_nodes_and_parents(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::EquationSystems::get_solution(), libMesh::SystemSubsetBySubdomain::init(), libMesh::LaplaceMeshSmoother::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::System::local_dof_indices(), libMesh::DofMap::max_constraint_error(), libMesh::FEMSystem::mesh_position_get(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshTools::n_active_local_levels(), libMesh::ErrorVector::plot_error(), libMesh::FEMSystem::postprocess(), libMesh::System::project_vector(), libMesh::HPSingularity::select_refinement(), libMesh::HPCoarsenTest::select_refinement(), libMesh::Nemesis_IO_Helper::write_exodus_initialization_info(), libMesh::EnsightIO::write_geometry_ascii(), libMesh::EnsightIO::write_scalar_ascii(), libMesh::EnsightIO::write_vector_ascii(), and libMesh::System::zero_variable().

virtual const_element_iterator libMesh::MeshBase::active_local_elements_end (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_local_elements_end (  )  [pure virtual, inherited]

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::FEMSystem::assemble_qoi(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::EquationSystems::build_solution_vector(), libMesh::DofMap::build_sparsity(), libMesh::System::calculate_norm(), libMesh::VTKIO::cells_to_vtk(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::MeshTools::find_hanging_nodes_and_parents(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::EquationSystems::get_solution(), libMesh::SystemSubsetBySubdomain::init(), libMesh::LaplaceMeshSmoother::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::System::local_dof_indices(), libMesh::DofMap::max_constraint_error(), libMesh::FEMSystem::mesh_position_get(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshTools::n_active_local_levels(), libMesh::ErrorVector::plot_error(), libMesh::FEMSystem::postprocess(), libMesh::HPSingularity::select_refinement(), libMesh::HPCoarsenTest::select_refinement(), libMesh::Nemesis_IO_Helper::write_exodus_initialization_info(), libMesh::EnsightIO::write_geometry_ascii(), libMesh::EnsightIO::write_scalar_ascii(), libMesh::EnsightIO::write_vector_ascii(), and libMesh::System::zero_variable().

virtual const_element_iterator libMesh::MeshBase::active_local_subdomain_elements_begin ( const subdomain_id_type  subdomain_id  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_local_subdomain_elements_begin ( const subdomain_id_type  subdomain_id  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::active_local_subdomain_elements_end ( const subdomain_id_type  subdomain_id  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_local_subdomain_elements_end ( const subdomain_id_type  subdomain_id  )  [pure virtual, inherited]
virtual const_node_iterator libMesh::MeshBase::active_nodes_begin (  )  const [pure virtual, inherited]
virtual node_iterator libMesh::MeshBase::active_nodes_begin (  )  [pure virtual, inherited]
virtual const_node_iterator libMesh::MeshBase::active_nodes_end (  )  const [pure virtual, inherited]
virtual node_iterator libMesh::MeshBase::active_nodes_end (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::active_not_local_elements_begin (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_not_local_elements_begin (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::active_not_local_elements_end (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_not_local_elements_end (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::active_pid_elements_begin ( const processor_id_type  proc_id  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_pid_elements_begin ( const processor_id_type  proc_id  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::active_pid_elements_end ( const processor_id_type  proc_id  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_pid_elements_end ( const processor_id_type  proc_id  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::active_subdomain_elements_begin ( const subdomain_id_type  subdomain_id  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_subdomain_elements_begin ( const subdomain_id_type  subdomain_id  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::active_subdomain_elements_end ( const subdomain_id_type  subdomain_id  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_subdomain_elements_end ( const subdomain_id_type  subdomain_id  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::active_type_elements_begin ( const ElemType  type  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_type_elements_begin ( const ElemType  type  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::active_type_elements_end ( const ElemType  type  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::active_type_elements_end ( const ElemType  type  )  [pure virtual, inherited]
virtual Node* libMesh::MeshBase::add_node ( Node n  )  [pure virtual, inherited]

Add Node n to the end of the vertex array.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::mesh_inserter_iterator< T >::operator=().

virtual Node* libMesh::MeshBase::add_point ( const Point p,
const dof_id_type  id = DofObject::invalid_id,
const processor_id_type  proc_id = DofObject::invalid_processor_id 
) [pure virtual, inherited]
void libMesh::UnstructuredMesh::all_first_order (  )  [virtual]

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

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

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

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

Implements libMesh::MeshBase.

Definition at line 254 of file mesh_modification.C.

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

00255 {
00256   /*
00257    * when the mesh is not prepared,
00258    * at least renumber the nodes and
00259    * elements, so that the node ids
00260    * are correct
00261    */
00262   if (!this->_is_prepared)
00263     this->renumber_nodes_and_elements ();
00264 
00265   START_LOG("all_first_order()", "Mesh");
00266 
00270   std::vector<bool> node_touched_by_me(this->max_node_id(), false);
00271 
00277   element_iterator endit = elements_end();
00278   for (element_iterator it = elements_begin();
00279        it != endit; ++it)
00280     {
00281       Elem* so_elem = *it;
00282 
00283       libmesh_assert(so_elem);
00284 
00285       /*
00286        * build the first-order equivalent, add to
00287        * the new_elements list.
00288        */
00289       Elem* lo_elem = Elem::build
00290         (Elem::first_order_equivalent_type
00291           (so_elem->type()), so_elem->parent()).release();
00292 
00293       for (unsigned int s=0; s != so_elem->n_sides(); ++s)
00294         if (so_elem->neighbor(s) == remote_elem)
00295           lo_elem->set_neighbor(s, const_cast<RemoteElem*>(remote_elem));
00296 
00297 #ifdef LIBMESH_ENABLE_AMR
00298       /*
00299        * Reset the parent links of any child elements
00300        */
00301       if (so_elem->has_children())
00302         for (unsigned int c=0; c != so_elem->n_children(); ++c)
00303           {
00304             so_elem->child(c)->set_parent(lo_elem);
00305             lo_elem->add_child(so_elem->child(c), c);
00306           }
00307 
00308       /*
00309        * Reset the child link of any parent element
00310        */
00311       if (so_elem->parent())
00312         {
00313           unsigned int c =
00314             so_elem->parent()->which_child_am_i(so_elem);
00315           lo_elem->parent()->replace_child(lo_elem, c);
00316         }
00317 
00318       /*
00319        * Copy as much data to the new element as makes sense
00320        */
00321       lo_elem->set_p_level(so_elem->p_level());
00322       lo_elem->set_refinement_flag(so_elem->refinement_flag());
00323       lo_elem->set_p_refinement_flag(so_elem->p_refinement_flag());
00324 #endif
00325 
00326       libmesh_assert_equal_to (lo_elem->n_vertices(), so_elem->n_vertices());
00327 
00328       /*
00329        * By definition the vertices of the linear and
00330        * second order element are identically numbered.
00331        * transfer these.
00332        */
00333       for (unsigned int v=0; v < so_elem->n_vertices(); v++)
00334         {
00335           lo_elem->set_node(v) = so_elem->get_node(v);
00336           node_touched_by_me[lo_elem->node(v)] = true;
00337         }
00338 
00345       libmesh_assert_equal_to (lo_elem->n_sides(), so_elem->n_sides());
00346 
00347       for (unsigned int s=0; s<so_elem->n_sides(); s++)
00348         {
00349           const std::vector<boundary_id_type> boundary_ids =
00350             this->boundary_info->raw_boundary_ids (so_elem, s);
00351 
00352           this->boundary_info->add_side (lo_elem, s, boundary_ids);
00353         }
00354 
00355       /*
00356        * The new first-order element is ready.
00357        * Inserting it into the mesh will replace and delete
00358        * the second-order element.
00359        */
00360       lo_elem->set_id(so_elem->id());
00361       lo_elem->processor_id() = so_elem->processor_id();
00362       lo_elem->subdomain_id() = so_elem->subdomain_id();
00363       this->insert_elem(lo_elem);
00364     }
00365 
00366   const MeshBase::node_iterator nd_end = this->nodes_end();
00367   MeshBase::node_iterator nd = this->nodes_begin();
00368     while (nd != nd_end)
00369     {
00370       Node *the_node = *nd;
00371       ++nd;
00372       if (!node_touched_by_me[the_node->id()])
00373         this->delete_node(the_node);
00374     }
00375 
00376   STOP_LOG("all_first_order()", "Mesh");
00377 
00378   // On hanging nodes that used to also be second order nodes, we
00379   // might now have an invalid nodal processor_id()
00380   Partitioner::set_node_processor_ids(*this);
00381 
00382   // delete or renumber nodes, etc
00383   this->prepare_for_use(/*skip_renumber =*/ false);
00384 }

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

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

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

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

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

Implements libMesh::MeshBase.

Definition at line 388 of file mesh_modification.C.

References libMesh::MeshBase::_is_prepared, libMesh::MeshBase::add_point(), libMesh::MeshBase::boundary_info, libMesh::Elem::build(), libMesh::CommWorld, libMesh::Elem::default_order(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::err, libMeshEnums::FIRST, libMesh::Elem::get_node(), libMesh::DofObject::id(), libMesh::MeshBase::insert_elem(), libMesh::DofObject::invalid_id, libMesh::MeshBase::is_serial(), libMesh::Elem::level(), libMesh::Parallel::Communicator::max(), libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::Elem::n_sides(), libMesh::Elem::n_vertices(), libMesh::Elem::neighbor(), libMesh::MeshBase::node(), libMesh::MeshBase::point(), libMesh::MeshBase::prepare_for_use(), libMesh::DofObject::processor_id(), libMesh::MeshBase::processor_id(), libMesh::Real, libMesh::AutoPtr< Tp >::release(), libMesh::remote_elem, libMesh::MeshBase::renumber_nodes_and_elements(), libMesh::MeshBase::reserve_nodes(), libMesh::Elem::second_order_equivalent_type(), libMesh::Elem::subdomain_id(), and libMesh::Elem::type().

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

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

virtual void libMesh::MeshBase::allgather (  )  [inline, virtual, inherited]

Gathers all elements and nodes of the mesh onto every processor

Reimplemented in libMesh::ParallelMesh.

Definition at line 129 of file mesh_base.h.

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

00129 {}

bool libMesh::MeshBase::allow_renumbering (  )  const [inline, inherited]
void libMesh::MeshBase::allow_renumbering ( bool  allow  )  [inline, inherited]

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

Definition at line 501 of file mesh_base.h.

References libMesh::MeshBase::_skip_renumber_nodes_and_elements.

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

virtual const_element_iterator libMesh::MeshBase::ancestor_elements_begin (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::ancestor_elements_begin (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::ancestor_elements_end (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::ancestor_elements_end (  )  [pure virtual, inherited]
void libMesh::MeshBase::clear_point_locator (  )  [inherited]

Releases the current PointLocator object.

Definition at line 379 of file mesh_base.C.

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

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

00380 {
00381   _point_locator.reset(NULL);
00382 }

virtual AutoPtr<MeshBase> libMesh::MeshBase::clone (  )  const [pure virtual, inherited]

Virtual "copy constructor"

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::ErrorVector::plot_error().

bool libMesh::UnstructuredMesh::contract (  )  [virtual]

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

Implements libMesh::MeshBase.

Definition at line 1064 of file unstructured_mesh.C.

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

01065 {
01066   START_LOG ("contract()", "Mesh");
01067 
01068   // Flag indicating if this call actually changes the mesh
01069   bool mesh_changed = false;
01070 
01071   element_iterator in        = elements_begin();
01072   const element_iterator end = elements_end();
01073 
01074 #ifdef DEBUG
01075   for ( ; in != end; ++in)
01076     if (*in != NULL)
01077       {
01078         Elem* el = *in;
01079         libmesh_assert(el->active() || el->subactive() || el->ancestor());
01080       }
01081   in = elements_begin();
01082 #endif
01083 
01084   // Loop over the elements.
01085   for ( ; in != end; ++in)
01086     if (*in != NULL)
01087       {
01088         Elem* el = *in;
01089 
01090         // Delete all the subactive ones
01091         if (el->subactive())
01092           {
01093             // No level-0 element should be subactive.
01094             // Note that we CAN'T test elem->level(), as that
01095             // touches elem->parent()->dim(), and elem->parent()
01096             // might have already been deleted!
01097             libmesh_assert(el->parent());
01098 
01099             // Delete the element
01100             // This just sets a pointer to NULL, and doesn't
01101             // invalidate any iterators
01102             this->delete_elem(el);
01103 
01104             // the mesh has certainly changed
01105             mesh_changed = true;
01106           }
01107         else
01108           {
01109             // Compress all the active ones
01110             if (el->active())
01111               el->contract();
01112             else
01113               libmesh_assert (el->ancestor());
01114           }
01115       }
01116 
01117   // Strip any newly-created NULL voids out of the element array
01118   this->renumber_nodes_and_elements();
01119 
01120   // FIXME: Need to understand why deleting subactive children
01121   // invalidates the point locator.  For now we will clear it explicitly
01122   this->clear_point_locator();
01123 
01124   STOP_LOG ("contract()", "Mesh");
01125 
01126   return mesh_changed;
01127 }

void libMesh::UnstructuredMesh::copy_nodes_and_elements ( const UnstructuredMesh other_mesh  )  [virtual]

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

Definition at line 90 of file unstructured_mesh.C.

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

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

00091 {
00092   // We're assuming our subclass data needs no copy
00093   libmesh_assert_equal_to (_n_parts, other_mesh._n_parts);
00094   libmesh_assert_equal_to (_dim, other_mesh._dim);
00095   libmesh_assert_equal_to (_is_prepared, other_mesh._is_prepared);
00096 
00097   // We're assuming the other mesh has proper element number ordering,
00098   // so that we add parents before their children.
00099 #ifdef DEBUG
00100   MeshTools::libmesh_assert_valid_amr_elem_ids(other_mesh);
00101 #endif
00102 
00103   //Copy in Nodes
00104   {
00105     //Preallocate Memory if necessary
00106     this->reserve_nodes(other_mesh.n_nodes());
00107 
00108     const_node_iterator it = other_mesh.nodes_begin();
00109     const_node_iterator end = other_mesh.nodes_end();
00110 
00111     for (; it != end; ++it)
00112       {
00113         const Node *oldn = *it;
00114 
00115         // Add new nodes in old node Point locations
00116         /*Node *newn =*/ this->add_point(*oldn, oldn->id(), oldn->processor_id());
00117 
00118         // And start them off in the same subdomain
00119 //        newn->processor_id() = oldn->processor_id();
00120       }
00121   }
00122 
00123   //Copy in Elements
00124   {
00125     //Preallocate Memory if necessary
00126     this->reserve_elem(other_mesh.n_elem());
00127 
00128     // Loop over the elements
00129     MeshBase::const_element_iterator it = other_mesh.elements_begin();
00130     const MeshBase::const_element_iterator end = other_mesh.elements_end();
00131 
00132     // FIXME: Where do we set element IDs??
00133     for (; it != end; ++it)
00134     {
00135       //Look at the old element
00136       const Elem *old = *it;
00137       //Build a new element
00138       Elem *newparent = old->parent() ?
00139           this->elem(old->parent()->id()) : NULL;
00140       AutoPtr<Elem> ap = Elem::build(old->type(), newparent);
00141       Elem * el = ap.release();
00142 
00143       el->subdomain_id() = old->subdomain_id();
00144 
00145       for (unsigned int s=0; s != old->n_sides(); ++s)
00146         if (old->neighbor(s) == remote_elem)
00147           el->set_neighbor(s, const_cast<RemoteElem*>(remote_elem));
00148 
00149 #ifdef LIBMESH_ENABLE_AMR
00150       if (old->has_children())
00151         for (unsigned int c=0; c != old->n_children(); ++c)
00152           if (old->child(c) == remote_elem)
00153             el->add_child(const_cast<RemoteElem*>(remote_elem), c);
00154 
00155       //Create the parent's child pointers if necessary
00156       if (newparent)
00157         {
00158           unsigned int oldc = old->parent()->which_child_am_i(old);
00159           newparent->add_child(el, oldc);
00160         }
00161 
00162       // Copy the refinement flags
00163       el->set_refinement_flag(old->refinement_flag());
00164       el->set_p_refinement_flag(old->p_refinement_flag());
00165 #endif // #ifdef LIBMESH_ENABLE_AMR
00166 
00167       //Assign all the nodes
00168       for(unsigned int i=0;i<el->n_nodes();i++)
00169         el->set_node(i) = &this->node(old->node(i));
00170 
00171       // And start it off in the same subdomain
00172       el->processor_id() = old->processor_id();
00173 
00174       // Give it the same id
00175       el->set_id(old->id());
00176 
00177       //Hold onto it
00178       this->add_elem(el);
00179     }
00180   }
00181 
00182   //Finally prepare the new Mesh for use.  Keep the same numbering and
00183   //partitioning but also the same renumbering and partitioning
00184   //policies as our source mesh.
00185   this->allow_renumbering(false);
00186   this->skip_partitioning(true);
00187   this->prepare_for_use();
00188   this->allow_renumbering(other_mesh.allow_renumbering());
00189   this->skip_partitioning(other_mesh.skip_partitioning());
00190 }

void libMesh::UnstructuredMesh::create_pid_mesh ( UnstructuredMesh pid_mesh,
const processor_id_type  pid 
) const

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

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

00932 {
00933 
00934   // Issue a warning if the number the number of processors
00935   // currently available is less that that requested for
00936   // partitioning.  This is not necessarily an error since
00937   // you may run on one processor and still partition the
00938   // mesh into several partitions.
00939 #ifdef DEBUG
00940   if (this->n_processors() < pid)
00941     {
00942       libMesh::out << "WARNING:  You are creating a "
00943                     << "mesh for a processor id (="
00944                     << pid
00945                     << ") greater than "
00946                     << "the number of processors available for "
00947                     << "the calculation. (="
00948                     << libMesh::n_processors()
00949                     << ")."
00950                     << std::endl;
00951     }
00952 #endif
00953 
00954   // Create iterators to loop over the list of elements
00955 //   const_active_pid_elem_iterator       it(this->elements_begin(),   pid);
00956 //   const const_active_pid_elem_iterator it_end(this->elements_end(), pid);
00957 
00958   const_element_iterator       it     = this->active_pid_elements_begin(pid);
00959   const const_element_iterator it_end = this->active_pid_elements_end(pid);
00960 
00961   this->create_submesh (pid_mesh, it, it_end);
00962 }

void libMesh::UnstructuredMesh::create_submesh ( UnstructuredMesh new_mesh,
const_element_iterator it,
const const_element_iterator it_end 
) const

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

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

Referenced by create_pid_mesh().

00973 {
00974   // Just in case the subdomain_mesh already has some information
00975   // in it, get rid of it.
00976   new_mesh.clear();
00977 
00978   // Fail if (*this == new_mesh), we cannot create a submesh inside ourself!
00979   // This may happen if the user accidently passes the original mesh into
00980   // this function!  We will check this by making sure we did not just
00981   // clear ourself.
00982   libmesh_assert_not_equal_to (this->n_nodes(), 0);
00983   libmesh_assert_not_equal_to (this->n_elem(), 0);
00984 
00985   // How the nodes on this mesh will be renumbered to nodes
00986   // on the new_mesh.
00987   std::vector<dof_id_type> new_node_numbers (this->n_nodes());
00988 
00989   std::fill (new_node_numbers.begin(),
00990              new_node_numbers.end(),
00991              libMesh::invalid_uint);
00992 
00993 
00994 
00995   // the number of nodes on the new mesh, will be incremented
00996   dof_id_type n_new_nodes = 0;
00997   dof_id_type n_new_elem  = 0;
00998 
00999   for (; it != it_end; ++it)
01000     {
01001       // increment the new element counter
01002       n_new_elem++;
01003 
01004       const Elem* old_elem = *it;
01005 
01006       // Add an equivalent element type to the new_mesh
01007       Elem* new_elem =
01008         new_mesh.add_elem (Elem::build(old_elem->type()).release());
01009 
01010       libmesh_assert(new_elem);
01011 
01012       // Loop over the nodes on this element.
01013       for (unsigned int n=0; n<old_elem->n_nodes(); n++)
01014         {
01015           libmesh_assert_less (old_elem->node(n), new_node_numbers.size());
01016 
01017           if (new_node_numbers[old_elem->node(n)] == libMesh::invalid_uint)
01018             {
01019               new_node_numbers[old_elem->node(n)] = n_new_nodes;
01020 
01021               // Add this node to the new mesh
01022               new_mesh.add_point (old_elem->point(n));
01023 
01024               // Increment the new node counter
01025               n_new_nodes++;
01026             }
01027 
01028           // Define this element's connectivity on the new mesh
01029           libmesh_assert_less (new_node_numbers[old_elem->node(n)], new_mesh.n_nodes());
01030 
01031           new_elem->set_node(n) = new_mesh.node_ptr (new_node_numbers[old_elem->node(n)]);
01032         }
01033 
01034       // Copy ids for this element
01035       new_elem->subdomain_id() = old_elem->subdomain_id();
01036       new_elem->processor_id() = old_elem->processor_id();
01037 
01038       // Maybe add boundary conditions for this element
01039       for (unsigned int s=0; s<old_elem->n_sides(); s++)
01040 // We're supporting boundary ids on internal sides now
01041 //      if (old_elem->neighbor(s) == NULL)
01042           {
01043             const std::vector<boundary_id_type>& bc_ids = this->boundary_info->boundary_ids(old_elem, s);
01044             for (std::vector<boundary_id_type>::const_iterator id_it=bc_ids.begin(); id_it!=bc_ids.end(); ++id_it)
01045               {
01046                 const boundary_id_type bc_id = *id_it;
01047                 if (bc_id != this->boundary_info->invalid_id)
01048                 new_mesh.boundary_info->add_side (new_elem,
01049                                                   s,
01050                                                   bc_id);
01051               }
01052           }
01053     } // end loop over elements
01054 
01055 
01056   // Prepare the new_mesh for use
01057   new_mesh.prepare_for_use(/*skip_renumber =*/false);
01058 
01059 }

virtual void libMesh::MeshBase::delete_elem ( Elem e  )  [pure 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.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::MeshTools::Modification::all_tri(), libMesh::MeshTools::Generation::build_cube(), contract(), libMesh::TetGenMeshInterface::delete_2D_hull_elements(), libMesh::MeshTools::Modification::flatten(), and libMesh::TetGenMeshInterface::pointset_convexhull().

virtual void libMesh::MeshBase::delete_node ( Node n  )  [pure virtual, inherited]

Removes the Node n from the mesh.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by all_first_order().

virtual void libMesh::MeshBase::delete_remote_elements (  )  [inline, virtual, inherited]

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

Reimplemented in libMesh::ParallelMesh.

Definition at line 136 of file mesh_base.h.

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

00136 {}

virtual Elem* libMesh::MeshBase::elem ( const dof_id_type  i  )  [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

virtual const_element_iterator libMesh::MeshBase::elements_begin (  )  const [pure virtual, inherited]

const Elem iterator accessor functions.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

virtual element_iterator libMesh::MeshBase::elements_begin (  )  [pure virtual, inherited]

Elem iterator accessor functions. These must be defined in Concrete base classes.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::EquationSystems::_add_system_to_nodes_and_elems(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::add_p_to_h_refinement(), libMesh::VariationalMeshSmoother::adjust_adapt_data(), all_first_order(), all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::EquationSystems::allgather(), libMesh::MeshData::assign(), libMesh::MeshCommunication::assign_global_indices(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshTools::build_nodes_to_elem_map(), libMesh::MeshTools::Modification::change_subdomain_id(), libMesh::TetGenMeshInterface::check_hull_integrity(), libMesh::MeshRefinement::clean_refinement_flags(), libMesh::MeshRefinement::coarsen_elements(), libMesh::CentroidPartitioner::compute_centroids(), contract(), copy_nodes_and_elements(), libMesh::DofMap::create_dof_constraints(), libMesh::TetGenMeshInterface::delete_2D_hull_elements(), libMesh::DofMap::distribute_dofs(), libMesh::MeshTools::elem_types(), libMesh::UNVIO::element_out(), find_neighbors(), libMesh::MeshTools::Modification::flatten(), libMesh::MeshTools::get_not_subactive_node_ids(), libMesh::EquationSystems::init(), libMesh::MeshTools::libmesh_assert_connected_nodes(), libMesh::MeshTools::libmesh_assert_equal_n_systems(), libMesh::MeshTools::libmesh_assert_no_links_to_elem(), libMesh::MeshTools::libmesh_assert_old_dof_objects(), libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_node_pointers(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_refinement_tree(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshBase::n_sub_elem(), libMesh::TetGenMeshInterface::pointset_convexhull(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::EquationSystems::reinit(), libMesh::DofMap::reinit(), libMesh::Partitioner::single_partition(), libMesh::MeshRefinement::switch_h_to_p_refinement(), libMesh::BoundaryInfo::sync(), libMesh::MeshTools::total_weight(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::UCDIO::write_interior_elems(), and libMesh::LegacyXdrIO::write_mesh().

virtual const_element_iterator libMesh::MeshBase::elements_end (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::elements_end (  )  [pure virtual, inherited]

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::EquationSystems::_add_system_to_nodes_and_elems(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::add_p_to_h_refinement(), libMesh::VariationalMeshSmoother::adjust_adapt_data(), all_first_order(), all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::EquationSystems::allgather(), libMesh::MeshData::assign(), libMesh::MeshCommunication::assign_global_indices(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshTools::build_nodes_to_elem_map(), libMesh::MeshTools::Modification::change_subdomain_id(), libMesh::TetGenMeshInterface::check_hull_integrity(), libMesh::MeshRefinement::clean_refinement_flags(), libMesh::MeshRefinement::coarsen_elements(), libMesh::CentroidPartitioner::compute_centroids(), contract(), copy_nodes_and_elements(), libMesh::DofMap::create_dof_constraints(), libMesh::TetGenMeshInterface::delete_2D_hull_elements(), libMesh::DofMap::distribute_dofs(), libMesh::MeshTools::elem_types(), libMesh::UNVIO::element_out(), find_neighbors(), libMesh::MeshTools::Modification::flatten(), libMesh::MeshTools::get_not_subactive_node_ids(), libMesh::EquationSystems::init(), libMesh::MeshTools::libmesh_assert_connected_nodes(), libMesh::MeshTools::libmesh_assert_equal_n_systems(), libMesh::MeshTools::libmesh_assert_no_links_to_elem(), libMesh::MeshTools::libmesh_assert_old_dof_objects(), libMesh::MeshTools::libmesh_assert_valid_amr_elem_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_node_pointers(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_refinement_tree(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshBase::n_sub_elem(), libMesh::TetGenMeshInterface::pointset_convexhull(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::EquationSystems::reinit(), libMesh::DofMap::reinit(), libMesh::Partitioner::single_partition(), libMesh::MeshRefinement::switch_h_to_p_refinement(), libMesh::BoundaryInfo::sync(), libMesh::MeshTools::total_weight(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::UCDIO::write_interior_elems(), and libMesh::LegacyXdrIO::write_mesh().

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

Other functions from MeshBase requiring re-definition.

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

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

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

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

Implements libMesh::MeshBase.

Definition at line 205 of file unstructured_mesh.C.

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

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

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

virtual void libMesh::MeshBase::fix_broken_node_and_element_numbering (  )  [pure virtual, inherited]

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

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::EquationSystems::_read_impl().

subdomain_id_type libMesh::MeshBase::get_id_by_name ( const std::string &  name  )  const [inherited]

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

Definition at line 406 of file mesh_base.C.

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

00407 {
00408   // This function is searching the *values* of the map (linear search)
00409   // We might want to make this more efficient...
00410   std::map<subdomain_id_type, std::string>::const_iterator
00411     iter = _block_id_to_name.begin(),
00412     end_iter = _block_id_to_name.end();
00413 
00414   for ( ; iter != end_iter; ++iter)
00415     {
00416       if (iter->second == name)
00417         return iter->first;
00418     }
00419 
00420   libMesh::err << "Block '" << name << "' does not exist in mesh" << std::endl;
00421   libmesh_error();
00422 }

std::string libMesh::MeshBase::get_info (  )  const [inherited]
Returns:
a string containing relevant information about the mesh.

Definition at line 270 of file mesh_base.C.

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

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

00271 {
00272   std::ostringstream oss;
00273 
00274   oss << " Mesh Information:"                                  << '\n'
00275       << "  mesh_dimension()="    << this->mesh_dimension()    << '\n'
00276       << "  spatial_dimension()=" << this->spatial_dimension() << '\n'
00277       << "  n_nodes()="           << this->n_nodes()           << '\n'
00278       << "    n_local_nodes()="   << this->n_local_nodes()     << '\n'
00279       << "  n_elem()="            << this->n_elem()            << '\n'
00280       << "    n_local_elem()="    << this->n_local_elem()      << '\n'
00281 #ifdef LIBMESH_ENABLE_AMR
00282       << "    n_active_elem()="   << this->n_active_elem()     << '\n'
00283 #endif
00284       << "  n_subdomains()="      << this->n_subdomains()      << '\n'
00285       << "  n_partitions()="      << this->n_partitions()      << '\n'
00286       << "  n_processors()="      << libMesh::n_processors()   << '\n'
00287       << "  n_threads()="         << libMesh::n_threads()      << '\n'
00288       << "  processor_id()="      << this->processor_id()      << '\n';
00289 
00290   return oss.str();
00291 }

virtual Elem* libMesh::MeshBase::insert_elem ( Elem e  )  [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by all_first_order(), and all_second_order().

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

Definition at line 115 of file mesh_base.h.

References libMesh::MeshBase::_is_prepared.

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

00116   { return _is_prepared; }

virtual const_element_iterator libMesh::MeshBase::level_elements_begin ( const unsigned int  level  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::level_elements_begin ( const unsigned int  level  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::level_elements_end ( const unsigned int  level  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::level_elements_end ( const unsigned int  level  )  [pure virtual, inherited]
virtual void libMesh::MeshBase::libmesh_assert_valid_parallel_ids (  )  const [inline, virtual, inherited]

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

Reimplemented in libMesh::ParallelMesh.

Definition at line 670 of file mesh_base.h.

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

00670 {}

virtual const_element_iterator libMesh::MeshBase::local_elements_begin (  )  const [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::local_elements_end (  )  const [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::local_level_elements_begin ( const unsigned int  level  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::local_level_elements_begin ( const unsigned int  level  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::local_level_elements_end ( const unsigned int  level  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::local_level_elements_end ( const unsigned int  level  )  [pure virtual, inherited]
virtual const_node_iterator libMesh::MeshBase::local_nodes_begin (  )  const [pure virtual, inherited]
virtual const_node_iterator libMesh::MeshBase::local_nodes_end (  )  const [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::local_not_level_elements_begin ( const unsigned int  level  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::local_not_level_elements_begin ( const unsigned int  level  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::local_not_level_elements_end ( const unsigned int  level  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::local_not_level_elements_end ( const unsigned int  level  )  [pure virtual, inherited]
virtual dof_id_type libMesh::MeshBase::max_node_id (  )  const [pure virtual, inherited]
unsigned int libMesh::MeshBase::mesh_dimension (  )  const [inline, inherited]
Returns:
the logical dimension of the mesh; i.e. the manifold dimension of the elements in the mesh. If we ever support multi-dimensional meshes (e.g. hexes and quads in the same mesh) then this will return the largest such dimension.

Definition at line 144 of file mesh_base.h.

References libMesh::MeshBase::_dim.

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

00145   { return static_cast<unsigned int>(_dim); }

dof_id_type libMesh::MeshBase::n_active_elem_on_proc ( const processor_id_type  proc  )  const [inherited]

Returns the number of active elements on processor proc.

Definition at line 231 of file mesh_base.C.

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

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

00232 {
00233   libmesh_assert_less (proc_id, libMesh::n_processors());
00234   return static_cast<dof_id_type>(std::distance (this->active_pid_elements_begin(proc_id),
00235                                                  this->active_pid_elements_end  (proc_id)));
00236 }

dof_id_type libMesh::MeshBase::n_active_local_elem (  )  const [inline, inherited]
dof_id_type libMesh::MeshBase::n_active_sub_elem (  )  const [inherited]

Same, but only counts active elements.

Definition at line 255 of file mesh_base.C.

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

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

00256 {
00257   dof_id_type ne=0;
00258 
00259   const_element_iterator       el  = this->active_elements_begin();
00260   const const_element_iterator end = this->active_elements_end();
00261 
00262   for (; el!=end; ++el)
00263     ne += (*el)->n_sub_elem();
00264 
00265   return ne;
00266 }

virtual dof_id_type libMesh::MeshBase::n_elem (  )  const [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::SFCPartitioner::_do_partition(), libMesh::CentroidPartitioner::_do_partition(), all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::MeshCommunication::assign_global_indices(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::MeshTools::build_nodes_to_elem_map(), libMesh::TetGenMeshInterface::check_hull_integrity(), libMesh::CentroidPartitioner::compute_centroids(), copy_nodes_and_elements(), create_submesh(), libMesh::MeshTools::Modification::distort(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshBase::get_info(), libMesh::EquationSystems::get_solution(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_discontinuous(), libMesh::ErrorVector::plot_error(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::AbaqusIO::read(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::HPCoarsenTest::select_refinement(), libMesh::MeshTools::subdomain_bounding_box(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::XdrIO::write(), libMesh::TetGenIO::write(), libMesh::FroIO::write(), libMesh::UNVIO::write_implementation(), libMesh::LegacyXdrIO::write_mesh(), libMesh::System::write_serialized_vectors(), and libMesh::DivaIO::write_stream().

dof_id_type libMesh::MeshBase::n_elem_on_proc ( const processor_id_type  proc  )  const [inherited]

Returns the number of elements on processor proc.

Definition at line 218 of file mesh_base.C.

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

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

00219 {
00220   // We're either counting a processor's elements or unpartitioned
00221   // elements
00222   libmesh_assert (proc_id < libMesh::n_processors() ||
00223           proc_id == DofObject::invalid_processor_id);
00224 
00225   return static_cast<dof_id_type>(std::distance (this->pid_elements_begin(proc_id),
00226                                                  this->pid_elements_end  (proc_id)));
00227 }

dof_id_type libMesh::MeshBase::n_local_elem (  )  const [inline, inherited]

Returns the number of elements on the local processor.

Definition at line 260 of file mesh_base.h.

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

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

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

dof_id_type libMesh::MeshBase::n_local_nodes (  )  const [inline, inherited]

Returns the number of nodes on the local processor.

Definition at line 186 of file mesh_base.h.

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

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

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

virtual dof_id_type libMesh::MeshBase::n_nodes (  )  const [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by all_second_order(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::MeshCommunication::assign_global_indices(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_delaunay_square(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshTools::build_nodes_to_elem_map(), libMesh::EquationSystems::build_solution_vector(), libMesh::GMVIO::copy_nodal_solution(), copy_nodes_and_elements(), create_submesh(), libMesh::MeshTools::Modification::distort(), libMesh::TetGenMeshInterface::fill_pointlist(), libMesh::MeshTools::find_boundary_nodes(), libMesh::MeshBase::get_info(), libMesh::LaplaceMeshSmoother::init(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::TreeNode< N >::insert(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::ErrorVector::plot_error(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::AbaqusIO::read(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::VariationalMeshSmoother::smooth(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshTools::Modification::smooth(), libMesh::MeshTools::subdomain_bounding_box(), libMesh::VTKIO::system_vectors_to_vtk(), libMesh::TreeNode< N >::transform_nodes_to_elements(), libMesh::MeshData::translate(), libMesh::TriangleInterface::triangulate(), libMesh::TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), libMesh::XdrIO::write(), libMesh::TetGenIO::write(), libMesh::FroIO::write(), libMesh::TecplotIO::write_ascii(), libMesh::MEDITIO::write_ascii(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::TecplotIO::write_binary(), libMesh::GMVIO::write_binary(), libMesh::UCDIO::write_header(), libMesh::UNVIO::write_implementation(), libMesh::GmshIO::write_mesh(), libMesh::GmshIO::write_post(), libMesh::XdrIO::write_serialized_nodes(), libMesh::System::write_serialized_vectors(), libMesh::UCDIO::write_soln(), libMesh::LegacyXdrIO::write_soln(), libMesh::DivaIO::write_stream(), and libMesh::VariationalMeshSmoother::writegr().

dof_id_type libMesh::MeshBase::n_nodes_on_proc ( const processor_id_type  proc  )  const [inherited]

Returns the number of nodes on processor proc.

Definition at line 205 of file mesh_base.C.

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

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

00206 {
00207   // We're either counting a processor's nodes or unpartitioned
00208   // nodes
00209   libmesh_assert (proc_id < libMesh::n_processors() ||
00210           proc_id == DofObject::invalid_processor_id);
00211 
00212   return static_cast<dof_id_type>(std::distance (this->pid_nodes_begin(proc_id),
00213                                                  this->pid_nodes_end  (proc_id)));
00214 }

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

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

Definition at line 543 of file mesh_base.h.

References libMesh::MeshBase::_n_parts.

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

00544   { return _n_parts; }

processor_id_type libMesh::MeshBase::n_processors (  )  const [inline, inherited]
dof_id_type libMesh::MeshBase::n_sub_elem (  )  const [inherited]

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

Definition at line 240 of file mesh_base.C.

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

00241 {
00242   dof_id_type ne=0;
00243 
00244   const_element_iterator       el  = this->elements_begin();
00245   const const_element_iterator end = this->elements_end();
00246 
00247   for (; el!=end; ++el)
00248     ne += (*el)->n_sub_elem();
00249 
00250   return ne;
00251 }

subdomain_id_type libMesh::MeshBase::n_subdomains (  )  const [inherited]

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

Definition at line 190 of file mesh_base.C.

References libMesh::MeshBase::subdomain_ids().

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

00191 {
00192   // This requires an inspection on every processor
00193   parallel_only();
00194 
00195   std::set<subdomain_id_type> ids;
00196 
00197   this->subdomain_ids (ids);
00198 
00199   return ids.size();
00200 }

dof_id_type libMesh::MeshBase::n_unpartitioned_elem (  )  const [inline, inherited]

Returns the number of elements owned by no processor.

Definition at line 266 of file mesh_base.h.

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

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

dof_id_type libMesh::MeshBase::n_unpartitioned_nodes (  )  const [inline, inherited]

Returns the number of nodes owned by no processor.

Definition at line 192 of file mesh_base.h.

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

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

virtual Node& libMesh::MeshBase::node ( const dof_id_type  i  )  [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

virtual const Node& libMesh::MeshBase::node ( const dof_id_type  i  )  const [pure virtual, inherited]
virtual Node* libMesh::MeshBase::node_ptr ( const dof_id_type  i  )  [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

virtual const_node_iterator libMesh::MeshBase::nodes_begin (  )  const [pure virtual, inherited]

const Node iterator accessor functions.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

virtual node_iterator libMesh::MeshBase::nodes_begin (  )  [pure virtual, inherited]

non-const Node iterator accessor functions.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::EquationSystems::_add_system_to_nodes_and_elems(), all_first_order(), libMesh::EquationSystems::allgather(), libMesh::MeshCommunication::assign_global_indices(), libMesh::MeshTools::Generation::build_extrusion(), copy_nodes_and_elements(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::DofMap::distribute_dofs(), libMesh::LocationMap< T >::fill(), libMesh::TetGenMeshInterface::fill_pointlist(), libMesh::LocationMap< T >::init(), libMesh::EquationSystems::init(), libMesh::DofMap::invalidate_dofs(), libMesh::MeshTools::libmesh_assert_connected_nodes(), libMesh::MeshTools::libmesh_assert_equal_n_systems(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::FEMSystem::mesh_position_set(), libMesh::UNVIO::node_out(), libMesh::System::read_legacy_data(), libMesh::VariationalMeshSmoother::readgr(), libMesh::EquationSystems::reinit(), libMesh::DofMap::reinit(), libMesh::MeshTools::Modification::rotate(), libMesh::MeshTools::Modification::scale(), libMesh::Partitioner::set_node_processor_ids(), libMesh::Partitioner::single_partition(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::BoundaryInfo::sync(), libMesh::MeshTools::Modification::translate(), libMesh::MeshData::translate(), libMesh::Tree< N >::Tree(), libMesh::TriangleInterface::triangulate(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodes(), and libMesh::VariationalMeshSmoother::writegr().

virtual const_node_iterator libMesh::MeshBase::nodes_end (  )  const [pure virtual, inherited]
virtual node_iterator libMesh::MeshBase::nodes_end (  )  [pure virtual, inherited]

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::EquationSystems::_add_system_to_nodes_and_elems(), all_first_order(), libMesh::EquationSystems::allgather(), libMesh::MeshCommunication::assign_global_indices(), libMesh::MeshTools::Generation::build_extrusion(), copy_nodes_and_elements(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::DofMap::distribute_dofs(), libMesh::LocationMap< T >::fill(), libMesh::TetGenMeshInterface::fill_pointlist(), libMesh::LocationMap< T >::init(), libMesh::EquationSystems::init(), libMesh::DofMap::invalidate_dofs(), libMesh::MeshTools::libmesh_assert_connected_nodes(), libMesh::MeshTools::libmesh_assert_equal_n_systems(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::FEMSystem::mesh_position_set(), libMesh::UNVIO::node_out(), libMesh::System::read_legacy_data(), libMesh::VariationalMeshSmoother::readgr(), libMesh::EquationSystems::reinit(), libMesh::DofMap::reinit(), libMesh::MeshTools::Modification::rotate(), libMesh::MeshTools::Modification::scale(), libMesh::Partitioner::set_node_processor_ids(), libMesh::Partitioner::single_partition(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::BoundaryInfo::sync(), libMesh::MeshTools::Modification::translate(), libMesh::MeshData::translate(), libMesh::Tree< N >::Tree(), libMesh::TriangleInterface::triangulate(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodes(), and libMesh::VariationalMeshSmoother::writegr().

virtual const_element_iterator libMesh::MeshBase::not_active_elements_begin (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::not_active_elements_begin (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::not_active_elements_end (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::not_active_elements_end (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::not_ancestor_elements_begin (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::not_ancestor_elements_begin (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::not_ancestor_elements_end (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::not_ancestor_elements_end (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::not_level_elements_begin ( const unsigned int  level  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::not_level_elements_begin ( const unsigned int  level  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::not_level_elements_end ( const unsigned int  level  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::not_level_elements_end ( const unsigned int  level  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::not_local_elements_begin (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::not_local_elements_begin (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::not_local_elements_end (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::not_local_elements_end (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::not_subactive_elements_begin (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::not_subactive_elements_begin (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::not_subactive_elements_end (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::not_subactive_elements_end (  )  [pure virtual, inherited]
virtual dof_id_type libMesh::MeshBase::parallel_n_elem (  )  const [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::Nemesis_IO_Helper::initialize(), and libMesh::Nemesis_IO::read().

virtual dof_id_type libMesh::MeshBase::parallel_n_nodes (  )  const [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::Nemesis_IO_Helper::initialize(), and libMesh::Nemesis_IO::read().

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

Call the default partitioner (currently metis_partition()).

Definition at line 308 of file mesh_base.C.

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

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

00309 {
00310   // NULL partitioner means don't partition
00311   // Non-serial meshes aren't ready for partitioning yet.
00312   if(!skip_partitioning() && 
00313      partitioner().get() && 
00314      this->is_serial())
00315   {
00316     partitioner()->partition (*this, n_parts);
00317   }
00318   else
00319   {
00320     // Make sure locally cached partition count
00321     this->recalculate_n_partitions();
00322 
00323     // Make sure any other locally cached data is correct
00324     this->update_post_partitioning();
00325   }
00326 }

virtual AutoPtr<Partitioner>& libMesh::MeshBase::partitioner (  )  [inline, virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::pid_elements_begin ( const processor_id_type  proc_id  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::pid_elements_begin ( const processor_id_type  proc_id  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::pid_elements_end ( const processor_id_type  proc_id  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::pid_elements_end ( const processor_id_type  proc_id  )  [pure virtual, inherited]
virtual const_node_iterator libMesh::MeshBase::pid_nodes_begin ( const processor_id_type  proc_id  )  const [pure virtual, inherited]
virtual node_iterator libMesh::MeshBase::pid_nodes_begin ( const processor_id_type  proc_id  )  [pure virtual, inherited]
virtual const_node_iterator libMesh::MeshBase::pid_nodes_end ( const processor_id_type  proc_id  )  const [pure virtual, inherited]
virtual node_iterator libMesh::MeshBase::pid_nodes_end ( const processor_id_type  proc_id  )  [pure virtual, inherited]
const PointLocatorBase & libMesh::MeshBase::point_locator (  )  const [inherited]

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

Definition at line 348 of file mesh_base.C.

References libMesh::MeshBase::_point_locator, libMesh::PointLocatorBase::build(), libMesh::AutoPtr< Tp >::get(), libMesh::Threads::in_threads, libMesh::AutoPtr< Tp >::reset(), and libMeshEnums::TREE.

00349 {
00350   libmesh_deprecated();
00351 
00352   if (_point_locator.get() == NULL)
00353     {
00354       // PointLocator construction may not be safe within threads
00355       libmesh_assert(!Threads::in_threads);
00356 
00357       _point_locator.reset (PointLocatorBase::build(TREE, *this).release());
00358     }
00359 
00360   return *_point_locator;
00361 }

void libMesh::MeshBase::prepare_for_use ( const bool  skip_renumber_nodes_and_elements = false  )  [inherited]

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

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

Definition at line 90 of file mesh_base.C.

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

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

00091 {
00092   parallel_only();
00093 
00094   // A distributed mesh may have processors with no elements (or
00095   // processors with no elements of higher dimension, if we ever
00096   // support mixed-dimension meshes), but we want consistent
00097   // mesh_dimension anyways.
00098   libmesh_assert(CommWorld.verify(this->is_serial()));
00099 
00100   if (!this->is_serial())
00101     {
00102       unsigned int dim = this->mesh_dimension();
00103       CommWorld.max(dim);
00104       this->set_mesh_dimension(dim);
00105     }
00106 
00107   // Renumber the nodes and elements so that they in contiguous
00108   // blocks.  By default, _skip_renumber_nodes_and_elements is false.
00109   //
00110   // We may currently change that by passing
00111   // skip_renumber_nodes_and_elements==true to this function, but we
00112   // should use the allow_renumbering() accessor instead.
00113   //
00114   // Instances where you if prepare_for_use() should not renumber the nodes
00115   // and elements include reading in e.g. an xda/r or gmv file. In
00116   // this case, the ordering of the nodes may depend on an accompanying
00117   // solution, and the node ordering cannot be changed.
00118 
00119   if (skip_renumber_nodes_and_elements)
00120     {
00121       libmesh_deprecated();
00122       this->allow_renumbering(false);
00123     }
00124 
00125   // Mesh modification operations might not leave us with consistent
00126   // id counts, but our partitioner might need that consistency.
00127   if(!_skip_renumber_nodes_and_elements)
00128     this->renumber_nodes_and_elements();
00129   else
00130     this->update_parallel_id_counts();
00131 
00132   // Let all the elements find their neighbors
00133   this->find_neighbors();
00134 
00135   // Partition the mesh.
00136   this->partition();
00137 
00138   // If we're using ParallelMesh, we'll want it parallelized.
00139   this->delete_remote_elements();
00140 
00141   if(!_skip_renumber_nodes_and_elements)
00142     this->renumber_nodes_and_elements();
00143 
00144   // Reset our PointLocator.  This needs to happen any time the elements
00145   // in the underlying elements in the mesh have changed, so we do it here.
00146   this->clear_point_locator();
00147 
00148   // The mesh is now prepared for use.
00149   _is_prepared = true;
00150 }

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

Prints relevant information about the mesh.

Definition at line 294 of file mesh_base.C.

References libMesh::MeshBase::get_info().

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

00295 {
00296   os << this->get_info()
00297      << std::endl;
00298 }

virtual Elem* libMesh::MeshBase::query_elem ( const dof_id_type  i  )  [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

virtual const Elem* libMesh::MeshBase::query_elem ( const dof_id_type  i  )  const [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::Parallel::unpack(), and libMesh::Elem::PackedElem::unpack().

virtual Node* libMesh::MeshBase::query_node_ptr ( const dof_id_type  i  )  [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

virtual const Node* libMesh::MeshBase::query_node_ptr ( const dof_id_type  i  )  const [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

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

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

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

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

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

Implements libMesh::MeshBase.

Definition at line 468 of file unstructured_mesh.C.

References libMesh::MeshBase::allow_renumbering(), libMesh::XdrIO::binary(), libMesh::err, libMesh::XdrIO::legacy(), libMesh::MeshBase::n_processors(), libMesh::MeshBase::prepare_for_use(), libMesh::processor_id(), libMesh::MeshBase::processor_id(), and libMesh::XdrIO::read().

00471 {
00472   // See if the file exists.  Perform this check on all processors
00473   // so that the code is terminated properly in the case that the
00474   // file does not exist.
00475 
00476   // For Nemesis files, the name we try to read will have suffixes
00477   // identifying processor rank
00478   if (name.rfind(".nem") + 4 == name.size() ||
00479       name.rfind(".n") + 2 == name.size())
00480     {
00481       std::ostringstream full_name;
00482       full_name << name << '.' << libMesh::n_processors() << '.' << libMesh::processor_id();
00483 
00484       std::ifstream in (full_name.str().c_str());
00485 
00486       if (!in.good())
00487         {
00488           libMesh::err << "ERROR: cannot locate specified file:\n\t"
00489                         << full_name.str()
00490                         << std::endl;
00491           libmesh_error();
00492         }
00493     }
00494   else
00495     {
00496       std::ifstream in (name.c_str());
00497 
00498       if (!in.good())
00499         {
00500           libMesh::err << "ERROR: cannot locate specified file:\n\t"
00501                         << name
00502                         << std::endl;
00503           libmesh_error();
00504         }
00505     }
00506 
00507   // Set the skip_renumber_nodes_and_elements flag on all processors.
00508   // This ensures that renumber_nodes_and_elements is *not* called
00509   // during prepare_for_use() for certain types of mesh files.
00510   // This is required in cases where there is an associated solution
00511   // file which expects a certain ordering of the nodes.
00512   if(name.rfind(".gmv")+4==name.size())
00513     {
00514       skip_renumber_nodes_and_elements =  true;
00515     }
00516 
00517   // Look for parallel formats first
00518   if (is_parallel_file_format(name))
00519     {
00520       // no need to handle bz2 files here -- the Xdr class does that.
00521       if ((name.rfind(".xda") < name.size()) ||
00522           (name.rfind(".xdr") < name.size()))
00523         {
00524           XdrIO xdr_io(*this);
00525 
00526           // .xda* ==> bzip2/gzip/ASCII flavors
00527           if (name.rfind(".xda") < name.size())
00528             {
00529               xdr_io.binary() = false;
00530               xdr_io.read (name);
00531             }
00532           else // .xdr* ==> true binary XDR file
00533             {
00534               xdr_io.binary() = true;
00535               xdr_io.read (name);
00536             }
00537 
00538           // The xdr_io object gets constructed with legacy() == false.
00539           // if legacy() == true then it means that a legacy file was detected and
00540           // thus processor 0 performed the read. We therefore need to broadcast the
00541           // mesh.  Further, for this flavor of mesh solution data ordering is tied
00542           // to the node ordering, so we better not reorder the nodes!
00543           if (xdr_io.legacy())
00544             {
00545               this->allow_renumbering(false);
00546               MeshCommunication().broadcast(*this);
00547             }
00548 
00549           // libHilbert-enabled libMesh builds should construct files
00550           // with a canonical node ordering, which libHilbert-enabled
00551           // builds will be able to read in again regardless of any
00552           // renumbering.  So in that case we're free to renumber.
00553           // However, if either the writer or the reader of this file
00554           // don't have libHilbert, then we'll have to skip
00555           // renumbering because we need the numbering to remain
00556           // consistent with any solution file we read in next.
00557 #ifdef LIBMESH_HAVE_LIBHILBERT
00558           // if (!xdr_io.libhilbert_ordering())
00559           //   skip_renumber_nodes_and_elements = true;
00560 #else
00561           this->allow_renumbering(false);
00562 #endif
00563         }
00564       else if (name.rfind(".nem") < name.size() ||
00565                name.rfind(".n")   < name.size())
00566         Nemesis_IO(*this).read (name);
00567 
00568     }
00569 
00570   // Serial mesh formats
00571   else
00572     {
00573       START_LOG("read()", "Mesh");
00574 
00575       // Read the file based on extension.  Only processor 0
00576       // needs to read the mesh.  It will then broadcast it and
00577       // the other processors will pick it up
00578       if (libMesh::processor_id() == 0)
00579         {
00580           std::ostringstream pid_suffix;
00581           pid_suffix << '_' << getpid();
00582           // Nasty hack for reading/writing zipped files
00583           std::string new_name = name;
00584           if (name.size() - name.rfind(".bz2") == 4)
00585             {
00586 #ifdef LIBMESH_HAVE_BZIP
00587               new_name.erase(new_name.end() - 4, new_name.end());
00588               new_name += pid_suffix.str();
00589               std::string system_string = "bunzip2 -f -k -c ";
00590               system_string += name + " > " + new_name;
00591               START_LOG("system(bunzip2)", "Mesh");
00592               if (std::system(system_string.c_str()))
00593                 libmesh_file_error(system_string);
00594               STOP_LOG("system(bunzip2)", "Mesh");
00595 #else
00596               libMesh::err << "ERROR: need bzip2/bunzip2 to open .bz2 file "
00597                            << name << std::endl;
00598               libmesh_error();
00599 #endif
00600             }
00601           else if (name.size() - name.rfind(".xz") == 3)
00602             {
00603 #ifdef LIBMESH_HAVE_XZ
00604               new_name.erase(new_name.end() - 3, new_name.end());
00605               new_name += pid_suffix.str();
00606               std::string system_string = "xz -f -d -k -c ";
00607               system_string += name + " > " + new_name;
00608               START_LOG("system(xz -d)", "XdrIO");
00609               if (std::system(system_string.c_str()))
00610                 libmesh_file_error(system_string);
00611               STOP_LOG("system(xz -d)", "XdrIO");
00612 #else
00613               libMesh::err << "ERROR: need xz to open .xz file "
00614                            << name << std::endl;
00615               libmesh_error();
00616 #endif
00617             }
00618 
00619           if (new_name.rfind(".mat") < new_name.size())
00620             MatlabIO(*this).read(new_name);
00621 
00622           else if (new_name.rfind(".ucd") < new_name.size())
00623             UCDIO(*this).read (new_name);
00624 
00625           else if ((new_name.rfind(".off")  < new_name.size()) ||
00626                    (new_name.rfind(".ogl")  < new_name.size()) ||
00627                    (new_name.rfind(".oogl") < new_name.size()))
00628             OFFIO(*this).read (new_name);
00629 
00630           else if (new_name.rfind(".mgf") < new_name.size())
00631             LegacyXdrIO(*this,true).read_mgf (new_name);
00632 
00633           else if (new_name.rfind(".unv") < new_name.size())
00634             {
00635               if (mesh_data == NULL)
00636                 {
00637                   libMesh::err << "Error! You must pass a "
00638                                 << "valid MeshData pointer to "
00639                                 << "read UNV files!" << std::endl;
00640                   libmesh_error();
00641                 }
00642               UNVIO(*this, *mesh_data).read (new_name);
00643             }
00644 
00645           else if ((new_name.rfind(".node")  < new_name.size()) ||
00646                    (new_name.rfind(".ele")   < new_name.size()))
00647             TetGenIO(*this,mesh_data).read (new_name);
00648 
00649           else if (new_name.rfind(".exd") < new_name.size() ||
00650                    new_name.rfind(".e") < new_name.size())
00651             ExodusII_IO(*this).read (new_name);
00652 
00653           else if (new_name.rfind(".msh") < new_name.size())
00654             GmshIO(*this).read (new_name);
00655 
00656           else if (new_name.rfind(".gmv") < new_name.size())
00657             GMVIO(*this).read (new_name);
00658 
00659           else if (new_name.rfind(".vtu") < new_name.size())
00660             VTKIO(*this).read(new_name);
00661 
00662           else if (new_name.rfind(".inp") < new_name.size())
00663             AbaqusIO(*this).read(new_name);
00664 
00665           else
00666             {
00667               libMesh::err << " ERROR: Unrecognized file extension: " << name
00668                             << "\n   I understand the following:\n\n"
00669                             << "     *.e    -- Sandia's ExodusII format\n"
00670                         << "     *.exd  -- Sandia's ExodusII format\n"
00671                         << "     *.gmv  -- LANL's General Mesh Viewer format\n"
00672                         << "     *.mat  -- Matlab triangular ASCII file\n"
00673                         << "     *.n    -- Sandia's Nemesis format\n"
00674                         << "     *.nem  -- Sandia's Nemesis format\n"
00675                         << "     *.off  -- OOGL OFF surface format\n"
00676                         << "     *.ucd  -- AVS's ASCII UCD format\n"
00677                         << "     *.unv  -- I-deas Universal format\n"
00678                         << "     *.vtu  -- Paraview VTK format\n"
00679                         << "     *.inp  -- Abaqus .inp format\n"
00680                         << "     *.xda  -- libMesh ASCII format\n"
00681                         << "     *.xdr  -- libMesh binary format\n"
00682                         << "     *.gz   -- any above format gzipped\n"
00683                         << "     *.bz2  -- any above format bzip2'ed\n"
00684                         << "     *.xz   -- any above format xzipped\n"
00685 
00686                         << std::endl;
00687               libmesh_error();
00688             }
00689 
00690           // If we temporarily decompressed a file, remove the
00691           // uncompressed version
00692           if (name.size() - name.rfind(".bz2") == 4)
00693             std::remove(new_name.c_str());
00694           if (name.size() - name.rfind(".xz") == 3)
00695             std::remove(new_name.c_str());
00696         }
00697 
00698 
00699       STOP_LOG("read()", "Mesh");
00700 
00701       // Send the mesh & bcs (which are now only on processor 0) to the other
00702       // processors
00703       MeshCommunication().broadcast (*this);
00704     }
00705 
00706   if (skip_renumber_nodes_and_elements)
00707     {
00708       // Use MeshBase::allow_renumbering() yourself instead.
00709       libmesh_deprecated();
00710       this->allow_renumbering(false);
00711     }
00712 
00713   // Done reading the mesh.  Now prepare it for use.
00714   this->prepare_for_use();
00715 }

unsigned int libMesh::MeshBase::recalculate_n_partitions (  )  [inherited]

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

Definition at line 328 of file mesh_base.C.

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

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

00329 {
00330   const_element_iterator       el  = this->active_elements_begin();
00331   const const_element_iterator end = this->active_elements_end();
00332 
00333   unsigned int max_proc_id=0;
00334 
00335   for (; el!=end; ++el)
00336     max_proc_id = std::max(max_proc_id, static_cast<unsigned int>((*el)->processor_id()));
00337 
00338   // The number of partitions is one more than the max processor ID.
00339   _n_parts = max_proc_id+1;
00340 
00341   CommWorld.max(_n_parts);
00342 
00343   return _n_parts;
00344 }

virtual void libMesh::MeshBase::redistribute (  )  [inline, virtual, inherited]

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

Reimplemented in libMesh::ParallelMesh.

Definition at line 487 of file mesh_base.h.

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

00487 {}

virtual void libMesh::MeshBase::renumber_elem ( dof_id_type  old_id,
dof_id_type  new_id 
) [pure 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.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

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

virtual void libMesh::MeshBase::renumber_node ( dof_id_type  old_id,
dof_id_type  new_id 
) [pure 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.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

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

virtual void libMesh::MeshBase::renumber_nodes_and_elements (  )  [pure virtual, inherited]

After partitoning a mesh it is useful to renumber the nodes and elements so that they lie in contiguous blocks on the processors. This method does just that.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by all_first_order(), all_second_order(), contract(), libMesh::ErrorVector::plot_error(), and libMesh::MeshBase::prepare_for_use().

virtual void libMesh::MeshBase::reserve_elem ( const dof_id_type  ne  )  [pure 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.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::XdrIO::read(), libMesh::ExodusII_IO::read(), libMesh::LegacyXdrIO::read_mesh(), and libMesh::GmshIO::read_mesh().

virtual void libMesh::MeshBase::reserve_nodes ( const dof_id_type  nn  )  [pure 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.

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by all_second_order(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::XdrIO::read(), libMesh::ExodusII_IO::read(), libMesh::LegacyXdrIO::read_mesh(), and libMesh::GmshIO::read_mesh().

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

Returns a writeable reference to the number of partitions.

Definition at line 825 of file mesh_base.h.

References libMesh::MeshBase::_n_parts.

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

00826   { return _n_parts; }

bool libMesh::MeshBase::skip_partitioning (  )  const [inline, inherited]

Definition at line 517 of file mesh_base.h.

References libMesh::MeshBase::_skip_partitioning.

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

00517 { return _skip_partitioning; }

void libMesh::MeshBase::skip_partitioning ( bool  skip  )  [inline, inherited]

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

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

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

Definition at line 516 of file mesh_base.h.

References libMesh::MeshBase::_skip_partitioning.

Referenced by copy_nodes_and_elements().

00516 { _skip_partitioning = skip; }

unsigned int libMesh::MeshBase::spatial_dimension (  )  const [inline, inherited]
AutoPtr< PointLocatorBase > libMesh::MeshBase::sub_point_locator (  )  const [inherited]

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

Definition at line 364 of file mesh_base.C.

References libMesh::MeshBase::_point_locator, libMesh::PointLocatorBase::build(), libMesh::AutoPtr< Tp >::get(), libMesh::Threads::in_threads, libMesh::AutoPtr< Tp >::reset(), and libMeshEnums::TREE.

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

00365 {
00366   if (_point_locator.get() == NULL)
00367     {
00368       // PointLocator construction may not be safe within threads
00369       libmesh_assert(!Threads::in_threads);
00370 
00371       _point_locator.reset (PointLocatorBase::build(TREE, *this).release());
00372     }
00373 
00374   return PointLocatorBase::build(TREE, *this, _point_locator.get());
00375 }

virtual const_element_iterator libMesh::MeshBase::subactive_elements_begin (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::subactive_elements_begin (  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::subactive_elements_end (  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::subactive_elements_end (  )  [pure virtual, inherited]
void libMesh::MeshBase::subdomain_ids ( std::set< subdomain_id_type > &  ids  )  const [inherited]

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

Definition at line 171 of file mesh_base.C.

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

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

00172 {
00173   // This requires an inspection on every processor
00174   parallel_only();
00175 
00176   ids.clear();
00177   
00178   const_element_iterator       el  = this->active_elements_begin();
00179   const const_element_iterator end = this->active_elements_end();
00180 
00181   for (; el!=end; ++el)
00182     ids.insert((*el)->subdomain_id());
00183 
00184   // Some subdomains may only live on other processors
00185   CommWorld.set_union(ids);
00186 }

const std::string & libMesh::MeshBase::subdomain_name ( subdomain_id_type  id  )  const [inherited]

Definition at line 391 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name.

00392 {
00393   // An empty string to return when no matching subdomain name is found
00394   static const std::string empty;
00395 
00396   std::map<subdomain_id_type, std::string>::const_iterator iter = _block_id_to_name.find(id);
00397   if (iter == _block_id_to_name.end())
00398     return empty;
00399   else
00400     return iter->second;
00401 }

std::string & libMesh::MeshBase::subdomain_name ( subdomain_id_type  id  )  [inherited]

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

Definition at line 386 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name.

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

00387 {
00388   return _block_id_to_name[id];
00389 }

virtual const_element_iterator libMesh::MeshBase::type_elements_begin ( const ElemType  type  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::type_elements_begin ( const ElemType  type  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::type_elements_end ( const ElemType  type  )  const [pure virtual, inherited]
virtual element_iterator libMesh::MeshBase::type_elements_end ( const ElemType  type  )  [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::unpartitioned_elements_begin (  )  const [pure virtual, inherited]
virtual const_element_iterator libMesh::MeshBase::unpartitioned_elements_end (  )  const [pure virtual, inherited]
virtual void libMesh::MeshBase::update_parallel_id_counts (  )  [pure virtual, inherited]

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

Implemented in libMesh::ParallelMesh, and libMesh::SerialMesh.

Referenced by libMesh::MeshRefinement::_coarsen_elements(), libMesh::MeshRefinement::_refine_elements(), and libMesh::MeshBase::prepare_for_use().

virtual void libMesh::MeshBase::update_post_partitioning (  )  [inline, virtual, inherited]

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

Reimplemented in libMesh::ParallelMesh.

Definition at line 493 of file mesh_base.h.

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

00493 {}

void libMesh::UnstructuredMesh::write ( const std::string &  name,
const std::vector< Number > &  values,
const std::vector< std::string > &  variable_names 
)

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

Definition at line 883 of file unstructured_mesh.C.

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

00886 {
00887   START_LOG("write()", "Mesh");
00888 
00889   // Write the file based on extension
00890   if (name.rfind(".dat") < name.size())
00891     TecplotIO(*this).write_nodal_data (name, v, vn);
00892 
00893   else if (name.rfind(".plt") < name.size())
00894     TecplotIO(*this,true).write_nodal_data (name, v, vn);
00895 
00896   else if (name.rfind(".gmv") < name.size())
00897     {
00898       if (n_subdomains() > 1)
00899         GMVIO(*this).write_nodal_data (name, v, vn);
00900       else
00901         {
00902           GMVIO io(*this);
00903           io.partitioning() = false;
00904           io.write_nodal_data (name, v, vn);
00905         }
00906     }
00907   else if (name.rfind(".pvtu") < name.size())
00908     {
00909       VTKIO(*this).write_nodal_data (name, v, vn);
00910     }
00911   else
00912     {
00913       libMesh::err
00914         << " ERROR: Unrecognized file extension: " << name
00915         << "\n   I understand the following:\n\n"
00916         << "     *.dat  -- Tecplot ASCII file\n"
00917         << "     *.gmv  -- LANL's GMV (General Mesh Viewer) format\n"
00918         << "     *.plt  -- Tecplot binary file\n"
00919         << "     *.pvtu -- Paraview VTK file\n"
00920         << "\n Exiting without writing output\n";
00921     }
00922 
00923   STOP_LOG("write()", "Mesh");
00924 }

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

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

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

Implements libMesh::MeshBase.

Definition at line 719 of file unstructured_mesh.C.

References libMesh::Parallel::Communicator::barrier(), libMesh::Parallel::Communicator::broadcast(), libMesh::CommWorld, libMesh::err, libMesh::MeshBase::n_partitions(), libMesh::GMVIO::partitioning(), libMesh::processor_id(), and libMesh::GMVIO::write().

00721 {
00722   // parallel formats are special -- they may choose to write
00723   // separate files, let's not try to handle the zipping here.
00724   if (is_parallel_file_format(name))
00725     {
00726       // no need to handle bz2 files here -- the Xdr class does that.
00727       if (name.rfind(".xda") < name.size())
00728         XdrIO(*this).write(name);
00729 
00730       else if (name.rfind(".xdr") < name.size())
00731         XdrIO(*this,true).write(name);
00732 
00733       else if (name.rfind(".nem") < name.size() ||
00734                name.rfind(".n")   < name.size())
00735         Nemesis_IO(*this).write(name);
00736     }
00737 
00738   // serial file formats
00739   else
00740     {
00741       START_LOG("write()", "Mesh");
00742 
00743       // Nasty hack for reading/writing zipped files
00744       std::string new_name = name;
00745       processor_id_type pid_0 = 0;
00746       if (libMesh::processor_id() == 0)
00747         pid_0 = getpid();
00748       CommWorld.broadcast(pid_0);
00749       std::ostringstream pid_suffix;
00750       pid_suffix << '_' << pid_0;
00751 
00752       if (name.size() - name.rfind(".bz2") == 4)
00753         {
00754           new_name.erase(new_name.end() - 4, new_name.end());
00755           new_name += pid_suffix.str();
00756         }
00757       else if (name.size() - name.rfind(".xz") == 3)
00758         {
00759           new_name.erase(new_name.end() - 3, new_name.end());
00760           new_name += pid_suffix.str();
00761         }
00762 
00763       // New scope so that io will close before we try to zip the file
00764       {
00765         // Write the file based on extension
00766         if (new_name.rfind(".dat") < new_name.size())
00767           TecplotIO(*this).write (new_name);
00768 
00769         else if (new_name.rfind(".plt") < new_name.size())
00770           TecplotIO(*this,true).write (new_name);
00771 
00772         else if (new_name.rfind(".ucd") < new_name.size())
00773           UCDIO (*this).write (new_name);
00774 
00775         else if (new_name.rfind(".gmv") < new_name.size())
00776           if (this->n_partitions() > 1)
00777             GMVIO(*this).write (new_name);
00778           else
00779             {
00780               GMVIO io(*this);
00781               io.partitioning() = false;
00782               io.write (new_name);
00783             }
00784 
00785         else if (new_name.rfind(".ugrid") < new_name.size())
00786           DivaIO(*this).write(new_name);
00787         else if (new_name.rfind(".exd") < new_name.size() ||
00788                  new_name.rfind(".e") < new_name.size())
00789           ExodusII_IO(*this).write(new_name);
00790         else if (new_name.rfind(".mgf")  < new_name.size())
00791           LegacyXdrIO(*this,true).write_mgf(new_name);
00792 
00793         else if (new_name.rfind(".unv") < new_name.size())
00794           {
00795             if (mesh_data == NULL)
00796               {
00797                 libMesh::err << "Error! You must pass a "
00798                               << "valid MeshData pointer to "
00799                               << "write UNV files!" << std::endl;
00800                 libmesh_error();
00801               }
00802             UNVIO(*this, *mesh_data).write (new_name);
00803           }
00804 
00805         else if (new_name.rfind(".mesh") < new_name.size())
00806           MEDITIO(*this).write (new_name);
00807 
00808         else if (new_name.rfind(".poly") < new_name.size())
00809           TetGenIO(*this).write (new_name);
00810 
00811         else if (new_name.rfind(".msh") < new_name.size())
00812           GmshIO(*this).write (new_name);
00813 
00814         else if (new_name.rfind(".fro") < new_name.size())
00815           FroIO(*this).write (new_name);
00816 
00817         else if (new_name.rfind(".vtu") < new_name.size())
00818           VTKIO(*this).write (new_name);
00819 
00820         else
00821           {
00822             libMesh::err
00823               << " ERROR: Unrecognized file extension: " << name
00824               << "\n   I understand the following:\n\n"
00825               << "     *.dat   -- Tecplot ASCII file\n"
00826               << "     *.e     -- Sandia's ExodusII format\n"
00827               << "     *.exd   -- Sandia's ExodusII format\n"
00828               << "     *.fro   -- ACDL's surface triangulation file\n"
00829               << "     *.gmv   -- LANL's GMV (General Mesh Viewer) format\n"
00830               << "     *.mesh  -- MEdit mesh format\n"
00831               << "     *.mgf   -- MGF binary mesh format\n"
00832               << "     *.msh   -- GMSH ASCII file\n"
00833               << "     *.n     -- Sandia's Nemesis format\n"
00834               << "     *.nem   -- Sandia's Nemesis format\n"
00835               << "     *.plt   -- Tecplot binary file\n"
00836               << "     *.poly  -- TetGen ASCII file\n"
00837               << "     *.ucd   -- AVS's ASCII UCD format\n"
00838               << "     *.ugrid -- Kelly's DIVA ASCII format\n"
00839               << "     *.unv   -- I-deas Universal format\n"
00840               << "     *.xda   -- libMesh ASCII format\n"
00841               << "     *.xdr   -- libMesh binary format,\n"
00842               << std::endl
00843               << "\n Exiting without writing output\n";
00844           }
00845       }
00846 
00847       // Nasty hack for reading/writing zipped files
00848       if (name.size() - name.rfind(".bz2") == 4)
00849         {
00850           START_LOG("system(bzip2)", "Mesh");
00851           if (libMesh::processor_id() == 0)
00852             {
00853               std::string system_string = "bzip2 -f -c ";
00854               system_string += new_name + " > " + name;
00855               if (std::system(system_string.c_str()))
00856                 libmesh_file_error(system_string);
00857               std::remove(new_name.c_str());
00858             }
00859           CommWorld.barrier();
00860           STOP_LOG("system(bzip2)", "Mesh");
00861         }
00862       if (name.size() - name.rfind(".xz") == 3)
00863         {
00864           START_LOG("system(xz)", "Mesh");
00865           if (libMesh::processor_id() == 0)
00866             {
00867               std::string system_string = "xz -f -c ";
00868               system_string += new_name + " > " + name;
00869               if (std::system(system_string.c_str()))
00870                 libmesh_file_error(system_string);
00871               std::remove(new_name.c_str());
00872             }
00873           CommWorld.barrier();
00874           STOP_LOG("system(xz)", "Mesh");
00875         }
00876 
00877       STOP_LOG("write()", "Mesh");
00878     }
00879 }


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

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

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

friend class Partitioner [friend, inherited]

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

Definition at line 889 of file mesh_base.h.


Member Data Documentation

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

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

Definition at line 883 of file mesh_base.h.

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

unsigned int libMesh::MeshBase::_dim [protected, inherited]
bool libMesh::MeshBase::_is_prepared [protected, inherited]

Flag indicating if the mesh has been prepared for use.

Definition at line 847 of file mesh_base.h.

Referenced by all_first_order(), all_second_order(), libMesh::MeshBase::clear(), copy_nodes_and_elements(), libMesh::MeshBase::is_prepared(), and libMesh::MeshBase::prepare_for_use().

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

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

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

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

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

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

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

bool libMesh::MeshBase::_skip_partitioning [protected, inherited]

If this is true then no partitioning should be done.

Definition at line 869 of file mesh_base.h.

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

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

This is set when prepare_for_use() is called.

Definition at line 876 of file mesh_base.h.

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

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

Definition at line 99 of file mesh_base.h.

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


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

Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:43 UTC

Hosted By:
SourceForge.net Logo