coordinateScaling.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) 2018-2020 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 Class
27  Foam::coordinateScaling
28 
29 Description
30  Helper class to wrap coordinate system and component-wise scaling
31 
32 See also
33  Foam::Function1Types
34 
35 SourceFiles
36  coordinateScaling.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef coordinateScaling_H
41 #define coordinateScaling_H
42 
43 #include "coordinateSystem.H"
44 #include "Function1.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class coordinateScaling Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class Type>
57 {
58  // Private Data
59 
60  //- Local coordinate system
61  const autoPtr<coordinateSystem> coordSys_;
62 
63  //- In local coordinate system component-wise scaling
65 
66  //- Cache whether any scaling or coordinate system
67  bool active_;
68 
69 
70  // Private Member Functions
71 
72  //- No copy assignment
73  void operator=(const coordinateScaling<Type>&) = delete;
74 
75 public:
76 
77  // Constructors
78 
79  //- Default construct
81 
82  //- Construct from registry and dictionary
84  (
85  const objectRegistry& obr,
86  const dictionary& dict
87  );
88 
89  //- Construct copy
91 
92 
93  //- Destructor
94  virtual ~coordinateScaling() = default;
95 
96 
97  // Member Functions
98 
99  //- Has any scaling or coordinate transformation
100  bool active() const
101  {
102  return active_;
103  }
104 
105  //- Access to optional coordinate system
106  const autoPtr<coordinateSystem>& coordSys() const
107  {
108  return coordSys_;
109  }
110 
111  //- Evaluate
112  virtual tmp<Field<Type>> transform
113  (
114  const pointField& pos,
115  const Field<Type>& local
116  ) const;
117 
118  //- Write dictionary entry
119  virtual void writeEntry(Ostream& os) const;
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 // Template specializations
126 template<>
127 tmp<Field<label>> coordinateScaling<label>::transform
128 (
129  const pointField& pos,
130  const Field<label>& local
131 ) const;
132 
133 } // End namespace Foam
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 #ifdef NoRepository
138  #include "coordinateScaling.C"
139 #endif
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::coordinateScaling::coordSys
const autoPtr< coordinateSystem > & coordSys() const
Access to optional coordinate system.
Definition: coordinateScaling.H:105
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Function1.H
Foam::coordinateScaling::transform
virtual tmp< Field< Type > > transform(const pointField &pos, const Field< Type > &local) const
Evaluate.
Definition: coordinateScaling.C:81
Foam::coordinateScaling
Helper class to wrap coordinate system and component-wise scaling.
Definition: coordinateScaling.H:55
coordinateSystem.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::coordinateScaling::active
bool active() const
Has any scaling or coordinate transformation.
Definition: coordinateScaling.H:99
Foam::Field< vector >
coordinateScaling.C
Foam::coordinateScaling::~coordinateScaling
virtual ~coordinateScaling()=default
Destructor.
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::coordinateScaling::coordinateScaling
coordinateScaling()
Default construct.
Definition: coordinateScaling.C:31
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::coordinateScaling::writeEntry
virtual void writeEntry(Ostream &os) const
Write dictionary entry.
Definition: coordinateScaling.C:126
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177