Loading...
Searching...
No Matches
volumeType.C
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-2013 OpenFOAM Foundation
9 Copyright (C) 2018-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
27\*---------------------------------------------------------------------------*/
28
29#include "volumeType.H"
30#include "dictionary.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34const Foam::Enum
35<
37>
39({
40 { volumeType::type::UNKNOWN, "unknown" },
41 { volumeType::type::INSIDE, "inside" },
43 { volumeType::type::MIXED, "mixed" },
44});
45
46
47// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48
50(
51 const word& key,
52 const dictionary& dict,
53 const type deflt
54)
56 t_(names.getOrDefault(key, dict, deflt))
57{}
58
59
60// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
61
64 return names[t_];
65}
66
67
68// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
69
70Foam::Istream& Foam::operator>>(Istream& is, volumeType& vt)
71{
72 int val;
73 is >> val;
75 vt.t_ = static_cast<volumeType::type>(val);
76
77 return is;
78}
79
80
81Foam::Ostream& Foam::operator<<(Ostream& os, const volumeType& vt)
82{
84
85 return os;
86}
87
88
89// ************************************************************************* //
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
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
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
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)
auto & names
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
dictionary dict