1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 "meshReader.H"
32 // * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * //
34 void Foam::meshReader::warnDuplicates
40 HashTable<label> hashed(list.size());
41 bool duplicates = false;
45 // check duplicate name
46 HashTable<label>::iterator iter = hashed.find(list[listI]);
47 if (iter != hashed.end())
54 hashed.insert(list[listI], 1);
58 // warn about duplicate names
61 Info << nl << "WARNING: " << context << " with identical names:";
62 forAllConstIter(HashTable<label>, hashed, iter)
66 Info << " " << iter.key();
74 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
76 void Foam::meshReader::writeInterfaces(const objectRegistry& registry) const
78 // write constant/polyMesh/interface
79 IOList<labelList> ioObj
93 ioObj.note() = "as yet unsupported interfaces (baffles)";
95 Info<< "Writing " << ioObj.name() << " to " << ioObj.objectPath() << endl;
97 OFstream os(ioObj.objectPath());
98 ioObj.writeHeader(os);
101 << "// *************************************"
102 << "************************************ //"
107 void Foam::meshReader::writeMeshLabelList
109 const objectRegistry& registry,
110 const word& propertyName,
111 const labelList& list,
112 IOstream::streamFormat fmt
115 // write constant/polyMesh/propertyName
122 polyMesh::meshSubDir,
125 IOobject::AUTO_WRITE,
132 ioObj.note() = "persistent data for star-cd <-> foam translation";
133 Info<< "Writing " << ioObj.name() << " to " << ioObj.objectPath() << endl;
136 // the cellTableId is an integer and almost always < 1000, thus ASCII
137 // will be compacter than binary and makes external scripting easier
142 IOstream::currentVersion,
143 IOstream::UNCOMPRESSED
148 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
150 void Foam::meshReader::writeAux(const objectRegistry& registry) const
152 cellTable_.writeDict(registry);
153 writeInterfaces(registry);
155 // write origCellId as List<label>
164 // write cellTableId as List<label>
165 // this is crucial for later conversion back to ccm/starcd
176 // ************************************************************************* //