LCOV - code coverage report
Current view: top level - src/interfaces - SolutionInvalidInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: d8769b Lines: 16 20 80.0 %
Date: 2025-11-07 20:01:30 Functions: 4 5 80.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             : // MOOSE includes
      11             : #include "SolutionInvalidInterface.h"
      12             : #include "MooseBase.h"
      13             : #include "MooseApp.h"
      14             : #include "FEProblemBase.h"
      15             : #include "SolutionInvalidityRegistry.h"
      16             : 
      17     6227521 : SolutionInvalidInterface::SolutionInvalidInterface(const MooseBase * const moose_base,
      18     6227521 :                                                    const InputParameters & parameters)
      19     6227521 :   : _si_moose_base(*moose_base),
      20     6227521 :     _si_problem(
      21     9686488 :         parameters.isParamValid("_fe_problem_base") ?
      22             :                                                     // MooseObjects get the problem that way
      23     2768554 :             parameters.get<FEProblemBase *>("_fe_problem_base")
      24             :                                                     :
      25             :                                                     // Actions get the problem that way
      26    16604422 :             parameters.getCheckedPointerParam<ActionWarehouse *>("awh")->problemBase().get())
      27             : {
      28     6227521 : }
      29             : 
      30             : #ifdef MOOSE_KOKKOS_ENABLED
      31           0 : SolutionInvalidInterface::SolutionInvalidInterface(const SolutionInvalidInterface & object,
      32           0 :                                                    const Moose::Kokkos::FunctorCopy &)
      33           0 :   : _si_moose_base(object._si_moose_base), _si_problem(object._si_problem)
      34             : {
      35           0 : }
      36             : #endif
      37             : 
      38             : /// Set solution invalid mark for the given solution ID
      39             : template <bool warning>
      40             : void
      41      106083 : SolutionInvalidInterface::flagInvalidSolutionInternal(
      42             :     const InvalidSolutionID invalid_solution_id) const
      43             : {
      44             :   mooseAssert(
      45             :       warning == moose::internal::getSolutionInvalidityRegistry().item(invalid_solution_id).warning,
      46             :       "Inconsistent warning flag");
      47      106083 :   auto & solution_invalidity = _si_moose_base.getMooseApp().solutionInvalidity();
      48             :   if constexpr (!warning)
      49       97513 :     if (!_si_problem || _si_problem->immediatelyPrintInvalidSolution())
      50         672 :       solution_invalidity.printDebug(invalid_solution_id);
      51      106083 :   return solution_invalidity.flagInvalidSolutionInternal(invalid_solution_id);
      52             : }
      53             : 
      54             : InvalidSolutionID
      55        4315 : SolutionInvalidInterface::registerInvalidSolutionInternal(const std::string & message,
      56             :                                                           const bool warning) const
      57             : {
      58        8630 :   return moose::internal::getSolutionInvalidityRegistry().registerInvalidity(
      59        8630 :       _si_moose_base.type(), message, warning);
      60             : }
      61             : 
      62             : template void SolutionInvalidInterface::flagInvalidSolutionInternal<true>(
      63             :     const InvalidSolutionID invalid_solution_id) const;
      64             : template void SolutionInvalidInterface::flagInvalidSolutionInternal<false>(
      65             :     const InvalidSolutionID invalid_solution_id) const;

Generated by: LCOV version 1.14