objectMapI.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 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "IOstreams.H"
29
30// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31
33:
34 index_(-1),
35 masterObjects_()
36{}
37
38
39inline Foam::objectMap::objectMap(const label index, const UList<label>& master)
40:
41 index_(index),
42 masterObjects_(master)
43{}
44
45
47{
48 is.readBegin("objectMap");
49
50 is >> index_ >> static_cast<labelList&>(masterObjects_);
51
52 is.readEnd("objectMap");
54}
55
56
57// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
58
60{
61 return index_;
62}
63
64
65inline Foam::label Foam::objectMap::index() const
66{
67 return index_;
68}
69
70
72{
73 return masterObjects_;
74}
75
76
78{
79 return masterObjects_;
80}
81
82
83// * * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * //
84
85inline bool Foam::operator==(const objectMap& a, const objectMap& b)
86{
87 return
88 (
89 (a.index_ == b.index_) && (a.masterObjects_ == b.masterObjects_)
90 );
91}
92
93
94inline bool Foam::operator!=(const objectMap& a, const objectMap& b)
95{
96 return !(a == b);
97}
98
99
100// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
101
103{
105 << a.index_ << token::SPACE
106 << a.masterObjects_
108
110 return os;
111}
112
113
115{
116 is.readBegin("objectMap");
117 is >> a.index_ >> a.masterObjects_;
118 is.readEnd("objectMap");
119
121 return is;
122}
123
124
125// ************************************************************************* //
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:58
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
bool readEnd(const char *funcName)
End read of data chunk, ends with ')'.
Definition: Istream.C:129
bool readBegin(const char *funcName)
Begin read of data chunk, starts with '('.
Definition: Istream.C:111
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
An objectMap is a pair of labels defining the mapping of an object from another object,...
Definition: objectMap.H:61
label & index()
Return object index.
Definition: objectMapI.H:59
labelList & masterObjects()
Return master object index.
Definition: objectMapI.H:71
objectMap()
Null constructor, with index=-1 and no objects.
Definition: objectMapI.H:32
@ BEGIN_LIST
Begin list [isseparator].
Definition: token.H:155
@ END_LIST
End list [isseparator].
Definition: token.H:156
@ SPACE
Space [isspace].
Definition: token.H:125
OBJstream os(runTime.globalPath()/outputName)
#define FUNCTION_NAME
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:239
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Istream & operator>>(Istream &, directionInfo &)
volScalarField & b
Definition: createFields.H:27