1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 "preservePatchTypes.H"
28 #include "polyBoundaryMeshEntries.H"
29 #include "dictionary.H"
31 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
33 void Foam::preservePatchTypes
35 const objectRegistry& obr,
36 const word& meshInstance,
37 const fileName& meshDir,
38 const wordList& patchNames,
40 const word& defaultFacesName,
41 word& defaultFacesType,
42 wordList& patchPhysicalTypes
45 dictionary patchDictionary;
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 if (patchDictionary.size())
73 forAll(patchNames, patchi)
75 if (patchDictionary.found(patchNames[patchi]))
77 const dictionary& patchDict =
78 patchDictionary.subDict(patchNames[patchi]);
80 patchDict.lookup("type") >> patchTypes[patchi];
82 patchDict.readIfPresent("geometricType", patchTypes[patchi]);
83 patchDict.readIfPresent
86 patchPhysicalTypes[patchi]
91 if (patchDictionary.found(defaultFacesName))
93 const dictionary& patchDict =
94 patchDictionary.subDict(defaultFacesName);
96 patchDict.readIfPresent("geometricType", defaultFacesType);
100 Info << nl << "Default patch type set to " << defaultFacesType << endl;
104 // ************************************************************************* //