https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SolutionInvalidInterface.C
Go to the documentation of this file.
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
12#include "MooseBase.h"
13#include "MooseApp.h"
14#include "FEProblemBase.h"
16
18 const InputParameters & parameters)
19 : _si_moose_base(*moose_base),
20 _si_problem(
21 parameters.isParamValid("_fe_problem_base") ?
22 // MooseObjects get the problem that way
23 parameters.get<FEProblemBase *>("_fe_problem_base")
24 :
25 // Actions get the problem that way
26 parameters.getCheckedPointerParam<ActionWarehouse *>("awh")->problemBase().get())
27{
28}
29
30#ifdef MOOSE_KOKKOS_ENABLED
33 : _si_moose_base(object._si_moose_base), _si_problem(object._si_problem)
34{
35}
36#endif
37
39template <bool warning>
40void
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 auto & solution_invalidity = _si_moose_base.getMooseApp().solutionInvalidity();
48 if constexpr (!warning)
50 solution_invalidity.printDebug(invalid_solution_id);
51 return solution_invalidity.flagInvalidSolutionInternal(invalid_solution_id);
52}
53
56 const bool warning) const
57{
59 _si_moose_base.type(), message, warning);
60}
61
62template void SolutionInvalidInterface::flagInvalidSolutionInternal<true>(
63 const InvalidSolutionID invalid_solution_id) const;
64template void SolutionInvalidInterface::flagInvalidSolutionInternal<false>(
65 const InvalidSolutionID invalid_solution_id) const;
unsigned int InvalidSolutionID
Definition MooseTypes.h:241
Storage for action instances.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
bool immediatelyPrintInvalidSolution() const
Whether or not the solution invalid warnings are printed out immediately.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition MooseApp.h:185
Base class for everything in MOOSE with a name and a type.
Definition MooseBase.h:50
const std::string & type() const
Get the type of this class.
Definition MooseBase.h:93
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition MooseBase.h:87
An interface that allows the marking of invalid solutions during a solve.
const FEProblemBase * _si_problem
A pointer to FEProblem base.
InvalidSolutionID registerInvalidSolutionInternal(const std::string &message, const bool warning) const
SolutionInvalidInterface(const MooseBase *const moose_base, const InputParameters &params)
void flagInvalidSolutionInternal(const InvalidSolutionID invalid_solution_id) const
Set solution invalid mark for the given solution ID.
const MooseBase & _si_moose_base
The MooseBase that owns this interface.
void printDebug(InvalidSolutionID _invalid_solution_id) const
Immediately print the section and message for debug purpose.
InvalidSolutionID registerInvalidity(const std::string &object_type, const std::string &message, const bool warning)
Call to register an invalid calculation.
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.