1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 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
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
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 \*---------------------------------------------------------------------------*/
27 #include "fvBoundaryMesh.H"
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 void Foam::fvBoundaryMesh::addPatches(const polyBoundaryMesh& basicBdry)
34 setSize(basicBdry.size());
36 // Set boundary patches
37 fvPatchList& Patches = *this;
39 forAll(Patches, patchI)
41 Patches.set(patchI, fvPatch::New(basicBdry[patchI], *this));
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 Foam::fvBoundaryMesh::fvBoundaryMesh
58 Foam::fvBoundaryMesh::fvBoundaryMesh
61 const polyBoundaryMesh& basicBdry
64 fvPatchList(basicBdry.size()),
67 addPatches(basicBdry);
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
73 Foam::label Foam::fvBoundaryMesh::findPatchID(const word& patchName) const
75 const fvPatchList& patches = *this;
77 forAll(patches, patchI)
79 if (patches[patchI].name() == patchName)
85 // Not found, return -1
90 void Foam::fvBoundaryMesh::movePoints()
94 operator[](patchI).initMovePoints();
99 operator[](patchI).movePoints();
104 Foam::lduInterfacePtrsList Foam::fvBoundaryMesh::interfaces() const
106 lduInterfacePtrsList interfaces(size());
108 forAll(interfaces, patchI)
110 if (isA<lduInterface>(this->operator[](patchI)))
115 &refCast<const lduInterface>(this->operator[](patchI))
124 void Foam::fvBoundaryMesh::readUpdate(const polyBoundaryMesh& basicBdry)
127 addPatches(basicBdry);
131 // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
133 const Foam::fvPatch& Foam::fvBoundaryMesh::operator[]
135 const word& patchName
138 const label patchI = findPatchID(patchName);
144 "fvBoundaryMesh::operator[](const word&) const"
145 ) << "Patch named " << patchName << " not found." << nl
146 << abort(FatalError);
149 return operator[](patchI);
153 Foam::fvPatch& Foam::fvBoundaryMesh::operator[]
155 const word& patchName
158 const label patchI = findPatchID(patchName);
164 "fvBoundaryMesh::operator[](const word&)"
165 ) << "Patch named " << patchName << " not found." << nl
166 << abort(FatalError);
169 return operator[](patchI);
173 // ************************************************************************* //