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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::volumeType
29 
30 Description
31  An enumeration wrapper for classification of a location as being
32  inside/outside of a volume.
33 
34 SourceFiles
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 
47 namespace Foam
48 {
49 
50 // Forward Declarations
51 class dictionary;
52 class volumeType;
53 Istream& operator>>(Istream& is, volumeType& vt);
54 Ostream& operator<<(Ostream& os, const volumeType& vt);
55 
56 
57 /*---------------------------------------------------------------------------*\
58  Class volumeType Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class volumeType
62 {
63 public:
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 
80 private:
81 
82  // Private data
83 
84  //- Volume type
85  type t_;
86 
87 
88 public:
89 
90  // Constructors
91 
92  //- Construct null as UNKNOWN state
93  volumeType()
94  :
95  t_(UNKNOWN)
96  {}
97 
98  //- Construct from enumeration
99  volumeType(type t)
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
127 
128  friend Istream& operator>>(Istream& is, volumeType& vt);
129  friend Ostream& operator<<(Ostream& os, const volumeType& vt);
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
134 
135 //- Contiguous data for volumeType
136 template<> struct is_contiguous<volumeType> : std::true_type {};
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace Foam
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
Foam::Enum< volumeType::type >
Foam::volumeType::type
type
Volume classification types.
Definition: volumeType.H:65
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::volumeType::volumeType
volumeType(const int t)
Construct from integer.
Definition: volumeType.H:107
Foam::volumeType::operator>>
friend Istream & operator>>(Istream &is, volumeType &vt)
Foam::glTF::key
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Definition: foamGltfBase.H:108
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::volumeType::operator<<
friend Ostream & operator<<(Ostream &os, const volumeType &vt)
Foam::volumeType
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition: volumeType.H:60
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::volumeType::UNKNOWN
Unknown state.
Definition: volumeType.H:67
Foam::volumeType::names
static const Enum< volumeType::type > names
Names for the classification enumeration.
Definition: volumeType.H:76
Foam::volumeType::MIXED
A location that is partly inside and outside.
Definition: volumeType.H:70
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
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::volumeType::str
const word & str() const
The string representation of the volume type enumeration.
Definition: volumeType.C:62
contiguous.H
Foam::volumeType::INSIDE
A location inside the volume.
Definition: volumeType.H:68
Foam::volumeType::volumeType
volumeType()
Construct null as UNKNOWN state.
Definition: volumeType.H:92
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::volumeType::volumeType
volumeType(type t)
Construct from enumeration.
Definition: volumeType.H:98
Foam::volumeType::OUTSIDE
A location outside the volume.
Definition: volumeType.H:69
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
Enum.H