1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A class holds the data needed to identify a patch in a dynamic mesh.
30 The patch is identified by name and its index in the boundary mesh
31 is updated if the mesh has changed.
33 \*---------------------------------------------------------------------------*/
38 #include "polyBoundaryMesh.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 // Forward declaration of friend functions and operators
48 Ostream& operator<<(Ostream& os, const polyPatchID& p);
51 /*---------------------------------------------------------------------------*\
52 Class polyPatchID Declaration
53 \*---------------------------------------------------------------------------*/
70 //- Construct from name
74 const polyBoundaryMesh& bm,
75 bool checkValid = false
79 index_(bm.findPatchID(name))
81 if (checkValid && index_ < 0)
87 " const word& name,\n"
88 " const polyBoundaryMesh& bm,\n"
89 " bool checkValid = false\n"
91 ) << "Patch " << name_ << " not found. Valid patch names: "
97 //- Construct from Istream
101 const polyBoundaryMesh& bm,
102 bool checkValid = false
106 index_(bm.findPatchID(name_))
108 if (checkValid && index_ < 0)
115 " const polyBoundaryMesh& bm,\n"
116 " bool checkValid = false\n"
118 ) << "Patch " << name_ << " not found. Valid patch names: "
120 << abort(FatalError);
130 const word& name() const
141 //- Has the patch been found
151 void update(const polyBoundaryMesh& bm)
153 index_ = bm.findPatchID(name_);
159 friend Ostream& operator<<(Ostream& os, const polyPatchID& p)
161 os << token::BEGIN_LIST
162 << p.name_ << token::SPACE
166 // Check state of Ostream
167 os.check("Ostream& operator<<(Ostream&, const polyPatchID&)");
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 } // End namespace Foam
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 // ************************************************************************* //