libMesh/libmesh: coverage diff

Base d735cc Head #4256 26f7e2
Total Total +/- New
Rate 64.83% 64.89% +0.06% 97.78%
Hits 76633 76734 +101 44
Misses 41572 41512 -60 1
Filename Stmts Miss Cover
src/geom/cell_prism15.C 0 -53 +22.36%
src/geom/cell_prism18.C 0 -3 +0.83%
src/geom/cell_prism20.C 0 -2 +0.93%
src/geom/cell_prism21.C 0 -3 +1.33%
src/mesh/distributed_mesh.C 0 -2 +0.25%
src/mesh/mesh_refinement.C 0 +2 -0.29%
src/mesh/mesh_smoother_vsmoother.C +7 0 +0.37%
src/systems/variational_smoother_system.C +34 +1 -0.10%
TOTAL +41 -60 +0.06%
code
coverage unchanged
code
coverage increased
code
coverage decreased
+
line added or modified

src/geom/cell_prism15.C

120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
  Point v = this->point(3) - this->point(0);
  if (!v.relative_fuzzy_equals(this->point(4) - this->point(1), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(5) - this->point(2), affine_tol))
    return false;
  // Make sure edges are straight
  v /= 2;
  if (!v.relative_fuzzy_equals(this->point(9) - this->point(0), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(10) - this->point(1), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(11) - this->point(2), affine_tol))
    return false;
  v = (this->point(1) - this->point(0))/2;
  if (!v.relative_fuzzy_equals(this->point(6) - this->point(0), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(12) - this->point(3), affine_tol))
    return false;
  v = (this->point(2) - this->point(0))/2;
  if (!v.relative_fuzzy_equals(this->point(8) - this->point(0), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(14) - this->point(3), affine_tol))
    return false;
  v = (this->point(2) - this->point(1))/2;
  if (!v.relative_fuzzy_equals(this->point(7) - this->point(1), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(13) - this->point(4), affine_tol))
    return false;
  return true;
}

349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
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  
415  
416  



Real Prism15::volume () const
{
  // This specialization is good for Lagrange mappings only
  if (this->mapping_type() != LAGRANGE_MAP)
    return this->Elem::volume();

  // Make copies of our points.  It makes the subsequent calculations a bit
  // shorter and avoids dereferencing the same pointer multiple times.
  Point
    x0 = point(0),   x1 = point(1),   x2 = point(2),   x3 = point(3),   x4 = point(4),
    x5 = point(5),   x6 = point(6),   x7 = point(7),   x8 = point(8),   x9 = point(9),
    x10 = point(10), x11 = point(11), x12 = point(12), x13 = point(13), x14 = point(14);

  // Terms are copied directly from a Python script.
  Point dx_dxi[10] =
    {
      -x0 - x1 + x10 + 2*x12 - x3 - x4 + 2*x6 - x9,
      3*x0/2 + x1/2 + 2*x12 - 3*x3/2 - x4/2 - 2*x6,
      -x0/2 + x1/2 - x10 - x3/2 + x4/2 + x9,
      2*x0 - 2*x12 + 2*x13 - 2*x14 + 2*x3 - 2*x6 + 2*x7 - 2*x8,
      -2*x0 - 2*x12 + 2*x13 - 2*x14 + 2*x3 + 2*x6 - 2*x7 + 2*x8,
      Point(0,0,0),
      2*x0 + 2*x1 - 4*x12 + 2*x3 + 2*x4 - 4*x6,
      -2*x0 - 2*x1 - 4*x12 + 2*x3 + 2*x4 + 4*x6,
      Point(0,0,0),
      Point(0,0,0)
    };

  Point dx_deta[10] =
    {
      -x0 + x11 + 2*x14 - x2 - x3 - x5 + 2*x8 - x9,
      3*x0/2 + 2*x14 + x2/2 - 3*x3/2 - x5/2 - 2*x8,
      -x0/2 - x11 + x2/2 - x3/2 + x5/2 + x9,
      2*x0 - 4*x14 + 2*x2 + 2*x3 + 2*x5 - 4*x8,
      -2*x0 - 4*x14 - 2*x2 + 2*x3 + 2*x5 + 4*x8,
      Point(0,0,0),
      2*x0 - 2*x12 + 2*x13 - 2*x14 + 2*x3 - 2*x6 + 2*x7 - 2*x8,
      -2*x0 - 2*x12 + 2*x13 - 2*x14 + 2*x3 + 2*x6 - 2*x7 + 2*x8,
      Point(0,0,0),
      Point(0,0,0)
    };

  Point dx_dzeta[10] =
    {
      -x0/2 + x3/2,
      x0 + x3 - 2*x9,
      Point(0,0,0),
      3*x0/2 + 2*x14 + x2/2 - 3*x3/2 - x5/2 - 2*x8,
      -x0 - 2*x11 + x2 - x3 + x5 + 2*x9,
      -x0 - 2*x14 - x2 + x3 + x5 + 2*x8,
      3*x0/2 + x1/2 + 2*x12 - 3*x3/2 - x4/2 - 2*x6,
      -x0 + x1 - 2*x10 - x3 + x4 + 2*x9,
      -2*x0 - 2*x12 + 2*x13 - 2*x14 + 2*x3 + 2*x6 - 2*x7 + 2*x8,
      -x0 - x1 - 2*x12 + x3 + x4 + 2*x6
    };

  // The quadrature rule for the Prism15 is a tensor product between a
  // FOURTH-order TRI3 rule (in xi, eta) and a FIFTH-order EDGE2 rule
  // in zeta.

  // Number of points in the 2D quadrature rule.
  const int N2D = 6;

  // Parameters of the 2D rule
  static const Real
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
    };

  // Number of points in the 1D quadrature rule.
  const int N1D = 3;

  // Points and weights of the 1D quadrature rule.
  static const Real w1D[N1D] = {5./9, 8./9, 5./9};

  const Real zeta[N1D][3] =
    {
      //^0   ^1                 ^2
      {  1., -std::sqrt(15)/5., 15./25},
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
      {2, 0, 0}
    };

  Real vol = 0.;
  for (int i=0; i<N2D; ++i)
    for (int j=0; j<N1D; ++j)
      {
        // Compute dx_dxi, dx_deta, dx_dzeta at the current quadrature point.
        Point dx_dxi_q, dx_deta_q, dx_dzeta_q;
        for (int c=0; c<10; ++c)
          {
            Real coeff =
              xi[i][exponents[c][0]]*
              eta[i][exponents[c][1]]*
              zeta[j][exponents[c][2]];

            dx_dxi_q   += coeff * dx_dxi[c];
            dx_deta_q  += coeff * dx_deta[c];
            dx_dzeta_q += coeff * dx_dzeta[c];
          }

        // Compute scalar triple product, multiply by weight, and accumulate volume.
        vol += w2D[i] * w1D[j] * triple_product(dx_dxi_q, dx_deta_q, dx_dzeta_q);
      }

  return vol;
}


src/geom/cell_prism18.C

125  
126  
127  
128  
129  
130  
131  
  Point v = this->point(3) - this->point(0);
  if (!v.relative_fuzzy_equals(this->point(4) - this->point(1), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(5) - this->point(2), affine_tol))
    return false;
  // Make sure edges are straight
  v /= 2;
  if (!v.relative_fuzzy_equals(this->point(9) - this->point(0), affine_tol) ||
134  
135  
136  
137  
138  
139  
140  
      !v.relative_fuzzy_equals(this->point(15) - this->point(6), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(16) - this->point(7), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(17) - this->point(8), affine_tol))
    return false;
  v = (this->point(1) - this->point(0))/2;
  if (!v.relative_fuzzy_equals(this->point(6) - this->point(0), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(12) - this->point(3), affine_tol))
146  
147  
148  
149  
150  
151  
152  
  v = (this->point(2) - this->point(1))/2;
  if (!v.relative_fuzzy_equals(this->point(7) - this->point(1), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(13) - this->point(4), affine_tol))
    return false;
  return true;
}

src/geom/cell_prism20.C

135  
136  
137  
138  
139  
140  
141  
      !v.relative_fuzzy_equals(this->point(15) - this->point(6), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(16) - this->point(7), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(17) - this->point(8), affine_tol))
    return false;
  v = (this->point(1) - this->point(0))/2;
  if (!v.relative_fuzzy_equals(this->point(6) - this->point(0), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(12) - this->point(3), affine_tol))
147  
148  
149  
150  
151  
152  
153  
  v = (this->point(2) - this->point(1))/2;
  if (!v.relative_fuzzy_equals(this->point(7) - this->point(1), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(13) - this->point(4), affine_tol))
    return false;

  // Make sure triangle face midpoints are centered
  v = this->point(2) + this->point(1) - 2*this->point(0);

src/geom/cell_prism21.C

152  
153  
154  
155  
156  
157  
158  
      !v.relative_fuzzy_equals(this->point(15) - this->point(6), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(16) - this->point(7), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(17) - this->point(8), affine_tol))
    return false;
  v = (this->point(1) - this->point(0))/2;
  if (!v.relative_fuzzy_equals(this->point(6) - this->point(0), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(12) - this->point(3), affine_tol))
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
  v = (this->point(2) - this->point(0))/2;
  if (!v.relative_fuzzy_equals(this->point(8) - this->point(0), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(14) - this->point(3), affine_tol))
    return false;
  v = (this->point(2) - this->point(1))/2;
  if (!v.relative_fuzzy_equals(this->point(7) - this->point(1), affine_tol) ||
      !v.relative_fuzzy_equals(this->point(13) - this->point(4), affine_tol))
    return false;

  // Make sure triangle face midpoints are centered
  v = this->point(2) + this->point(1) - 2*this->point(0);

src/mesh/distributed_mesh.C

1537  
1538  
1539  
1540  
1541  
1542  
1543  
1544  
1545  
1546  
1547  
1548  
1549  
1550  
                      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_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_smoother_vsmoother.C

54  
55  
56  
57 +
58  
59  
60  
61 +
62 +
63 +
64 +
65 +
66  
67  
68  
                                                 const double relative_residual_tolerance,
                                                 const double absolute_residual_tolerance,
                                                 const bool solver_quiet,
                                                 const bool solver_verbose)
  : MeshSmoother(mesh),
    _dilation_weight(dilation_weight),
    _preserve_subdomain_boundaries(preserve_subdomain_boundaries),
    _setup_called(false),
    _relative_residual_tolerance(relative_residual_tolerance),
    _absolute_residual_tolerance(absolute_residual_tolerance),
    _solver_quiet(solver_quiet),
    _solver_verbose(solver_verbose)
{}

void VariationalMeshSmoother::setup()
126  
127  
128  
129 +
130 +
131 +
132  
133  
134 +
135 +
136  
137  
138  
  _equation_systems->init();

  // Solver verbosity
  DiffSolver & solver = *(system()->time_solver->diff_solver().get());
  solver.quiet = _solver_quiet;
  solver.verbose = _solver_verbose;

  // Solver convergence tolerances
  system()->time_solver->diff_solver()->relative_residual_tolerance = _relative_residual_tolerance;
  system()->time_solver->diff_solver()->absolute_residual_tolerance = _absolute_residual_tolerance;

  _setup_called = true;
}

src/systems/variational_smoother_system.C

927  
928  
929  
930 +
931  
932  
933  
    } // if Tri

  // Elems deriving from Prism
  else if (type_str.compare(0, 5, "PRISM") == 0)
    {

      // The target element will be a prism with an equilateral triangular
945  
946  
947  
948 +
949  
950 +
951  
952 +
953 +
954  
955 +
956 +
957 +
958 +
959 +
960 +
961  
962 +
963  
964  
965 +
966 +
967 +
968 +
969 +
970 +
971 +
972 +
973 +
974 +
975  
976 +
977  
978  
979 +
980 +
981 +
982  
983 +
984  
985  
986 +
987 +
988  
989 +
990  
991 +
992  
993  
994 +
995  
996  
997 +
998 +
999  
1000  
1001  
      // identified.

      // Side length that preserves the volume of the reference element
      const auto side_length = std::pow(16. * ref_vol / 3., 1. / 3.);
      // Prism height with the property that all faces have equal area
      const auto target_height = 0.25 * side_length * sqrt_3;

      const auto & s = side_length;
      const auto & h = target_height;
      //                                         x        y                 z    node_id
      owned_nodes.emplace_back(Node::build(Point(0.,      0.,               0.), 0));
      owned_nodes.emplace_back(Node::build(Point(s,       0.,               0.), 1));
      owned_nodes.emplace_back(Node::build(Point(0.5 * s, 0.5 * sqrt_3 * s, 0.), 2));
      owned_nodes.emplace_back(Node::build(Point(0.,      0.,               h),  3));
      owned_nodes.emplace_back(Node::build(Point(s,       0.,               h),  4));
      owned_nodes.emplace_back(Node::build(Point(0.5 * s, 0.5 * sqrt_3 * s, h),  5));

      if (type == PRISM15 || type == PRISM18 || type == PRISM20 || type == PRISM21)
        {
          // Define the edge midpoint nodes of the prism
          const auto & on = owned_nodes;
          owned_nodes.emplace_back(Node::build(Point((*on[0] + *on[1]) / 2.), 6));
          owned_nodes.emplace_back(Node::build(Point((*on[1] + *on[2]) / 2.), 7));
          owned_nodes.emplace_back(Node::build(Point((*on[2] + *on[0]) / 2.), 8));
          owned_nodes.emplace_back(Node::build(Point((*on[0] + *on[3]) / 2.), 9));
          owned_nodes.emplace_back(Node::build(Point((*on[1] + *on[4]) / 2.), 10));
          owned_nodes.emplace_back(Node::build(Point((*on[2] + *on[5]) / 2.), 11));
          owned_nodes.emplace_back(Node::build(Point((*on[3] + *on[4]) / 2.), 12));
          owned_nodes.emplace_back(Node::build(Point((*on[4] + *on[5]) / 2.), 13));
          owned_nodes.emplace_back(Node::build(Point((*on[5] + *on[3]) / 2.), 14));

          if (type == PRISM18 || type == PRISM20 || type == PRISM21)
            {
              // Define the rectangular face midpoint nodes of the prism
              owned_nodes.emplace_back(Node::build(Point((*on[0] + *on[1] + *on[3] + *on[4]) / 4.), 15));
              owned_nodes.emplace_back(Node::build(Point((*on[1] + *on[2] + *on[4] + *on[5]) / 4.), 16));
              owned_nodes.emplace_back(Node::build(Point((*on[0] + *on[2] + *on[3] + *on[5]) / 4.), 17));

              if (type == PRISM20 || type == PRISM21)
                {
                  // Define the triangular face midpoint nodes of the prism
                  owned_nodes.emplace_back(Node::build(Point((*on[0] + *on[1] + *on[2]) / 3.), 18));
                  owned_nodes.emplace_back(Node::build(Point((*on[3] + *on[4] + *on[5]) / 3.), 19));

                  if (type == PRISM21)
                    // Define the interior point of the prism
                    owned_nodes.emplace_back(Node::build(Point((*on[9] + *on[10] + *on[11]) / 3.), 20));

                }
            }
        }

      else if (type != PRISM6)
        libmesh_error_msg("Unsupported prism element: " << type_str);

    } // if Prism