1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
26 #include "patchInteractionDataList.H"
27 #include "stringListOps.H"
28 #include "wallPolyPatch.H"
30 // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
32 Foam::patchInteractionDataList::patchInteractionDataList()
34 List<patchInteractionData>(),
39 Foam::patchInteractionDataList::patchInteractionDataList
42 const dictionary& dict
45 List<patchInteractionData>(dict.lookup("patches")),
46 patchGroupIDs_(this->size())
48 const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
49 const wordList allPatchNames = bMesh.names();
51 const List<patchInteractionData>& items = *this;
52 forAllReverse(items, i)
54 const word& patchName = items[i].patchName();
55 labelList patchIDs = findStrings(patchName, allPatchNames);
61 "Foam::patchInteractionDataList::patchInteractionDataList"
66 ) << "Cannot find any patch names matching " << patchName
70 patchGroupIDs_[i].transfer(patchIDs);
73 // check that all walls are specified
74 DynamicList<word> badWalls;
77 const polyPatch& pp = bMesh[patchI];
78 if (isA<wallPolyPatch>(pp) && applyToPatch(pp.index()) < 0)
80 badWalls.append(pp.name());
84 if (badWalls.size() > 0)
88 "Foam::patchInteractionDataList::patchInteractionDataList"
93 ) << "All wall patches must be specified when employing local patch "
94 << "interaction. Please specify data for patches:" << nl
95 << badWalls << nl << exit(FatalError);
100 Foam::patchInteractionDataList::patchInteractionDataList
102 const patchInteractionDataList& pidl
105 List<patchInteractionData>(pidl),
106 patchGroupIDs_(pidl.patchGroupIDs_)
110 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
112 Foam::label Foam::patchInteractionDataList::applyToPatch(const label id) const
114 forAll(patchGroupIDs_, groupI)
116 const labelList& patchIDs = patchGroupIDs_[groupI];
117 forAll(patchIDs, patchI)
119 if (patchIDs[patchI] == id)
130 // ************************************************************************* //