dimensionedMinMax.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) 2019 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Typedef
27 Foam::dimensionedScalarMinMax
28
29Description
30 A dimensioned scalarMinMix (MinMax for scalar quantities).
31
32Typedef
33 Foam::dimensionedMinMax<T>
34
35Description
36 A templated type alias for dimensioned<MinMax<T>>
37
38SourceFiles
39 dimensionedMinMaxTemplates.C
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef dimensionedMinMax_H
44#define dimensionedMinMax_H
45
46#include "dimensionedType.H"
47#include "MinMax.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54// General alias
55template<class T>
57
58// Common typedefs
60
61
62// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
63
64//- Make a dimensionedMinMax from all components
65template<class T>
67(
68 const word& name,
69 const dimensionSet& dims,
70 const T& minVal,
71 const T& maxVal
72)
73{
74 return dimensioned<MinMax<T>>(name, dims, MinMax<T>(minVal, maxVal));
75}
76
77
78//- Create a dimensionless "minmax"
79template<class T>
81(
82 const T& minVal,
83 const T& maxVal
84)
85{
86 return
88 (
89 "minmax", dimensionSet(), MinMax<T>(minVal, maxVal)
90 );
91}
92
93
94//- Combine two dimensioned types into a dimensionedMinMax with specified name
95template<class T>
97(
98 const word& name,
99 const dimensioned<T>& minVal,
100 const dimensioned<T>& maxVal
101)
102{
103 // Dimension check when dimensionSet::checking()
105 (
106 name,
107 (minVal.dimensions() + maxVal.dimensions()),
108 MinMax<T>(minVal.value(), maxVal.value())
109 );
110}
111
112
113//- Combine two dimensioned types into a dimensionedMinMax "minmax"
114template<class T>
116(
117 const dimensioned<T>& minVal,
118 const dimensioned<T>& maxVal
119)
120{
121 return makeDimensionedMinMax("minmax", minVal, maxVal);
122}
123
124
125//- Construct from components (name, dimensions, value) with an optional
126//- dictionary override that can also \e zip together different sub-entries.
127//
128// The dictionary override can specify separate min/max dictionary entries.
129// For example,
130// \verbatim
131// rhoMin 0.3;
132// rhoMax 2.0;
133// \endverbatim
134//
135// Construct as following:
136//
137// \verbatim
138// makeDimensionedMinMax<scalar>
139// (
140// "rhoMinMax", dimDensity, {Zero, GREAT}, dict, "rhoMin", "rhoMax"
141// );
142// \endverbatim
143template<class T>
145(
146 const word& name,
147 const dimensionSet& dims,
148 const MinMax<T>& values,
149 const dictionary& dict,
150 const word& minName,
151 const word& maxName
152);
153
154
155// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156
157} // End namespace Foam
158
159// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160
161#ifdef NoRepository
163#endif
164
165// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166
167#endif
168
169// ************************************************************************* //
A min/max value pair with additional methods. In addition to conveniently storing values,...
Definition: MinMax.H:128
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:109
Generic dimensioned Type class.
const dimensionSet & dimensions() const
Return const reference to dimensions.
const Type & value() const
Return const reference to value.
A class for handling words, derived from Foam::string.
Definition: word.H:68
const volScalarField & T
Namespace for OpenFOAM.
dimensioned< scalarMinMax > dimensionedScalarMinMax
A dimensioned scalarMinMix (MinMax for scalar quantities).
dimensioned< MinMax< T > > makeDimensionedMinMax(const word &name, const dimensionSet &dims, const T &minVal, const T &maxVal)
Make a dimensionedMinMax from all components.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
dictionary dict