#include <unstructured_mesh.h>
Inherits MeshBase.
Inherited by ParallelMesh, and SerialMesh.
typedef Predicates::multi_predicate Predicate
UnstructuredMesh (unsigned int d)
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 unsigned int pid) const
void create_submesh (UnstructuredMesh &new_mesh, const_element_iterator &it, const const_element_iterator &it_end) const
virtual void copy_nodes_and_elements (const UnstructuredMesh &other_mesh)
virtual void find_neighbors (const bool reset_remote_elements=false, const bool reset_current_list=true)
virtual bool contract ()
virtual AutoPtr< MeshBase > clone () 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 unsigned int n_nodes () const =0
unsigned int n_nodes_on_proc (const unsigned int proc) const
unsigned int n_local_nodes () const
unsigned int n_unpartitioned_nodes () const
virtual unsigned int max_node_id () const =0
virtual void reserve_nodes (const unsigned int nn)=0
virtual unsigned int n_elem () const =0
virtual unsigned int max_elem_id () const =0
virtual void reserve_elem (const unsigned int ne)=0
virtual void update_parallel_id_counts ()=0
virtual unsigned int n_active_elem () const =0
unsigned int n_elem_on_proc (const unsigned int proc) const
unsigned int n_local_elem () const
unsigned int n_unpartitioned_elem () const
unsigned int n_active_elem_on_proc (const unsigned int proc) const
unsigned int n_active_local_elem () const
unsigned int n_sub_elem () const
unsigned int n_active_sub_elem () const
virtual const Point & point (const unsigned int i) const =0
virtual const Node & node (const unsigned int i) const =0
virtual Node & node (const unsigned int i)=0
virtual const Node * node_ptr (const unsigned int i) const =0
virtual Node *& node_ptr (const unsigned int i)=0
virtual Elem * elem (const unsigned int i) const =0
virtual Node * add_point (const Point &p, const unsigned int id=DofObject::invalid_id, const unsigned int proc_id=DofObject::invalid_processor_id)=0
virtual Node * add_node (Node *n)=0
virtual void delete_node (Node *n)=0
virtual void renumber_node (unsigned int old_id, unsigned int new_id)=0
virtual Elem * add_elem (Elem *e)=0
virtual Elem * insert_elem (Elem *e)=0
virtual void delete_elem (Elem *e)=0
virtual void renumber_elem (unsigned int old_id, unsigned int new_id)=0
virtual void renumber_nodes_and_elements ()=0
void prepare_for_use (const bool skip_renumber_nodes_and_elements=false)
void partition (const unsigned int n_parts=libMesh::n_processors())
unsigned int n_subdomains () const
unsigned int n_partitions () const
unsigned int n_processors () const
unsigned int processor_id () const
std::string get_info () const
void print_info (std::ostream &os=std::cout) const
unsigned int recalculate_n_partitions ()
const PointLocatorBase & point_locator () const
void clear_point_locator ()
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 unsigned int proc_id)=0
virtual const_element_iterator pid_elements_begin (const unsigned int proc_id) const =0
virtual element_iterator pid_elements_end (const unsigned int proc_id)=0
virtual const_element_iterator pid_elements_end (const unsigned int 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 unsigned int proc_id)=0
virtual const_element_iterator active_pid_elements_begin (const unsigned int proc_id) const =0
virtual element_iterator active_pid_elements_end (const unsigned int proc_id)=0
virtual const_element_iterator active_pid_elements_end (const unsigned int 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 unsigned int subdomain_id)=0
virtual const_element_iterator active_local_subdomain_elements_begin (const unsigned int subdomain_id) const =0
virtual element_iterator active_local_subdomain_elements_end (const unsigned int subdomain_id)=0
virtual const_element_iterator active_local_subdomain_elements_end (const unsigned int 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 unsigned int proc_id)=0
virtual const_node_iterator pid_nodes_begin (const unsigned int proc_id) const =0
virtual node_iterator pid_nodes_end (const unsigned int proc_id)=0
virtual const_node_iterator pid_nodes_end (const unsigned int proc_id) const =0
unsigned int & set_n_subdomains ()
AutoPtr< BoundaryInfo > boundary_info
unsigned int & set_n_partitions ()
unsigned int _n_sbd
unsigned int _n_parts
unsigned int _dim
bool _is_prepared
AutoPtr< PointLocatorBase > _point_locator
AutoPtr< Partitioner > _partitioner
class Partitioner
class BoundaryInfo
std::ostream & operator<< (std::ostream &os, const MeshBase &m)
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 49 of file unstructured_mesh.h.
Definition at line 496 of file mesh_base.h.
Definition at line 85 of file unstructured_mesh.C.
References libMesh::initialized().
:
MeshBase (d)
{
libmesh_assert (libMesh::initialized());
}
Definition at line 177 of file unstructured_mesh.C.
References libMesh::closed().
{
// this->clear (); // Nothing to clear at this level
libmesh_assert (!libMesh::closed());
}
Implemented in ParallelMesh, and SerialMesh.
Referenced by SFCPartitioner::_do_partition(), MetisPartitioner::_do_partition(), LinearPartitioner::_do_partition(), DofMap::add_neighbors_to_send_list(), ParmetisPartitioner::assign_partitioning(), EquationSystems::build_discontinuous_solution_vector(), InfElemBuilder::build_inf_elem(), DofMap::compute_sparsity(), MeshTools::correct_node_proc_ids(), MeshTools::Modification::distort(), MeshRefinement::eliminate_unrefined_patches(), PointLocatorTree::enable_out_of_mesh_mode(), LocationMap< T >::fill(), MeshTools::find_boundary_nodes(), MeshRefinement::flag_elements_by_elem_fraction(), MeshRefinement::flag_elements_by_error_fraction(), MeshRefinement::flag_elements_by_error_tolerance(), MeshRefinement::flag_elements_by_mean_stddev(), MeshRefinement::flag_elements_by_nelem_target(), MeshTools::Modification::flatten(), PointLocatorList::init(), LaplaceMeshSmoother::init(), ParmetisPartitioner::initialize(), DofMap::invalidate_dofs(), MeshTools::libmesh_assert_valid_elem_ids(), MeshRefinement::limit_level_mismatch_at_edge(), MeshRefinement::limit_level_mismatch_at_node(), MeshRefinement::make_coarsening_compatible(), MeshCommunication::make_elems_parallel_consistent(), MeshRefinement::make_refinement_compatible(), FEMSystem::mesh_position_set(), MeshBase::n_active_sub_elem(), PointLocatorTree::operator()(), System::read_legacy_data(), GmshIO::read_mesh(), VariationalMeshSmoother::readgr(), MeshBase::recalculate_n_partitions(), DofMap::reinit(), Partitioner::set_node_processor_ids(), Partitioner::set_parent_processor_ids(), LaplaceMeshSmoother::smooth(), BoundaryInfo::sync(), Tree< N >::Tree(), MeshRefinement::uniformly_coarsen(), MeshRefinement::uniformly_p_coarsen(), MeshRefinement::uniformly_p_refine(), MeshRefinement::uniformly_refine(), TetGenIO::write(), PostscriptIO::write(), FroIO::write(), TecplotIO::write_ascii(), MEDITIO::write_ascii(), GMVIO::write_ascii_new_impl(), GMVIO::write_ascii_old_impl(), TecplotIO::write_binary(), GMVIO::write_discontinuous_gmv(), GmshIO::write_mesh(), GmshIO::write_post(), and GnuPlotIO::write_solution().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by SFCPartitioner::_do_partition(), MetisPartitioner::_do_partition(), LinearPartitioner::_do_partition(), DofMap::add_neighbors_to_send_list(), ParmetisPartitioner::assign_partitioning(), EquationSystems::build_discontinuous_solution_vector(), InfElemBuilder::build_inf_elem(), DofMap::compute_sparsity(), MeshTools::correct_node_proc_ids(), MeshTools::Modification::distort(), MeshRefinement::eliminate_unrefined_patches(), PointLocatorTree::enable_out_of_mesh_mode(), LocationMap< T >::fill(), MeshTools::find_boundary_nodes(), MeshRefinement::flag_elements_by_elem_fraction(), MeshRefinement::flag_elements_by_error_fraction(), MeshRefinement::flag_elements_by_error_tolerance(), MeshRefinement::flag_elements_by_mean_stddev(), MeshRefinement::flag_elements_by_nelem_target(), MeshTools::Modification::flatten(), PointLocatorList::init(), LaplaceMeshSmoother::init(), ParmetisPartitioner::initialize(), DofMap::invalidate_dofs(), MeshTools::libmesh_assert_valid_elem_ids(), MeshRefinement::limit_level_mismatch_at_edge(), MeshRefinement::limit_level_mismatch_at_node(), MeshRefinement::make_coarsening_compatible(), MeshCommunication::make_elems_parallel_consistent(), MeshRefinement::make_refinement_compatible(), FEMSystem::mesh_position_set(), MeshBase::n_active_sub_elem(), PointLocatorTree::operator()(), System::read_legacy_data(), GmshIO::read_mesh(), VariationalMeshSmoother::readgr(), MeshBase::recalculate_n_partitions(), DofMap::reinit(), Partitioner::set_node_processor_ids(), Partitioner::set_parent_processor_ids(), LaplaceMeshSmoother::smooth(), BoundaryInfo::sync(), Tree< N >::Tree(), MeshRefinement::uniformly_coarsen(), MeshRefinement::uniformly_p_coarsen(), MeshRefinement::uniformly_p_refine(), MeshRefinement::uniformly_refine(), TetGenIO::write(), PostscriptIO::write(), FroIO::write(), TecplotIO::write_ascii(), MEDITIO::write_ascii(), GMVIO::write_ascii_new_impl(), GMVIO::write_ascii_old_impl(), TecplotIO::write_binary(), GMVIO::write_discontinuous_gmv(), GmshIO::write_mesh(), GmshIO::write_post(), and GnuPlotIO::write_solution().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by ExactSolution::_compute_error(), UniformRefinementEstimator::_estimate_error(), DofMap::add_neighbors_to_send_list(), FEMSystem::assemble_qoi(), FEMSystem::assemble_qoi_derivative(), FEMSystem::assembly(), ParmetisPartitioner::build_graph(), EquationSystems::build_solution_vector(), System::calculate_norm(), DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), PatchRecoveryErrorEstimator::estimate_error(), JumpErrorEstimator::estimate_error(), ExactErrorEstimator::estimate_error(), MeshTools::find_hanging_nodes_and_parents(), MeshRefinement::flag_elements_by_error_fraction(), ParmetisPartitioner::initialize(), MeshTools::libmesh_assert_valid_node_procids(), System::local_dof_indices(), DofMap::max_constraint_error(), FEMSystem::mesh_position_get(), MeshTools::n_active_local_levels(), ErrorVector::plot_error(), FEMSystem::postprocess(), HPSingularity::select_refinement(), HPCoarsenTest::select_refinement(), MeshRefinement::test_level_one(), MeshRefinement::test_unflagged(), EnsightIO::write_geometry_ascii(), EnsightIO::write_scalar_ascii(), GnuPlotIO::write_solution(), EnsightIO::write_vector_ascii(), and System::zero_variable().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by ExactSolution::_compute_error(), UniformRefinementEstimator::_estimate_error(), DofMap::add_neighbors_to_send_list(), FEMSystem::assemble_qoi(), FEMSystem::assemble_qoi_derivative(), FEMSystem::assembly(), ParmetisPartitioner::build_graph(), EquationSystems::build_solution_vector(), System::calculate_norm(), DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), PatchRecoveryErrorEstimator::estimate_error(), JumpErrorEstimator::estimate_error(), ExactErrorEstimator::estimate_error(), MeshTools::find_hanging_nodes_and_parents(), MeshRefinement::flag_elements_by_error_fraction(), ParmetisPartitioner::initialize(), MeshTools::libmesh_assert_valid_node_procids(), System::local_dof_indices(), DofMap::max_constraint_error(), FEMSystem::mesh_position_get(), MeshTools::n_active_local_levels(), ErrorVector::plot_error(), FEMSystem::postprocess(), HPSingularity::select_refinement(), HPCoarsenTest::select_refinement(), MeshRefinement::test_level_one(), MeshRefinement::test_unflagged(), EnsightIO::write_geometry_ascii(), EnsightIO::write_scalar_ascii(), GnuPlotIO::write_solution(), EnsightIO::write_vector_ascii(), and System::zero_variable().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by create_pid_mesh(), ParmetisPartitioner::initialize(), and MeshBase::n_active_elem_on_proc().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by create_pid_mesh(), ParmetisPartitioner::initialize(), and MeshBase::n_active_elem_on_proc().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::n_active_elem_of_type().
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::n_active_elem_of_type().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by GMVIO::_read_one_cell(), MeshRefinement::add_elem(), MeshTools::Modification::all_tri(), MeshTools::Generation::build_cube(), InfElemBuilder::build_inf_elem(), Triangle::copy_tri_to_mesh(), create_submesh(), UNVIO::element_in(), MeshTools::Modification::flatten(), TetGenMeshInterface::pointset_convexhull(), VTKIO::read(), ExodusII_IO::read(), LegacyXdrIO::read_mesh(), GmshIO::read_mesh(), XdrIO::read_serialized_connectivity(), OFFIO::read_stream(), MatlabIO::read_stream(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), and TetGenMeshInterface::triangulate_pointset().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by GMVIO::_read_nodes(), MeshRefinement::add_point(), all_second_order(), MeshTools::Modification::all_tri(), MeshTools::Generation::build_cube(), MeshTools::Generation::build_delaunay_square(), InfElemBuilder::build_inf_elem(), Triangle::copy_tri_to_mesh(), create_submesh(), UNVIO::node_in(), VTKIO::read(), ExodusII_IO::read(), LegacyXdrIO::read_mesh(), GmshIO::read_mesh(), XdrIO::read_serialized_connectivity(), OFFIO::read_stream(), MatlabIO::read_stream(), TriangleInterface::triangulate(), and TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole().
Loop over the high-ordered elements. First make sure they _are_ indeed high-order, and then replace them with an equivalent first-order element.
If the second order element had any boundary conditions they should be transfered to the first-order element. The old boundary conditions will be removed from the BoundaryInfo data structure by insert_elem.
Implements MeshBase.
Definition at line 233 of file mesh_modification.C.
References MeshBase::_is_prepared, Elem::add_child(), MeshBase::boundary_info, Elem::build(), Elem::child(), MeshBase::elements_begin(), MeshBase::elements_end(), Elem::first_order_equivalent_type(), Elem::get_node(), Elem::has_children(), DofObject::id(), MeshBase::insert_elem(), Elem::n_children(), Elem::n_sides(), Elem::n_vertices(), Elem::p_level(), Elem::p_refinement_flag(), Elem::parent(), MeshBase::prepare_for_use(), DofObject::processor_id(), Elem::refinement_flag(), MeshBase::renumber_nodes_and_elements(), DofObject::set_id(), Elem::set_node(), Elem::set_p_level(), Elem::set_p_refinement_flag(), Elem::set_parent(), Elem::set_refinement_flag(), Elem::subdomain_id(), and Elem::type().
{
/*
* when the mesh is not prepared,
* at least renumber the nodes and
* elements, so that the node ids
* are correct
*/
if (!this->_is_prepared)
this->renumber_nodes_and_elements ();
START_LOG('all_first_order()', 'Mesh');
const_element_iterator endit = elements_end();
for (const_element_iterator it = elements_begin();
it != endit; ++it)
{
Elem* so_elem = *it;
libmesh_assert (so_elem != NULL);
/*
* build the first-order equivalent, add to
* the new_elements list.
*/
Elem *newparent = so_elem->parent();
Elem* lo_elem = Elem::build
(Elem::first_order_equivalent_type
(so_elem->type()), newparent).release();
#ifdef LIBMESH_ENABLE_AMR
/*
* Add this element to it's parent if it has one
*/
if (newparent)
newparent->add_child(lo_elem);
/*
* Reset the parent links of any child elements
*/
if (so_elem->has_children())
{
for (unsigned int c=0; c != so_elem->n_children(); ++c)
so_elem->child(c)->set_parent(lo_elem);
}
/*
* Copy as much data to the new element as makes sense
*/
lo_elem->set_p_level(so_elem->p_level());
lo_elem->set_refinement_flag(so_elem->refinement_flag());
lo_elem->set_p_refinement_flag(so_elem->p_refinement_flag());
#endif
libmesh_assert (lo_elem->n_vertices() == so_elem->n_vertices());
/*
* By definition the vertices of the linear and
* second order element are identically numbered.
* transfer these.
*/
for (unsigned int v=0; v < so_elem->n_vertices(); v++)
lo_elem->set_node(v) = so_elem->get_node(v);
libmesh_assert (lo_elem->n_sides() == so_elem->n_sides());
for (unsigned int s=0; s<so_elem->n_sides(); s++)
{
const short int boundary_id =
this->boundary_info->boundary_id (so_elem, s);
if (boundary_id != this->boundary_info->invalid_id)
this->boundary_info->add_side (lo_elem, s, boundary_id);
}
/*
* The new first-order element is ready.
* Inserting it into the mesh will replace and delete
* the second-order element.
*/
lo_elem->set_id(so_elem->id());
lo_elem->processor_id() = so_elem->processor_id();
lo_elem->subdomain_id() = so_elem->subdomain_id();
this->insert_elem(lo_elem);
}
STOP_LOG('all_first_order()', 'Mesh');
// delete or renumber nodes, etc
this->prepare_for_use();
}
Loop over the low-ordered elements in the _elements vector. First make sure they _are_ indeed low-order, and then replace them with an equivalent second-order element. Don't forget to delete the low-order element, or else it will leak!
If the linear element had any boundary conditions they should be transfered to the second-order element. The old boundary conditions will be removed from the BoundaryInfo data structure by insert_elem.
Implements MeshBase.
Definition at line 338 of file mesh_modification.C.
References MeshBase::_is_prepared, MeshBase::add_point(), MeshBase::boundary_info, Elem::build(), Elem::default_order(), MeshBase::elements_begin(), MeshBase::elements_end(), libMeshEnums::FIRST, Elem::get_node(), DofObject::id(), MeshBase::insert_elem(), DofObject::invalid_id, MeshBase::is_serial(), Elem::level(), MeshCommunication::make_nodes_parallel_consistent(), std::max(), MeshBase::mesh_dimension(), MeshBase::n_elem(), MeshBase::n_nodes(), Elem::n_sides(), Elem::n_vertices(), MeshBase::node(), MeshBase::point(), MeshBase::prepare_for_use(), DofObject::processor_id(), MeshBase::processor_id(), MeshBase::renumber_nodes_and_elements(), MeshBase::reserve_nodes(), Elem::second_order_equivalent_type(), Elem::subdomain_id(), and Elem::type().
Referenced by MeshTools::Generation::build_cube().
{
// This function must be run on all processors at once
parallel_only();
/*
* when the mesh is not prepared,
* at least renumber the nodes and
* elements, so that the node ids
* are correct
*/
if (!this->_is_prepared)
this->renumber_nodes_and_elements ();
/*
* If the mesh is empty
* then we have nothing to do
*/
if (!this->n_elem())
return;
/*
* If the mesh is already second order
* then we have nothing to do.
* We have to test for this in a round-about way to avoid
* a bug on distributed parallel meshes with more processors
* than elements.
*/
bool already_second_order = false;
if (this->elements_begin() != this->elements_end() &&
(*(this->elements_begin()))->default_order() != FIRST)
already_second_order = true;
Parallel::max(already_second_order);
if (already_second_order)
return;
START_LOG('all_second_order()', 'Mesh');
/*
* this map helps in identifying second order
* nodes. Namely, a second-order node:
* - edge node
* - face node
* - bubble node
* is uniquely defined through a set of adjacent
* vertices. This set of adjacent vertices is
* used to identify already added higher-order
* nodes. We are safe to use node id's since we
* make sure that these are correctly numbered.
*/
std::map<std::vector<unsigned int>, Node*> adj_vertices_to_so_nodes;
/*
* for speed-up of the
add_point() method, we
* can reserve memory. Guess the number of additional
* nodes for different dimensions
*/
switch (this->mesh_dimension())
{
case 1:
/*
* in 1D, there can only be order-increase from Edge2
* to Edge3. Something like 1/2 of n_nodes() have
* to be added
*/
this->reserve_nodes(static_cast<unsigned int>(1.5*this->n_nodes()));
break;
case 2:
/*
* in 2D, either refine from Tri3 to Tri6 (double the nodes)
* or from Quad4 to Quad8 (again, double) or Quad9 (2.25 that much)
*/
this->reserve_nodes(static_cast<unsigned int>(2*this->n_nodes()));
break;
case 3:
/*
* in 3D, either refine from Tet4 to Tet10 (factor = 2.5) up to
* Hex8 to Hex27 (something > 3). Since in 3D there _are_ already
* quite some nodes, and since we do not want to overburden the memory by
* a too conservative guess, use the lower bound
*/
this->reserve_nodes(static_cast<unsigned int>(2.5*this->n_nodes()));
break;
default:
// Hm?
libmesh_error();
}
/*
* form a vector that will hold the node id's of
* the vertices that are adjacent to the son-th
* second-order node. Pull this outside of the
* loop so that silly compilers don't repeatedly
* create and destroy the vector.
*/
std::vector<unsigned int> adjacent_vertices_ids;
const_element_iterator endit = elements_end();
for (const_element_iterator it = elements_begin();
it != endit; ++it)
{
// the linear-order element
Elem* lo_elem = *it;
libmesh_assert (lo_elem != NULL);
// make sure it is linear order
if (lo_elem->default_order() != FIRST)
{
std::cerr << 'ERROR: This is not a linear element: type='
<< lo_elem->type() << std::endl;
libmesh_error();
}
// this does _not_ work for refined elements
libmesh_assert (lo_elem->level () == 0);
/*
* build the second-order equivalent, add to
* the new_elements list. Note that this here
* is the only point where
full_ordered
* is necessary. The remaining code works well
* for either type of seconrd-order equivalent, e.g.
* Hex20 or Hex27, as equivalents for Hex8
*/
Elem* so_elem =
Elem::build (Elem::second_order_equivalent_type(lo_elem->type(),
full_ordered) ).release();
libmesh_assert (lo_elem->n_vertices() == so_elem->n_vertices());
/*
* By definition the vertices of the linear and
* second order element are identically numbered.
* transfer these.
*/
for (unsigned int v=0; v < lo_elem->n_vertices(); v++)
so_elem->set_node(v) = lo_elem->get_node(v);
/*
* Now handle the additional mid-side nodes. This
* is simply handled through a map that remembers
* the already-added nodes. This map maps the global
* ids of the vertices (that uniquely define this
* higher-order node) to the new node.
* Notation: son = second-order node
*/
const unsigned int son_begin = so_elem->n_vertices();
const unsigned int son_end = so_elem->n_nodes();
for (unsigned int son=son_begin; son<son_end; son++)
{
const unsigned int n_adjacent_vertices =
so_elem->n_second_order_adjacent_vertices(son);
adjacent_vertices_ids.resize(n_adjacent_vertices);
for (unsigned int v=0; v<n_adjacent_vertices; v++)
adjacent_vertices_ids[v] =
so_elem->node( so_elem->second_order_adjacent_vertex(son,v) );
/*
*
adjacent_vertices_ids is now in order of the current
* side. sort it, so that comparisons with the
*
adjacent_vertices_ids created through other elements'
* sides can match
*/
std::sort(adjacent_vertices_ids.begin(),
adjacent_vertices_ids.end());
// does this set of vertices already has a mid-node added?
std::pair<std::map<std::vector<unsigned int>, Node*>::iterator,
std::map<std::vector<unsigned int>, Node*>::iterator>
pos = adj_vertices_to_so_nodes.equal_range (adjacent_vertices_ids);
// no, not added yet
if (pos.first == pos.second)
{
/*
* for this set of vertices, there is no
* second_order node yet. Add it.
*
* compute the location of the new node as
* the average over the adjacent vertices.
*/
Point new_location = this->point(adjacent_vertices_ids[0]);
for (unsigned int v=1; v<n_adjacent_vertices; v++)
new_location += this->point(adjacent_vertices_ids[v]);
new_location /= static_cast<Real>(n_adjacent_vertices);
/* Add the new point to the mesh, giving it a globally
* well-defined processor id.
*/
Node* so_node = this->add_point
(new_location, DofObject::invalid_id,
this->node(adjacent_vertices_ids[0]).processor_id());
/*
* insert the new node with its defining vertex
* set into the map, and relocate pos to this
* new entry, so that the so_elem can use
*
pos for inserting the node
*/
adj_vertices_to_so_nodes.insert(pos.first,
std::make_pair(adjacent_vertices_ids,
so_node));
so_elem->set_node(son) = so_node;
}
// yes, already added.
else
{
libmesh_assert (pos.first->second != NULL);
so_elem->set_node(son) = pos.first->second;
}
}
libmesh_assert (lo_elem->n_sides() == so_elem->n_sides());
for (unsigned int s=0; s<lo_elem->n_sides(); s++)
{
const short int boundary_id =
this->boundary_info->boundary_id (lo_elem, s);
if (boundary_id != this->boundary_info->invalid_id)
this->boundary_info->add_side (so_elem, s, boundary_id);
}
/*
* The new second-order element is ready.
* Inserting it into the mesh will replace and delete
* the first-order element.
*/
so_elem->set_id(lo_elem->id());
so_elem->processor_id() = lo_elem->processor_id();
so_elem->subdomain_id() = lo_elem->subdomain_id();
this->insert_elem(so_elem);
}
// we can clear the map
adj_vertices_to_so_nodes.clear();
STOP_LOG('all_second_order()', 'Mesh');
// In a ParallelMesh our ghost node processor ids may be bad and
// the ids of nodes touching remote elements may be inconsistent.
// Fix them.
if (!this->is_serial())
{
LocationMap<Node> loc_map;
MeshCommunication().make_nodes_parallel_consistent
(*this, loc_map);
}
// renumber nodes, elements etc
this->prepare_for_use();
}
Reimplemented in ParallelMesh.
Definition at line 128 of file mesh_base.h.
Referenced by EquationSystems::allgather().
{}
Implemented in ParallelMesh, and SerialMesh.
Referenced by Partitioner::set_parent_processor_ids().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by Partitioner::set_parent_processor_ids().
Implemented in ParallelMesh, and SerialMesh.
Reimplemented in ParallelMesh, and SerialMesh.
Definition at line 117 of file mesh_base.C.
References MeshBase::_is_prepared, MeshBase::_n_parts, MeshBase::_n_sbd, MeshBase::boundary_info, and MeshBase::clear_point_locator().
Referenced by MeshTools::Generation::build_cube(), MeshTools::Generation::build_delaunay_square(), Triangle::copy_tri_to_mesh(), create_submesh(), VTKIO::read(), GMVIO::read(), ExodusII_IO::read(), LegacyXdrIO::read_ascii(), LegacyXdrIO::read_binary(), LegacyXdrIO::read_mesh(), GmshIO::read_mesh(), OFFIO::read_stream(), MatlabIO::read_stream(), TriangleInterface::triangulate(), and MeshBase::~MeshBase().
{
// Reset the number of subdomains
_n_sbd = 1;
// Reset the number of partitions
_n_parts = 1;
// Reset the _is_prepared flag
_is_prepared = false;
// Clear boundary information
this->boundary_info->clear();
// Clear our point locator.
this->clear_point_locator();
}
Definition at line 277 of file mesh_base.C.
References MeshBase::_point_locator, and AutoPtr< Tp >::reset().
Referenced by MeshBase::clear(), and MeshBase::prepare_for_use().
{
_point_locator.reset(NULL);
}
Implemented in ParallelMesh, and SerialMesh.
Referenced by ErrorVector::plot_error().
Implements MeshBase.
Definition at line 937 of file unstructured_mesh.C.
References Elem::active(), Elem::ancestor(), Elem::contract(), MeshBase::delete_elem(), MeshBase::elem(), MeshBase::elements_begin(), MeshBase::elements_end(), Elem::parent(), MeshBase::renumber_nodes_and_elements(), and Elem::subactive().
{
START_LOG ('contract()', 'Mesh');
// Flag indicating if this call actually changes the mesh
bool mesh_changed = false;
element_iterator in = elements_begin();
element_iterator out = elements_begin();
const element_iterator end = elements_end();
#ifdef DEBUG
for ( ; in != end; ++in)
if (*in != NULL)
{
Elem* elem = *in;
libmesh_assert(elem->active() || elem->subactive() || elem->ancestor());
}
in = elements_begin();
#endif
// Loop over the elements.
for ( ; in != end; ++in)
if (*in != NULL)
{
Elem* elem = *in;
// Delete all the subactive ones
if (elem->subactive())
{
// No level-0 element should be subactive.
// Note that we CAN'T test elem->level(), as that
// touches elem->parent()->dim(), and elem->parent()
// might have already been deleted!
libmesh_assert (elem->parent() != NULL);
// Delete the element
// This just sets a pointer to NULL, and doesn't
// invalidate any iterators
this->delete_elem(elem);
// the mesh has certainly changed
mesh_changed = true;
}
else
{
// Compress all the active ones
if (elem->active())
elem->contract();
else
libmesh_assert (elem->ancestor());
}
}
// Strip any newly-created NULL voids out of the element array
this->renumber_nodes_and_elements();
STOP_LOG ('contract()', 'Mesh');
return mesh_changed;
}
Definition at line 94 of file unstructured_mesh.C.
References MeshBase::_dim, MeshBase::_is_prepared, MeshBase::_n_parts, MeshBase::_n_sbd, Elem::add_child(), Elem::build(), MeshBase::elements_begin(), MeshBase::elements_end(), DofObject::id(), MeshBase::n_elem(), MeshBase::n_nodes(), Elem::node(), MeshBase::nodes_begin(), MeshBase::nodes_end(), Elem::p_refinement_flag(), Elem::parent(), DofObject::processor_id(), Elem::refinement_flag(), Elem::type(), and Elem::which_child_am_i().
Referenced by ParallelMesh::ParallelMesh(), and SerialMesh::SerialMesh().
{
// We're assuming our subclass data needs no copy
libmesh_assert(_n_sbd == other_mesh._n_sbd);
libmesh_assert(_n_parts == other_mesh._n_parts);
libmesh_assert(_dim == other_mesh._dim);
libmesh_assert(_is_prepared == other_mesh._is_prepared);
//Copy in Nodes
{
//Preallocate Memory if necessary
this->reserve_nodes(other_mesh.n_nodes());
const_node_iterator it = other_mesh.nodes_begin();
const_node_iterator end = other_mesh.nodes_end();
for (; it != end; ++it)
{
Node *oldn = *it;
// Add new nodes in old node Point locations
Node *newn = this->add_point(*oldn);
// And start them off in the same subdomain
newn->processor_id() = oldn->processor_id();
}
}
//Copy in Elements
{
//Preallocate Memory if necessary
this->reserve_elem(other_mesh.n_elem());
// Loop over the elements
MeshBase::const_element_iterator it = other_mesh.elements_begin();
const MeshBase::const_element_iterator end = other_mesh.elements_end();
// FIXME: Where do we set element IDs??
for (; it != end; ++it)
{
//Look at the old element
Elem *old = *it;
//Build a new element
Elem *newparent = old->parent() ?
this->elem(old->parent()->id()) : NULL;
AutoPtr<Elem> ap = Elem::build(old->type(), newparent);
Elem * elem = ap.release();
#ifdef LIBMESH_ENABLE_AMR
//Create the parent's child pointers if necessary
if (newparent)
{
// Make sure we have space for those child pointers
newparent->add_child(elem);
// We'd better be adding these in the correct order
libmesh_assert (newparent->which_child_am_i(elem) ==
old->parent()->which_child_am_i(old));
}
// Copy the refinement flags
elem->set_refinement_flag(old->refinement_flag());
elem->set_p_refinement_flag(old->p_refinement_flag());
#endif // #ifdef LIBMESH_ENABLE_AMR
//Assign all the nodes
for(unsigned int i=0;i<elem->n_nodes();i++)
elem->set_node(i) = &this->node(old->node(i));
//Hold onto it
this->add_elem(elem);
// And start it off in the same subdomain
elem->processor_id() = old->processor_id();
}
}
//Finally prepare the Mesh for use
this->prepare_for_use();
}
Definition at line 810 of file unstructured_mesh.C.
References MeshBase::active_pid_elements_begin(), MeshBase::active_pid_elements_end(), create_submesh(), and MeshBase::n_processors().
{
// Issue a warning if the number the number of processors
// currently available is less that that requested for
// partitioning. This is not necessarily an error since
// you may run on one processor and still partition the
// mesh into several partitions.
#ifdef DEBUG
if (this->n_processors() < pid)
{
std::cout << 'WARNING: You are creating a '
<< 'mesh for a processor id (='
<< pid
<< ') greater than '
<< 'the number of processors available for '
<< 'the calculation. (='
<< libMesh::n_processors()
<< ').'
<< std::endl;
}
#endif
// Create iterators to loop over the list of elements
// const_active_pid_elem_iterator it(this->elements_begin(), pid);
// const const_active_pid_elem_iterator it_end(this->elements_end(), pid);
const_element_iterator it = this->active_pid_elements_begin(pid);
const const_element_iterator it_end = this->active_pid_elements_end(pid);
this->create_submesh (pid_mesh, it, it_end);
}
Definition at line 850 of file unstructured_mesh.C.
References MeshBase::add_elem(), MeshBase::add_point(), MeshBase::boundary_info, Elem::build(), MeshBase::clear(), libMesh::invalid_uint, MeshBase::n_elem(), Elem::n_nodes(), MeshBase::n_nodes(), Elem::n_sides(), Elem::neighbor(), Elem::node(), MeshBase::node_ptr(), Elem::point(), MeshBase::prepare_for_use(), DofObject::processor_id(), Elem::set_node(), Elem::subdomain_id(), and Elem::type().
Referenced by create_pid_mesh().
{
// Just in case the subdomain_mesh already has some information
// in it, get rid of it.
new_mesh.clear();
// Fail if (*this == new_mesh), we cannot create a submesh inside ourself!
// This may happen if the user accidently passes the original mesh into
// this function! We will check this by making sure we did not just
// clear ourself.
libmesh_assert (this->n_nodes() != 0);
libmesh_assert (this->n_elem() != 0);
// How the nodes on this mesh will be renumbered to nodes
// on the new_mesh.
std::vector<unsigned int> new_node_numbers (this->n_nodes());
std::fill (new_node_numbers.begin(),
new_node_numbers.end(),
libMesh::invalid_uint);
// the number of nodes on the new mesh, will be incremented
unsigned int n_new_nodes = 0;
unsigned int n_new_elem = 0;
for (; it != it_end; ++it)
{
// increment the new element counter
n_new_elem++;
const Elem* old_elem = *it;
// Add an equivalent element type to the new_mesh
Elem* new_elem =
new_mesh.add_elem (Elem::build(old_elem->type()).release());
libmesh_assert (new_elem != NULL);
// Loop over the nodes on this element.
for (unsigned int n=0; n<old_elem->n_nodes(); n++)
{
libmesh_assert (old_elem->node(n) < new_node_numbers.size());
if (new_node_numbers[old_elem->node(n)] == libMesh::invalid_uint)
{
new_node_numbers[old_elem->node(n)] = n_new_nodes;
// Add this node to the new mesh
new_mesh.add_point (old_elem->point(n));
// Increment the new node counter
n_new_nodes++;
}
// Define this element's connectivity on the new mesh
libmesh_assert (new_node_numbers[old_elem->node(n)] < new_mesh.n_nodes());
new_elem->set_node(n) = new_mesh.node_ptr (new_node_numbers[old_elem->node(n)]);
}
// Copy ids for this element
new_elem->subdomain_id() = old_elem->subdomain_id();
new_elem->processor_id() = old_elem->processor_id();
// Maybe add boundary conditions for this element
for (unsigned int s=0; s<old_elem->n_sides(); s++)
if (old_elem->neighbor(s) == NULL)
if (this->boundary_info->boundary_id (old_elem, s) !=
this->boundary_info->invalid_id)
new_mesh.boundary_info->add_side (new_elem,
s,
this->boundary_info->boundary_id (old_elem, s));
} // end loop over elements
// Prepare the new_mesh for use
new_mesh.prepare_for_use();
}
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::Modification::all_tri(), MeshTools::Generation::build_cube(), contract(), MeshTools::Modification::flatten(), and TetGenMeshInterface::pointset_convexhull().
Implemented in ParallelMesh, and SerialMesh.
Reimplemented in ParallelMesh.
Definition at line 135 of file mesh_base.h.
Referenced by EquationSystems::init(), and MeshBase::prepare_for_use().
{}
Implemented in ParallelMesh, and SerialMesh.
Referenced by GMVIO::_read_materials(), BoundaryInfo::add_side(), InfElemBuilder::build_inf_elem(), VTKIO::cells_to_vtk(), contract(), DofMap::elem_ptr(), find_neighbors(), MeshRefinement::flag_elements_by_nelem_target(), MeshData::foreign_id_to_elem(), ExodusII_IO_Helper::initialize(), ErrorVector::is_active_elem(), ExodusII_IO::read(), XdrIO::read_serialized_connectivity(), MeshTools::subdomain_bounding_box(), Parallel::sync_element_data_by_parent_id(), TetGenMeshInterface::triangulate_conformingDelaunayMesh(), FroIO::write(), ExodusII_IO_Helper::write_elements(), LegacyXdrIO::write_mesh(), ExodusII_IO_Helper::write_sidesets(), and DivaIO::write_stream().
Implemented in ParallelMesh, and SerialMesh.
Referenced by EquationSystems::_add_system_to_nodes_and_elems(), MeshRefinement::_coarsen_elements(), MeshRefinement::_refine_elements(), MeshRefinement::add_p_to_h_refinement(), VariationalMeshSmoother::adjust_adapt_data(), all_first_order(), all_second_order(), MeshTools::Modification::all_tri(), EquationSystems::allgather(), MeshData::assign(), MeshCommunication::assign_global_indices(), MeshTools::Generation::build_cube(), MeshTools::Generation::build_delaunay_square(), MeshTools::build_nodes_to_elem_map(), MeshRefinement::clean_refinement_flags(), MeshRefinement::coarsen_elements(), CentroidPartitioner::compute_centroids(), contract(), copy_nodes_and_elements(), DofMap::create_dof_constraints(), DofMap::distribute_dofs(), MeshTools::elem_types(), UNVIO::element_out(), find_neighbors(), MeshTools::Modification::flatten(), MeshTools::get_not_subactive_node_ids(), EquationSystems::init(), MeshTools::libmesh_assert_no_links_to_elem(), MeshTools::libmesh_assert_valid_neighbors(), MeshTools::libmesh_assert_valid_node_pointers(), MeshTools::libmesh_assert_valid_refinement_flags(), MeshRefinement::make_coarsening_compatible(), MeshRefinement::make_flags_parallel_consistent(), MeshBase::n_sub_elem(), TetGenMeshInterface::pointset_convexhull(), MeshRefinement::refine_and_coarsen_elements(), MeshRefinement::refine_elements(), EquationSystems::reinit(), DofMap::reinit(), Partitioner::set_node_processor_ids(), Partitioner::single_partition(), MeshRefinement::switch_h_to_p_refinement(), MeshTools::total_weight(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), and LegacyXdrIO::write_mesh().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by EquationSystems::_add_system_to_nodes_and_elems(), MeshRefinement::_coarsen_elements(), MeshRefinement::_refine_elements(), MeshRefinement::add_p_to_h_refinement(), VariationalMeshSmoother::adjust_adapt_data(), all_first_order(), all_second_order(), MeshTools::Modification::all_tri(), EquationSystems::allgather(), MeshData::assign(), MeshCommunication::assign_global_indices(), MeshTools::Generation::build_cube(), MeshTools::Generation::build_delaunay_square(), MeshTools::build_nodes_to_elem_map(), MeshRefinement::clean_refinement_flags(), MeshRefinement::coarsen_elements(), CentroidPartitioner::compute_centroids(), contract(), copy_nodes_and_elements(), DofMap::create_dof_constraints(), DofMap::distribute_dofs(), MeshTools::elem_types(), UNVIO::element_out(), find_neighbors(), MeshTools::Modification::flatten(), MeshTools::get_not_subactive_node_ids(), EquationSystems::init(), MeshTools::libmesh_assert_no_links_to_elem(), MeshTools::libmesh_assert_valid_neighbors(), MeshTools::libmesh_assert_valid_node_pointers(), MeshTools::libmesh_assert_valid_refinement_flags(), MeshRefinement::make_coarsening_compatible(), MeshRefinement::make_flags_parallel_consistent(), MeshBase::n_sub_elem(), TetGenMeshInterface::pointset_convexhull(), MeshRefinement::refine_and_coarsen_elements(), MeshRefinement::refine_elements(), EquationSystems::reinit(), DofMap::reinit(), Partitioner::set_node_processor_ids(), Partitioner::single_partition(), MeshRefinement::switch_h_to_p_refinement(), MeshTools::total_weight(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), and LegacyXdrIO::write_mesh().
Implemented in ParallelMesh, and SerialMesh.
Here we look at all of the child elements.
If a child element has a NULL neighbor it is either because it is on the boundary or because its neighbor is at a different level. In the latter case we must get the neighbor from the parent.
If a child element has a remote_elem neighbor on a boundary it shares with its parent, that info may be out of date - if the parent's neighbor is active then the child should share it.
Furthermore, that neighbor better be active, otherwise we missed a child somewhere.
Implements MeshBase.
Definition at line 186 of file unstructured_mesh.C.
References MeshBase::_dim, Elem::active(), Elem::ancestor(), Elem::centroid(), Elem::child(), MeshBase::elem(), MeshBase::elements_begin(), MeshBase::elements_end(), Elem::has_children(), Elem::hmin(), DofObject::id(), Elem::key(), Elem::level(), MeshBase::level_elements_begin(), MeshBase::level_elements_end(), MeshTools::libmesh_assert_valid_neighbors(), Elem::n_children(), MeshTools::n_levels(), Elem::n_neighbors(), Elem::neighbor(), Elem::parent(), MeshBase::processor_id(), DofObject::processor_id(), remote_elem, Elem::set_neighbor(), Elem::side(), Elem::subactive(), and GMVIO::write().
Referenced by MeshCommunication::allgather().
{
// We might actually want to run this on an empty mesh
// (e.g. the boundary mesh for a nonexistant bcid!)
// libmesh_assert(this->n_nodes() != 0);
// libmesh_assert(this->n_elem() != 0);
// This function must be run on all processors at once
parallel_only();
START_LOG('find_neighbors()', 'Mesh');
const element_iterator el_end = this->elements_end();
//TODO:[BSK] This should be removed later?!
if (reset_current_list)
for (element_iterator el = this->elements_begin(); el != el_end; ++el)
{
Elem* elem = *el;
for (unsigned int s=0; s<elem->n_neighbors(); s++)
if (elem->neighbor(s) != remote_elem ||
reset_remote_elements)
elem->set_neighbor(s,NULL);
}
// Find neighboring elements by first finding elements
// with identical side keys and then check to see if they
// are neighbors
{
// data structures -- Use the hash_multimap if available
typedef unsigned int key_type;
typedef std::pair<Elem*, unsigned char> val_type;
typedef std::pair<key_type, val_type> key_val_pair;
#if defined(LIBMESH_HAVE_UNORDERED_MAP)
typedef std::unordered_multimap<key_type, val_type> map_type;
#elif defined(LIBMESH_HAVE_TR1_UNORDERED_MAP)
typedef std::tr1::unordered_multimap<key_type, val_type> map_type;
#elif defined(LIBMESH_HAVE_HASH_MAP)
typedef std::hash_multimap<key_type, val_type> map_type;
#elif defined(LIBMESH_HAVE_EXT_HASH_MAP)
# if (__GNUC__ == 3) && (__GNUC_MINOR__ == 0) // gcc 3.0
typedef std::hash_multimap<key_type, val_type> map_type;
# elif (__GNUC__ >= 3) // gcc 3.1 & newer
typedef __gnu_cxx::hash_multimap<key_type, val_type> map_type;
# else
// XLC and who knows what other compilers get here.
// Try the most standard thing we can:
typedef std::multimap<key_type, val_type> map_type;
# endif
#else
typedef std::multimap<key_type, val_type> map_type;
#endif
// A map from side keys to corresponding elements & side numbers
map_type side_to_elem_map;
for (element_iterator el = this->elements_begin(); el != el_end; ++el)
{
Elem* element = *el;
for (unsigned int ms=0; ms<element->n_neighbors(); ms++)
{
next_side:
// If we haven't yet found a neighbor on this side, try.
// Even if we think our neighbor is remote, that
// information may be out of date.
if (element->neighbor(ms) == NULL ||
element->neighbor(ms) == remote_elem)
{
// Get the key for the side of this element
const unsigned int key = element->key(ms);
// Look for elements that have an identical side key
std::pair <map_type::iterator, map_type::iterator>
bounds = side_to_elem_map.equal_range(key);
// May be multiple keys, check all the possible
// elements which _might_ be neighbors.
if (bounds.first != bounds.second)
{
// Get the side for this element
const AutoPtr<DofObject> my_side(element->side(ms));
// Look at all the entries with an equivalent key
while (bounds.first != bounds.second)
{
// Get the potential element
Elem* neighbor = bounds.first->second.first;
// Get the side for the neighboring element
const unsigned int ns = bounds.first->second.second;
const AutoPtr<DofObject> their_side(neighbor->side(ns));
//libmesh_assert (my_side.get() != NULL);
//libmesh_assert (their_side.get() != NULL);
// If found a match with my side
//
// We need special tests here for 1D:
// since parents and children have an equal
// side (i.e. a node), we need to check
// ns != ms, and we also check level() to
// avoid setting our neighbor pointer to
// any of our neighbor's descendants
if( (*my_side == *their_side) &&
(element->level() == neighbor->level()) &&
((_dim != 1) || (ns != ms)) )
{
// So share a side. Is this a mixed pair
// of subactive and active/ancestor
// elements?
// If not, then we're neighbors.
// If so, then the subactive's neighbor is
if (element->subactive() ==
neighbor->subactive())
{
// an element is only subactive if it has
// been coarsened but not deleted
element->set_neighbor (ms,neighbor);
neighbor->set_neighbor(ns,element);
}
else if (element->subactive())
{
element->set_neighbor(ms,neighbor);
}
else if (neighbor->subactive())
{
neighbor->set_neighbor(ns,element);
}
side_to_elem_map.erase (bounds.first);
// get out of this nested crap
goto next_side;
}
++bounds.first;
}
}
// didn't find a match...
// Build the map entry for this element
key_val_pair kvp;
kvp.first = key;
kvp.second.first = element;
kvp.second.second = ms;
// use the lower bound as a hint for
// where to put it.
#if defined(LIBMESH_HAVE_UNORDERED_MAP) || defined(LIBMESH_HAVE_TR1_UNORDERED_MAP) || defined(LIBMESH_HAVE_HASH_MAP) || defined(LIBMESH_HAVE_EXT_HASH_MAP)
side_to_elem_map.insert (kvp);
#else
side_to_elem_map.insert (bounds.first,kvp);
#endif
}
}
}
}
#ifdef LIBMESH_ENABLE_AMR
const unsigned int n_levels = MeshTools::n_levels(*this);
for (unsigned int level = 1; level < n_levels; ++level)
{
element_iterator end = this->level_elements_end(level);
for (element_iterator el = this->level_elements_begin(level);
el != end; ++el)
{
Elem* elem = *el;
libmesh_assert(elem);
libmesh_assert(elem->parent());
for (unsigned int s=0; s < elem->n_neighbors(); s++)
if (elem->neighbor(s) == NULL)
// This currently leads to an infinite loop in ex10?
// if (elem->neighbor(s) == NULL ||
// (elem->neighbor(s) == remote_elem &&
// parent->is_child_on_side(parent->which_child_am_i(elem), s)))
{
Elem *neigh = elem->parent()->neighbor(s);
// If neigh was refined and had non-subactive children
// made remote earlier, then a non-subactive elem should
// actually have one of those remote children as a
// neighbor
if (neigh && (neigh->ancestor()) && (!elem->subactive()))
{
#ifdef DEBUG
// Let's make sure that 'had children made remote'
// situation is actually the case
libmesh_assert(neigh->has_children());
bool neigh_has_remote_children = false;
for (unsigned int c = 0; c != neigh->n_children(); ++c)
{
if (neigh->child(c) == remote_elem)
neigh_has_remote_children = true;
}
libmesh_assert(neigh_has_remote_children);
// And let's double-check that we don't have
// a remote_elem neighboring a local element
libmesh_assert(elem->processor_id() !=
libMesh::processor_id());
#endif // DEBUG
neigh = const_cast<RemoteElem*>(remote_elem);
}
elem->set_neighbor(s, neigh);
#ifdef DEBUG
if (neigh != NULL && neigh != remote_elem)
// We ignore subactive elements here because
// we don't care about neighbors of subactive element.
if ((!neigh->active()) && (!elem->subactive()))
{
std::cerr << 'On processor ' << libMesh::processor_id()
<< std::endl;
std::cerr << 'Bad element ID = ' << elem->id()
<< ', Side ' << s << ', Bad neighbor ID = ' << neigh->id() << std::endl;
std::cerr << 'Bad element proc_ID = ' << elem->processor_id()
<< ', Bad neighbor proc_ID = ' << neigh->processor_id() << std::endl;
std::cerr << 'Bad element size = ' << elem->hmin()
<< ', Bad neighbor size = ' << neigh->hmin() << std::endl;
std::cerr << 'Bad element center = ' << elem->centroid()
<< ', Bad neighbor center = ' << neigh->centroid() << std::endl;
std::cerr << 'ERROR: '
<< (elem->active()?'Active':'Ancestor')
<< ' Element at level '
<< elem->level() << std::endl;
std::cerr << 'with '
<< (elem->parent()->active()?'active':
(elem->parent()->subactive()?'subactive':'ancestor'))
<< ' parent share '
<< (neigh->subactive()?'subactive':'ancestor')
<< ' neighbor at level ' << neigh->level()
<< std::endl;
GMVIO(*this).write ('bad_mesh.gmv');
libmesh_error();
}
#endif // DEBUG
}
}
}
#endif // AMR
#ifdef DEBUG
MeshTools::libmesh_assert_valid_neighbors(*this);
#endif
STOP_LOG('find_neighbors()', 'Mesh');
}
Definition at line 203 of file mesh_base.C.
References MeshBase::mesh_dimension(), MeshBase::n_active_elem(), MeshBase::n_elem(), MeshBase::n_local_elem(), MeshBase::n_local_nodes(), MeshBase::n_nodes(), MeshBase::n_processors(), MeshBase::n_subdomains(), MeshBase::processor_id(), and MeshBase::spatial_dimension().
Referenced by MeshBase::print_info().
{
std::ostringstream out;
out << ' Mesh Information:' << '
<< ' mesh_dimension()=' << this->mesh_dimension() << '
<< ' spatial_dimension()=' << this->spatial_dimension() << '
<< ' n_nodes()=' << this->n_nodes() << '
<< ' n_local_nodes()=' << this->n_local_nodes() << '
<< ' n_elem()=' << this->n_elem() << '
<< ' n_local_elem()=' << this->n_local_elem() << '
#ifdef LIBMESH_ENABLE_AMR
<< ' n_active_elem()=' << this->n_active_elem() << '
#endif
<< ' n_subdomains()=' << this->n_subdomains() << '
<< ' n_processors()=' << this->n_processors() << '
<< ' processor_id()=' << this->processor_id() << ';
return out.str();
}
Implemented in ParallelMesh, and SerialMesh.
Referenced by all_first_order(), and all_second_order().
Definition at line 114 of file mesh_base.h.
References MeshBase::_is_prepared.
Referenced by DofMap::compute_sparsity(), DofMap::create_dof_constraints(), DofMap::distribute_dofs(), and DofMap::reinit().
{ return _is_prepared; }
Reimplemented in ParallelMesh.
Definition at line 121 of file mesh_base.h.
Referenced by MeshRefinement::_coarsen_elements(), MetisPartitioner::_do_partition(), ParmetisPartitioner::_do_repartition(), MeshRefinement::_refine_elements(), all_second_order(), EquationSystems::allgather(), InfElemBuilder::build_inf_elem(), MeshRefinement::coarsen_elements(), DofMap::create_dof_constraints(), MeshRefinement::flag_elements_by_elem_fraction(), MeshRefinement::flag_elements_by_mean_stddev(), MeshRefinement::flag_elements_by_nelem_target(), LocationMap< T >::init(), MeshRefinement::make_coarsening_compatible(), FEMSystem::mesh_position_set(), BoundaryInfo::n_boundary_conds(), Partitioner::partition(), MeshRefinement::refine_and_coarsen_elements(), MeshRefinement::refine_elements(), Partitioner::set_parent_processor_ids(), MeshTools::total_weight(), GMVIO::write_ascii_old_impl(), and LegacyXdrIO::write_mesh().
{ return true; }
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::Modification::change_boundary_id(), find_neighbors(), MeshRefinement::make_coarsening_compatible(), and MeshTools::Modification::smooth().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::Modification::change_boundary_id(), find_neighbors(), MeshRefinement::make_coarsening_compatible(), and MeshTools::Modification::smooth().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshCommunication::assign_global_indices(), DofMap::create_dof_constraints(), MeshTools::libmesh_assert_valid_remote_elems(), MeshTools::n_local_levels(), and MeshTools::n_p_levels().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshCommunication::assign_global_indices(), DofMap::create_dof_constraints(), MeshTools::libmesh_assert_valid_remote_elems(), MeshTools::n_local_levels(), MeshTools::n_p_levels(), and XdrIO::write_serialized_connectivity().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by XdrIO::write_serialized_bcs(), and XdrIO::write_serialized_connectivity().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by XdrIO::write_serialized_bcs(), and XdrIO::write_serialized_connectivity().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshCommunication::assign_global_indices(), MeshTools::bounding_box(), DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), MeshTools::libmesh_assert_valid_node_procids(), XdrIO::write_serialized_nodes(), and System::zero_variable().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshCommunication::assign_global_indices(), MeshTools::bounding_box(), DofMap::distribute_local_dofs_node_major(), DofMap::distribute_local_dofs_var_major(), MeshTools::libmesh_assert_valid_node_procids(), XdrIO::write_serialized_nodes(), and System::zero_variable().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by UniformRefinementEstimator::_estimate_error(), InfElemBuilder::build_inf_elem(), PatchRecoveryErrorEstimator::estimate_error(), JumpErrorEstimator::estimate_error(), ExactErrorEstimator::estimate_error(), MeshTools::libmesh_assert_valid_refinement_flags(), ParallelMesh::ParallelMesh(), and Partitioner::set_parent_processor_ids().
Implemented in ParallelMesh, and SerialMesh.
Referenced by DofMap::add_neighbors_to_send_list(), InfElemBuilder::build_inf_elem(), EquationSystems::build_solution_vector(), MeshTools::libmesh_assert_valid_node_procids(), ParallelMesh::ParallelMesh(), and GMVIO::write_ascii_old_impl().
Definition at line 140 of file mesh_base.h.
References MeshBase::_dim.
Referenced by ExactSolution::_compute_error(), UniformRefinementEstimator::_estimate_error(), HPCoarsenTest::add_projection(), all_second_order(), MeshTools::Generation::build_cube(), EquationSystems::build_discontinuous_solution_vector(), EquationSystems::build_solution_vector(), System::calculate_norm(), DofMap::create_dof_constraints(), MeshTools::Modification::distort(), JumpErrorEstimator::estimate_error(), ExactErrorEstimator::estimate_error(), MeshRefinement::flag_elements_by_elem_fraction(), MeshRefinement::flag_elements_by_nelem_target(), MeshBase::get_info(), MeshFunction::gradient(), MeshFunction::hessian(), PointLocatorTree::init(), LaplaceMeshSmoother::init(), System::ProjectVector::operator()(), PatchRecoveryErrorEstimator::EstimateError::operator()(), MeshFunction::operator()(), Nemesis_IO::read(), ExodusII_IO::read(), System::read_header(), GmshIO::read_mesh(), OFFIO::read_stream(), MatlabIO::read_stream(), MeshTools::Modification::rotate(), HPCoarsenTest::select_refinement(), MeshTools::Modification::smooth(), DofMap::use_coupled_neighbor_dofs(), PostscriptIO::write(), TecplotIO::write_ascii(), GMVIO::write_ascii_old_impl(), TecplotIO::write_binary(), GMVIO::write_discontinuous_gmv(), EnsightIO::write_scalar_ascii(), GnuPlotIO::write_solution(), DivaIO::write_stream(), and EnsightIO::write_vector_ascii().
{ return static_cast<unsigned int>(_dim); }
Implemented in ParallelMesh, and SerialMesh.
Referenced by SFCPartitioner::_do_partition(), MetisPartitioner::_do_partition(), LinearPartitioner::_do_partition(), GMVIO::add_cell_centered_data(), MeshTools::Modification::all_tri(), VTKIO::cells_to_vtk(), MeshRefinement::flag_elements_by_error_tolerance(), MeshRefinement::flag_elements_by_nelem_target(), MeshTools::Modification::flatten(), MeshBase::get_info(), PointLocatorList::init(), Partitioner::partition(), Partitioner::repartition(), VariationalMeshSmoother::smooth(), VTKIO::write(), GMVIO::write_ascii_new_impl(), GMVIO::write_ascii_old_impl(), GMVIO::write_discontinuous_gmv(), VTKIO::write_equation_systems(), GmshIO::write_mesh(), and GnuPlotIO::write_solution().
Definition at line 164 of file mesh_base.C.
References MeshBase::active_pid_elements_begin(), MeshBase::active_pid_elements_end(), and libMesh::n_processors().
Referenced by MeshBase::n_active_local_elem().
{
libmesh_assert (proc_id < libMesh::n_processors());
return static_cast<unsigned int>(std::distance (this->active_pid_elements_begin(proc_id),
this->active_pid_elements_end (proc_id)));
}
Definition at line 253 of file mesh_base.h.
References MeshBase::n_active_elem_on_proc(), and libMesh::processor_id().
Referenced by ParmetisPartitioner::assign_partitioning(), ParmetisPartitioner::build_graph(), and ParmetisPartitioner::initialize().
{ return this->n_active_elem_on_proc (libMesh::processor_id()); }
Definition at line 188 of file mesh_base.C.
References MeshBase::active_elements_begin(), and MeshBase::active_elements_end().
Referenced by TecplotIO::write_ascii(), GMVIO::write_ascii_old_impl(), and TecplotIO::write_binary().
{
unsigned int ne=0;
const_element_iterator el = this->active_elements_begin();
const const_element_iterator end = this->active_elements_end();
for (; el!=end; ++el)
ne += (*el)->n_sub_elem();
return ne;
}
Implemented in ParallelMesh, and SerialMesh.
Referenced by SFCPartitioner::_do_partition(), CentroidPartitioner::_do_partition(), UniformRefinementEstimator::_estimate_error(), all_second_order(), MeshCommunication::assign_global_indices(), MeshTools::Generation::build_cube(), InfElemBuilder::build_inf_elem(), MeshTools::build_nodes_to_elem_map(), CentroidPartitioner::compute_centroids(), copy_nodes_and_elements(), create_submesh(), MeshTools::Modification::distort(), MeshRefinement::flag_elements_by_elem_fraction(), MeshBase::get_info(), ExodusII_IO_Helper::initialize(), ParallelMesh::ParallelMesh(), ExodusII_IO::read(), HPCoarsenTest::select_refinement(), MeshBase::set_mesh_dimension(), MeshTools::subdomain_bounding_box(), TetGenMeshInterface::triangulate_conformingDelaunayMesh(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), XdrIO::write(), TetGenIO::write(), FroIO::write(), UNVIO::write_implementation(), LegacyXdrIO::write_mesh(), XdrIO::write_serialized_connectivity(), and DivaIO::write_stream().
Definition at line 151 of file mesh_base.C.
References DofObject::invalid_processor_id, libMesh::n_processors(), MeshBase::pid_elements_begin(), and MeshBase::pid_elements_end().
Referenced by MeshBase::n_local_elem(), and MeshBase::n_unpartitioned_elem().
{
// We're either counting a processor's elements or unpartitioned
// elements
libmesh_assert (proc_id < libMesh::n_processors() ||
proc_id == DofObject::invalid_processor_id);
return static_cast<unsigned int>(std::distance (this->pid_elements_begin(proc_id),
this->pid_elements_end (proc_id)));
}
Definition at line 236 of file mesh_base.h.
References MeshBase::n_elem_on_proc(), and libMesh::processor_id().
Referenced by MeshBase::get_info(), ParallelMesh::parallel_n_elem(), and ParallelMesh::update_parallel_id_counts().
{ return this->n_elem_on_proc (libMesh::processor_id()); }
Definition at line 172 of file mesh_base.h.
References MeshBase::n_nodes_on_proc(), and libMesh::processor_id().
Referenced by MeshBase::get_info(), ParallelMesh::parallel_n_nodes(), and ParallelMesh::update_parallel_id_counts().
{ return this->n_nodes_on_proc (libMesh::processor_id()); }
Implemented in ParallelMesh, and SerialMesh.
Referenced by all_second_order(), MeshCommunication::assign_global_indices(), MeshTools::Generation::build_cube(), MeshTools::Generation::build_delaunay_square(), MeshTools::build_nodes_to_elem_map(), EquationSystems::build_solution_vector(), GMVIO::copy_nodal_solution(), copy_nodes_and_elements(), create_submesh(), MeshTools::Modification::distort(), MeshTools::find_boundary_nodes(), MeshBase::get_info(), TetGenMeshInterface::get_node_index(), LaplaceMeshSmoother::init(), ExodusII_IO_Helper::initialize(), MeshRefinement::limit_level_mismatch_at_node(), VTKIO::nodes_to_vtk(), ParallelMesh::ParallelMesh(), TetGenMeshInterface::pointset_convexhull(), ExodusII_IO::read(), MeshTools::Modification::rotate(), MeshTools::Modification::scale(), VariationalMeshSmoother::smooth(), LaplaceMeshSmoother::smooth(), MeshTools::Modification::smooth(), VTKIO::solution_to_vtk(), MeshTools::subdomain_bounding_box(), BoundaryInfo::sync(), VTKIO::system_vectors_to_vtk(), MeshTools::Modification::translate(), MeshData::translate(), TriangleInterface::triangulate(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), TetGenMeshInterface::triangulate_pointset(), XdrIO::write(), TetGenIO::write(), FroIO::write(), TecplotIO::write_ascii(), MEDITIO::write_ascii(), GMVIO::write_ascii_new_impl(), GMVIO::write_ascii_old_impl(), TecplotIO::write_binary(), UNVIO::write_implementation(), GmshIO::write_mesh(), GmshIO::write_post(), XdrIO::write_serialized_nodes(), LegacyXdrIO::write_soln(), DivaIO::write_stream(), and VariationalMeshSmoother::writegr().
Definition at line 138 of file mesh_base.C.
References DofObject::invalid_processor_id, libMesh::n_processors(), MeshBase::pid_nodes_begin(), and MeshBase::pid_nodes_end().
Referenced by MeshBase::n_local_nodes(), and MeshBase::n_unpartitioned_nodes().
{
// We're either counting a processor's nodes or unpartitioned
// nodes
libmesh_assert (proc_id < libMesh::n_processors() ||
proc_id == DofObject::invalid_processor_id);
return static_cast<unsigned int>(std::distance (this->pid_nodes_begin(proc_id),
this->pid_nodes_end (proc_id)));
}
Definition at line 429 of file mesh_base.h.
References MeshBase::_n_parts.
Referenced by Partitioner::set_node_processor_ids(), BoundaryInfo::sync(), write(), GMVIO::write_ascii_new_impl(), and GMVIO::write_ascii_old_impl().
{ return _n_parts; }
Definition at line 436 of file mesh_base.h.
Referenced by ParallelMesh::add_elem(), ParallelMesh::add_node(), ParallelMesh::clear(), create_pid_mesh(), MeshBase::get_info(), ParallelMesh::renumber_dof_objects(), ParallelMesh::renumber_nodes_and_elements(), and GMVIO::write_discontinuous_gmv().
{ return libMesh::n_processors(); }
Definition at line 173 of file mesh_base.C.
References MeshBase::elements_begin(), and MeshBase::elements_end().
{
unsigned int ne=0;
const_element_iterator el = this->elements_begin();
const const_element_iterator end = this->elements_end();
for (; el!=end; ++el)
ne += (*el)->n_sub_elem();
return ne;
}
Definition at line 420 of file mesh_base.h.
References MeshBase::_n_sbd.
Referenced by MeshBase::get_info(), BoundaryInfo::sync(), XdrIO::write(), and write().
{ return _n_sbd; }
Definition at line 242 of file mesh_base.h.
References DofObject::invalid_processor_id, and MeshBase::n_elem_on_proc().
Referenced by ParallelMesh::parallel_n_elem(), and ParallelMesh::update_parallel_id_counts().
{ return this->n_elem_on_proc (DofObject::invalid_processor_id); }
Definition at line 178 of file mesh_base.h.
References DofObject::invalid_processor_id, and MeshBase::n_nodes_on_proc().
Referenced by ParallelMesh::parallel_n_nodes(), and ParallelMesh::update_parallel_id_counts().
{ return this->n_nodes_on_proc (DofObject::invalid_processor_id); }
Implemented in ParallelMesh, and SerialMesh.
Referenced by all_second_order(), MeshTools::Modification::all_tri(), MeshTools::Generation::build_cube(), InfElemBuilder::build_inf_elem(), MeshTools::Modification::distort(), TetGenMeshInterface::get_node_index(), MeshTools::Modification::rotate(), MeshTools::Modification::scale(), LaplaceMeshSmoother::smooth(), MeshTools::Modification::smooth(), VTKIO::solution_to_vtk(), MeshTools::Modification::translate(), LegacyXdrIO::write_mesh(), and GmshIO::write_mesh().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by GMVIO::_read_one_cell(), BoundaryInfo::add_node(), MeshTools::Generation::build_cube(), GMVIO::copy_nodal_solution(), Triangle::copy_tri_to_mesh(), create_submesh(), UNVIO::element_in(), MeshData::foreign_id_to_node(), DofMap::node_ptr(), TetGenMeshInterface::pointset_convexhull(), VTKIO::read(), ExodusII_IO::read(), LegacyXdrIO::read_mesh(), GmshIO::read_mesh(), OFFIO::read_stream(), MatlabIO::read_stream(), Partitioner::set_node_processor_ids(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), TetGenMeshInterface::triangulate_pointset(), and ExodusII_IO_Helper::write_nodal_coordinates().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by EquationSystems::_add_system_to_nodes_and_elems(), EquationSystems::allgather(), MeshCommunication::assign_global_indices(), copy_nodes_and_elements(), MeshTools::correct_node_proc_ids(), DofMap::distribute_dofs(), LocationMap< Node >::fill(), LocationMap< T >::init(), EquationSystems::init(), DofMap::invalidate_dofs(), MeshCommunication::make_node_ids_parallel_consistent(), MeshCommunication::make_node_proc_ids_parallel_consistent(), MeshCommunication::make_nodes_parallel_consistent(), UNVIO::node_out(), VTKIO::nodes_to_vtk(), TetGenMeshInterface::pointset_convexhull(), System::read_legacy_data(), VariationalMeshSmoother::readgr(), EquationSystems::reinit(), DofMap::reinit(), Partitioner::set_node_processor_ids(), Partitioner::single_partition(), LaplaceMeshSmoother::smooth(), BoundaryInfo::sync(), MeshData::translate(), Tree< N >::Tree(), TriangleInterface::triangulate(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), TetGenMeshInterface::triangulate_pointset(), and VariationalMeshSmoother::writegr().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by EquationSystems::_add_system_to_nodes_and_elems(), EquationSystems::allgather(), MeshCommunication::assign_global_indices(), copy_nodes_and_elements(), MeshTools::correct_node_proc_ids(), DofMap::distribute_dofs(), LocationMap< Node >::fill(), LocationMap< T >::init(), EquationSystems::init(), DofMap::invalidate_dofs(), MeshCommunication::make_node_ids_parallel_consistent(), MeshCommunication::make_node_proc_ids_parallel_consistent(), MeshCommunication::make_nodes_parallel_consistent(), UNVIO::node_out(), VTKIO::nodes_to_vtk(), TetGenMeshInterface::pointset_convexhull(), System::read_legacy_data(), VariationalMeshSmoother::readgr(), EquationSystems::reinit(), DofMap::reinit(), Partitioner::set_node_processor_ids(), Partitioner::single_partition(), LaplaceMeshSmoother::smooth(), BoundaryInfo::sync(), MeshData::translate(), Tree< N >::Tree(), TriangleInterface::triangulate(), TetGenMeshInterface::triangulate_conformingDelaunayMesh_carvehole(), TetGenMeshInterface::triangulate_pointset(), and VariationalMeshSmoother::writegr().
Implemented in ParallelMesh, and SerialMesh.
Referenced by Partitioner::set_node_processor_ids().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by Partitioner::set_node_processor_ids().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Definition at line 241 of file mesh_base.C.
References MeshBase::partitioner().
Referenced by MeshBase::prepare_for_use().
{
if (partitioner().get()) // 'NULL' means don't partition
partitioner()->partition (*this, n_parts);
}
Definition at line 103 of file mesh_base.h.
References MeshBase::_partitioner.
Referenced by UniformRefinementEstimator::_estimate_error(), MeshBase::partition(), and BoundaryInfo::sync().
{ return _partitioner; }
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshBase::n_elem_on_proc(), MeshTools::processor_bounding_box(), and MeshTools::weight().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshBase::n_elem_on_proc(), MeshTools::processor_bounding_box(), and MeshTools::weight().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::bounding_box(), and MeshBase::n_nodes_on_proc().
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::bounding_box(), and MeshBase::n_nodes_on_proc().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by all_second_order(), InfElemBuilder::build_inf_elem(), LaplaceMeshSmoother::smooth(), MeshTools::subdomain_bounding_box(), TriangleInterface::triangulate(), TetGenIO::write(), FroIO::write(), TecplotIO::write_ascii(), MEDITIO::write_ascii(), GMVIO::write_ascii_new_impl(), GMVIO::write_ascii_old_impl(), TecplotIO::write_binary(), GnuPlotIO::write_solution(), and DivaIO::write_stream().
Definition at line 267 of file mesh_base.C.
References MeshBase::_point_locator, PointLocatorBase::build(), AutoPtr< Tp >::get(), AutoPtr< Tp >::release(), AutoPtr< Tp >::reset(), and MeshEnums::TREE.
Referenced by PeriodicBoundaries::neighbor().
{
if (_point_locator.get() == NULL)
_point_locator.reset (PointLocatorBase::build(TREE, *this).release());
return *_point_locator;
}
The read_xda_file boolean flag is true when prepare_for_use is called from Mesh::read after reading an xda file. It prevents the renumbering of nodes and elements. In general, leave this at the default value of false.
Definition at line 81 of file mesh_base.C.
References MeshBase::_is_prepared, MeshBase::clear_point_locator(), MeshBase::delete_remote_elements(), MeshBase::find_neighbors(), MeshBase::partition(), and MeshBase::renumber_nodes_and_elements().
Referenced by all_first_order(), all_second_order(), MeshTools::Modification::all_tri(), MeshTools::Generation::build_cube(), InfElemBuilder::build_inf_elem(), MeshRefinement::coarsen_elements(), Triangle::copy_tri_to_mesh(), create_submesh(), MeshTools::Modification::flatten(), read(), GMVIO::read(), MeshRefinement::refine_and_coarsen_elements(), MeshRefinement::refine_elements(), BoundaryInfo::sync(), MeshRefinement::uniformly_coarsen(), and MeshRefinement::uniformly_refine().
{
// Renumber the nodes and elements so that they in contiguous
// blocks. By default, skip_renumber_nodes_and_elements is false,
// however we may skip this step by passing
// skip_renumber_nodes_and_elements==true to this function.
//
// Instances where you if prepare_for_use() should not renumber the nodes
// and elements include reading in e.g. an xda/r or gmv file. In
// this case, the ordering of the nodes may depend on an accompanying
// solution, and the node ordering cannot be changed.
if(!skip_renumber_nodes_and_elements)
this->renumber_nodes_and_elements();
// Let all the elements find their neighbors
this->find_neighbors();
// Partition the mesh.
this->partition();
// If we're using ParallelMesh, we'll want it parallelized.
this->delete_remote_elements();
if(!skip_renumber_nodes_and_elements)
this->renumber_nodes_and_elements();
// Reset our PointLocator. This needs to happen any time the elements
// in the underlying elements in the mesh have changed, so we do it here.
this->clear_point_locator();
// The mesh is now prepared for use.
_is_prepared = true;
}
Definition at line 225 of file mesh_base.C.
References MeshBase::get_info().
Referenced by InfElemBuilder::build_inf_elem(), and operator<<().
{
os << this->get_info()
<< std::endl;
}
Definition at line 442 of file mesh_base.h.
Referenced by all_second_order(), EquationSystems::build_discontinuous_solution_vector(), ParallelMesh::clear(), DofMap::compute_sparsity(), find_neighbors(), MeshBase::get_info(), SparsityPattern::Build::operator()(), MeshData::read_xdr(), ParallelMesh::renumber_dof_objects(), ParallelMesh::renumber_nodes_and_elements(), GMVIO::write_discontinuous_gmv(), and System::write_header().
{ return libMesh::processor_id(); }
In order to read the UNV and TetGen file types, you must also pass a separate pointer to the MeshData object you will use with this mesh, since these read methods expect it.
Implements MeshBase.
Definition at line 465 of file unstructured_mesh.C.
References XdrIO::binary(), MeshCommunication::broadcast(), XdrIO::legacy(), Quality::name(), MeshBase::prepare_for_use(), libMesh::processor_id(), VTKIO::read(), GMVIO::read(), GmshIO::read(), ExodusII_IO::read(), TetGenIO::read(), UNVIO::read(), OFFIO::read(), UCDIO::read(), MatlabIO::read(), XdrIO::read(), and LegacyXdrIO::read_mgf().
{
// See if the file exists. Perform this check on all processors
// so that the code is terminated properly in the case that the
// file does not exist.
{
std::ifstream in (name.c_str());
if (!in.good())
{
std::cerr << 'ERROR: cannot locate specified file:t'
<< name
<< std::endl;
libmesh_error();
}
}
// Set the skip_renumber_nodes_and_elements flag on all processors.
// This ensures that renumber_nodes_and_elements is *not* called
// during prepare_for_use() for certain types of mesh files.
// This is required in cases where there is an associated solution
// file which expects a certain ordering of the nodes.
if(name.rfind('.gmv')+4==name.size())
{
skip_renumber_nodes_and_elements = true;
}
// Look for parallel formats first
if (is_parallel_file_format(name))
{
// no need to handling bz2 files here -- the Xdr class does that.
if ((name.rfind('.xda') < name.size()) ||
(name.rfind('.xdr') < name.size()))
{
XdrIO xdr_io(*this);
// .xda* ==> bzip2/gzip/ASCII flavors
if (name.rfind('.xda') < name.size())
{
xdr_io.binary() = false;
xdr_io.read (name);
}
else // .xdr* ==> true binary XDR file
{
xdr_io.binary() = true;
xdr_io.read (name);
}
// The xdr_io object gets constructed with legacy() == false.
// if legacy() == true then it means that a legacy file was detected and
// thus processor 0 performed the read. We therefore need to broadcast the
// mesh. Further, for this flavor of mesh solution data ordering is tied
// to the node ordering, so we better not reorder the nodes!
if (xdr_io.legacy())
{
skip_renumber_nodes_and_elements = true;
MeshCommunication().broadcast(*this);
}
}
}
// Serial mesh formats
else
{
START_LOG('read()', 'Mesh');
// Read the file based on extension. Only processor 0
// needs to read the mesh. It will then broadcast it and
// the other processors will pick it up
if (libMesh::processor_id() == 0)
{
// Nasty hack for reading/writing zipped files
std::string new_name = name;
if (name.size() - name.rfind('.bz2') == 4)
{
new_name.erase(new_name.end() - 4, new_name.end());
std::string system_string = 'bunzip2 -f -k ';
system_string += name;
START_LOG('system(bunzip2)', 'Mesh');
if (std::system(system_string.c_str()))
libmesh_file_error(system_string);
STOP_LOG('system(bunzip2)', 'Mesh');
}
if (new_name.rfind('.mat') < new_name.size())
MatlabIO(*this).read(new_name);
else if (new_name.rfind('.ucd') < new_name.size())
UCDIO(*this).read (new_name);
else if ((new_name.rfind('.off') < new_name.size()) ||
(new_name.rfind('.ogl') < new_name.size()) ||
(new_name.rfind('.oogl') < new_name.size()))
OFFIO(*this).read (new_name);
else if (new_name.rfind('.mgf') < new_name.size())
LegacyXdrIO(*this,true).read_mgf (new_name);
else if (new_name.rfind('.unv') < new_name.size())
{
if (mesh_data == NULL)
{
std::cerr << 'Error! You must pass a '
<< 'valid MeshData pointer to '
<< 'read UNV files!' << std::endl;
libmesh_error();
}
UNVIO(*this, *mesh_data).read (new_name);
}
else if ((new_name.rfind('.node') < new_name.size()) ||
(new_name.rfind('.ele') < new_name.size()))
TetGenIO(*this,mesh_data).read (new_name);
else if (new_name.rfind('.exd') < new_name.size() ||
new_name.rfind('.e') < new_name.size())
ExodusII_IO(*this).read (new_name);
else if (new_name.rfind('.msh') < new_name.size())
GmshIO(*this).read (new_name);
else if (new_name.rfind('.gmv') < new_name.size())
GMVIO(*this).read (new_name);
else if (new_name.rfind('.vtu') < new_name.size())
VTKIO(*this).read(new_name);
else
{
std::cerr << ' ERROR: Unrecognized file extension: ' << name
<< ' I understand the following:n'
<< ' *.e -- Sandia's ExodusII format
<< ' *.exd -- Sandia's ExodusII format
<< ' *.gmv -- LANL's General Mesh Viewer format
<< ' *.mat -- Matlab triangular ASCII file
<< ' *.off -- OOGL OFF surface format
<< ' *.ucd -- AVS's ASCII UCD format
<< ' *.unv -- I-deas Universal format
<< ' *.vtu -- Paraview VTK format
<< ' *.xda -- libMesh ASCII format
<< ' *.xdr -- libMesh binary format
<< ' *.gz -- any above format gzipped
<< ' *.bz2 -- any above format bzip2'ed
<< std::endl;
libmesh_error();
}
// If we temporarily decompressed a .bz2 file, remove the
// uncompressed version
if (name.size() - name.rfind('.bz2') == 4)
std::remove(new_name.c_str());
}
STOP_LOG('read()', 'Mesh');
// Send the mesh & bcs (which are now only on processor 0) to the other
// processors
MeshCommunication().broadcast (*this);
}
// Done reading the mesh. Now prepare it for use.
this->prepare_for_use(skip_renumber_nodes_and_elements);
}
Definition at line 249 of file mesh_base.C.
References MeshBase::_n_parts, MeshBase::active_elements_begin(), MeshBase::active_elements_end(), and std::max().
{
const_element_iterator el = this->active_elements_begin();
const const_element_iterator end = this->active_elements_end();
unsigned int max_proc_id=0;
for (; el!=end; ++el)
max_proc_id = std::max(max_proc_id, static_cast<unsigned int>((*el)->processor_id()));
// The number of partitions is one more than the max processor ID.
_n_parts = max_proc_id+1;
return _n_parts;
}
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshCommunication::make_elems_parallel_consistent().
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshCommunication::make_node_ids_parallel_consistent().
Implemented in ParallelMesh, and SerialMesh.
Referenced by all_first_order(), all_second_order(), contract(), and MeshBase::prepare_for_use().
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::Generation::build_cube(), XdrIO::read(), ExodusII_IO::read(), LegacyXdrIO::read_mesh(), and GmshIO::read_mesh().
Implemented in ParallelMesh, and SerialMesh.
Referenced by all_second_order(), MeshTools::Generation::build_cube(), XdrIO::read(), ExodusII_IO::read(), LegacyXdrIO::read_mesh(), and GmshIO::read_mesh().
Definition at line 147 of file mesh_base.h.
References MeshBase::_dim, and MeshBase::n_elem().
Referenced by MeshTools::Generation::build_cube(), MeshTools::Generation::build_delaunay_square(), Triangle::copy_tri_to_mesh(), and TriangleInterface::triangulate().
{ libmesh_assert(!this->n_elem()); _dim = d; }
Definition at line 685 of file mesh_base.h.
References MeshBase::_n_parts.
Referenced by Partitioner::partition(), Partitioner::repartition(), and BoundaryInfo::sync().
{ return _n_parts; }
Definition at line 671 of file mesh_base.h.
References MeshBase::_n_sbd.
Referenced by BoundaryInfo::sync().
{ return _n_sbd; }
Definition at line 154 of file mesh_base.h.
Referenced by MeshBase::get_info(), ExodusII_IO_Helper::initialize(), UNVIO::node_out(), LegacyXdrIO::read_mesh(), MeshTools::Modification::scale(), MeshTools::subdomain_bounding_box(), and LegacyXdrIO::write_mesh().
{ return static_cast<unsigned int>(LIBMESH_DIM); }
Implemented in ParallelMesh, and SerialMesh.
Referenced by Partitioner::set_node_processor_ids().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by Partitioner::set_node_processor_ids().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::n_elem_of_type(), and MeshTools::n_non_subactive_elem_of_type_at_level().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::n_elem_of_type(), and MeshTools::n_non_subactive_elem_of_type_at_level().
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::n_active_levels(), MeshTools::n_levels(), MeshTools::n_p_levels(), Partitioner::partition_unpartitioned_elements(), Partitioner::set_node_processor_ids(), and Partitioner::set_parent_processor_ids().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshTools::n_active_levels(), MeshTools::n_levels(), MeshTools::n_p_levels(), Partitioner::partition_unpartitioned_elements(), Partitioner::set_node_processor_ids(), and Partitioner::set_parent_processor_ids().
Implemented in ParallelMesh, and SerialMesh.
Implemented in ParallelMesh, and SerialMesh.
Referenced by MeshRefinement::_coarsen_elements(), and MeshRefinement::_refine_elements().
Definition at line 764 of file unstructured_mesh.C.
References MeshBase::n_subdomains(), GMVIO::partitioning(), MeshOutput< MT >::write_nodal_data(), GMVIO::write_nodal_data(), and TecplotIO::write_nodal_data().
{
START_LOG('write()', 'Mesh');
// Write the file based on extension
if (name.rfind('.dat') < name.size())
TecplotIO(*this).write_nodal_data (name, v, vn);
else if (name.rfind('.plt') < name.size())
TecplotIO(*this,true).write_nodal_data (name, v, vn);
else if (name.rfind('.gmv') < name.size())
{
if (n_subdomains() > 1)
GMVIO(*this).write_nodal_data (name, v, vn);
else
{
GMVIO io(*this);
io.partitioning() = false;
io.write_nodal_data (name, v, vn);
}
}
else if (name.rfind('.pvtu') < name.size())
{
VTKIO(*this).write_nodal_data (name, v, vn);
}
else
{
std::cerr << ' ERROR: Unrecognized file extension: ' << name
<< ' I understand the following:n'
<< ' *.dat -- Tecplot ASCII file
<< ' *.gmv -- LANL's GMV (General Mesh Viewer) format
<< ' *.plt -- Tecplot binary file
<< ' *.pvtu -- Paraview VTK file
<< 'Exiting without writing output;
}
STOP_LOG('write()', 'Mesh');
}
In order to write the UNV and TetGen file types, you must also pass a separate pointer to the MeshData object you have been using with this mesh, since these write methods expect it.
Implements MeshBase.
Definition at line 637 of file unstructured_mesh.C.
References MeshBase::n_partitions(), Quality::name(), GMVIO::partitioning(), libMesh::processor_id(), VTKIO::write(), FroIO::write(), GmshIO::write(), TetGenIO::write(), MEDITIO::write(), UNVIO::write(), ExodusII_IO::write(), DivaIO::write(), GMVIO::write(), UCDIO::write(), TecplotIO::write(), XdrIO::write(), and LegacyXdrIO::write_mgf().
{
// parallel formats are special -- they may choose to write
// separate files, let's not try to handle the zipping here.
if (is_parallel_file_format(name))
{
// no need to handling bz2 files here -- the Xdr class does that.
if (name.rfind('.xda') < name.size())
XdrIO(*this).write(name);
else if (name.rfind('.xdr') < name.size())
XdrIO(*this,true).write(name);
}
// serial file formats
else
{
START_LOG('write()', 'Mesh');
// Nasty hack for reading/writing zipped files
std::string new_name = name;
if (name.size() - name.rfind('.bz2') == 4)
new_name.erase(new_name.end() - 4, new_name.end());
// New scope so that io will close before we try to zip the file
{
// Write the file based on extension
if (new_name.rfind('.dat') < new_name.size())
TecplotIO(*this).write (new_name);
else if (new_name.rfind('.plt') < new_name.size())
TecplotIO(*this,true).write (new_name);
else if (new_name.rfind('.ucd') < new_name.size())
UCDIO (*this).write (new_name);
else if (new_name.rfind('.gmv') < new_name.size())
if (this->n_partitions() > 1)
GMVIO(*this).write (new_name);
else
{
GMVIO io(*this);
io.partitioning() = false;
io.write (new_name);
}
else if (new_name.rfind('.ugrid') < new_name.size())
DivaIO(*this).write(new_name);
else if (new_name.rfind('.exd') < new_name.size() ||
new_name.rfind('.e') < new_name.size())
ExodusII_IO(*this).write(new_name);
else if (new_name.rfind('.mgf') < new_name.size())
LegacyXdrIO(*this,true).write_mgf(new_name);
else if (new_name.rfind('.unv') < new_name.size())
{
if (mesh_data == NULL)
{
std::cerr << 'Error! You must pass a '
<< 'valid MeshData pointer to '
<< 'write UNV files!' << std::endl;
libmesh_error();
}
UNVIO(*this, *mesh_data).write (new_name);
}
else if (new_name.rfind('.mesh') < new_name.size())
MEDITIO(*this).write (new_name);
else if (new_name.rfind('.poly') < new_name.size())
TetGenIO(*this).write (new_name);
else if (new_name.rfind('.msh') < new_name.size())
GmshIO(*this).write (new_name);
else if (new_name.rfind('.fro') < new_name.size())
FroIO(*this).write (new_name);
else if (new_name.rfind('.vtu') < new_name.size())
VTKIO(*this).write (new_name);
else
{
std::cerr << ' ERROR: Unrecognized file extension: ' << name
<< ' I understand the following:n'
<< ' *.dat -- Tecplot ASCII file
<< ' *.e -- Sandia's ExodusII format
<< ' *.exd -- Sandia's ExodusII format
<< ' *.fro -- ACDL's surface triangulation file
<< ' *.gmv -- LANL's GMV (General Mesh Viewer) format
<< ' *.mesh -- MEdit mesh format
<< ' *.mgf -- MGF binary mesh format
<< ' *.msh -- GMSH ASCII file
<< ' *.plt -- Tecplot binary file
<< ' *.poly -- TetGen ASCII file
<< ' *.ucd -- AVS's ASCII UCD format
<< ' *.ugrid -- Kelly's DIVA ASCII format
<< ' *.unv -- I-deas Universal format
<< ' *.xda -- libMesh ASCII format
<< ' *.xdr -- libMesh binary format,
<< std::endl
<< 'Exiting without writing output;
}
}
// Nasty hack for reading/writing zipped files
if (name.size() - name.rfind('.bz2') == 4)
{
START_LOG('system(bzip2)', 'Mesh');
if (libMesh::processor_id() == 0)
{
std::string system_string = 'bzip2 -f ';
system_string += new_name;
if (std::system(system_string.c_str()))
libmesh_file_error(system_string);
}
Parallel::barrier();
STOP_LOG('system(bzip2)', 'Mesh');
}
STOP_LOG('write()', 'Mesh');
}
}
Definition at line 746 of file mesh_base.h.
Definition at line 232 of file mesh_base.C.
{
m.print_info(os);
return os;
}
Definition at line 740 of file mesh_base.h.
Definition at line 712 of file mesh_base.h.
Referenced by copy_nodes_and_elements(), find_neighbors(), MeshBase::mesh_dimension(), MeshBase::MeshBase(), and MeshBase::set_mesh_dimension().
Definition at line 717 of file mesh_base.h.
Referenced by all_first_order(), all_second_order(), MeshBase::clear(), copy_nodes_and_elements(), MeshBase::is_prepared(), and MeshBase::prepare_for_use().
Definition at line 707 of file mesh_base.h.
Referenced by MeshBase::clear(), copy_nodes_and_elements(), MeshBase::n_partitions(), MeshBase::recalculate_n_partitions(), and MeshBase::set_n_partitions().
Definition at line 696 of file mesh_base.h.
Referenced by MeshBase::clear(), copy_nodes_and_elements(), MeshBase::n_subdomains(), and MeshBase::set_n_subdomains().
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 734 of file mesh_base.h.
Referenced by ParallelMesh::ParallelMesh(), MeshBase::partitioner(), and SerialMesh::SerialMesh().
Definition at line 726 of file mesh_base.h.
Referenced by MeshBase::clear_point_locator(), and MeshBase::point_locator().
Definition at line 98 of file mesh_base.h.
Referenced by MeshRefinement::_coarsen_elements(), all_first_order(), all_second_order(), MeshTools::Modification::all_tri(), MeshCommunication::allgather(), MeshCommunication::broadcast(), MeshTools::Generation::build_cube(), MeshTools::Generation::build_delaunay_square(), MeshTools::Modification::change_boundary_id(), MeshBase::clear(), FEBase::compute_periodic_constraints(), create_submesh(), SerialMesh::delete_elem(), ParallelMesh::delete_elem(), SerialMesh::delete_node(), ParallelMesh::delete_node(), MeshTools::Modification::flatten(), ExodusII_IO_Helper::initialize(), ExodusII_IO::read(), LegacyXdrIO::read_mesh(), GmshIO::read_mesh(), SerialMesh::renumber_nodes_and_elements(), ParallelMesh::renumber_nodes_and_elements(), XdrIO::write(), FroIO::write(), LegacyXdrIO::write_mesh(), ExodusII_IO_Helper::write_nodesets(), XdrIO::write_serialized_bcs(), ExodusII_IO_Helper::write_sidesets(), LegacyXdrIO::write_soln(), and DivaIO::write_stream().
Generated automatically by Doxygen for libMesh from the source code.