https://mooseframework.inl.gov
Terminator.h
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 #pragma once
11 
12 #include "libmesh/libmesh_config.h"
13 
14 #ifdef LIBMESH_HAVE_FPARSER
15 
16 #include "GeneralUserObject.h"
17 #include "libmesh/fparser.hh"
18 
39 {
40 public:
42 
44 
45  virtual void initialSetup() override;
46  virtual void initialize() override {}
47  virtual void execute() override;
48  virtual void finalize() override {}
49 
50 protected:
52  void handleMessage();
53 
55  const enum class FailMode { HARD, SOFT, NONE } _fail_mode;
56 
58  const enum class MessageType { INFO, WARNING, ERROR, NONE } _msg_type;
59 
61  std::vector<std::string> _pp_names;
62 
63  // Number of postprocessors the expression depends on
64  unsigned int _pp_num;
65 
67  std::vector<const PostprocessorValue *> _pp_values;
68 
70  std::string _expression;
71 
74 
76  std::vector<Real> _params;
77 };
78 
79 #endif // LIBMESH_HAVE_FPARSER
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
Definition: Terminator.C:93
enum Terminator::MessageType _msg_type
Terminator(const InputParameters &parameters)
Definition: Terminator.C:55
std::vector< std::string > _pp_names
Postprocessor names.
Definition: Terminator.h:61
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::vector< Real > _params
Fparser parameter buffer.
Definition: Terminator.h:76
void handleMessage()
handle output of the optional message
Definition: Terminator.C:111
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition: Terminator.h:46
std::string _expression
Expression of the criterion, to be parsed for evaluation.
Definition: Terminator.h:70
std::vector< const PostprocessorValue * > _pp_values
Postprocessor values.
Definition: Terminator.h:67
MessageType
What logging level the terminator message is output with.
Definition: Terminator.h:58
enum Terminator::FailMode _fail_mode
This Userobject requests termination of the current solve based on the values of Postprocessors (and ...
Definition: Terminator.h:38
static InputParameters validParams()
Definition: Terminator.C:22
virtual void finalize() override
Finalize.
Definition: Terminator.h:48
const InputParameters & parameters() const
Get the parameters of the object.
FailMode
What action the terminator takes when the criteria is met.
Definition: Terminator.h:55
virtual void execute() override
Execute method.
Definition: Terminator.C:147
FunctionParserBase< Real > _fp
Fparser object.
Definition: Terminator.h:73
unsigned int _pp_num
Definition: Terminator.h:64