27 #include <unordered_map> 58 _count_lower_dim_elems_in_point_locator(true),
60 #ifdef LIBMESH_ENABLE_UNIQUE_ID
61 _next_unique_id(
DofObject::invalid_unique_id),
64 _skip_renumber_nodes_and_elements(false),
65 _allow_remote_element_removal(true),
66 _spatial_dimension(d),
71 libmesh_assert_less_equal (LIBMESH_DIM, 3);
72 libmesh_assert_greater_equal (LIBMESH_DIM, d);
81 _n_parts (other_mesh._n_parts),
82 _is_prepared (other_mesh._is_prepared),
84 _count_lower_dim_elems_in_point_locator(other_mesh._count_lower_dim_elems_in_point_locator),
86 #ifdef LIBMESH_ENABLE_UNIQUE_ID
87 _next_unique_id(other_mesh._next_unique_id),
90 _skip_renumber_nodes_and_elements(false),
91 _allow_remote_element_removal(true),
92 _elem_dims(other_mesh._elem_dims),
93 _spatial_dimension(other_mesh._spatial_dimension),
95 _ghosting_functors(other_mesh._ghosting_functors)
129 return cast_int<unsigned int>(*
_elem_dims.rbegin());
154 LOG_SCOPE(
"prepare_for_use()",
"MeshBase");
156 parallel_object_only();
181 if (skip_renumber_nodes_and_elements)
183 libmesh_deprecated();
195 if (!skip_find_neighbors)
220 #if defined(DEBUG) && defined(LIBMESH_ENABLE_UNIQUE_ID) 252 #if defined(DEBUG) && defined(LIBMESH_ENABLE_UNIQUE_ID) 291 parallel_object_only();
307 parallel_object_only();
309 std::set<subdomain_id_type> ids;
313 return cast_int<subdomain_id_type>(ids.size());
380 std::ostringstream oss;
382 oss <<
" Mesh Information:" <<
'\n';
386 oss <<
" elem_dimensions()={";
389 std::ostream_iterator<unsigned int>(oss,
", "));
390 oss << cast_int<unsigned int>(*
_elem_dims.rbegin());
395 <<
" n_nodes()=" << this->
n_nodes() <<
'\n' 397 <<
" n_elem()=" << this->
n_elem() <<
'\n' 399 #ifdef LIBMESH_ENABLE_AMR 402 <<
" n_subdomains()=" <<
static_cast<std::size_t
>(this->
n_subdomains()) <<
'\n' 403 <<
" n_partitions()=" << static_cast<std::size_t>(this->
n_partitions()) <<
'\n' 404 <<
" n_processors()=" << static_cast<std::size_t>(this->
n_processors()) <<
'\n' 406 <<
" processor_id()=" << static_cast<std::size_t>(this->
processor_id()) <<
'\n';
461 parallel_object_only();
463 unsigned int max_proc_id=0;
478 #ifdef LIBMESH_ENABLE_DEPRECATED 481 libmesh_deprecated();
505 parallel_object_only();
546 static const std::string empty;
548 std::map<subdomain_id_type, std::string>::const_iterator iter =
_block_id_to_name.find(
id);
561 std::map<subdomain_id_type, std::string>::const_iterator
565 for ( ; iter != end_iter; ++iter)
566 if (iter->second ==
name)
577 parallel_object_only();
608 if ((*
node)(1) != 0.)
621 if ((*
node)(2) != 0.)
636 parallel_object_only();
643 std::unordered_map<dof_id_type, std::vector<dof_id_type>> node_to_elem;
660 if (element->dim()>=LIBMESH_DIM || element->interior_parent())
667 std::vector<std::set<dof_id_type>> neighbors( element->n_vertices() );
669 bool found_interior_parents =
false;
671 for (
dof_id_type n=0; n < element->n_vertices(); n++)
673 std::vector<dof_id_type> & element_ids = node_to_elem[element->node_id(n)];
674 for (
const auto & eid : element_ids)
676 neighbors[n].insert(eid);
678 if (neighbors[n].size()>0)
680 found_interior_parents =
true;
687 found_interior_parents =
false;
696 if (found_interior_parents)
698 std::set<dof_id_type> & neighbors_0 = neighbors[0];
699 for (
const auto & interior_parent_id : neighbors_0)
701 found_interior_parents =
false;
702 for (
dof_id_type n=1; n < element->n_vertices(); n++)
704 if (neighbors[n].find(interior_parent_id)!=neighbors[n].end())
706 found_interior_parents=
true;
710 found_interior_parents=
false;
714 if (found_interior_parents)
716 element->set_interior_parent(this->
elem_ptr(interior_parent_id));
std::string name(const ElemQuality q)
void set_union(T &data, const unsigned int root_id) const
bool _skip_renumber_nodes_and_elements
virtual const Elem * elem(const dof_id_type i) const
virtual dof_id_type n_active_elem() const =0
dof_id_type n_elem_on_proc(const processor_id_type proc) const
virtual node_iterator pid_nodes_end(processor_id_type proc_id)=0
std::unique_ptr< PointLocatorBase > sub_point_locator() const
void detect_interior_parents()
dof_id_type n_active_elem_on_proc(const processor_id_type proc) const
void set_spatial_dimension(unsigned char d)
bool get_count_lower_dim_elems_in_point_locator() const
void remove_ghosting_functor(GhostingFunctor &ghosting_functor)
uint8_t processor_id_type
dof_id_type n_local_nodes() const
virtual std::unique_ptr< Partitioner > & partitioner()
std::string get_info() const
const Parallel::Communicator & comm() const
virtual SimpleRange< element_iterator > active_element_ptr_range()=0
unsigned char _spatial_dimension
std::unique_ptr< BoundaryInfo > boundary_info
const PointLocatorBase & point_locator() const
bool _allow_remote_element_removal
dof_id_type n_unpartitioned_elem() const
long double max(long double a, double b)
dof_id_type n_local_elem() const
void subdomain_ids(std::set< subdomain_id_type > &ids) const
virtual SimpleRange< element_iterator > active_local_element_ptr_range()=0
std::set< GhostingFunctor * > _ghosting_functors
processor_id_type n_processors() const
virtual bool is_serial() const
static const subdomain_id_type invalid_subdomain_id
virtual void find_neighbors(const bool reset_remote_elements=false, const bool reset_current_list=true)=0
virtual SimpleRange< element_iterator > element_ptr_range()=0
static const processor_id_type invalid_processor_id
dof_id_type n_sub_elem() const
virtual element_iterator active_pid_elements_begin(processor_id_type proc_id)=0
virtual void update_parallel_id_counts()=0
std::unique_ptr< Partitioner > _partitioner
virtual SimpleRange< node_iterator > node_ptr_range()=0
virtual dof_id_type max_elem_id() const =0
void clear_point_locator()
Used by the Mesh to keep track of boundary nodes and elements.
std::set< unsigned char > _elem_dims
void prepare_for_use(const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false)
std::string & subdomain_name(subdomain_id_type id)
const std::set< unsigned char > & elem_dimensions() const
dof_id_type n_nodes_on_proc(const processor_id_type proc) const
An object whose state is distributed along a set of processors.
bool skip_partitioning() const
virtual const Node & node(const dof_id_type i) const
unsigned int n_partitions() const
virtual element_iterator pid_elements_begin(processor_id_type proc_id)=0
virtual const Elem * elem_ptr(const dof_id_type i) const =0
unsigned int recalculate_n_partitions()
virtual unsigned int n_vertices() const =0
subdomain_id_type n_subdomains() const
virtual element_iterator active_pid_elements_end(processor_id_type proc_id)=0
subdomain_id_type subdomain_id() const
virtual unsigned short dim() const =0
unsigned int spatial_dimension() const
virtual const Elem & elem_ref(const dof_id_type i) const
void set_count_lower_dim_elems_in_point_locator(bool count_lower_dim_elems)
MeshBase(const Parallel::Communicator &comm_in, unsigned char dim=1)
dof_id_type n_active_sub_elem() const
unsigned int mesh_dimension() const
std::unique_ptr< GhostingFunctor > _default_ghosting
bool on_command_line(std::string arg)
bool allow_renumbering() const
virtual void delete_remote_elements()
virtual unsigned int n_sub_elem() const =0
void print_info(std::ostream &os=libMesh::out) const
virtual void update_post_partitioning()
virtual dof_id_type n_elem() const =0
processor_id_type processor_id() const
std::unique_ptr< PointLocatorBase > _point_locator
virtual node_iterator pid_nodes_begin(processor_id_type proc_id)=0
processor_id_type processor_id() const
std::ostream & operator<<(std::ostream &os, const FEAbstract &fe)
static std::unique_ptr< PointLocatorBase > build(PointLocatorType t, const MeshBase &mesh, const PointLocatorBase *master=nullptr)
bool _count_lower_dim_elems_in_point_locator
dof_id_type node_id(const unsigned int i) const
std::map< subdomain_id_type, std::string > _block_id_to_name
virtual dof_id_type n_nodes() const =0
virtual void renumber_nodes_and_elements()=0
subdomain_id_type get_id_by_name(const std::string &name) const
virtual element_iterator pid_elements_end(processor_id_type proc_id)=0