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 "meshReader.H"
31 // * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * //
33 void Foam::meshReader::warnDuplicates
39 HashTable<label> hashed(list.size());
40 bool duplicates = false;
44 // check duplicate name
45 HashTable<label>::iterator iter = hashed.find(list[listI]);
46 if (iter != hashed.end())
53 hashed.insert(list[listI], 1);
57 // warn about duplicate names
60 Info<< nl << "WARNING: " << context << " with identical names:";
61 forAllConstIter(HashTable<label>, hashed, iter)
65 Info<< " " << iter.key();
73 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
75 void Foam::meshReader::writeInterfaces(const objectRegistry& registry) const
77 // write constant/polyMesh/interface
78 IOList<labelList> ioObj
92 ioObj.note() = "as yet unsupported interfaces (baffles)";
94 Info<< "Writing " << ioObj.name() << " to " << ioObj.objectPath() << endl;
96 OFstream os(ioObj.objectPath());
97 ioObj.writeHeader(os);
100 ioObj.writeEndDivider(os);
104 void Foam::meshReader::writeMeshLabelList
106 const objectRegistry& registry,
107 const word& propertyName,
108 const labelList& list,
109 IOstream::streamFormat fmt
112 // write constant/polyMesh/propertyName
119 polyMesh::meshSubDir,
122 IOobject::AUTO_WRITE,
129 ioObj.note() = "persistent data for star-cd <-> foam translation";
130 Info<< "Writing " << ioObj.name() << " to " << ioObj.objectPath() << endl;
133 // the cellTableId is an integer and almost always < 1000, thus ASCII
134 // will be compacter than binary and makes external scripting easier
139 IOstream::currentVersion,
140 IOstream::UNCOMPRESSED
145 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
147 void Foam::meshReader::writeAux(const objectRegistry& registry) const
149 cellTable_.writeDict(registry);
150 writeInterfaces(registry);
152 // write origCellId as List<label>
161 // write cellTableId as List<label>
162 // this is crucial for later conversion back to ccm/starcd
173 // ************************************************************************* //