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 volumeType_H
40#define volumeType_H
41
42#include "contiguous.H"
43#include "Enum.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50// Forward Declarations
51class dictionary;
52class volumeType;
53Istream& operator>>(Istream& is, volumeType& vt);
54Ostream& operator<<(Ostream& os, const volumeType& vt);
55
56
57/*---------------------------------------------------------------------------*\
58 Class volumeType Declaration
59\*---------------------------------------------------------------------------*/
61class volumeType
62{
63public:
64
65 //- Volume classification types
66 enum type : char
67 {
68 UNKNOWN = 0,
69 INSIDE = 0x1,
70 OUTSIDE = 0x2,
71 MIXED = 0x3
72 };
73
74 // Static data
75
76 //- Names for the classification enumeration
77 static const Enum<volumeType::type> names;
78
79
80private:
81
82 // Private data
83
84 //- Volume type
85 type t_;
86
87
88public:
89
90 // Constructors
91
92 //- Construct null as UNKNOWN state
94 :
95 t_(UNKNOWN)
96 {}
97
98 //- Construct from enumeration
100 :
101 t_(t)
102 {}
103
104 //- Construct as getOrDefault by name from dictionary
105 volumeType(const word& key, const dictionary& dict, const type deflt);
106
107 //- Construct from integer
108 explicit volumeType(const int t)
109 :
110 t_(static_cast<volumeType::type>(t))
111 {}
112
113
114 // Member Functions
115
116 //- Return the enumeration
117 operator type() const
118 {
119 return t_;
120 }
121
122 //- The string representation of the volume type enumeration
123 const word& str() const;
124
125
126 // IOstream operators
129 friend Ostream& operator<<(Ostream& os, const volumeType& vt);
130};
131
132
133// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
134
135//- Contiguous data for volumeType
136template<> struct is_contiguous<volumeType> : std::true_type {};
137
138
139// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140
141} // End namespace Foam
142
143// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144
145#endif
146
147// ************************************************************************* //
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
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition: volumeType.H:61
volumeType(const int t)
Construct from integer.
Definition: volumeType.H:107
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:62
static const Enum< volumeType::type > names
Names for the classification enumeration.
Definition: volumeType.H:76
volumeType()
Construct null as UNKNOWN state.
Definition: volumeType.H:92
type
Volume classification types.
Definition: volumeType.H:66
@ OUTSIDE
A location outside the volume.
Definition: volumeType.H:69
@ MIXED
A location that is partly inside and outside.
Definition: volumeType.H:70
@ UNKNOWN
Unknown state.
Definition: volumeType.H:67
@ INSIDE
A location inside the volume.
Definition: volumeType.H:68
volumeType(type t)
Construct from enumeration.
Definition: volumeType.H:98
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Istream & operator>>(Istream &, directionInfo &)
dictionary dict
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:78