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 "preservePatchTypes.H"
27 #include "polyBoundaryMeshEntries.H"
29 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
31 void Foam::preservePatchTypes
33 const objectRegistry& obr,
34 const word& meshInstance,
35 const fileName& meshDir,
36 const wordList& patchNames,
37 PtrList<dictionary>& patchDicts,
38 const word& defaultFacesName,
39 word& defaultFacesType
42 patchDicts.setSize(patchNames.size());
44 dictionary patchDictionary;
46 // Read boundary file as single dictionary
48 IOobject patchEntriesHeader
59 if (patchEntriesHeader.headerOk())
61 // Create a list of entries from the boundary file.
62 polyBoundaryMeshEntries patchEntries(patchEntriesHeader);
64 forAll(patchEntries, patchi)
66 patchDictionary.add(patchEntries[patchi]);
71 forAll(patchNames, patchi)
73 if (patchDictionary.found(patchNames[patchi]))
75 const dictionary& patchDict =
76 patchDictionary.subDict(patchNames[patchi]);
78 patchDicts.set(patchi, patchDict.clone());
79 patchDicts[patchi].remove("nFaces");
80 patchDicts[patchi].remove("startFace");
84 if (patchDictionary.found(defaultFacesName))
86 const dictionary& patchDict =
87 patchDictionary.subDict(defaultFacesName);
89 patchDict.readIfPresent("geometricType", defaultFacesType);
92 Info<< nl << "Default patch type set to " << defaultFacesType << endl;
96 // ************************************************************************* //