LCOV - code coverage report
Current view: top level - src/executioners - MultiSystemSolveObject.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 23 26 88.5 %
Date: 2025-07-17 01:28:37 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "MultiSystemSolveObject.h"
      11             : #include "FEProblemBase.h"
      12             : #include "LinearSystem.h"
      13             : #include "NonlinearSystem.h"
      14             : 
      15             : InputParameters
      16      286959 : MultiSystemSolveObject::validParams()
      17             : {
      18      286959 :   InputParameters params = emptyInputParameters();
      19      286959 :   params.addParam<std::vector<SolverSystemName>>(
      20             :       "system_names",
      21             :       "Names of the solver systems (both linear and nonlinear) that will be solved");
      22      286959 :   params.addParamNamesToGroup("system_names", "Multiple solver system");
      23      286959 :   return params;
      24           0 : }
      25             : 
      26       57491 : MultiSystemSolveObject::MultiSystemSolveObject(Executioner & ex) : SolveObject(ex)
      27             : {
      28             :   // Retrieve pointers to all the systems from the problem by default
      29       57491 :   const auto & nl_sys_names = _problem.getNonlinearSystemNames();
      30       57491 :   const auto & linear_sys_names = _problem.getLinearSystemNames();
      31       57491 :   if (!isParamValid("system_names"))
      32             :   {
      33      112966 :     for (const auto & sys_name : nl_sys_names)
      34       56582 :       _systems.push_back(&_problem.getSolverSystem(_problem.solverSysNum(sys_name)));
      35       56396 :     for (const auto & sys_name : linear_sys_names)
      36          12 :       _systems.push_back(&_problem.getSolverSystem(_problem.solverSysNum(sys_name)));
      37       56384 :     _num_nl_systems = nl_sys_names.size();
      38             :   }
      39             :   else
      40             :   {
      41        1107 :     _num_nl_systems = 0;
      42             :     // Retrieve pointers to all the user-specified systems in the order that the user specified them
      43        2248 :     for (const auto & sys_name : getParam<std::vector<SolverSystemName>>("system_names"))
      44             :     {
      45        1141 :       if (std::find(nl_sys_names.begin(), nl_sys_names.end(), sys_name) != nl_sys_names.end())
      46             :       {
      47          34 :         _systems.push_back(&_problem.getSolverSystem(_problem.solverSysNum(sys_name)));
      48          34 :         _num_nl_systems++;
      49             :       }
      50        1107 :       else if (std::find(linear_sys_names.begin(), linear_sys_names.end(), sys_name) !=
      51        2214 :                linear_sys_names.end())
      52        1107 :         _systems.push_back(&_problem.getSolverSystem(_problem.solverSysNum(sys_name)));
      53             :       else
      54           0 :         paramError("system_names",
      55           0 :                    "System '" + sys_name +
      56             :                        "' was not found in the Problem. Did you forget to declare it in the "
      57             :                        "[Problem] block?");
      58             :     }
      59             :   }
      60       57491 : }

Generated by: LCOV version 1.14