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" },
42 { volumeType::type::OUTSIDE, "outside" },
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)
55:
56 t_(names.getOrDefault(key, dict, deflt))
57{}
58
59
60// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
61
63{
64 return names[t_];
65}
66
67
68// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
69
71{
72 int val;
73 is >> val;
74
75 vt.t_ = static_cast<volumeType::type>(val);
76
77 return is;
78}
79
80
82{
83 os << static_cast<int>(vt.t_);
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: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
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
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Istream & operator>>(Istream &, directionInfo &)
dictionary dict