Scale2.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "Scale2.H"
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 template<class Type>
31 void Foam::Function2s::Scale<Type>::read(const dictionary& dict)
32 {
33  scale_ = Function2<scalar>::New("scale", dict);
34  xScale_ =
35  dict.found("xScale")
36  ? Function1<scalar>::New("xScale", dict)
37  : autoPtr<Function1<scalar>>
38  (
39  new Function1s::Constant<scalar>("xScale", 1)
40  );
41  yScale_ =
42  dict.found("yScale")
43  ? Function1<scalar>::New("yScale", dict)
44  : autoPtr<Function1<scalar>>
45  (
46  new Function1s::Constant<scalar>("yScale", 1)
47  );
48  value_ = Function2<Type>::New("value", dict);
49 }
50 
51 
52 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
53 
54 template<class Type>
56 (
57  const word& name,
58  const dictionary& dict
59 )
60 :
61  FieldFunction2<Type, Scale<Type>>(name)
62 {
63  read(dict);
64 }
65 
66 
67 template<class Type>
69 :
70  FieldFunction2<Type, Scale<Type>>(se),
71  scale_(se.scale_, false),
72  xScale_(se.xScale_, false),
73  yScale_(se.yScale_, false),
74  value_(se.value_, false)
75 {}
76 
77 
78 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
79 
80 template<class Type>
82 {}
83 
84 
85 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
86 
87 template<class Type>
89 {
90  writeEntry(os, scale_());
91  writeEntry(os, xScale_());
92  writeEntry(os, yScale_());
93  writeEntry(os, value_());
94 }
95 
96 
97 // ************************************************************************* //
Function2 which scales a given 'value' function by a 'scale' scalar function and scales the 'x' and '...
Definition: Scale2.H:61
Scale(const word &name, const dictionary &dict)
Construct from name and dictionary.
Definition: Scale2.C:56
virtual void write(Ostream &os) const
Write data to dictionary stream.
Definition: Scale2.C:88
virtual ~Scale()
Destructor.
Definition: Scale2.C:81
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A class for handling words, derived from string.
Definition: word.H:62
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
dictionary dict