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 -------------------------------------------------------------------------------
10 License
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 
39 inline 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");
53  is.check(FUNCTION_NAME);
54 }
55 
56 
57 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
58 
59 Foam::label& Foam::objectMap::index()
60 {
61  return index_;
62 }
63 
64 
65 inline 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 
85 inline 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 
94 inline 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_
107  << token::END_LIST;
108 
110  return os;
111 }
112 
113 
115 {
116  is.readBegin("objectMap");
117  is >> a.index_ >> a.masterObjects_;
118  is.readEnd("objectMap");
119 
120  is.check(FUNCTION_NAME);
121  return is;
122 }
123 
124 
125 // ************************************************************************* //
IOstreams.H
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::objectMap::masterObjects
labelList & masterObjects()
Return master object index.
Definition: objectMapI.H:71
Foam::Istream::readEnd
bool readEnd(const char *funcName)
End read of data chunk, ends with ')'.
Definition: Istream.C:129
Foam::Istream::readBegin
bool readBegin(const char *funcName)
Begin read of data chunk, starts with '('.
Definition: Istream.C:111
Foam::operator!=
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:239
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::objectMap::index
label & index()
Return object index.
Definition: objectMapI.H:59
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::objectMap::objectMap
objectMap()
Null constructor, with index=-1 and no objects.
Definition: objectMapI.H:32
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:58
Foam::objectMap
An objectMap is a pair of labels defining the mapping of an object from another object,...
Definition: objectMap.H:60
os
OBJstream os(runTime.globalPath()/outputName)
Foam::List< label >
Foam::token::SPACE
Space [isspace].
Definition: token.H:125
Foam::UList< label >
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:295
Foam::token::END_LIST
End list [isseparator].
Definition: token.H:156
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::token::BEGIN_LIST
Begin list [isseparator].
Definition: token.H:155