fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / OpenFOAM / meshes / preservePatchTypes / preservePatchTypes.C
blobeba55b33d8ac156803b1b031fc25c9c80c653a47
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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,
39     wordList& patchTypes,
40     const word& defaultFacesName,
41     word& defaultFacesType,
42     wordList& patchPhysicalTypes
45     dictionary patchDictionary;
47     {
48         IOobject patchEntriesHeader
49         (
50             "boundary",
51             meshInstance,
52             meshDir,
53             obr,
54             IOobject::MUST_READ,
55             IOobject::NO_WRITE,
56             false
57         );
59         if (patchEntriesHeader.headerOk())
60         {
61             // Create a list of entries from the boundary file.
62             polyBoundaryMeshEntries patchEntries(patchEntriesHeader);
64             forAll(patchEntries, patchi)
65             {
66                 patchDictionary.add(patchEntries[patchi]);
67             }
68         }
69     }
71     if (patchDictionary.size())
72     {
73         forAll(patchNames, patchi)
74         {
75             if (patchDictionary.found(patchNames[patchi]))
76             {
77                 const dictionary& patchDict = 
78                     patchDictionary.subDict(patchNames[patchi]);
80                 patchDict.lookup("type") >> patchTypes[patchi];
82                 patchDict.readIfPresent("geometricType", patchTypes[patchi]);
83                 patchDict.readIfPresent
84                 (
85                     "physicalType",
86                     patchPhysicalTypes[patchi]
87                 );
88             }
89         }
91         if (patchDictionary.found(defaultFacesName))
92         {
93             const dictionary& patchDict = 
94                 patchDictionary.subDict(defaultFacesName);
96             patchDict.readIfPresent("geometricType", defaultFacesType);
97         }
98     }
100     Info << nl << "Default patch type set to " << defaultFacesType << endl;
104 // ************************************************************************* //