libMesh/libmesh: coverage diff

Base 332933 Head #4257 1b0007
Total Total +/- New
Rate 64.79% 64.83% +0.04% 91.28%
Hits 76453 76594 +141 136
Misses 41544 41553 +9 13
Filename Stmts Miss Cover
src/fe/fe_boundary.C 0 -6 +1.28%
src/geom/cell_c0polyhedron.C +18 +1 +0.95%
src/geom/cell_hex8.C +14 -1 +1.12%
src/geom/cell_polyhedron.C +2 0 +0.15%
src/geom/cell_prism6.C +25 +2 +0.74%
src/geom/cell_pyramid5.C +25 +2 +3.94%
src/geom/cell_tet4.C +8 +8 -3.92%
src/geom/edge_edge2.C +4 0 +4.35%
src/geom/elem.C +9 0 +0.17%
src/geom/face_c0polygon.C +18 0 +2.57%
src/geom/face_quad4.C +17 0 +1.20%
src/geom/face_tri3.C +10 0 +2.51%
src/mesh/mesh_refinement.C 0 +2 -0.29%
src/mesh/mesh_triangle_holes.C 0 +1 -0.27%
TOTAL +150 +9 +0.04%
code
coverage unchanged
code
coverage increased
code
coverage decreased
+
line added or modified

src/fe/fe_boundary.C

148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
  if (pts != nullptr)
    {
      // The shape functions do not correspond to the qrule
      this->shapes_on_quadrature = false;

      // Initialize the face shape functions
      this->_fe_map->template init_face_shape_functions<Dim>(*pts, side.get());

      // Compute the Jacobian*Weight on the face for integration
      if (weights != nullptr)
        {
          this->_fe_map->compute_face_map (Dim, *weights, side.get());
        }
      else
        {
          std::vector<Real> dummy_weights (pts->size(), 1.);
          this->_fe_map->compute_face_map (Dim, dummy_weights, side.get());
        }
    }
  // If there are no user specified points, we use the
218  
219  
220  
221  
222  
223  
224  
  // full element.
  const std::vector<Point> * ref_qp;
  if (pts != nullptr)
    ref_qp = pts;
  else
    ref_qp = &this->qrule->get_points();

src/geom/cell_c0polyhedron.C

243  
244  
245  
246 +
247  
248 +
249 +
250 +
251 +
252  
253  
254  
255 +
256 +
257 +
258  
259 +
260 +
261 +
262 +
263  
264 +
265 +
266 +
267  
268 +
269 +
270  
271  
272  


Point
C0Polyhedron::side_vertex_average_normal(const unsigned int s) const
{
  libmesh_assert_less (s, this->n_sides());
  libmesh_assert_equal_to(this->mapping_type(), LAGRANGE_MAP);
  const auto poly_side_ptr = this->side_ptr(s);
  const auto n_side_edges = poly_side_ptr->n_sides();

  // At the side vertex average, things simplify a bit
  // We get the side "plane" normal at all vertices, then average them
  Point normal;
  Point current_edge = poly_side_ptr->point(1) - poly_side_ptr->point(0);
  for (auto i : make_range(n_side_edges))
  {
    const Point next_edge = poly_side_ptr->point((i + 2) % n_side_edges) -
                            poly_side_ptr->point((i + 1) % n_side_edges);
    const Point normal_at_vertex = current_edge.cross(next_edge);
    normal += normal_at_vertex;
    // Note: the sides are planar, we don't need to test them all
    if (normal.norm_sq() > TOLERANCE)
      break;
    current_edge = next_edge;
  }
  bool outward_normal = std::get<1>(_sidelinks_data[s]);
  return (outward_normal ? 1. : -1.) * normal.unit();
}


src/geom/cell_hex8.C

129  
130  
131  
132  
133  
134  
135  
  // Make sure xz-faces are identical parallelograms
  v = this->point(4) - this->point(0);
  if (!v.relative_fuzzy_equals(this->point(7) - this->point(3), affine_tol))
    return false;
  // If all the above checks out, the map is affine
  return true;
}
531  
532  
533  
534 +
535  
536 +
537 +
538  
539  
540  
541 +
542 +
543 +
544 +
545  
546 +
547 +
548 +
549  
550 +
551 +
552  
553 +
554 +
555  
556  
557  


Point
Hex8::side_vertex_average_normal(const unsigned int s) const
{
  libmesh_assert_less (s, 6);
  libmesh_assert_equal_to(this->mapping_type(), LAGRANGE_MAP);

  // At the side vertex average, things simplify a bit
  // We get the side "plane" normal at all vertices, then average them
  Point normal;
  Point current_edge = this->point(side_nodes_map[s][1]) -
                       this->point(side_nodes_map[s][0]);
  for (auto i : make_range(4))
  {
    const Point next_edge = this->point(side_nodes_map[s][(i + 2) % 4]) -
                            this->point(side_nodes_map[s][(i + 1) % 4]);
    const Point normal_at_vertex = current_edge.cross(next_edge);
    // Note: unweighted and unnormalized sum matches the FE computation of normals
    normal += normal_at_vertex;
    current_edge = next_edge;
  }
  normal /= 4;
  return normal.unit();
}


src/geom/cell_polyhedron.C

318  
319  
320  
321 +
322  
323  
324  
325  
326 +
327  
328  
329  

std::unique_ptr<Elem> Polyhedron::side_ptr (const unsigned int i)
{
  return const_cast<const Polyhedron *>(this)->side_ptr(i);
}



std::unique_ptr<Elem> Polyhedron::side_ptr (const unsigned int i) const
{
  libmesh_assert_less (i, this->n_sides());

src/geom/cell_prism6.C

504  
505  
506  
507 +
508  
509 +
510 +
511  
512 +
513  
514 +
515  
516  
517 +
518 +
519 +
520 +
521 +
522 +
523  
524 +
525  
526  
527  
528  
529  
530 +
531 +
532 +
533 +
534  
535 +
536 +
537 +
538 +
539 +
540  
541 +
542 +
543  
544 +
545 +
546  
547  
548  
}

Point
Prism6::side_vertex_average_normal(const unsigned int s) const
{
  libmesh_assert_less (s, 5);
  libmesh_assert_equal_to(this->mapping_type(), LAGRANGE_MAP);

  switch (s)
    {
    case 0: // the triangular face at z=-1
    case 4: // the triangular face at z=1
      {
        const Point n1 = this->point(side_nodes_map[s][1]) -
                         this->point(side_nodes_map[s][0]);
        const Point n2 = this->point(side_nodes_map[s][2]) -
                         this->point(side_nodes_map[s][1]);
        const Point pointing_out = n1.cross(n2);
        return pointing_out.unit();
      }
    case 1: // the quad face at y=0
    case 2: // the other quad face
    case 3: // the quad face at x=0
      {
        // At the side vertex average, things simplify a bit
        // We get the side "plane" normal at all vertices, then average them
        Point normal;
        Point current_edge = this->point(side_nodes_map[s][1]) -
                             this->point(side_nodes_map[s][0]);
        for (auto i : make_range(4))
        {
          const Point next_edge = this->point(side_nodes_map[s][(i + 2) % 4]) -
                                  this->point(side_nodes_map[s][(i + 1) % 4]);
          const Point normal_at_vertex = current_edge.cross(next_edge);
          normal += normal_at_vertex;
          current_edge = next_edge;
        }
        normal /= 4;
        return normal.unit();
      }
    default:
      libmesh_error_msg("Invalid side s = " << s);
    }
}

src/geom/cell_pyramid5.C

307  
308  
309  
310 +
311  
312 +
313 +
314  
315 +
316  
317 +
318  
319  
320  
321  
322 +
323 +
324 +
325 +
326 +
327 +
328  
329 +
330  
331  
332  
333 +
334 +
335 +
336 +
337  
338 +
339 +
340 +
341 +
342 +
343  
344 +
345 +
346  
347 +
348 +
349  
350  
351  


Point
Pyramid5::side_vertex_average_normal(const unsigned int s) const
{
  libmesh_assert_less (s, 5);
  libmesh_assert_equal_to(this->mapping_type(), LAGRANGE_MAP);

  switch (s)
    {
    case 0: // triangular face 1
    case 1: // triangular face 2
    case 2: // triangular face 3
    case 3: // triangular face 4
      {
        const Point n1 = this->point(side_nodes_map[s][1]) -
                         this->point(side_nodes_map[s][0]);
        const Point n2 = this->point(side_nodes_map[s][2]) -
                         this->point(side_nodes_map[s][1]);
        const Point pointing_out = n1.cross(n2);
        return pointing_out.unit();
      }
    case 4: // the quad face at z=0
      {
        // At the side vertex average, things simplify a bit
        // We get the side "plane" normal at all vertices, then average them
        Point normal;
        Point current_edge = this->point(side_nodes_map[s][1]) -
                             this->point(side_nodes_map[s][0]);
        for (auto i : make_range(4))
        {
          const Point next_edge = this->point(side_nodes_map[s][(i + 2) % 4]) -
                                  this->point(side_nodes_map[s][(i + 1) % 4]);
          const Point normal_at_vertex = current_edge.cross(next_edge);
          normal += normal_at_vertex;
          current_edge = next_edge;
        }
        normal /= 4;
        return normal.unit();
      }
    default:
      libmesh_error_msg("Invalid side s = " << s);
    }
}

src/geom/cell_tet4.C

627  
628  
629  
630 +
631  
632 +
633 +
634 +
635 +
636 +
637 +
638 +
639  
640  
641  


Point
Tet4::side_vertex_average_normal(const unsigned int s) const
{
  libmesh_assert_less (s, 4);
  const Point n1 = this->node_ptr(side_nodes_map[s][1]) -
                   this->node_ptr(side_nodes_map[s][0]);
  const Point n2 = this->node_ptr(side_nodes_map[s][2]) -
                   this->node_ptr(side_nodes_map[s][1]);
  const Point pointing_out = n2.cross(n1);
  return pointing_out.unit();
}


src/geom/edge_edge2.C

144  
145  
146  
147 +
148  
149 +
150 +
151 +
152  
153  
154  


Point
Edge2::side_vertex_average_normal(const unsigned int s) const
{
  libmesh_assert_less (s, 2);
  const auto v = (this->point(0) - this->point(1)).unit();
  return (s == 0) ? v : -v;
}

dof_id_type Edge2::key () const

src/geom/elem.C

3487  
3488  
3489  
3490 +
3491  
3492 +
3493 +
3494  
3495 +
3496 +
3497 +
3498 +
3499 +
3500 +
3501  
3502  
3503  
}

Point
Elem::side_vertex_average_normal(const unsigned int s) const
{
  unsigned int dim = this->dim();
  const std::unique_ptr<const Elem> face = this->build_side_ptr(s);
  std::unique_ptr<libMesh::FEBase> fe(
      libMesh::FEBase::build(dim, libMesh::FEType(this->default_order())));
  const std::vector<Point> & normals = fe->get_normals();
  std::vector<Point> ref_side_vertex_average_v = {face->reference_elem()->vertex_average()};
  fe->reinit(this, s, TOLERANCE, &ref_side_vertex_average_v);
  return normals[0];
}

bool Elem::is_vertex_on_parent(unsigned int c,
                               unsigned int n) const

src/geom/face_c0polygon.C

337  
338  
339  
340 +
341  
342 +
343 +
344 +
345 +
346 +
347 +
348  
349  
350  
351 +
352 +
353 +
354  
355 +
356 +
357 +
358  
359 +
360 +
361  
362 +
363  
364 +
365 +
366  
367  
368  


Point
C0Polygon::side_vertex_average_normal(const unsigned int s) const
{
  const auto n_sides = this->n_sides();
  libmesh_assert_less (s, n_sides);
  libmesh_assert_equal_to(this->mapping_type(), LAGRANGE_MAP);
  const Point side_t = this->point((s+1) % n_sides) -
                       this->point(s);
  Point plane_normal(0, 0, 1);
  // Find out what plane we're in, if we're in 3D
  // Note we don't support non-planar C0-polygon at this time
#if LIBMESH_DIM > 2
  plane_normal(2) = 0;
  const auto vavg = this->vertex_average();
  for (auto i : make_range(n_sides))
    {
      const Point vi     = this->point(i) - vavg;
      const Point viplus = this->point((i+1)%n_sides) - vavg;
      plane_normal += vi.cross(viplus);
      // Since we know the polygon is planar
      if (plane_normal.norm_sq() > TOLERANCE)
        break;
    }
  plane_normal = plane_normal.unit();
#endif
  const Point v = side_t.cross(plane_normal);
  return v.unit();
}


src/geom/face_quad4.C

385  
386  
387  
388 +
389  
390 +
391 +
392 +
393 +
394  
395  
396  
397 +
398 +
399  
400 +
401 +
402 +
403 +
404 +
405 +
406 +
407  
408 +
409  
410 +
411 +
412  
413  
414  


Point
Quad4::side_vertex_average_normal(const unsigned int s) const
{
  libmesh_assert_less (s, 4);
  libmesh_assert_equal_to(this->mapping_type(), LAGRANGE_MAP);
  const Point side_t = this->point(side_nodes_map[s][1]) -
                       this->point(side_nodes_map[s][0]);

  // At the vertex average, things simplify a bit
  // We get the element "plane" normal at the two vertex, average them
  Point normal;
  for (auto i : make_range(2))
  {
    const int incr = (i == 0) ? -1 : 1;
    const unsigned int other_side = (s + incr) % 4;
    const Point other_side_t = this->point(side_nodes_map[other_side][1]) -
                               this->point(side_nodes_map[other_side][0]);
    const auto sign = (incr < 0) ? -1 : 1;
    const Point normal_at_vertex = sign * side_t.cross(other_side_t);
    normal += normal_at_vertex;
  }
  normal /= 2;

  const Point v = side_t.cross(normal);
  return v.unit();
}


src/geom/face_tri3.C

291  
292  
293  
294 +
295  
296 +
297 +
298 +
299 +
300 +
301 +
302 +
303 +
304 +
305  
306  
307  


Point
Tri3::side_vertex_average_normal(const unsigned int s) const
{
  libmesh_assert_less (s, 3);
  const Point side_t = this->point(side_nodes_map[s][1]) -
                       this->point(side_nodes_map[s][0]);
  const unsigned int another_side = s > 1 ? 0 : s + 1;
  const Point other_side_t = this->point(side_nodes_map[another_side][1]) -
                             this->point(side_nodes_map[another_side][0]);
  const Point pointing_up = side_t.cross(other_side_t);
  const Point v = side_t.cross(pointing_up);
  return v.unit();
}


src/mesh/mesh_refinement.C

1272  
1273  
1274  
1275  
1276  
1277  
1278  
1279  
                              if (neighbor->p_level() < my_p_level &&
                                  neighbor->p_refinement_flag() != Elem::REFINE)
                                {
                                  neighbor->set_p_refinement_flag(Elem::REFINE);
                                  level_one_satisfied = false;
                                  compatible_with_coarsening = false;
                                }
                              if (neighbor->p_level() == my_p_level &&

src/mesh/mesh_triangle_holes.C

270  
271  
272  
273  
274  
275  
276  
    {
      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