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-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 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 "Istream.H"
41 #include "Ostream.H"
42 #include "dictionary.H"
43 #include "Enum.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declaration of friend functions and operators
51 
52 class orientedType;
53 
54 Istream& operator>>(Istream& is, orientedType& ot);
55 
56 Ostream& operator<<(Ostream& os, const orientedType& ot);
57 
58 /*---------------------------------------------------------------------------*\
59  Class orientedType Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class orientedType
63 {
64 public:
65 
66  // Public data types
67 
68  //- Enumeration defining the valid oriented flags
69  enum orientedOption
70  {
73  UNKNOWN
74  };
75 
77 
78 
79 private:
80 
81  // Private data
82 
83  //- Oriented flag
84  orientedOption oriented_;
85 
86 
87 public:
88 
89  // Constructors
90 
91  //- Null constructor - flag initialised to false
92  orientedType();
93 
94  //- Copy constructor
95  orientedType(const orientedType& ot);
96 
97  //- Construct from bool
98  orientedType(const bool oriented);
99 
100  //- Construct from Istream
101  orientedType(Istream& is);
102 
103 
104  // Member functions
105 
106  //- Return true if can operate on this pair of oriented types
107  static bool checkType
108  (
109  const orientedType& ot1,
110  const orientedType& ot2
111  );
112 
113  //- Return non-const reference to the oriented flag
115 
116  //- Return const reference to the oriented flag
117  orientedOption oriented() const;
118 
119  //- Set the oriented flag
120  void setOriented(const bool oriented = true);
121 
122  //- Read the oriented state from dictionary
123  void read(const dictionary& dict);
124 
125  //- Write the oriented flag entry
126  void writeEntry(Ostream& os) const;
127 
128 
129  // Member operators
130 
131  void operator=(const orientedType& ot);
132 
133  void operator+=(const orientedType& ot);
134  void operator-=(const orientedType& ot);
135  void operator*=(const orientedType& ot);
136  void operator/=(const orientedType& ot);
137  void operator*=(const scalar s);
138  void operator/=(const scalar s);
139  bool operator()() const;
140 
141 
142  // IOstream operators
143 
144  friend Istream& operator>>(Istream& is, orientedType& ot);
145 
146  friend Ostream& operator<<(Ostream& os, const orientedType& ot);
147 };
148 
149 
150 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
151 
152 orientedType max(const orientedType& ot1, const orientedType& ot2);
153 orientedType min(const orientedType& ot1, const orientedType& ot2);
154 orientedType cmptMultiply(const orientedType& ot1, const orientedType& ot2);
155 orientedType cmptDivide(const orientedType& ot1, const orientedType& ot);
156 orientedType cmptAv(const orientedType& ot);
157 
158 
159 orientedType pow(const orientedType& ot, const scalar r);
160 orientedType sqr(const orientedType& ot);
161 orientedType pow3(const orientedType& ot);
162 orientedType pow4(const orientedType& ot);
163 orientedType pow5(const orientedType& ot);
164 orientedType pow6(const orientedType& ot);
165 orientedType pow025(const orientedType& ot);
166 
167 
168 orientedType sqrt(const orientedType& ot);
169 orientedType cbrt(const orientedType& ot);
170 orientedType magSqr(const orientedType& ot);
171 orientedType mag(const orientedType& ot);
172 orientedType sign(const orientedType& ot);
173 orientedType pos(const orientedType& ot);
174 orientedType pos0(const orientedType& ot);
175 orientedType neg(const orientedType& ot);
176 orientedType neg0(const orientedType& ot);
179 orientedType inv(const orientedType& ot);
180 
181 
182 orientedType trans(const orientedType& ot);
183 orientedType atan2(const orientedType& ot1, const orientedType& ot2);
184 orientedType hypot(const orientedType& ot1, const orientedType& ot2);
186 
188 orientedType operator*(const scalar s, const orientedType& ot);
189 orientedType operator/(const orientedType& ot, const scalar s);
190 
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 orientedType operator*(const orientedType& ot1, const orientedType& ot2);
195 orientedType operator^(const orientedType& ot1, const orientedType& ot2);
196 orientedType operator&(const orientedType& ot1, const orientedType& ot2);
197 orientedType operator&&(const orientedType& ot1, const orientedType& ot2);
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
Foam::trans
dimensionSet trans(const dimensionSet &ds)
Check the argument is dimensionless (for transcendental functions)
Definition: dimensionSet.C:484
Foam::orientedType::operator*=
void operator*=(const orientedType &ot)
Definition: orientedType.C:175
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::operator&
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Foam::orientedType::oriented
orientedOption & oriented()
Return non-const reference to the oriented flag.
Definition: orientedType.C:89
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:45
Foam::operator-
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Foam::neg0
dimensionedScalar neg0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:210
Foam::orientedType::orientedType
orientedType()
Null constructor - flag initialised to false.
Definition: orientedType.C:61
Foam::orientedType::orientedOptionNames
static const Enum< orientedOption > orientedOptionNames
Definition: orientedType.H:75
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:519
Foam::orientedType::operator=
void operator=(const orientedType &ot)
Definition: orientedType.C:130
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::orientedType::setOriented
void setOriented(const bool oriented=true)
Set the oriented flag.
Definition: orientedType.C:101
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::orientedType::UNKNOWN
Definition: orientedType.H:72
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:71
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:70
Istream.H
Foam::orientedType::operator+=
void operator+=(const orientedType &ot)
Definition: orientedType.C:137
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
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::operator&&
dimensioned< typename scalarProduct< Type1, Type2 >::type > operator&&(const dimensioned< Type1 > &, const dimensioned< Type2 > &)
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::pow5
dimensionedScalar pow5(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:111
Foam::orientedType::operator()
bool operator()() const
Definition: orientedType.C:215
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::operator/
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
Definition: dimensionedScalar.C:68
Ostream.H
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::writeEntry
void writeEntry(Ostream &os) const
Write the oriented flag entry.
Definition: orientedType.C:119
Foam::orientedType::read
void read(const dictionary &dict)
Read the oriented state from dictionary.
Definition: orientedType.C:107
Foam::orientedType::operator>>
friend Istream & operator>>(Istream &is, orientedType &ot)
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::operator+
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::operator*
tmp< faMatrix< Type > > operator*(const areaScalarField &, const faMatrix< Type > &)
dictionary.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::operator^
bitSet operator^(const bitSet &a, const bitSet &b)
Bitwise-XOR of two bitsets to form a unique bit-set.
Definition: bitSetI.H:768
Foam::cbrt
dimensionedScalar cbrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:155
Foam::orientedType::operator-=
void operator-=(const orientedType &ot)
Definition: orientedType.C:156
Foam::orientedType::orientedOption
orientedOption
Enumeration defining the valid oriented flags.
Definition: orientedType.H:68
Foam::orientedType
Class to determine the 'oriented' status of surface fields.
Definition: orientedType.H:61
Foam::orientedType::operator<<
friend Ostream & operator<<(Ostream &os, const orientedType &ot)
Foam::neg
dimensionedScalar neg(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:199
Foam::orientedType::operator/=
void operator/=(const orientedType &ot)
Definition: orientedType.C:189
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177
Enum.H