Loading...
Searching...
No Matches
volumeType.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) 2011-2014 OpenFOAM Foundation
9 Copyright (C) 2015-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::volumeType
29
30Description
31 An enumeration wrapper for classification of a location as being
32 inside/outside of a volume.
33
34SourceFiles
35 volumeType.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef Foam_volumeType_H
40#define Foam_volumeType_H
41
42#include "contiguous.H"
43#include "Enum.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50// Forward Declarations
51class volumeType;
54
56/*---------------------------------------------------------------------------*\
57 Class volumeType Declaration
58\*---------------------------------------------------------------------------*/
59
60class volumeType
61{
62public:
63
64 //- Volume classification types
65 enum type : char
66 {
67 UNKNOWN = 0,
68 INSIDE = 0x1,
69 OUTSIDE = 0x2,
70 MIXED = 0x3
71 };
72
73 // Static data
74
75 //- Names for the classification enumeration
76 static const Enum<volumeType::type> names;
77
78
79private:
80
81 // Private data
82
83 //- Volume type
84 type t_;
85
86
87public:
88
89 // Constructors
90
91 //- Default construct as \c UNKNOWN state
92 constexpr volumeType() noexcept
93 :
94 t_(UNKNOWN)
95 {}
96
97 //- Implicit construct from enumeration
99 :
100 t_(t)
101 {}
102
103 //- Construct as getOrDefault by name from dictionary
104 volumeType(const word& key, const dictionary& dict, const type deflt);
105
106 //- Construct from integer
107 explicit volumeType(const int t)
108 :
109 t_(static_cast<volumeType::type>(t & 0x3))
110 {}
111
112
113 // Member Functions
114
115 //- Implicit cast to the enumeration
116 operator type() const noexcept
117 {
118 return t_;
119 }
120
121 //- The string representation of the volume type enumeration
122 const word& str() const;
123
124
125 // IOstream Operators
126
128 friend Ostream& operator<<(Ostream& os, const volumeType& vt);
129};
130
131
132// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
133
134//- Contiguous data for volumeType
135template<> struct is_contiguous<volumeType> : std::true_type {};
136
137
138// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140} // End namespace Foam
142// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143
144#endif
145
146// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition volumeType.H:56
volumeType(const int t)
Construct from integer.
Definition volumeType.H:116
friend Ostream & operator<<(Ostream &os, const volumeType &vt)
friend Istream & operator>>(Istream &is, volumeType &vt)
const word & str() const
The string representation of the volume type enumeration.
Definition volumeType.C:55
static const Enum< volumeType::type > names
Names for the classification enumeration.
Definition volumeType.H:75
volumeType(type t) noexcept
Implicit construct from enumeration.
Definition volumeType.H:103
type
Volume classification types.
Definition volumeType.H:63
@ OUTSIDE
A location outside the volume.
Definition volumeType.H:66
@ MIXED
A location that is partly inside and outside.
Definition volumeType.H:67
@ UNKNOWN
Unknown state.
Definition volumeType.H:64
@ INSIDE
A location inside the volume.
Definition volumeType.H:65
constexpr volumeType() noexcept
Default construct as UNKNOWN state.
Definition volumeType.H:95
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
const direction noexcept
Definition scalarImpl.H:265
dictionary dict
A template class to specify that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70