meshReaderAux.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "meshReader.H"
00028 #include "IOMap.H"
00029 #include "OFstream.H"
00030
00031
00032
00033
00034 void Foam::meshReader::warnDuplicates
00035 (
00036 const word& context,
00037 const wordList& list
00038 )
00039 {
00040 HashTable<label> hashed(list.size());
00041 bool duplicates = false;
00042
00043 forAll(list, listI)
00044 {
00045
00046 HashTable<label>::iterator iter = hashed.find(list[listI]);
00047 if (iter != hashed.end())
00048 {
00049 (*iter)++;
00050 duplicates = true;
00051 }
00052 else
00053 {
00054 hashed.insert(list[listI], 1);
00055 }
00056 }
00057
00058
00059 if (duplicates)
00060 {
00061 Info << nl << "WARNING: " << context << " with identical names:";
00062 forAllConstIter(HashTable<label>, hashed, iter)
00063 {
00064 if (*iter > 1)
00065 {
00066 Info << " " << iter.key();
00067 }
00068 }
00069 Info << nl << endl;
00070 }
00071 }
00072
00073
00074
00075
00076 void Foam::meshReader::writeInterfaces(const objectRegistry& registry) const
00077 {
00078
00079 IOList<labelList> ioObj
00080 (
00081 IOobject
00082 (
00083 "interfaces",
00084 "constant",
00085 polyMesh::meshSubDir,
00086 registry,
00087 IOobject::NO_READ,
00088 IOobject::NO_WRITE,
00089 false
00090 )
00091 );
00092
00093 ioObj.note() = "as yet unsupported interfaces (baffles)";
00094
00095 Info<< "Writing " << ioObj.name() << " to " << ioObj.objectPath() << endl;
00096
00097 OFstream os(ioObj.objectPath());
00098 ioObj.writeHeader(os);
00099
00100 os << interfaces_;
00101 ioObj.writeEndDivider(os);
00102 }
00103
00104
00105 void Foam::meshReader::writeMeshLabelList
00106 (
00107 const objectRegistry& registry,
00108 const word& propertyName,
00109 const labelList& list,
00110 IOstream::streamFormat fmt
00111 ) const
00112 {
00113
00114 IOList<label> ioObj
00115 (
00116 IOobject
00117 (
00118 propertyName,
00119 "constant",
00120 polyMesh::meshSubDir,
00121 registry,
00122 IOobject::NO_READ,
00123 IOobject::AUTO_WRITE,
00124 false
00125 ),
00126 list
00127 );
00128
00129
00130 ioObj.note() = "persistent data for star-cd <-> foam translation";
00131 Info<< "Writing " << ioObj.name() << " to " << ioObj.objectPath() << endl;
00132
00133
00134
00135
00136
00137 ioObj.writeObject
00138 (
00139 fmt,
00140 IOstream::currentVersion,
00141 IOstream::UNCOMPRESSED
00142 );
00143 }
00144
00145
00146
00147
00148 void Foam::meshReader::writeAux(const objectRegistry& registry) const
00149 {
00150 cellTable_.writeDict(registry);
00151 writeInterfaces(registry);
00152
00153
00154 writeMeshLabelList
00155 (
00156 registry,
00157 "origCellId",
00158 origCellId_,
00159 IOstream::BINARY
00160 );
00161
00162
00163
00164 writeMeshLabelList
00165 (
00166 registry,
00167 "cellTableId",
00168 cellTableId_,
00169 IOstream::ASCII
00170 );
00171 }
00172
00173
00174
Copyright © 2000-2009 OpenCFD Ltd