1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 \*---------------------------------------------------------------------------*/
29 #include "surfacePatch.H"
30 #include "dictionary.H"
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(Foam::surfacePatch, 0);
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 Foam::surfacePatch::surfacePatch()
44 geometricSurfacePatch("", "", -1),
51 // Construct from components
52 Foam::surfacePatch::surfacePatch
54 const word& geometricType,
61 geometricSurfacePatch(geometricType, name, index),
67 // Construct from Istream
68 Foam::surfacePatch::surfacePatch(Istream& is, const label index)
70 geometricSurfacePatch(is, index),
74 size_ = readLabel(is);
75 start_ = readLabel(is);
78 // Construct from dictionary
79 Foam::surfacePatch::surfacePatch
82 const dictionary& dict,
86 geometricSurfacePatch(name, dict, index),
87 size_(readLabel(dict.lookup("nFaces"))),
88 start_(readLabel(dict.lookup("startFace")))
93 Foam::surfacePatch::surfacePatch(const Foam::surfacePatch& sp)
95 geometricSurfacePatch(sp),
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
103 void Foam::surfacePatch::write(Ostream& os) const
106 << static_cast<const geometricSurfacePatch&>(*this) << endl
107 << size() << tab << start();
110 void Foam::surfacePatch::writeDict(Ostream& os) const
112 os << nl << name() << nl << token::BEGIN_BLOCK << nl;
114 geometricSurfacePatch::writeDict(os);
116 os << " nFaces " << size() << ';' << nl
117 << " startFace " << start() << ';' << nl
118 << token::END_BLOCK << endl;
122 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
124 bool Foam::surfacePatch::operator!=(const surfacePatch& p) const
126 return !(*this == p);
130 bool Foam::surfacePatch::operator==(const surfacePatch& p) const
134 (geometricType() == p.geometricType())
135 && (size() == p.size())
136 && (start() == p.start())
141 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
143 Foam::Ostream& Foam::operator<<(Ostream& os, const surfacePatch& p)
146 os.check("Ostream& operator<<(Ostream& f, const surfacePatch& p");
151 // ************************************************************************* //