orientedType.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) 2017-2021 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::orientedType
28 
29 Description
30  Class to determine the 'oriented' status of surface fields
31 
32 SourceFiles
33  orientedType.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef orientedType_H
38 #define orientedType_H
39 
40 #include "Enum.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward Declarations
48 class orientedType;
49 
50 Istream& operator>>(Istream& is, orientedType& ot);
51 Ostream& operator<<(Ostream& os, const orientedType& ot);
52 
53 /*---------------------------------------------------------------------------*\
54  Class orientedType Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class orientedType
58 {
59 public:
60 
61  // Public Data Types
62 
63  //- Enumeration defining oriented flags
64  enum orientedOption
65  {
66  UNKNOWN = 0,
67  ORIENTED = 1,
68  UNORIENTED = 2
69  };
70 
71  //- Named enumerations for oriented flags
73 
74 
75 private:
76 
77  // Private Data
78 
79  //- Oriented type
80  orientedOption oriented_;
81 
82 
83 public:
84 
85  // Constructors
86 
87  //- Default construct as "UNKNOWN"
88  orientedType();
89 
90  //- Copy construct
91  orientedType(const orientedType& ot);
92 
93  //- Construct from bool
94  explicit orientedType(const bool oriented);
95 
96  //- Construct from Istream
97  explicit orientedType(Istream& is);
98 
99 
100  // Member Functions
101 
102  //- Return true if can operate on this pair of oriented types
103  static bool checkType
104  (
105  const orientedType& ot1,
106  const orientedType& ot2
107  );
108 
109  //- Return non-const reference to the oriented flag
110  orientedOption& oriented() noexcept;
111 
112  //- Return the oriented flag
113  orientedOption oriented() const noexcept;
114 
115  //- Set the oriented flag
116  void setOriented(const bool oriented = true) noexcept;
117 
118  //- Read the "oriented" state from dictionary
119  void read(const dictionary& dict);
120 
121  //- Write the "oriented" flag entry (if ORIENTED)
122  // \return True if entry was written
123  bool writeEntry(Ostream& os) const;
124 
125 
126  // Member Operators
127 
128  void operator=(const orientedType& ot);
129 
130  void operator+=(const orientedType& ot);
131  void operator-=(const orientedType& ot);
132  void operator*=(const orientedType& ot);
133  void operator/=(const orientedType& ot);
134  void operator*=(const scalar s);
135  void operator/=(const scalar s);
136  bool operator()() const;
137 
138 
139  // IOstream Operators
140 
141  friend Istream& operator>>(Istream& is, orientedType& ot);
142  friend Ostream& operator<<(Ostream& os, const orientedType& ot);
143 };
144 
145 
146 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
147 
148 orientedType max(const orientedType& ot1, const orientedType& ot2);
149 orientedType min(const orientedType& ot1, const orientedType& ot2);
150 orientedType cmptMultiply(const orientedType& ot1, const orientedType& ot2);
151 orientedType cmptDivide(const orientedType& ot1, const orientedType& ot);
152 orientedType cmptAv(const orientedType& ot);
153 
154 
155 orientedType pow(const orientedType& ot, const scalar r);
156 orientedType sqr(const orientedType& ot);
157 orientedType pow3(const orientedType& ot);
158 orientedType pow4(const orientedType& ot);
159 orientedType pow5(const orientedType& ot);
160 orientedType pow6(const orientedType& ot);
161 orientedType pow025(const orientedType& ot);
162 
163 
164 orientedType sqrt(const orientedType& ot);
165 orientedType cbrt(const orientedType& ot);
166 orientedType magSqr(const orientedType& ot);
167 orientedType mag(const orientedType& ot);
168 orientedType sign(const orientedType& ot);
169 orientedType pos(const orientedType& ot);
170 orientedType pos0(const orientedType& ot);
171 orientedType neg(const orientedType& ot);
172 orientedType neg0(const orientedType& ot);
175 orientedType inv(const orientedType& ot);
176 
177 
178 orientedType trans(const orientedType& ot);
179 orientedType atan2(const orientedType& ot1, const orientedType& ot2);
180 orientedType hypot(const orientedType& ot1, const orientedType& ot2);
182 
183 orientedType operator-(const orientedType& ot);
184 orientedType operator*(const scalar s, const orientedType& ot);
185 orientedType operator/(const orientedType& ot, const scalar s);
186 
187 orientedType operator+(const orientedType& ot1, const orientedType& ot2);
188 orientedType operator-(const orientedType& ot1, const orientedType& ot2);
189 orientedType operator/(const orientedType& ot1, const orientedType& ot2);
190 orientedType operator*(const orientedType& ot1, const orientedType& ot2);
191 orientedType operator^(const orientedType& ot1, const orientedType& ot2);
192 orientedType operator&(const orientedType& ot1, const orientedType& ot2);
193 orientedType operator&&(const orientedType& ot1, const orientedType& ot2);
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 } // End namespace Foam
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************************************************************* //
Foam::trans
dimensionSet trans(const dimensionSet &ds)
Check the argument is dimensionless (for transcendental functions)
Definition: dimensionSet.C:486
Foam::Enum< orientedOption >
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputSpray.H:25
Foam::cmptMultiply
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::posPart
dimensionedScalar posPart(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:221
Foam::atan2
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
Definition: dimensionedScalar.C:312
Foam::orientedType::checkType
static bool checkType(const orientedType &ot1, const orientedType &ot2)
Return true if can operate on this pair of oriented types.
Definition: orientedType.C:50
Foam::neg0
dimensionedScalar neg0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:210
Foam::orientedType::orientedType
orientedType()
Default construct as "UNKNOWN".
Definition: orientedType.C:66
Foam::orientedType::orientedOptionNames
static const Enum< orientedOption > orientedOptionNames
Named enumerations for oriented flags.
Definition: orientedType.H:71
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::pos0
dimensionedScalar pos0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:188
Foam::sign
dimensionedScalar sign(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:166
Foam::transform
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
Foam::orientedType::writeEntry
bool writeEntry(Ostream &os) const
Write the "oriented" flag entry (if ORIENTED)
Definition: orientedType.C:124
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::orientedType::UNKNOWN
Definition: orientedType.H:65
Foam::pow025
dimensionedScalar pow025(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:133
Foam::hypot
dimensionedScalar hypot(const dimensionedScalar &x, const dimensionedScalar &y)
Definition: dimensionedScalar.C:327
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::pow4
dimensionedScalar pow4(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:100
Foam::pow6
dimensionedScalar pow6(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:122
Foam::orientedType::UNORIENTED
Definition: orientedType.H:67
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::pow3
dimensionedScalar pow3(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:89
Foam::inv
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:73
Foam::cmptAv
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:246
Foam::orientedType::ORIENTED
Definition: orientedType.H:66
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::orientedType::oriented
orientedOption & oriented() noexcept
Return non-const reference to the oriented flag.
Definition: orientedType.C:94
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
Foam::pow5
dimensionedScalar pow5(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:111
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cmptDivide
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::negPart
dimensionedScalar negPart(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:232
Foam::orientedType::read
void read(const dictionary &dict)
Read the "oriented" state from dictionary.
Definition: orientedType.C:112
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::cbrt
dimensionedScalar cbrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:155
Foam::orientedType::orientedOption
orientedOption
Enumeration defining oriented flags.
Definition: orientedType.H:63
Foam::orientedType
Class to determine the 'oriented' status of surface fields.
Definition: orientedType.H:56
Foam::neg
dimensionedScalar neg(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:199
Foam::orientedType::setOriented
void setOriented(const bool oriented=true) noexcept
Set the oriented flag.
Definition: orientedType.C:106
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177
Enum.H