dimensionedMinMaxTemplates.C
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 \*---------------------------------------------------------------------------*/
27 
28 #include "dimensionedMinMax.H"
29 #include "dictionary.H"
30 
31 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
32 
33 
34 template<class T>
36 (
37  const word& name,
38  const dimensionSet& dims,
39  const MinMax<T>& values,
40  const dictionary& dict,
41  const word& minName,
42  const word& maxName
43 )
44 {
45  // Normal construction with optional entry
46 
47  dimensioned<MinMax<T>> range(name, dims, values, dict);
48 
49  // Optional min specification
50  if (!minName.empty())
51  {
52  dimensioned<T> minVal(minName, dims, values.min(), dict);
53  range.dimensions() += minVal.dimensions();
54  range.value().min() = minVal.value();
55  }
56 
57  // Optional max specification
58  if (!maxName.empty())
59  {
60  dimensioned<T> maxVal(maxName, dims, values.max(), dict);
61  range.dimensions() += maxVal.dimensions();
62  range.value().max() = maxVal.value();
63  }
64 
65  return range;
66 }
67 
68 
69 // ************************************************************************* //
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
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
dimensionedMinMax.H
range
scalar range
Definition: LISASMDCalcMethod1.H:12
dictionary.H
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