libMesh::UnstructuredMesh Class Referenceabstract

#include <unstructured_mesh.h>

Inheritance diagram for libMesh::UnstructuredMesh:

Public Types

typedef Predicates::multi_predicate Predicate
 

Public Member Functions

 UnstructuredMesh (const Parallel::Communicator &comm, unsigned int dim=1)
 
 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
 
unique_id_type next_unique_id ()
 
void set_next_unique_id (unique_id_type id)
 
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 Nodeinsert_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)
 
void partition ()
 
virtual void redistribute ()
 
virtual void update_post_partitioning ()
 
void allow_renumbering (bool allow)
 
bool allow_renumbering () const
 
void skip_partitioning (bool skip)
 
bool skip_partitioning () const
 
void subdomain_ids (std::set< subdomain_id_type > &ids) const
 
subdomain_id_type n_subdomains () const
 
unsigned int n_partitions () const
 
std::string get_info () const
 
void print_info (std::ostream &os=libMesh::out) const
 
unsigned int recalculate_n_partitions ()
 
const PointLocatorBasepoint_locator () const
 
AutoPtr< PointLocatorBasesub_point_locator () const
 
void clear_point_locator ()
 
virtual void libmesh_assert_valid_parallel_ids () const
 
std::string & subdomain_name (subdomain_id_type id)
 
const std::string & subdomain_name (subdomain_id_type id) const
 
subdomain_id_type get_id_by_name (const std::string &name) const
 
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
 
std::map< subdomain_id_type,
std::string > & 
set_subdomain_name_map ()
 
const std::map
< subdomain_id_type,
std::string > & 
get_subdomain_name_map () const
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Public Attributes

AutoPtr< BoundaryInfoboundary_info
 

Protected Member Functions

virtual void assign_unique_ids ()=0
 
unsigned int & set_n_partitions ()
 

Protected Attributes

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

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

Constructor & Destructor Documentation

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

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

Definition at line 84 of file unstructured_mesh.C.

References libMesh::initialized(), and libMesh::libmesh_assert().

85  :
86  MeshBase (comm,d)
87 {
89 }
libMesh::UnstructuredMesh::UnstructuredMesh ( unsigned int  dim = 1)

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

Definition at line 94 of file unstructured_mesh.C.

References libMesh::initialized(), and libMesh::libmesh_assert().

94  :
95  MeshBase (d)
96 {
98 }
libMesh::UnstructuredMesh::~UnstructuredMesh ( )
virtual

Destructor.

Definition at line 208 of file unstructured_mesh.C.

References libMesh::closed(), and libMesh::libmesh_assert().

209 {
210 // this->clear (); // Nothing to clear at this level
211 
213 }

Member Function Documentation

virtual element_iterator libMesh::MeshBase::active_elements_begin ( )
pure virtualinherited

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

Referenced by libMesh::MetisPartitioner::_do_partition(), libMesh::LinearPartitioner::_do_partition(), libMesh::SFCPartitioner::_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::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::CheckpointIO::n_active_levels_on_processor(), libMesh::MeshBase::n_active_sub_elem(), 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::FroIO::write(), libMesh::PostscriptIO::write(), libMesh::TetGenIO::write(), libMesh::MEDITIO::write_ascii(), libMesh::TecplotIO::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_begin ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::active_elements_end ( )
pure virtualinherited

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

Referenced by libMesh::MetisPartitioner::_do_partition(), libMesh::LinearPartitioner::_do_partition(), libMesh::SFCPartitioner::_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::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::CheckpointIO::n_active_levels_on_processor(), libMesh::MeshBase::n_active_sub_elem(), 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::FroIO::write(), libMesh::PostscriptIO::write(), libMesh::TetGenIO::write(), libMesh::MEDITIO::write_ascii(), libMesh::TecplotIO::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 virtualinherited
virtual element_iterator libMesh::MeshBase::active_local_elements_begin ( )
pure virtualinherited

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

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_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::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::for(), libMesh::EquationSystems::get_solution(), libMesh::LaplaceMeshSmoother::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), 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::MeshRefinement::test_level_one(), libMesh::MeshRefinement::test_unflagged(), 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_begin ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::active_local_elements_end ( )
pure virtualinherited

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

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_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::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::for(), libMesh::EquationSystems::get_solution(), libMesh::LaplaceMeshSmoother::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), 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::MeshRefinement::test_level_one(), libMesh::MeshRefinement::test_unflagged(), 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 virtualinherited
virtual element_iterator libMesh::MeshBase::active_local_subdomain_elements_begin ( const subdomain_id_type  subdomain_id)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::active_local_subdomain_elements_begin ( const subdomain_id_type  subdomain_id) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::active_local_subdomain_elements_end ( const subdomain_id_type  subdomain_id)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::active_local_subdomain_elements_end ( const subdomain_id_type  subdomain_id) const
pure virtualinherited
virtual node_iterator libMesh::MeshBase::active_nodes_begin ( )
pure virtualinherited
virtual const_node_iterator libMesh::MeshBase::active_nodes_begin ( ) const
pure virtualinherited
virtual node_iterator libMesh::MeshBase::active_nodes_end ( )
pure virtualinherited
virtual const_node_iterator libMesh::MeshBase::active_nodes_end ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::active_not_local_elements_begin ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::active_not_local_elements_begin ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::active_not_local_elements_end ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::active_not_local_elements_end ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::active_pid_elements_begin ( const processor_id_type  proc_id)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::active_pid_elements_begin ( const processor_id_type  proc_id) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::active_pid_elements_end ( const processor_id_type  proc_id)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::active_pid_elements_end ( const processor_id_type  proc_id) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::active_subdomain_elements_begin ( const subdomain_id_type  subdomain_id)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::active_subdomain_elements_begin ( const subdomain_id_type  subdomain_id) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::active_subdomain_elements_end ( const subdomain_id_type  subdomain_id)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::active_subdomain_elements_end ( const subdomain_id_type  subdomain_id) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::active_type_elements_begin ( const ElemType  type)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::active_type_elements_begin ( const ElemType  type) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::active_type_elements_end ( const ElemType  type)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::active_type_elements_end ( const ElemType  type) const
pure virtualinherited
virtual Node* libMesh::MeshBase::add_node ( Node n)
pure virtualinherited

Add Node n to the end of the vertex array.

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

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 virtualinherited
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::libmesh_assert(), libMesh::MeshBase::max_node_id(), libMesh::Elem::n_children(), libMesh::Elem::n_sides(), libMesh::Elem::n_vertices(), libMesh::Elem::neighbor(), libMesh::Elem::node(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), libMesh::Elem::p_level(), libMesh::Elem::p_refinement_flag(), libMesh::Elem::parent(), libMesh::MeshBase::prepare_for_use(), libMesh::DofObject::processor_id(), libMesh::Elem::refinement_flag(), libMesh::remote_elem, libMesh::MeshBase::renumber_nodes_and_elements(), libMesh::Elem::replace_child(), libMesh::DofObject::set_id(), libMesh::Elem::set_neighbor(), libMesh::Elem::set_node(), libMesh::Partitioner::set_node_processor_ids(), libMesh::Elem::set_p_level(), libMesh::Elem::set_p_refinement_flag(), libMesh::Elem::set_parent(), libMesh::Elem::set_refinement_flag(), libMesh::START_LOG(), libMesh::STOP_LOG(), libMesh::Elem::subdomain_id(), libMesh::Elem::type(), and libMesh::Elem::which_child_am_i().

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

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

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

Gathers all elements and nodes of the mesh onto every processor

Reimplemented in libMesh::ParallelMesh.

Definition at line 140 of file mesh_base.h.

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

140 {}
void libMesh::MeshBase::allow_renumbering ( bool  allow)
inlineinherited

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

Definition at line 536 of file mesh_base.h.

References libMesh::MeshBase::_skip_renumber_nodes_and_elements.

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

bool libMesh::MeshBase::allow_renumbering ( ) const
inlineinherited
virtual element_iterator libMesh::MeshBase::ancestor_elements_begin ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::ancestor_elements_begin ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::ancestor_elements_end ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::ancestor_elements_end ( ) const
pure virtualinherited
virtual void libMesh::MeshBase::assign_unique_ids ( )
protectedpure virtualinherited

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

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

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

void libMesh::MeshBase::clear_point_locator ( )
inherited

Releases the current PointLocator object.

Definition at line 414 of file mesh_base.C.

References libMesh::MeshBase::_point_locator.

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

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

Virtual "copy constructor"

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

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

const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inlineinherited
Returns
a reference to the Parallel::Communicator object used by this mesh.

Definition at line 86 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

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

87  { return _communicator; }
bool libMesh::UnstructuredMesh::contract ( )
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 1099 of file unstructured_mesh.C.

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

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

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

Definition at line 104 of file unstructured_mesh.C.

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

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

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

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

Definition at line 965 of file unstructured_mesh.C.

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

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

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

Definition at line 1005 of file unstructured_mesh.C.

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

Referenced by create_pid_mesh().

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

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

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 virtualinherited

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

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

Reimplemented in libMesh::ParallelMesh.

Definition at line 147 of file mesh_base.h.

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

147 {}
virtual Elem* libMesh::MeshBase::elem ( const dof_id_type  i)
pure virtualinherited

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 element_iterator libMesh::MeshBase::elements_begin ( )
pure virtualinherited

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_procids< Elem >(), 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_begin ( ) const
pure virtualinherited

const Elem iterator accessor functions.

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

virtual element_iterator libMesh::MeshBase::elements_end ( )
pure virtualinherited

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_procids< Elem >(), 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 virtualinherited
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 219 of file unstructured_mesh.C.

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

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

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

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

This function restores a previously broken element/node numbering such that mesh.node(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 441 of file mesh_base.C.

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

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

Definition at line 305 of file mesh_base.C.

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

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

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

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

virtual Node* libMesh::MeshBase::insert_node ( Node n)
pure virtualinherited

Insert Node n into the Mesh at a location consistent with n->id(), allocating extra storage if necessary. Will error rather than overwriting an existing Node. Primarily intended for use with the mesh_inserter_iterator, only use if you know what you are doing...

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

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

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

Definition at line 126 of file mesh_base.h.

References libMesh::MeshBase::_is_prepared.

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

127  { return _is_prepared; }
virtual element_iterator libMesh::MeshBase::level_elements_begin ( const unsigned int  level)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::level_elements_begin ( const unsigned int  level) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::level_elements_end ( const unsigned int  level)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::level_elements_end ( const unsigned int  level) const
pure virtualinherited
virtual void libMesh::MeshBase::libmesh_assert_valid_parallel_ids ( ) const
inlinevirtualinherited

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

Reimplemented in libMesh::ParallelMesh.

Definition at line 692 of file mesh_base.h.

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

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

Definition at line 155 of file mesh_base.h.

References libMesh::MeshBase::_dim.

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

156  { return static_cast<unsigned int>(_dim); }
dof_id_type libMesh::MeshBase::n_active_elem_on_proc ( const processor_id_type  proc) const
inherited

Returns the number of active elements on processor proc.

Definition at line 266 of file mesh_base.C.

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

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

267 {
268  libmesh_assert_less (proc_id, this->n_processors());
269  return static_cast<dof_id_type>(std::distance (this->active_pid_elements_begin(proc_id),
270  this->active_pid_elements_end (proc_id)));
271 }
dof_id_type libMesh::MeshBase::n_active_local_elem ( ) const
inlineinherited
dof_id_type libMesh::MeshBase::n_active_sub_elem ( ) const
inherited

Same, but only counts active elements.

Definition at line 290 of file mesh_base.C.

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

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

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

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(), libMesh::UniformRefinementEstimator::_estimate_error(), 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::AbaqusIO::read(), libMesh::Nemesis_IO::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::FroIO::write(), libMesh::TetGenIO::write(), libMesh::XdrIO::write(), libMesh::UNVIO::write_implementation(), libMesh::LegacyXdrIO::write_mesh(), libMesh::UCDIO::write_nodal_data(), libMesh::XdrIO::write_serialized_connectivity(), 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 253 of file mesh_base.C.

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

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

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

Returns the number of elements on the local processor.

Definition at line 283 of file mesh_base.h.

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

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

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

Returns the number of nodes on the local processor.

Definition at line 197 of file mesh_base.h.

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

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

198  { return this->n_nodes_on_proc (this->processor_id()); }
virtual dof_id_type libMesh::MeshBase::n_nodes ( ) const
pure virtualinherited

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(), 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::AbaqusIO::read(), libMesh::Nemesis_IO::read(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshTools::Modification::smooth(), libMesh::VariationalMeshSmoother::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::FroIO::write(), libMesh::TetGenIO::write(), libMesh::XdrIO::write(), libMesh::MEDITIO::write_ascii(), libMesh::TecplotIO::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::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), 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 240 of file mesh_base.C.

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

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

241 {
242  // We're either counting a processor's nodes or unpartitioned
243  // nodes
244  libmesh_assert (proc_id < this->n_processors() ||
246 
247  return static_cast<dof_id_type>(std::distance (this->pid_nodes_begin(proc_id),
248  this->pid_nodes_end (proc_id)));
249 }
unsigned int libMesh::MeshBase::n_partitions ( ) const
inlineinherited

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

Definition at line 578 of file mesh_base.h.

References libMesh::MeshBase::_n_parts.

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

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

Definition at line 92 of file parallel_object.h.

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

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

93  { return libmesh_cast_int<processor_id_type>(_communicator.size()); }
dof_id_type libMesh::MeshBase::n_sub_elem ( ) const
inherited

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

Definition at line 275 of file mesh_base.C.

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

276 {
277  dof_id_type ne=0;
278 
279  const_element_iterator el = this->elements_begin();
280  const const_element_iterator end = this->elements_end();
281 
282  for (; el!=end; ++el)
283  ne += (*el)->n_sub_elem();
284 
285  return ne;
286 }
subdomain_id_type libMesh::MeshBase::n_subdomains ( ) const
inherited

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

Definition at line 225 of file mesh_base.C.

References libMesh::MeshBase::subdomain_ids().

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

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

Returns the number of elements owned by no processor.

Definition at line 289 of file mesh_base.h.

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

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

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

Returns the number of nodes owned by no processor.

Definition at line 203 of file mesh_base.h.

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

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

unique_id_type libMesh::MeshBase::next_unique_id ( )
inlineinherited

Returns the next unique id to be used.

Definition at line 216 of file mesh_base.h.

References libMesh::MeshBase::_next_unique_id.

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

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_ptr ( const dof_id_type  i) const
pure virtualinherited

Return a 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.

Referenced by libMesh::GMVIO::_read_one_cell(), libMesh::SyncNodalPositions::act_on_data(), libMesh::BoundaryInfo::add_node(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::AbaqusIO::assign_boundary_node_ids(), libMesh::TetGenMeshInterface::assign_nodes_to_elem(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::VTKIO::cells_to_vtk(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::TriangleWrapper::copy_tri_to_mesh(), create_submesh(), libMesh::MeshTools::Modification::distort(), libMesh::UNVIO::element_in(), libMesh::MeshData::foreign_id_to_node(), libMesh::SyncNodalPositions::gather_data(), libMesh::DofMap::node_ptr(), libMesh::BoundaryInfo::operator=(), libMesh::ExodusII_IO::read(), libMesh::Nemesis_IO::read(), libMesh::VTKIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::AbaqusIO::read_elements(), libMesh::GmshIO::read_mesh(), libMesh::LegacyXdrIO::read_mesh(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::DofMap::scatter_constraints(), libMesh::Partitioner::set_node_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::unpack(), libMesh::Elem::PackedElem::unpack(), and libMesh::Nemesis_IO_Helper::write_nodal_coordinates().

virtual Node* libMesh::MeshBase::node_ptr ( const dof_id_type  i)
pure virtualinherited

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 node_iterator libMesh::MeshBase::nodes_begin ( )
pure virtualinherited

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(), libMesh::CheckpointIO::write_nodes(), and libMesh::VariationalMeshSmoother::writegr().

virtual const_node_iterator libMesh::MeshBase::nodes_begin ( ) const
pure virtualinherited

const Node iterator accessor functions.

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

virtual node_iterator libMesh::MeshBase::nodes_end ( )
pure virtualinherited

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(), libMesh::CheckpointIO::write_nodes(), and libMesh::VariationalMeshSmoother::writegr().

virtual const_node_iterator libMesh::MeshBase::nodes_end ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::not_active_elements_begin ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::not_active_elements_begin ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::not_active_elements_end ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::not_active_elements_end ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::not_ancestor_elements_begin ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::not_ancestor_elements_begin ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::not_ancestor_elements_end ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::not_ancestor_elements_end ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::not_level_elements_begin ( const unsigned int  level)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::not_level_elements_begin ( const unsigned int  level) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::not_level_elements_end ( const unsigned int  level)
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::not_level_elements_end ( const unsigned int  level) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::not_local_elements_begin ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::not_local_elements_begin ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::not_local_elements_end ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::not_local_elements_end ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::not_subactive_elements_begin ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::not_subactive_elements_begin ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::not_subactive_elements_end ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::not_subactive_elements_end ( ) const
pure virtualinherited
virtual dof_id_type libMesh::MeshBase::parallel_n_elem ( ) const
pure virtualinherited

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 virtualinherited

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)
virtualinherited

Call the default partitioner (currently metis_partition()).

Definition at line 343 of file mesh_base.C.

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

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

Definition at line 514 of file mesh_base.h.

References libMesh::ParallelObject::n_processors().

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

515  { this->partition(this->n_processors()); }
virtual AutoPtr<Partitioner>& libMesh::MeshBase::partitioner ( )
inlinevirtualinherited
virtual const_element_iterator libMesh::MeshBase::pid_elements_begin ( const processor_id_type  proc_id) const
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::pid_elements_end ( const processor_id_type  proc_id) const
pure virtualinherited
virtual node_iterator libMesh::MeshBase::pid_nodes_begin ( const processor_id_type  proc_id)
pure virtualinherited
virtual const_node_iterator libMesh::MeshBase::pid_nodes_begin ( const processor_id_type  proc_id) const
pure virtualinherited
virtual node_iterator libMesh::MeshBase::pid_nodes_end ( const processor_id_type  proc_id)
pure virtualinherited
virtual const_node_iterator libMesh::MeshBase::pid_nodes_end ( const processor_id_type  proc_id) const
pure virtualinherited
const PointLocatorBase & libMesh::MeshBase::point_locator ( ) const
inherited

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

Definition at line 383 of file mesh_base.C.

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

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

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

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

Definition at line 120 of file mesh_base.C.

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

Referenced by 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(), libMesh::GMVIO::read(), read(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::SerialMesh::stitching_helper(), libMesh::BoundaryInfo::sync(), libMesh::MeshRefinement::uniformly_coarsen(), and libMesh::MeshRefinement::uniformly_refine().

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

Prints relevant information about the mesh.

Definition at line 329 of file mesh_base.C.

References libMesh::MeshBase::get_info().

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

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

Definition at line 98 of file parallel_object.h.

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

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

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

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 Node* libMesh::MeshBase::query_node_ptr ( const dof_id_type  i) const
pure virtualinherited

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::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), and libMesh::Parallel::unpack().

virtual Node* libMesh::MeshBase::query_node_ptr ( const dof_id_type  i)
pure virtualinherited

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.

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

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

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

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

Definition at line 363 of file mesh_base.C.

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

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

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

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

Reimplemented in libMesh::ParallelMesh.

Definition at line 522 of file mesh_base.h.

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

522 {}
virtual void libMesh::MeshBase::renumber_elem ( dof_id_type  old_id,
dof_id_type  new_id 
)
pure virtualinherited

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

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 virtualinherited

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

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 virtualinherited

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 virtualinherited

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::ExodusII_IO::read(), libMesh::XdrIO::read(), libMesh::GmshIO::read_mesh(), and libMesh::LegacyXdrIO::read_mesh().

virtual void libMesh::MeshBase::reserve_nodes ( const dof_id_type  nn)
pure virtualinherited

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::ExodusII_IO::read(), libMesh::XdrIO::read(), libMesh::GmshIO::read_mesh(), and libMesh::LegacyXdrIO::read_mesh().

unsigned int& libMesh::MeshBase::set_n_partitions ( )
inlineprotectedinherited

Returns a writeable reference to the number of partitions.

Definition at line 859 of file mesh_base.h.

References libMesh::MeshBase::_n_parts.

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

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

Sets the next unique id to be used.

Definition at line 221 of file mesh_base.h.

References libMesh::MeshBase::_next_unique_id.

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

Return a writeable reference to the whole subdomain name map

Definition at line 841 of file mesh_base.h.

References libMesh::MeshBase::_block_id_to_name.

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

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

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

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

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

Definition at line 551 of file mesh_base.h.

References libMesh::MeshBase::_skip_partitioning.

Referenced by copy_nodes_and_elements().

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

Definition at line 552 of file mesh_base.h.

References libMesh::MeshBase::_skip_partitioning.

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

552 { return _skip_partitioning; }
unsigned int libMesh::MeshBase::spatial_dimension ( ) const
inlineinherited
AutoPtr< PointLocatorBase > libMesh::MeshBase::sub_point_locator ( ) const
inherited

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

Definition at line 399 of file mesh_base.C.

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

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

400 {
401  if (_point_locator.get() == NULL)
402  {
403  // PointLocator construction may not be safe within threads
405 
406  _point_locator.reset (PointLocatorBase::build(TREE, *this).release());
407  }
408 
409  return PointLocatorBase::build(TREE, *this, _point_locator.get());
410 }
virtual element_iterator libMesh::MeshBase::subactive_elements_begin ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::subactive_elements_begin ( ) const
pure virtualinherited
virtual element_iterator libMesh::MeshBase::subactive_elements_end ( )
pure virtualinherited
virtual const_element_iterator libMesh::MeshBase::subactive_elements_end ( ) const
pure virtualinherited
void libMesh::MeshBase::subdomain_ids ( std::set< subdomain_id_type > &  ids) const
inherited

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

Definition at line 206 of file mesh_base.C.

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

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

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

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

Definition at line 421 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name.

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

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

Definition at line 426 of file mesh_base.C.

References libMesh::MeshBase::_block_id_to_name.

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

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

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

Reimplemented in libMesh::ParallelMesh.

Definition at line 528 of file mesh_base.h.

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

528 {}
void libMesh::UnstructuredMesh::write ( const std::string &  name,
MeshData mesh_data = NULL 
)
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 753 of file unstructured_mesh.C.

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

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

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

Definition at line 918 of file unstructured_mesh.C.

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

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

Member Data Documentation

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

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

Definition at line 924 of file mesh_base.h.

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

unsigned int libMesh::MeshBase::_dim
protectedinherited
bool libMesh::MeshBase::_is_prepared
protectedinherited

Flag indicating if the mesh has been prepared for use.

Definition at line 881 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
protectedinherited

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

Definition at line 871 of file mesh_base.h.

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

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

A partitioner to use at each prepare_for_use().

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

Definition at line 898 of file mesh_base.h.

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

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

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

Definition at line 890 of file mesh_base.h.

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

bool libMesh::MeshBase::_skip_partitioning
protectedinherited

If this is true then no partitioning should be done.

Definition at line 910 of file mesh_base.h.

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

bool libMesh::MeshBase::_skip_renumber_nodes_and_elements
protectedinherited

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

This is set when prepare_for_use() is called.

Definition at line 917 of file mesh_base.h.

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

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

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

Definition at line 110 of file mesh_base.h.

Referenced by libMesh::MeshRefinement::_coarsen_elements(), 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< T >::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::AbaqusIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::CheckpointIO::read_bcs(), libMesh::GmshIO::read_mesh(), libMesh::LegacyXdrIO::read_mesh(), libMesh::CheckpointIO::read_nodesets(), libMesh::SerialMesh::renumber_nodes_and_elements(), libMesh::ParallelMesh::renumber_nodes_and_elements(), libMesh::SerialMesh::SerialMesh(), libMesh::SerialMesh::stitching_helper(), libMesh::Elem::topological_neighbor(), libMesh::Parallel::unpack(), libMesh::FroIO::write(), libMesh::ExodusII_IO::write(), libMesh::Nemesis_IO::write(), libMesh::XdrIO::write(), libMesh::LegacyXdrIO::write_mesh(), libMesh::Nemesis_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::LegacyXdrIO::write_soln(), and libMesh::DivaIO::write_stream().


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

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

Hosted By:
SourceForge.net Logo