minMaxCondition.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2015 OpenFOAM Foundation
9 Copyright (C) 2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::minMaxCondition
29
30Description
31 Minimum/maximum run time conditions. If the value type is not scalar,
32 the magnitude of the value is used in the evaluation.
33
34SourceFiles
35 minMaxCondition.H
36 minMaxCondition.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef functionObjects_runTimeControls_minMaxCondition_H
41#define functionObjects_runTimeControls_minMaxCondition_H
42
43#include "runTimeCondition.H"
44#include "Enum.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50namespace functionObjects
51{
52namespace runTimeControls
53{
54
55/*---------------------------------------------------------------------------*\
56 Class minMaxCondition Declaration
57\*---------------------------------------------------------------------------*/
60:
61 public runTimeCondition
62{
63public:
64
65 // Public enumerations
66
67 // Mode type
68 enum modeType
69 {
70 mdMin,
72 };
74 static const Enum<modeType> modeTypeNames_;
75
76
77protected:
78
79 // Protected data
80
81 //- Name of function object to retrueve data from
83
84 //- Mode
86
87 //- Field names
89
90 //- Value to compare
91 const scalar value_;
92
93 //- Helper function to retrieve the value from the state dictionary
94 template<class Type>
95 void setValue
96 (
97 const word& valueType,
98 const word& fieldName,
99 scalar& value
100 ) const;
101
102
103public:
104
105 //- Runtime type information
106 TypeName("minMax");
107
108 //- Constructor
110 (
111 const word& name,
112 const objectRegistry& obr,
113 const dictionary& dict,
115 );
116
117 //- Destructor
118 virtual ~minMaxCondition() = default;
119
120
121 // Public Member Functions
122
123 //- Apply the condition
124 virtual bool apply();
125
126 //- Write
127 virtual void write();
128
129 //- Reset
130 virtual void reset();
131};
132
133
134// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135template<>
137(
138 const word& valueType,
139 const word& fieldName,
140 scalar& value
141) const;
142
143} // End namespace runTimeControls
144} // End namespace functionObjects
145} // End namespace Foam
146
147// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148
149#ifdef NoRepository
151#endif
152
153// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154
155#endif
156
157// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
word functionObjectName_
Name of function object to retrueve data from.
void setValue(const word &valueType, const word &fieldName, scalar &value) const
Helper function to retrieve the value from the state dictionary.
virtual const word & name() const
Return the condition name.
Base class for function objects, adding functionality to read/write state information (data required ...
Registry of regIOobjects.
A class for handling words, derived from Foam::string.
Definition: word.H:68
void Foam::functionObjects::runTimeControls::minMaxCondition::setValue< Foam::scalar >(const word &valueType, const word &fieldName, scalar &value) const
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73