LCOV - code coverage report
Current view: top level - src/tensor_solver - SplitOperatorBase.C (source / functions) Hit Total Coverage
Test: idaholab/swift: #92 (25e020) with base b3cd84 Lines: 25 28 89.3 %
Date: 2025-09-10 17:10:32 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /**********************************************************************/
       2             : /*                    DO NOT MODIFY THIS HEADER                       */
       3             : /*             Swift, a Fourier spectral solver for MOOSE             */
       4             : /*                                                                    */
       5             : /*            Copyright 2024 Battelle Energy Alliance, LLC            */
       6             : /*                        ALL RIGHTS RESERVED                         */
       7             : /**********************************************************************/
       8             : 
       9             : #include "SplitOperatorBase.h"
      10             : #include "TensorProblem.h"
      11             : #include "DomainAction.h"
      12             : 
      13             : InputParameters
      14         158 : SplitOperatorBase::validParams()
      15             : {
      16         158 :   InputParameters params = TensorSolver::validParams();
      17         158 :   params.addClassDescription("Base class for non-linear/linear operator splits.");
      18             : 
      19         316 :   params.addRequiredParam<std::vector<TensorOutputBufferName>>(
      20             :       "buffer", "The buffer this solver is writing to");
      21             : 
      22         316 :   params.addRequiredParam<std::vector<TensorInputBufferName>>(
      23             :       "reciprocal_buffer", "Buffer with the reciprocal of the integrated buffer");
      24         316 :   params.addRequiredParam<std::vector<TensorInputBufferName>>(
      25             :       "linear_reciprocal",
      26             :       "Buffer with the reciprocal of the linear prefactor (e.g. kappa*k^2). Either one buffer per "
      27             :       "nonlinear_reciprocal, or no buffer names, or `0` to skip linear reciprocal buffers for a "
      28             :       "given variable.");
      29         316 :   params.addRequiredParam<std::vector<TensorInputBufferName>>(
      30             :       "nonlinear_reciprocal", "Buffer with the reciprocal of the non-linear contribution");
      31         158 :   return params;
      32           0 : }
      33             : 
      34          78 : SplitOperatorBase::SplitOperatorBase(const InputParameters & parameters) : TensorSolver(parameters)
      35             : {
      36          78 : }
      37             : 
      38             : void
      39          78 : SplitOperatorBase::getVariables(unsigned int history_size)
      40             : {
      41         156 :   auto buffers = getParam<std::vector<TensorOutputBufferName>>("buffer");
      42         156 :   auto reciprocal_buffers = getParam<std::vector<TensorInputBufferName>>("reciprocal_buffer");
      43         156 :   auto linear_reciprocals = getParam<std::vector<TensorInputBufferName>>("linear_reciprocal");
      44         234 :   auto nonlinear_reciprocals = getParam<std::vector<TensorInputBufferName>>("nonlinear_reciprocal");
      45             : 
      46             :   const auto n = buffers.size();
      47             : 
      48          78 :   if (linear_reciprocals.empty())
      49           0 :     linear_reciprocals.assign(n, "0");
      50             : 
      51          78 :   if (reciprocal_buffers.size() != n || linear_reciprocals.size() != n ||
      52             :       nonlinear_reciprocals.size() != n)
      53           0 :     paramError("buffer",
      54             :                "Must have the same number of entries as 'reciprocal_buffer', 'linear_reciprocal' "
      55             :                "and 'nonlinear_reciprocal'.");
      56             : 
      57         188 :   for (const auto i : make_range(n))
      58         330 :     _variables.push_back(Variable{
      59         110 :         getOutputBufferByName(buffers[i]),
      60         110 :         getInputBufferByName(reciprocal_buffers[i]),
      61         110 :         linear_reciprocals[i] == "0" ? nullptr : &getInputBufferByName(linear_reciprocals[i]),
      62         110 :         getInputBufferByName(nonlinear_reciprocals[i]),
      63         110 :         getBufferOldByName(nonlinear_reciprocals[i], history_size)});
      64          78 : }

Generated by: LCOV version 1.14