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-2022 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 Foam_coordinateScaling_H
41 #define Foam_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  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 noexcept
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  //- Convert to local coordinates,
112  //- pass-through if no coordinate system is active
113  tmp<pointField> localPosition(const pointField& globalPos) const;
114 
115  //- Evaluate
116  virtual tmp<Field<Type>> transform
117  (
118  const pointField& pos,
119  const Field<Type>& local
120  ) const;
122  //- Write dictionary entry
123  virtual void writeEntry(Ostream& os) const;
124 };
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 // Template specializations
130 template<>
132 (
133  const pointField& pos,
134  const Field<label>& local
135 ) const;
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #ifdef NoRepository
142  #include "coordinateScaling.C"
143 #endif
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #endif
148 
149 // ************************************************************************* //
dictionary dict
tmp< pointField > localPosition(const pointField &globalPos) const
Convert to local coordinates, pass-through if no coordinate system is active.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
dimensionedScalar pos(const dimensionedScalar &ds)
coordinateScaling()
Default construct.
bool local
Definition: EEqn.H:20
const autoPtr< coordinateSystem > & coordSys() const
Access to optional coordinate system.
virtual ~coordinateScaling()=default
Destructor.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: Scalar.H:258
bool active() const noexcept
Has any scaling or coordinate transformation.
OBJstream os(runTime.globalPath()/outputName)
Helper class to wrap coordinate system and component-wise scaling.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Registry of regIOobjects.
virtual tmp< Field< Type > > transform(const pointField &pos, const Field< Type > &local) const
Evaluate.
virtual void writeEntry(Ostream &os) const
Write dictionary entry.
Namespace for OpenFOAM.