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
25 \*---------------------------------------------------------------------------*/
27 #include "surfacePatchIOList.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 defineTypeNameAndDebug(Foam::surfacePatchIOList, 0);
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 // Construct from IOObject
37 Foam::surfacePatchIOList::surfacePatchIOList
45 Foam::string functionName =
46 "surfacePatchIOList::surfacePatchIOList"
47 "(const IOobject& io)";
50 if (readOpt() == IOobject::MUST_READ)
52 surfacePatchList& patches = *this;
55 Istream& is = readStream(typeName);
57 PtrList<entry> patchEntries(is);
58 patches.setSize(patchEntries.size());
62 forAll(patches, patchI)
64 const dictionary& dict = patchEntries[patchI].dict();
66 label patchSize = readLabel(dict.lookup("nFaces"));
67 label startFaceI = readLabel(dict.lookup("startFace"));
72 word(dict.lookup("geometricType")),
73 patchEntries[patchI].keyword(),
80 if (startFaceI != faceI)
82 FatalErrorIn(functionName)
83 << "Patches are not ordered. Start of patch " << patchI
84 << " does not correspond to sum of preceding patches."
86 << "while reading " << io.objectPath()
93 // Check state of IOstream
94 is.check(functionName.c_str());
100 // Construct from IOObject
101 Foam::surfacePatchIOList::surfacePatchIOList
104 const surfacePatchList& patches
107 surfacePatchList(patches),
112 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
114 Foam::surfacePatchIOList::~surfacePatchIOList()
118 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 // writeData member function required by regIOobject
122 bool Foam::surfacePatchIOList::writeData(Ostream& os) const
129 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
131 Foam::Ostream& Foam::operator<<(Ostream& os, const surfacePatchIOList& patches)
133 os << patches.size() << nl << token::BEGIN_LIST;
135 forAll(patches, patchI)
137 patches[patchI].writeDict(os);
140 os << token::END_LIST;
146 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
149 // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
151 // ************************************************************************* //