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 -------------------------------------------------------------------------------
10 License
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 
26 Typedef
27  Foam::dimensionedScalarMinMax
28 
29 Description
30  A dimensioned scalarMinMix (MinMax for scalar quantities).
31 
32 Typedef
33  Foam::dimensionedMinMax<T>
34 
35 Description
36  A templated type alias for dimensioned<MinMax<T>>
37 
38 SourceFiles
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 
51 namespace Foam
52 {
53 
54 // General alias
55 template<class T>
57 
58 // Common typedefs
60 
61 
62 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
63 
64 //- Make a dimensionedMinMax from all components
65 template<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"
79 template<class T>
80 inline dimensioned<MinMax<T>> makeDimensionedMinMax
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
95 template<class T>
96 inline dimensioned<MinMax<T>> makeDimensionedMinMax
97 (
98  const word& name,
99  const dimensioned<T>& minVal,
100  const dimensioned<T>& maxVal
101 )
102 {
103  // Dimension check when dimensionSet::checking()
104  return dimensioned<MinMax<T>>
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"
114 template<class T>
115 inline dimensioned<MinMax<T>> makeDimensionedMinMax
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
143 template<class T>
144 dimensioned<MinMax<T>> makeDimensionedMinMax
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 // ************************************************************************* //
Foam::dimensionedScalarMinMax
dimensioned< scalarMinMax > dimensionedScalarMinMax
A dimensioned scalarMinMix (MinMax for scalar quantities).
Definition: dimensionedMinMax.H:59
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::HashTableOps::values
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:149
MinMax.H
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:434
Foam::dimensionSet
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:108
dimensionedMinMaxTemplates.C
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::makeDimensionedMinMax
dimensioned< MinMax< T > > makeDimensionedMinMax(const word &name, const dimensionSet &dims, const T &minVal, const T &maxVal)
Make a dimensionedMinMax from all components.
Definition: dimensionedMinMax.H:67
Foam::dimensioned::dimensions
const dimensionSet & dimensions() const
Return const reference to dimensions.
Definition: dimensionedType.C:420
Foam::MinMax
A min/max value pair with additional methods. In addition to conveniently storing values,...
Definition: HashSet.H:76
dimensionedType.H