Transferred copyright to the OpenFOAM Foundation
[OpenFOAM-2.0.x.git] / src / surfMesh / surfZone / surfZone / surfZone.C
bloba4370eb1222436f761363bff5e223a463f4d7746
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "surfZone.H"
27 #include "dictionary.H"
28 #include "word.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 defineTypeNameAndDebug(Foam::surfZone, 0);
35 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
37 Foam::surfZone::surfZone()
39     surfZoneIdentifier(),
40     size_(0),
41     start_(0)
45 Foam::surfZone::surfZone
47     const word& name,
48     const label size,
49     const label start,
50     const label index,
51     const word& geometricType
54     surfZoneIdentifier(name, index, geometricType),
55     size_(size),
56     start_(start)
60 Foam::surfZone::surfZone(Istream& is, const label index)
62     surfZoneIdentifier(),
63     size_(0),
64     start_(0)
66     word name(is);
67     dictionary dict(is);
69     operator=(surfZone(name, dict, index));
73 Foam::surfZone::surfZone
75     const word& name,
76     const dictionary& dict,
77     const label index
80     surfZoneIdentifier(name, dict, index),
81     size_(readLabel(dict.lookup("nFaces"))),
82     start_(readLabel(dict.lookup("startFace")))
86 Foam::surfZone::surfZone(const surfZone& zone)
88     surfZoneIdentifier(zone, zone.index()),
89     size_(zone.size()),
90     start_(zone.start())
94 Foam::surfZone::surfZone(const surfZone& zone, const label index)
96     surfZoneIdentifier(zone, index),
97     size_(zone.size()),
98     start_(zone.start())
102 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
104 void Foam::surfZone::write(Ostream& os) const
106     writeDict(os);
110 void Foam::surfZone::writeDict(Ostream& os) const
112     os  << indent << name() << nl
113         << indent << token::BEGIN_BLOCK << incrIndent << nl;
115     surfZoneIdentifier::write(os);
116     os.writeKeyword("nFaces") << size() << token::END_STATEMENT << nl;
117     os.writeKeyword("startFace") << start() << token::END_STATEMENT << nl;
119     os  << decrIndent << indent << token::END_BLOCK << endl;
123 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
125 bool Foam::surfZone::operator!=(const surfZone& rhs) const
127     return !(*this == rhs);
131 bool Foam::surfZone::operator==(const surfZone& rhs) const
133     return
134     (
135         size() == rhs.size()
136      && start() == rhs.start()
137      && geometricType() == rhs.geometricType()
138     );
142 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
144 Foam::Istream& Foam::operator>>(Istream& is, surfZone& zone)
146     zone = surfZone(is, 0);
148     is.check("Istream& operator>>(Istream&, surfZone&)");
149     return is;
153 Foam::Ostream& Foam::operator<<(Ostream& os, const surfZone& zone)
155     zone.write(os);
156     os.check("Ostream& operator<<(Ostream&, const surfZone&");
157     return os;
161 // ************************************************************************* //