| 240 | \*---------------------------------------------------------------------------*/ |
| 241 | |
| 242 | void Foam::meshReaders::STARCD::readCells(const fileName& inputName) |
| 243 | { |
| 244 | const word fileSignature = "PROSTAR_CELL"; |
| 245 | label nFluids = 0, nSolids = 0, nBaffles = 0, nShells = 0; |
| 246 | label maxId = 0; |
| 247 | |
| 248 | bool unknownVertices = false; |
| 249 | |
| 250 | |
| 251 | // Pass 1: |
| 252 | // count nFluids, nSolids, nBaffle, nShell and maxId |
| 253 | // also see if polyhedral cells were used |
| 254 | { |
| 255 | IFstream is(inputName); |
| 256 | readHeader(is, fileSignature); |
| 257 | |
| 258 | label lineLabel, shapeId, nLabels, cellTableId, typeId; |
| 259 | |
| 260 | while ((is >> lineLabel).good()) |
| 261 | { |
| 262 | label starCellId = lineLabel; |
| 263 | is >> shapeId |
| 264 | >> nLabels |
| 265 | >> cellTableId |
| 266 | >> typeId; |
| 267 | |
| 268 | // skip the rest of the line |
| 269 | readToNewline(is); |
| 270 | |
| 271 | // max 8 indices per line |
| 272 | while (nLabels > 0) |
| 273 | { |
| 274 | readToNewline(is); |
| 275 | nLabels -= 8; |
| 276 | } |
| 277 | |
| 278 | if (typeId == starcdFluidType) |
| 279 | { |
| 280 | nFluids++; |
| 281 | maxId = max(maxId, starCellId); |
| 282 | |
| 283 | if (!cellTable_.found(cellTableId)) |
| 284 | { |
| 285 | cellTable_.setName(cellTableId); |
| 286 | cellTable_.setMaterial(cellTableId, "fluid"); |
| 287 | } |
| 288 | } |
| 289 | else if (typeId == starcdSolidType) |
| 290 | { |
| 291 | nSolids++; |
| 292 | if (keepSolids) |
| 293 | { |
| 294 | maxId = max(maxId, starCellId); |
| 295 | } |
| 296 | |
| 297 | if (!cellTable_.found(cellTableId)) |
| 298 | { |
| 299 | cellTable_.setName(cellTableId); |
no test coverage detected