@@ -1080,26 +1080,12 @@ void MeshBase::remove_ghosting_functor(GhostingFunctor & ghosting_functor)
10801080
10811081void MeshBase ::subdomain_ids (std ::set < subdomain_id_type > & ids , const bool global /* = true */ ) const
10821082{
1083- // This requires an inspection on every processor
1084- if (global )
1085- parallel_object_only ();
1086-
1087- ids .clear ();
1088-
1089- for (const auto & elem : this -> active_local_element_ptr_range ())
1090- ids .insert (elem - > subdomain_id ());
1083+ libmesh_assert (this -> has_cached_elem_data ());
10911084
10921085 if (global )
1093- {
1094- // Only include the unpartitioned elements if the user requests the global IDs.
1095- // In the case of the local subdomain IDs, it doesn't make sense to include the
1096- // unpartitioned elements because said elements do not have a sense of locality.
1097- for (const auto & elem : this -> active_unpartitioned_element_ptr_range ())
1098- ids .insert (elem - > subdomain_id ());
1099-
1100- // Some subdomains may only live on other processors
1101- this -> comm ().set_union (ids );
1102- }
1086+ ids = this -> get_mesh_subdomains ();
1087+ else
1088+ ids = this -> get_mesh_local_subdomains ();
11031089}
11041090
11051091
@@ -1128,14 +1114,7 @@ void MeshBase::update_post_partitioning()
11281114
11291115subdomain_id_type MeshBase ::n_subdomains () const
11301116{
1131- // This requires an inspection on every processor
1132- parallel_object_only ();
1133-
1134- std ::set < subdomain_id_type > ids ;
1135-
1136- this -> subdomain_ids (ids );
1137-
1138- return cast_int < subdomain_id_type > (ids .size ());
1117+ return cast_int < subdomain_id_type > (this -> get_mesh_subdomains ().size ());
11391118}
11401119
11411120
0 commit comments