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-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::orientedType
28
29Description
30 Class to determine the 'oriented' status of surface fields
31
32SourceFiles
33 orientedType.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef Foam_orientedType_H
38#define Foam_orientedType_H
39
40#include "Enum.H"
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44namespace Foam
45{
46
47// Forward Declarations
48class orientedType;
49
50Istream& operator>>(Istream& is, orientedType& ot);
51Ostream& operator<<(Ostream& os, const orientedType& ot);
52
53/*---------------------------------------------------------------------------*\
54 Class orientedType Declaration
55\*---------------------------------------------------------------------------*/
57class orientedType
58{
59public:
60
61 // Public Data Types
62
63 //- Enumeration defining oriented flags
64 enum orientedOption : unsigned char
65 {
67 ORIENTED = 1,
69 };
70
71 //- Named enumerations for oriented flags
73
74
75private:
76
77 // Private Data
78
79 //- Oriented type
80 orientedOption oriented_;
81
82
83public:
84
85 // Constructors
86
87 //- Default construct as \c UNKNOWN
89
90 //- Copy construct
92
93 //- Construct from bool
94 explicit orientedType(const bool isOriented) noexcept;
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
111
112 //- Return the oriented flag
114
115 //- Set the oriented flag: on/off
116 void setOriented(const bool on = true) noexcept;
117
118 //- Read the "oriented" state from dictionary
119 void read(const dictionary& dict);
120
121 //- Write the "oriented" flag entry (if \c ORIENTED)
122 // \return True if entry was written
123 bool writeEntry(Ostream& os) const;
124
125
126 // Member Operators
127
128 //- True if type is \c ORIENTED
129 explicit operator bool() const noexcept
130 {
131 return (oriented_ == orientedOption::ORIENTED);
132 }
133
134 void operator=(const orientedType& ot);
135
136 void operator+=(const orientedType& ot);
137 void operator-=(const orientedType& ot);
138 void operator*=(const orientedType& ot);
139 void operator/=(const orientedType& ot);
140 void operator*=(const scalar s);
141 void operator/=(const scalar s);
142
143 //- True if type is \c ORIENTED. Same as bool operator
144 bool operator()() const noexcept;
145
146
147 // IOstream Operators
149 friend Istream& operator>>(Istream& is, orientedType& ot);
150 friend Ostream& operator<<(Ostream& os, const orientedType& ot);
151};
152
153
154// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
155
156orientedType max(const orientedType& ot1, const orientedType& ot2);
157orientedType min(const orientedType& ot1, const orientedType& ot2);
158orientedType cmptMultiply(const orientedType& ot1, const orientedType& ot2);
159orientedType cmptDivide(const orientedType& ot1, const orientedType& ot);
161
162
163orientedType pow(const orientedType& ot, const scalar r);
164orientedType sqr(const orientedType& ot);
170
171
175orientedType mag(const orientedType& ot);
177orientedType pos(const orientedType& ot);
179orientedType neg(const orientedType& ot);
183orientedType inv(const orientedType& ot);
184
185
187orientedType atan2(const orientedType& ot1, const orientedType& ot2);
188orientedType hypot(const orientedType& ot1, const orientedType& ot2);
190
191orientedType operator-(const orientedType& ot);
192orientedType operator*(const scalar s, const orientedType& ot);
193orientedType operator/(const orientedType& ot, const scalar s);
194
195orientedType operator+(const orientedType& ot1, const orientedType& ot2);
196orientedType operator-(const orientedType& ot1, const orientedType& ot2);
197orientedType operator/(const orientedType& ot1, const orientedType& ot2);
198orientedType operator*(const orientedType& ot1, const orientedType& ot2);
199orientedType operator^(const orientedType& ot1, const orientedType& ot2);
200orientedType operator&(const orientedType& ot1, const orientedType& ot2);
201orientedType operator&&(const orientedType& ot1, const orientedType& ot2);
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204
205} // End namespace Foam
206
207// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208
209#endif
210
211// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Class to determine the 'oriented' status of surface fields.
Definition: orientedType.H:57
void operator/=(const orientedType &ot)
Definition: orientedType.C:198
orientedType() noexcept
Default construct as UNKNOWN.
Definition: orientedType.C:66
void operator*=(const orientedType &ot)
Definition: orientedType.C:184
void read(const dictionary &dict)
Read the "oriented" state from dictionary.
Definition: orientedType.C:112
orientedOption
Enumeration defining oriented flags.
Definition: orientedType.H:64
void operator-=(const orientedType &ot)
Definition: orientedType.C:165
void operator=(const orientedType &ot)
Definition: orientedType.C:139
orientedOption & oriented() noexcept
Return non-const reference to the oriented flag.
Definition: orientedType.C:94
bool operator()() const noexcept
True if type is ORIENTED. Same as bool operator.
Definition: orientedType.C:224
bool writeEntry(Ostream &os) const
Write the "oriented" flag entry (if ORIENTED)
Definition: orientedType.C:124
void setOriented(const bool on=true) noexcept
Set the oriented flag: on/off.
Definition: orientedType.C:106
static const Enum< orientedOption > orientedOptionNames
Named enumerations for oriented flags.
Definition: orientedType.H:71
void operator+=(const orientedType &ot)
Definition: orientedType.C:146
static bool checkType(const orientedType &ot1, const orientedType &ot2)
Return true if can operate on this pair of oriented types.
Definition: orientedType.C:50
OBJstream os(runTime.globalPath()/outputName)
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))
Namespace for OpenFOAM.
dimensionedScalar pow6(const dimensionedScalar &ds)
dimensionedScalar pos(const dimensionedScalar &ds)
dimensionedScalar pow5(const dimensionedScalar &ds)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
dimensionedScalar pos0(const dimensionedScalar &ds)
dimensionedScalar sign(const dimensionedScalar &ds)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar pow3(const dimensionedScalar &ds)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
dimensionedScalar negPart(const dimensionedScalar &ds)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Istream & operator>>(Istream &, directionInfo &)
dimensionedScalar hypot(const dimensionedScalar &x, const dimensionedScalar &y)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
dimensionedScalar pow4(const dimensionedScalar &ds)
dimensionSet trans(const dimensionSet &ds)
Check the argument is dimensionless (for transcendental functions)
Definition: dimensionSet.C:486
dimensionedScalar neg(const dimensionedScalar &ds)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
const direction noexcept
Definition: Scalar.H:223
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
dimensionedScalar neg0(const dimensionedScalar &ds)
dimensionedScalar cbrt(const dimensionedScalar &ds)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh > > cmptAv(const DimensionedField< Type, GeoMesh > &df)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensionedScalar posPart(const dimensionedScalar &ds)
dimensionedScalar pow025(const dimensionedScalar &ds)
dictionary dict