libMesh/libmesh: coverage diff

Base 9bbd75 Head #4417 f0ff5e
Total Total +/- New
Rate 66.63% 66.63% +0.00% 100.00%
Hits 81281 81301 +20 48
Misses 40714 40715 +1 0
Filename Stmts Miss Cover
src/mesh/distributed_mesh.C +1 -2 +0.25%
src/mesh/mesh_base.C +18 +1 +0.10%
src/mesh/mesh_tetgen_interface.C +1 0 +0.07%
src/mesh/mesh_triangle_holes.C 0 +2 -0.56%
src/partitioning/partitioner.C +1 0 +0.05%
TOTAL +21 +1 +0.00%
code
coverage unchanged
code
coverage increased
code
coverage decreased
+
line added or modified

src/mesh/distributed_mesh.C

1157  
1158  
1159  
1160 +
1161  
1162  
1163  

void DistributedMesh::update_post_partitioning ()
{
  this->UnstructuredMesh::update_post_partitioning();

  // Let's do the base class cache clearing first, just in case our
  // later computations are ever changed to make use of a local
1621  
1622  
1623  
1624  
1625  
1626  
1627  
1628  
1629  
1630  
1631  
1632  
1633  
1634  
                      sender_could_become_owner)
                    {
                      if (it != repartitioned_node_pids.end() &&
                          pid < it->second)
                        it->second = pid;
                      else
                        repartitioned_node_pids[n] = pid;
                    }
                  else
                    if (it == repartitioned_node_pids.end())
                      repartitioned_node_pids[n] =
                        DofObject::invalid_processor_id;

                  repartitioned_node_sets_to_push[pid].insert(n);

src/mesh/mesh_base.C

77  
78  
79  
80 +
81  
82  
83 +
84 +
85  
86 +
87 +
88 +
89 +
90  
91 +
92 +
93 +
94  
95  
96  
  }


struct SBDInserter {
  std::set<subdomain_id_type> my_ids;

  SBDInserter () {}
  SBDInserter (SBDInserter &, Threads::split) {}

  void operator()(const ConstElemRange & range) {
    for (const Elem * elem : range)
      my_ids.insert(elem->subdomain_id());
  }

  void join(SBDInserter & other) {
    my_ids.merge(other.my_ids);
  }
};

}
192  
193  
194  
195 +
196  
197  
198  
  _elem_default_orders(other_mesh._elem_default_orders),
  _supported_nodal_order(other_mesh._supported_nodal_order),
  _mesh_subdomains(other_mesh._mesh_subdomains),
  _mesh_local_subdomains(other_mesh._mesh_local_subdomains),
  _elemset_codes_inverse_map(other_mesh._elemset_codes_inverse_map),
  _all_elemset_ids(other_mesh._all_elemset_ids),
  _spatial_dimension(other_mesh._spatial_dimension),
292  
293  
294  
295 +
296  
297  
298  
  _elem_default_orders = std::move(other_mesh.elem_default_orders());
  _supported_nodal_order = other_mesh.supported_nodal_order();
  _mesh_subdomains = other_mesh._mesh_subdomains;
  _mesh_local_subdomains = other_mesh._mesh_local_subdomains;
  _elemset_codes = std::move(other_mesh._elemset_codes);
  _elemset_codes_inverse_map = std::move(other_mesh._elemset_codes_inverse_map);
  _all_elemset_ids = std::move(other_mesh._all_elemset_ids);
447  
448  
449  
450 +
451  
452  
453  
  CHECK_MEMBER(_elem_default_orders);
  CHECK_MEMBER(_supported_nodal_order);
  CHECK_MEMBER(_mesh_subdomains);
  CHECK_MEMBER(_mesh_local_subdomains);
  CHECK_MEMBER(_all_elemset_ids);
  CHECK_MEMBER(_elem_integer_names);
  CHECK_MEMBER(_elem_integer_default_values);
1234  
1235  
1236  
1237 +
1238  
1239  
1240 +
1241  
1242 +
1243  
1244  
1245  

void MeshBase::subdomain_ids (std::set<subdomain_id_type> & ids, const bool global /* = true */) const
{
  libmesh_assert(this->preparation().has_cached_elem_data);

  if (global)
    ids = this->get_mesh_subdomains();
  else
    ids = this->get_mesh_local_subdomains();
}


1280  
1281  
1282  
1283 +
1284 +
1285  
1286 +
1287  
1288  
1289  
1290  
1291  
1292  
1293 +
1294  
1295  
1296  
      _const_node_stored_range.reset();
    }

  SBDInserter inserter;
  Threads::parallel_reduce(this->const_active_local_element_stored_range(), inserter);

  _mesh_local_subdomains.swap(inserter.my_ids);
}



subdomain_id_type MeshBase::n_subdomains() const
{
  return cast_int<subdomain_id_type>(this->get_mesh_subdomains().size());
}


1306  
1307  
1308  
1309 +
1310  
1311 +
1312  
1313  
1314  
1315 +
1316  
1317  
1318 +
1319  
1320  
1321  
1322  
1323 +
1324  
1325 +
1326  
1327  
1328  
1329  
1330 +
1331  
1332 +
1333  
1334 +
1335  
1336  
1337 +
1338  
1339  
1340  



const std::set<subdomain_id_type> & MeshBase::get_mesh_subdomains() const
{
  libmesh_assert(_preparation.has_cached_elem_data);

#ifdef DEBUG
  // Hit local dbg test; global cache test would need parallel_only()
  this->get_mesh_local_subdomains();
#endif

  return _mesh_subdomains;
}



const std::set<subdomain_id_type> & MeshBase::get_mesh_local_subdomains() const
{
  libmesh_assert(_preparation.has_cached_elem_data);

#ifdef DEBUG
  // This is O(N) instead of O(1), but that's what dbg is for, and
  // it's not worse than this call was before the cache was added
  SBDInserter inserter;
  Threads::parallel_reduce
    (this->const_active_local_element_stored_range(), inserter);

  libmesh_assert(inserter.my_ids == _mesh_local_subdomains);
#endif

  return _mesh_local_subdomains;
}


1449  
1450  
1451  
1452 +
1453  
1454 +
1455 +
1456  
1457 +
1458  
1459  
1460  
#ifdef LIBMESH_ENABLE_AMR
  oss << "    n_active_elem()="       << this->n_active_elem()                                << '\n';
#endif
  if (!this->preparation().has_cached_elem_data)
    {
      if (global)
        oss << "  n_subdomains()="        << static_cast<std::size_t>(this->n_subdomains())       << '\n';
      else
        oss << "  n_local_subdomains()= " << static_cast<std::size_t>(this->n_local_subdomains()) << '\n';
    }
  oss << "  n_elemsets()="            << static_cast<std::size_t>(this->n_elemsets())         << '\n';
  if (!_elemset_codes.empty())
2153  
2154  
2155  
2156  
2157  
2158  
2159  
2160  
2161  
2162  
}


const ConstElemRange & MeshBase::const_active_local_element_stored_range() const
{
  return const_shim(*this, &MeshBase::active_local_element_stored_range,
                    _const_active_local_element_stored_range);
}


2359  
2360  
2361  
2362 +
2363  
2364  
2365  
  _elem_dims.clear();
  _elem_default_orders.clear();
  _mesh_subdomains.clear();
  _mesh_local_subdomains.clear();
  _supported_nodal_order = MAXIMUM;

  for (const auto & elem : this->active_element_ptr_range())
2367  
2368  
2369  
2370 +
2371 +
2372  
2373  
2374  
    _elem_dims.insert(cast_int<unsigned char>(elem->dim()));
    _elem_default_orders.insert(elem->default_order());
    _mesh_subdomains.insert(elem->subdomain_id());
    if (elem->processor_id() == this->processor_id())
      _mesh_local_subdomains.insert(elem->subdomain_id());
    _supported_nodal_order =
      static_cast<Order>
        (std::min(static_cast<int>(_supported_nodal_order),
2810  
2811  
2812  
2813 +
2814  
2815  
2816  
  this->_elem_default_orders = other_mesh._elem_default_orders;
  this->_supported_nodal_order = other_mesh._supported_nodal_order;
  this->_mesh_subdomains = other_mesh._mesh_subdomains;
  this->_mesh_local_subdomains = other_mesh._mesh_local_subdomains;
}


3089  
3090  
3091  
3092 +
3093  
3094  
3095  
3096  
3097 +
3098  
3099 +
3100 +
3101 +
3102 +
3103 +
3104  
3105  
3106  
      // DistributedMesh doesn't get confused and think you're not
      // adding them on all processors at once.
      int n_pids = 0;
      processor_id_type best_pid = DofObject::invalid_processor_id;
      for (auto [pid, count] : pids)
        if (count >= n_pids)
          {
            n_pids = count;
            best_pid = pid;
          }
      libmesh_assert_not_equal_to(best_pid, DofObject::invalid_processor_id);
      added_elem->processor_id() = best_pid;
      n->processor_id() = best_pid;
      if (this->processor_id() == best_pid)
        this->_mesh_local_subdomains.insert(new_sbd_id);
    }

  // Calculate constraint rows in an indexed form that's easy for us

src/mesh/mesh_tetgen_interface.C

130  
131  
132  
133 +
134  
135  
136  
  // be expensive here and user code hasn't been expecting it, but we
  // do have code downstream expecting element caches to be up to
  // date.
  this->_mesh.cache_elem_data();
}


src/mesh/mesh_triangle_holes.C

274  
275  
276  
277  
278  
279  
280  
281  
282  
  // intersections to the right?  Try looking to the left.
  if (!intersection_distances.size())
    {
      ray_target = inside - Point(1);
      intersection_distances =
        this->find_ray_intersections(inside, ray_target);
    }

  // I'd make this an assert, but I'm not 100% confident we can't

src/partitioning/partitioner.C

219  
220  
221  
222 +
223  
224  
225  

      // Give derived Mesh classes a chance to update any cached data
      // to reflect the new partitioning
      mesh.update_post_partitioning();

      return;
    }