www.mooseframework.org
Terminator.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
54  const enum class FailMode { HARD, SOFT } _fail_mode;
55  const enum class ErrorLevel { INFO, WARNING, ERROR, NONE } _error_level;
56 
58  std::vector<std::string> _pp_names;
59 
60  // Number of postprocessors the expression depends on
61  unsigned int _pp_num;
62 
64  std::vector<const PostprocessorValue *> _pp_values;
65 
67  std::string _expression;
68 
71 
73  std::vector<Real> _params;
74 };
75 
76 #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:89
Terminator(const InputParameters &parameters)
Definition: Terminator.C:55
std::vector< std::string > _pp_names
Postprocessor names.
Definition: Terminator.h:58
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:73
void handleMessage()
handle output of the optional message
Definition: Terminator.C:107
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:67
std::vector< const PostprocessorValue * > _pp_values
Postprocessor values.
Definition: Terminator.h:64
enum Terminator::FailMode _fail_mode
This Userobject requests termination of the current solve based on the values of Postprocessors (and ...
Definition: Terminator.h:38
enum Terminator::ErrorLevel _error_level
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.
virtual void execute() override
Execute method.
Definition: Terminator.C:141
FunctionParserBase< Real > _fp
Fparser object.
Definition: Terminator.h:70
unsigned int _pp_num
Definition: Terminator.h:61