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 "MooseObject.h" 13 : #include "MooseApp.h" 14 : #include "FEProblemBase.h" 15 : #include "SolutionInvalidityRegistry.h" 16 : 17 43690 : SolutionInvalidInterface::SolutionInvalidInterface(const MooseObject * const moose_object) 18 43690 : : _si_moose_object(*moose_object), 19 43690 : _si_problem( 20 174760 : *_si_moose_object.parameters().getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")) 21 : { 22 43690 : } 23 : 24 : #ifdef MOOSE_KOKKOS_ENABLED 25 37959 : SolutionInvalidInterface::SolutionInvalidInterface(const SolutionInvalidInterface & object, 26 37959 : const Moose::Kokkos::FunctorCopy &) 27 37959 : : _si_moose_object(object._si_moose_object), _si_problem(object._si_problem) 28 : { 29 37959 : } 30 : #endif 31 : 32 : /// Set solution invalid mark for the given solution ID 33 : template <bool warning> 34 : void 35 102073 : SolutionInvalidInterface::flagInvalidSolutionInternal( 36 : const InvalidSolutionID invalid_solution_id) const 37 : { 38 : mooseAssert( 39 : warning == moose::internal::getSolutionInvalidityRegistry().item(invalid_solution_id).warning, 40 : "Inconsistent warning flag"); 41 102073 : auto & solution_invalidity = _si_moose_object.getMooseApp().solutionInvalidity(); 42 : if constexpr (!warning) 43 97513 : if (_si_problem.immediatelyPrintInvalidSolution()) 44 672 : solution_invalidity.printDebug(invalid_solution_id); 45 102073 : return solution_invalidity.flagInvalidSolutionInternal(invalid_solution_id); 46 : } 47 : 48 : InvalidSolutionID 49 305 : SolutionInvalidInterface::registerInvalidSolutionInternal(const std::string & message, 50 : const bool warning) const 51 : { 52 610 : return moose::internal::getSolutionInvalidityRegistry().registerInvalidity( 53 610 : _si_moose_object.type(), message, warning); 54 : } 55 : 56 : template void SolutionInvalidInterface::flagInvalidSolutionInternal<true>( 57 : const InvalidSolutionID invalid_solution_id) const; 58 : template void SolutionInvalidInterface::flagInvalidSolutionInternal<false>( 59 : const InvalidSolutionID invalid_solution_id) const;