idaholab/moose: framework coverage diff

Base 7323e9 Head #31613 c7d555
Total Total +/- New
Rate 86.02% 86.02% +0.00% 100.00%
Hits 124629 124696 +67 78
Misses 20254 20264 +10 0
Filename Stmts Miss Cover
framework/include/mfem/auxkernels/MFEMCrossProductAux.h +1 0 +100.00%
framework/include/mfem/auxkernels/MFEMDotProductAux.h +1 0 +100.00%
framework/src/base/MooseError.C 0 -1 +1.82%
framework/src/mfem/auxkernels/MFEMCrossProductAux.C +35 +5 +85.71%
framework/src/mfem/auxkernels/MFEMDotProductAux.C +30 +3 +90.00%
framework/src/mfem/fespaces/MFEMScalarFESpace.C +6 +2 -7.14%
framework/src/mfem/fespaces/MFEMVectorFESpace.C +4 +1 -1.65%
TOTAL +77 +10 +0.00%
code
coverage unchanged
code
coverage increased
code
coverage decreased
+
line added or modified

framework/include/mfem/auxkernels/MFEMCrossProductAux.h

26  
27  
28  
29 +
30  
31  
32  
  static InputParameters validParams();

  MFEMCrossProductAux(const InputParameters & parameters);
  ~MFEMCrossProductAux() override = default;

  void execute() override;

framework/include/mfem/auxkernels/MFEMDotProductAux.h

26  
27  
28  
29 +
30  
31  
32  
  static InputParameters validParams();

  MFEMDotProductAux(const InputParameters & parameters);
  ~MFEMDotProductAux() override = default;

  void execute() override;

framework/src/base/MooseError.C

113  
114  
115  
116  
117  
118  
119  
    // In parallel with libMesh configured with --enable-tracefiles, this will
    // dump a trace for each rank to file
    if (libMesh::global_n_processors() > 1)
      libMesh::write_traceout();

    MOOSE_ABORT;
  }

framework/src/mfem/auxkernels/MFEMCrossProductAux.C

16  
17  
18  
19 +
20  
21 +
22 +
23 +
24 +
25 +
26 +
27 +
28 +
29  
30 +
31  
32 +
33 +
34 +
35 +
36 +
37 +
38 +
39 +
40 +
41 +
42  
43  
44 +
45 +
46  
47  
48 +
49 +
50  
51 +
52 +
53  
54  
55 +
56 +
57  
58  
59 +
60 +
61  
62 +
63  
64  
65 +
66  
67  
68  
69 +
70 +
71 +
72  
73  
74  
registerMooseObject("MooseApp", MFEMCrossProductAux);

InputParameters
MFEMCrossProductAux::validParams()
{
  InputParameters params = MFEMAuxKernel::validParams();
  params.addClassDescription("Projects s(x) * (U x V) onto a vector MFEM auxvariable");
  params.addRequiredParam<VariableName>("first_source_vec", "Vector MFEMVariable U (vdim=3)");
  params.addRequiredParam<VariableName>("second_source_vec", "Vector MFEMVariable V (vdim=3)");
  params.addParam<mfem::real_t>(
      "scale_factor", 1.0, "Constant multiplier applied to the cross product");
  return params;
}

MFEMCrossProductAux::MFEMCrossProductAux(const InputParameters & parameters)
  : MFEMAuxKernel(parameters),
    _u_var_name(getParam<VariableName>("first_source_vec")),
    _v_var_name(getParam<VariableName>("second_source_vec")),
    _u_var(*getMFEMProblem().getProblemData().gridfunctions.Get(_u_var_name)),
    _v_var(*getMFEMProblem().getProblemData().gridfunctions.Get(_v_var_name)),
    _scale_factor(getParam<mfem::real_t>("scale_factor")),
    _u_coef(&_u_var),
    _v_coef(&_v_var),
    _cross_uv(_u_coef, _v_coef),
    _scale_c(_scale_factor),
    _final_coef(_scale_c, _cross_uv)
{
  // Check the target variable type and dimensions
  mfem::ParFiniteElementSpace * fes = _result_var.ParFESpace();
  const int mesh_dim = fes->GetMesh()->Dimension();

  // Enforce 3D cross product
  if (mesh_dim != 3)
    mooseError("MFEMCrossProductAux requires a 3D mesh (Dimension == 3).");

  if (fes->GetVDim() != 3)
    mooseError("MFEMCrossProductAux requires AuxVariable to have vdim == 3.");

  // Must be L2
  if (!dynamic_cast<const mfem::L2_FECollection *>(fes->FEColl()))
    mooseError("MFEMCrossProductAux requires the target variable to use L2_FECollection.");

  // Must have no shared/constrained DOFs (pure interior DOFs)
  if (fes->GetTrueVSize() != fes->GetVSize())
    mooseError("MFEMCrossProductAux currently supports only L2 spaces with interior DOFs "
               "(no shared/constrained DOFs).");
}

void
MFEMCrossProductAux::execute()
{

  // MFEM element projection for L2
  _result_var = 0.0;
  _result_var.ProjectCoefficient(_final_coef);
}

#endif // MOOSE_MFEM_ENABLED

framework/src/mfem/auxkernels/MFEMDotProductAux.C

15  
16  
17  
18 +
19  
20 +
21 +
22 +
23 +
24 +
25 +
26 +
27 +
28  
29 +
30  
31 +
32 +
33 +
34 +
35 +
36 +
37 +
38 +
39 +
40 +
41  
42  
43 +
44 +
45 +
46  
47  
48 +
49 +
50  
51 +
52  
53  
54 +
55  
56  
57 +
58 +
59 +
60  
61  
62  
registerMooseObject("MooseApp", MFEMDotProductAux);

InputParameters
MFEMDotProductAux::validParams()
{
  InputParameters params = MFEMAuxKernel::validParams();
  params.addClassDescription("Project s(x) * (U . V) onto a scalar MFEM auxvariable.");
  params.addRequiredParam<VariableName>("first_source_vec", "Vector MFEMVariable U");
  params.addRequiredParam<VariableName>("second_source_vec", "Vector MFEMVariable V");
  params.addParam<mfem::real_t>(
      "scale_factor", 1.0, "Constant multiplier applied to the dot product");
  return params;
}

MFEMDotProductAux::MFEMDotProductAux(const InputParameters & parameters)
  : MFEMAuxKernel(parameters),
    _u_var_name(getParam<VariableName>("first_source_vec")),
    _v_var_name(getParam<VariableName>("second_source_vec")),
    _u_var(*getMFEMProblem().getProblemData().gridfunctions.Get(_u_var_name)),
    _v_var(*getMFEMProblem().getProblemData().gridfunctions.Get(_v_var_name)),
    _scale_factor(getParam<mfem::real_t>("scale_factor")),
    _u_coef(&_u_var),
    _v_coef(&_v_var),
    _dot_uv(_u_coef, _v_coef),
    _scale_c(_scale_factor),
    _final_coef(_scale_c, _dot_uv)
{
  // Must be L2
  mfem::ParFiniteElementSpace * fes = _result_var.ParFESpace();
  if (!dynamic_cast<const mfem::L2_FECollection *>(fes->FEColl()))
    paramError("variable", "The target variable must use L2_FECollection.");

  // Must have no shared/constrained DOFs
  if (fes->GetTrueVSize() != fes->GetVSize())
    mooseError("MFEMDotProductAux currently supports only L2 spaces with interior DOFs (no "
               "shared/constrained DOFs).");
}

void
MFEMDotProductAux::execute()
{
  // Project into the scalar aux result variable per element projection for L2
  _result_var = 0.0;
  _result_var.ProjectCoefficient(_final_coef);
}

#endif // MOOSE_MFEM_ENABLED

framework/src/mfem/fespaces/MFEMScalarFESpace.C

28  
29  
30  
31 +
32 +
33  
34  
35  
      basis_types,
      "Specifies the basis used for scalar elements. H1 spaces require a closed basis "
      "(GaussLobatto Positive ClosedUniform Serendipity ClosedGL)");
  MooseEnum fec_maps("VALUE INTEGRAL", "VALUE", true);
  params.addParam<MooseEnum>(
      "fec_map",
      fec_maps,
      "Specify the FE map type used VALUE or INTEGRAL (meaningful for L2 only)");
39  
40  
41  
42 +
43 +
44  
45  
46  

MFEMScalarFESpace::MFEMScalarFESpace(const InputParameters & parameters)
  : MFEMSimplifiedFESpace(parameters),
    _fec_type(getParam<MooseEnum>("fec_type")),
    _fec_map(getParam<MooseEnum>("fec_map"))
{
}

55  
56  
57  
58 +
59 +
60 +
61  
62  
63  
  // This is to get around an MFEM bug (to be removed in #31525)
  basis = (basis == "@G" || basis == "_T0") ? "" : basis;

  if (_fec_map == "INTEGRAL")
    return "L2Int" + basis + "_" + std::to_string(getProblemDim()) + "D_P" +
           std::to_string(_fec_order);

  return _fec_type + basis + "_" + std::to_string(getProblemDim()) + "D_P" +
         std::to_string(_fec_order);

framework/src/mfem/fespaces/MFEMVectorFESpace.C

44  
45  
46  
47 +
48 +
49  
50  
51  
                       "(the default) means it will be the same as the problem dimension. "
                       "Note that MFEM does not currently support 2D vectors in 1D space "
                       "for ND and RT elements.");
  MooseEnum fec_maps("VALUE INTEGRAL", "VALUE", true);
  params.addParam<MooseEnum>(
      "fec_map",
      fec_maps,
      "Specify the FE map type used VALUE or INTEGRAL (meaningful for L2 only)");
94  
95  
96  
97 +
98  
99 +
100  
101  
102  
  // This is to get around an MFEM bug (to be removed in #31525)
  basis = (basis == "@Gg" || basis == "@G" || basis == "_T0") ? "" : basis;

  if (_fec_map == "INTEGRAL" && _fec_type == "L2")
  {
    return "L2Int" + basis + "_" + std::to_string(pdim) + "D_P" + std::to_string(_fec_order);
  }

  return actual_type + basis + "_" + std::to_string(pdim) + "D_P" + std::to_string(_fec_order);