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 "STARCDMeshReader.H"
00028 #include "cyclicPolyPatch.H"
00029 #include "emptyPolyPatch.H"
00030 #include "wallPolyPatch.H"
00031 #include "symmetryPolyPatch.H"
00032 #include "cellModeller.H"
00033 #include "ListOps.H"
00034 #include "IFstream.H"
00035 #include "IOMap.H"
00036
00037
00038
00039 const char* Foam::meshReaders::STARCD::defaultBoundaryName =
00040 "Default_Boundary_Region";
00041
00042 const char* Foam::meshReaders::STARCD::defaultSolidBoundaryName =
00043 "Default_Boundary_Solid";
00044
00045 bool Foam::meshReaders::STARCD::keepSolids = false;
00046
00047 const int Foam::meshReaders::STARCD::starToFoamFaceAddr[4][6] =
00048 {
00049 { 4, 5, 2, 3, 0, 1 },
00050 { 0, 1, 4, -1, 2, 3 },
00051 { 3, -1, 2, -1, 1, 0 },
00052 { 0, -1, 4, 2, 1, 3 }
00053 };
00054
00055
00056
00057
00058 void Foam::meshReaders::STARCD::readToNewline(IFstream& is)
00059 {
00060 char ch = '\n';
00061 do
00062 {
00063 (is).get(ch);
00064 }
00065 while ((is) && ch != '\n');
00066 }
00067
00068
00069 bool Foam::meshReaders::STARCD::readHeader(IFstream& is, word fileSignature)
00070 {
00071 if (!is.good())
00072 {
00073 FatalErrorIn("meshReaders::STARCD::readHeader()")
00074 << "cannot read " << fileSignature << " " << is.name()
00075 << abort(FatalError);
00076 }
00077
00078 word header;
00079 label majorVersion;
00080
00081 is >> header;
00082 is >> majorVersion;
00083
00084
00085 readToNewline(is);
00086
00087
00088 if (header != fileSignature)
00089 {
00090 Info<< "header mismatch " << fileSignature << " " << is.name()
00091 << endl;
00092 }
00093
00094 return true;
00095 }
00096
00097
00098
00099
00100 void Foam::meshReaders::STARCD::readAux(const objectRegistry& registry)
00101 {
00102 boundaryRegion_.readDict(registry);
00103 cellTable_.readDict(registry);
00104 }
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 void Foam::meshReaders::STARCD::readPoints
00121 (
00122 const fileName& inputName,
00123 const scalar scaleFactor
00124 )
00125 {
00126 const word fileSignature = "PROSTAR_VERTEX";
00127 label nPoints = 0, maxId = 0;
00128
00129
00130
00131 {
00132 IFstream is(inputName);
00133 readHeader(is, fileSignature);
00134
00135 label lineLabel;
00136 scalar x, y, z;
00137
00138 while ((is >> lineLabel).good())
00139 {
00140 nPoints++;
00141 maxId = max(maxId, lineLabel);
00142 is >> x >> y >> z;
00143 }
00144 }
00145
00146 Info<< "Number of points = " << nPoints << endl;
00147
00148
00149
00150 points_.setSize(nPoints);
00151 mapToFoamPointId_.setSize(maxId+1);
00152
00153
00154
00157
00158 mapToFoamPointId_ = -1;
00159
00160
00161
00162
00163 if (nPoints > 0)
00164 {
00165 IFstream is(inputName);
00166 readHeader(is, fileSignature);
00167
00168 label lineLabel;
00169
00170 label pointI = 0;
00171 while ((is >> lineLabel).good())
00172 {
00173 is >> points_[pointI].x()
00174 >> points_[pointI].y()
00175 >> points_[pointI].z();
00176
00177
00179 mapToFoamPointId_[lineLabel] = pointI;
00180 pointI++;
00181 }
00182
00183 if (nPoints > pointI)
00184 {
00185 nPoints = pointI;
00186 points_.setSize(nPoints);
00187
00189 }
00190
00191 if (scaleFactor > 1.0 + SMALL || scaleFactor < 1.0 - SMALL)
00192 {
00193 points_ *= scaleFactor;
00194 }
00195 }
00196 else
00197 {
00198 FatalErrorIn("meshReaders::STARCD::readPoints()")
00199 << "no points in file " << inputName
00200 << abort(FatalError);
00201 }
00202
00203 }
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246 void Foam::meshReaders::STARCD::readCells(const fileName& inputName)
00247 {
00248 const word fileSignature = "PROSTAR_CELL";
00249 label nFluids = 0, nSolids = 0, nBaffles = 0, nShells = 0;
00250 label maxId = 0;
00251
00252 bool unknownVertices = false;
00253
00254
00255
00256
00257
00258 {
00259 IFstream is(inputName);
00260 readHeader(is, fileSignature);
00261
00262 label lineLabel, shapeId, nLabels, cellTableId, typeId;
00263
00264 while ((is >> lineLabel).good())
00265 {
00266 label starCellId = lineLabel;
00267 is >> shapeId
00268 >> nLabels
00269 >> cellTableId
00270 >> typeId;
00271
00272
00273 readToNewline(is);
00274
00275
00276 while (nLabels > 0)
00277 {
00278 readToNewline(is);
00279 nLabels -= 8;
00280 }
00281
00282 if (typeId == starcdFluidType)
00283 {
00284 nFluids++;
00285 maxId = max(maxId, starCellId);
00286
00287 if (!cellTable_.found(cellTableId))
00288 {
00289 cellTable_.setName(cellTableId);
00290 cellTable_.setMaterial(cellTableId, "fluid");
00291 }
00292 }
00293 else if (typeId == starcdSolidType)
00294 {
00295 nSolids++;
00296 if (keepSolids)
00297 {
00298 maxId = max(maxId, starCellId);
00299 }
00300
00301 if (!cellTable_.found(cellTableId))
00302 {
00303 cellTable_.setName(cellTableId);
00304 cellTable_.setMaterial(cellTableId, "solid");
00305 }
00306
00307 }
00308 else if (typeId == starcdBaffleType)
00309 {
00310
00311 nBaffles++;
00312 maxId = max(maxId, starCellId);
00313 }
00314 else if (typeId == starcdShellType)
00315 {
00316 nShells++;
00317 if (!cellTable_.found(cellTableId))
00318 {
00319 cellTable_.setName(cellTableId);
00320 cellTable_.setMaterial(cellTableId, "shell");
00321 }
00322 }
00323
00324 }
00325 }
00326
00327 Info<< "Number of fluids = " << nFluids << nl
00328 << "Number of baffles = " << nBaffles << nl;
00329 if (keepSolids)
00330 {
00331 Info<< "Number of solids = " << nSolids << nl;
00332 }
00333 else
00334 {
00335 Info<< "Ignored solids = " << nSolids << nl;
00336 }
00337 Info<< "Ignored shells = " << nShells << endl;
00338
00339
00340 label nCells;
00341 if (keepSolids)
00342 {
00343 nCells = nFluids + nSolids;
00344 }
00345 else
00346 {
00347 nCells = nFluids;
00348 }
00349
00350 cellFaces_.setSize(nCells);
00351 cellShapes_.setSize(nCells);
00352 cellTableId_.setSize(nCells);
00353
00354
00355 baffleFaces_.setSize(nBaffles);
00356
00357
00358 origCellId_.setSize(nCells + nBaffles);
00359 mapToFoamCellId_.setSize(maxId+1);
00360 mapToFoamCellId_ = -1;
00361
00362
00363
00364 cellShape genericShape(*unknownModel, labelList(0));
00365
00366
00367
00368 if (nCells <= 0)
00369 {
00370 FatalErrorIn("meshReaders::STARCD::readCells()")
00371 << "no cells in file " << inputName
00372 << abort(FatalError);
00373 }
00374 else
00375 {
00376 IFstream is(inputName);
00377 readHeader(is, fileSignature);
00378
00379 labelList starLabels(64);
00380 label lineLabel, shapeId, nLabels, cellTableId, typeId;
00381
00382 label cellI = 0;
00383 label baffleI = 0;
00384
00385 while ((is >> lineLabel).good())
00386 {
00387 label starCellId = lineLabel;
00388 is >> shapeId
00389 >> nLabels
00390 >> cellTableId
00391 >> typeId;
00392
00393 if (nLabels > starLabels.size())
00394 {
00395 starLabels.setSize(nLabels);
00396 }
00397 starLabels = -1;
00398
00399
00400 for (label i = 0; i < nLabels; ++i)
00401 {
00402 if ((i % 8) == 0)
00403 {
00404 is >> lineLabel;
00405 }
00406 is >> starLabels[i];
00407 }
00408
00409
00410 if (typeId == starcdSolidType && !keepSolids)
00411 {
00412 continue;
00413 }
00414
00415
00416 const cellModel* curModelPtr = NULL;
00417
00418
00419 switch (shapeId)
00420 {
00421 case starcdHex:
00422 curModelPtr = hexModel;
00423 break;
00424 case starcdPrism:
00425 curModelPtr = prismModel;
00426 break;
00427 case starcdTet:
00428 curModelPtr = tetModel;
00429 break;
00430 case starcdPyr:
00431 curModelPtr = pyrModel;
00432 break;
00433 }
00434
00435 if (curModelPtr)
00436 {
00437
00438
00439
00440 bool isBad = false;
00441 for (label i=0; i < nLabels; ++i)
00442 {
00443 label pointId = mapToFoamPointId_[starLabels[i]];
00444 if (pointId < 0)
00445 {
00446 Info<< "Cells inconsistent with vertex file. "
00447 << "Star vertex " << starLabels[i]
00448 << " does not exist" << endl;
00449 isBad = true;
00450 unknownVertices = true;
00451 }
00452 starLabels[i] = pointId;
00453 }
00454
00455 if (isBad)
00456 {
00457 continue;
00458 }
00459
00460
00461 origCellId_[cellI] = starCellId;
00462 mapToFoamCellId_[starCellId] = cellI;
00463
00464 cellTableId_[cellI] = cellTableId;
00465 cellShapes_[cellI] = cellShape
00466 (
00467 *curModelPtr,
00468 SubList<label>(starLabels, nLabels)
00469 );
00470
00471 cellFaces_[cellI] = cellShapes_[cellI].faces();
00472 cellI++;
00473 }
00474 else if (shapeId == starcdPoly)
00475 {
00476
00477 label nFaces = starLabels[0] - 1;
00478
00479
00480
00481 bool isBad = false;
00482 for (label i=starLabels[0]; i < nLabels; ++i)
00483 {
00484 label pointId = mapToFoamPointId_[starLabels[i]];
00485 if (pointId < 0)
00486 {
00487 Info<< "Cells inconsistent with vertex file. "
00488 << "Star vertex " << starLabels[i]
00489 << " does not exist" << endl;
00490 isBad = true;
00491 unknownVertices = true;
00492 }
00493 starLabels[i] = pointId;
00494 }
00495
00496 if (isBad)
00497 {
00498 continue;
00499 }
00500
00501
00502 faceList faces(nFaces);
00503 label faceI = 0;
00504 for (label i=0; i < nFaces; ++i)
00505 {
00506 label beg = starLabels[i];
00507 label n = starLabels[i+1] - beg;
00508
00509 face f
00510 (
00511 SubList<label>(starLabels, n, beg)
00512 );
00513
00514 f.collapse();
00515
00516
00517 if (f.size() >= 3)
00518 {
00519 faces[faceI++] = f;
00520 }
00521 }
00522
00523 if (nFaces > faceI)
00524 {
00525 Info<< "star cell " << starCellId << " has "
00526 << (nFaces - faceI)
00527 << " empty faces - could cause boundary "
00528 << "addressing problems"
00529 << endl;
00530
00531 nFaces = faceI;
00532 faces.setSize(nFaces);
00533 }
00534
00535 if (nFaces < 4)
00536 {
00537 FatalErrorIn("meshReaders::STARCD::readCells()")
00538 << "star cell " << starCellId << " has " << nFaces
00539 << abort(FatalError);
00540 }
00541
00542
00543 origCellId_[cellI] = starCellId;
00544 mapToFoamCellId_[starCellId] = cellI;
00545
00546 cellTableId_[cellI] = cellTableId;
00547 cellShapes_[cellI] = genericShape;
00548 cellFaces_[cellI] = faces;
00549 cellI++;
00550 }
00551 else if (typeId == starcdBaffleType)
00552 {
00553
00554
00555
00556 bool isBad = false;
00557 for (label i=0; i < nLabels; ++i)
00558 {
00559 label pointId = mapToFoamPointId_[starLabels[i]];
00560 if (pointId < 0)
00561 {
00562 Info<< "Baffles inconsistent with vertex file. "
00563 << "Star vertex " << starLabels[i]
00564 << " does not exist" << endl;
00565 isBad = true;
00566 unknownVertices = true;
00567 }
00568 starLabels[i] = pointId;
00569 }
00570
00571 if (isBad)
00572 {
00573 continue;
00574 }
00575
00576
00577 face f
00578 (
00579 SubList<label>(starLabels, nLabels)
00580 );
00581
00582 f.collapse();
00583
00584
00585 if (f.size() >= 3)
00586 {
00587 baffleFaces_[baffleI] = f;
00588
00589 mapToFoamCellId_[starCellId] = nCells + baffleI;
00590 origCellId_[nCells + baffleI] = starCellId;
00591 baffleI++;
00592 }
00593 }
00594 }
00595
00596 baffleFaces_.setSize(baffleI);
00597 }
00598
00599 if (unknownVertices)
00600 {
00601 FatalErrorIn("meshReaders::STARCD::readCells()")
00602 << "cells with unknown vertices"
00603 << abort(FatalError);
00604 }
00605
00606
00607
00608 #ifdef DEBUG_READING
00609 Info<< "CELLS READ" << endl;
00610 #endif
00611
00612
00613 mapToFoamPointId_.clear();
00614 }
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637 void Foam::meshReaders::STARCD::readBoundary(const fileName& inputName)
00638 {
00639 const word fileSignature = "PROSTAR_BOUNDARY";
00640 label nPatches = 0, nFaces = 0, nBafflePatches = 0, maxId = 0;
00641 label lineLabel, starCellId, cellFaceId, starRegion, configNumber;
00642 word patchType;
00643
00644 labelList mapToFoamPatchId(1000, -1);
00645 labelList nPatchFaces(1000, 0);
00646 labelList origRegion(1000, 0);
00647 patchTypes_.setSize(1000);
00648
00649
00650
00651
00652 Map<label> faceLookupIndex;
00653
00654 faceLookupIndex.insert(hexModel->index(), 0);
00655 faceLookupIndex.insert(prismModel->index(), 1);
00656 faceLookupIndex.insert(tetModel->index(), 2);
00657 faceLookupIndex.insert(pyrModel->index(), 3);
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670 {
00671 IFstream is(inputName);
00672
00673 if (is.good())
00674 {
00675 readHeader(is, fileSignature);
00676
00677 while ((is >> lineLabel).good())
00678 {
00679 nFaces++;
00680 is >> starCellId
00681 >> cellFaceId
00682 >> starRegion
00683 >> configNumber
00684 >> patchType;
00685
00686
00687 label patchLabel = mapToFoamPatchId[starRegion];
00688 if (patchLabel == -1)
00689 {
00690 patchLabel = nPatches;
00691 mapToFoamPatchId[starRegion] = patchLabel;
00692 origRegion[patchLabel] = starRegion;
00693 patchTypes_[patchLabel] = patchType;
00694
00695 maxId = max(maxId, starRegion);
00696
00697 if (patchType == "BAFF")
00698 {
00699 nBafflePatches++;
00700 }
00701 nPatches++;
00702 }
00703
00704 nPatchFaces[patchLabel]++;
00705 }
00706
00707 if (nPatches == 0)
00708 {
00709 Info<< "No boundary faces in file " << inputName << endl;
00710 }
00711 }
00712 else
00713 {
00714 Info<< "Could not read boundary file " << inputName << endl;
00715 }
00716 }
00717
00718
00719 nPatches++;
00720 Info<< "Number of patches = " << nPatches
00721 << " (including extra for missing)" << endl;
00722
00723
00724 origRegion.setSize(nPatches);
00725 patchTypes_.setSize(nPatches);
00726 patchNames_.setSize(nPatches);
00727 nPatchFaces.setSize(nPatches);
00728
00729
00730 origRegion[nPatches-1] = 0;
00731 nPatchFaces[nPatches-1] = 0;
00732 patchTypes_[nPatches-1] = "none";
00733
00734
00735
00736 forAll(patchTypes_, patchI)
00737 {
00738 bool foundName = false, foundType = false;
00739
00740 Map<dictionary>::const_iterator
00741 iter = boundaryRegion_.find(origRegion[patchI]);
00742
00743 if
00744 (
00745 iter != boundaryRegion_.end()
00746 )
00747 {
00748 foundType = iter().readIfPresent
00749 (
00750 "BoundaryType",
00751 patchTypes_[patchI]
00752 );
00753
00754 foundName = iter().readIfPresent
00755 (
00756 "Label",
00757 patchNames_[patchI]
00758 );
00759 }
00760
00761
00762 if (!foundType)
00763 {
00764
00765 forAllIter(string, patchTypes_[patchI], i)
00766 {
00767 *i = tolower(*i);
00768 }
00769
00770 if (patchTypes_[patchI] == "symp")
00771 {
00772 patchTypes_[patchI] = "symplane";
00773 }
00774 else if (patchTypes_[patchI] == "cycl")
00775 {
00776 patchTypes_[patchI] = "cyclic";
00777 }
00778 else if (patchTypes_[patchI] == "baff")
00779 {
00780 patchTypes_[patchI] = "baffle";
00781 }
00782 else if (patchTypes_[patchI] == "moni")
00783 {
00784 patchTypes_[patchI] = "monitoring";
00785 }
00786 }
00787
00788
00789 if (!foundName)
00790 {
00791 patchNames_[patchI] =
00792 patchTypes_[patchI] + "_" + name(origRegion[patchI]);
00793 }
00794 }
00795
00796
00797 patchNames_[nPatches-1] = defaultBoundaryName;
00798
00799
00800
00801 {
00802 labelList sortedIndices;
00803 sortedOrder(SubList<label>(origRegion, nPatches-1), sortedIndices);
00804
00805 labelList oldToNew = identity(nPatches);
00806 forAll(sortedIndices, i)
00807 {
00808 oldToNew[sortedIndices[i]] = i;
00809 }
00810
00811 inplaceReorder(oldToNew, origRegion);
00812 inplaceReorder(oldToNew, patchTypes_);
00813 inplaceReorder(oldToNew, patchNames_);
00814 inplaceReorder(oldToNew, nPatchFaces);
00815 }
00816
00817
00818 nBafflePatches = 1;
00819 if (nBafflePatches)
00820 {
00821 labelList oldToNew = identity(nPatches);
00822 label newIndex = 0;
00823 label baffleIndex = (nPatches-1 - nBafflePatches);
00824
00825 for (label i=0; i < oldToNew.size()-1; ++i)
00826 {
00827 if (patchTypes_[i] == "baffle")
00828 {
00829 oldToNew[i] = baffleIndex++;
00830 }
00831 else
00832 {
00833 oldToNew[i] = newIndex++;
00834 }
00835 }
00836
00837 inplaceReorder(oldToNew, origRegion);
00838 inplaceReorder(oldToNew, patchTypes_);
00839 inplaceReorder(oldToNew, patchNames_);
00840 inplaceReorder(oldToNew, nPatchFaces);
00841 }
00842
00843 mapToFoamPatchId.setSize(maxId+1, -1);
00844 forAll(origRegion, patchI)
00845 {
00846 mapToFoamPatchId[origRegion[patchI]] = patchI;
00847 }
00848
00849 boundaryIds_.setSize(nPatches);
00850 forAll(boundaryIds_, patchI)
00851 {
00852 boundaryIds_[patchI].setSize(nPatchFaces[patchI]);
00853 nPatchFaces[patchI] = 0;
00854 }
00855
00856
00857
00858
00859 if (nPatches > 1 && mapToFoamCellId_.size() > 1)
00860 {
00861 IFstream is(inputName);
00862 readHeader(is, fileSignature);
00863
00864 while ((is >> lineLabel).good())
00865 {
00866 is
00867 >> starCellId
00868 >> cellFaceId
00869 >> starRegion
00870 >> configNumber
00871 >> patchType;
00872
00873 label patchI = mapToFoamPatchId[starRegion];
00874
00875
00876 cellFaceId--;
00877
00878 label cellId = -1;
00879
00880
00881 if (starCellId < mapToFoamCellId_.size())
00882 {
00883 cellId = mapToFoamCellId_[starCellId];
00884 }
00885
00886 if (cellId < 0)
00887 {
00888 Info
00889 << "Boundaries inconsistent with cell file. "
00890 << "Star cell " << starCellId << " does not exist"
00891 << endl;
00892 }
00893 else
00894 {
00895
00896 if (cellId < cellShapes_.size())
00897 {
00898 label index = cellShapes_[cellId].model().index();
00899 if (faceLookupIndex.found(index))
00900 {
00901 index = faceLookupIndex[index];
00902 cellFaceId = starToFoamFaceAddr[index][cellFaceId];
00903 }
00904 }
00905 else
00906 {
00907
00908
00909 cellFaceId = -1;
00910 }
00911
00912 boundaryIds_[patchI][nPatchFaces[patchI]] =
00913 cellFaceIdentifier(cellId, cellFaceId);
00914
00915 #ifdef DEBUG_BOUNDARY
00916 Info<< "bnd " << cellId << " " << cellFaceId << endl;
00917 #endif
00918
00919 nPatchFaces[patchI]++;
00920 }
00921 }
00922 }
00923
00924
00925 patchPhysicalTypes_.setSize(patchTypes_.size());
00926
00927
00928 forAll(boundaryIds_, patchI)
00929 {
00930
00931 if (nPatchFaces[patchI] < boundaryIds_[patchI].size())
00932 {
00933 boundaryIds_[patchI].setSize(nPatchFaces[patchI]);
00934 }
00935
00936 word origType = patchTypes_[patchI];
00937 patchPhysicalTypes_[patchI] = origType;
00938
00939 if (origType == "symplane")
00940 {
00941 patchTypes_[patchI] = symmetryPolyPatch::typeName;
00942 patchPhysicalTypes_[patchI] = patchTypes_[patchI];
00943 }
00944 else if (origType == "wall")
00945 {
00946 patchTypes_[patchI] = wallPolyPatch::typeName;
00947 patchPhysicalTypes_[patchI] = patchTypes_[patchI];
00948 }
00949 else if (origType == "cyclic")
00950 {
00951
00952
00953 patchTypes_[patchI] = cyclicPolyPatch::typeName;
00954 patchPhysicalTypes_[patchI] = patchTypes_[patchI];
00955 }
00956 else if (origType == "baffle")
00957 {
00958
00959
00960 patchTypes_[patchI] = emptyPolyPatch::typeName;
00961 patchPhysicalTypes_[patchI] = "baffle";
00962 }
00963 else
00964 {
00965 patchTypes_[patchI] = polyPatch::typeName;
00966 }
00967
00968 Info<< "patch " << patchI
00969 << " (region " << origRegion[patchI]
00970 << ": " << origType << ") type: '" << patchTypes_[patchI]
00971 << "' name: " << patchNames_[patchI] << endl;
00972 }
00973
00974
00975 mapToFoamCellId_.clear();
00976 cellShapes_.clear();
00977 }
00978
00979
00980
00981
00982
00983 void Foam::meshReaders::STARCD::cullPoints()
00984 {
00985 label nPoints = points_.size();
00986 labelList oldToNew(nPoints, -1);
00987
00988
00989 forAll(cellFaces_, cellI)
00990 {
00991 const faceList& faces = cellFaces_[cellI];
00992 forAll(faces, i)
00993 {
00994 const labelList& labels = faces[i];
00995 forAll(labels, j)
00996 {
00997 oldToNew[labels[j]]++;
00998 }
00999 }
01000 }
01001
01002
01003 label pointI = 0;
01004 forAll(oldToNew, i)
01005 {
01006 if (oldToNew[i] >= 0)
01007 {
01008 oldToNew[i] = pointI++;
01009 }
01010 }
01011
01012
01013 if (nPoints > pointI)
01014 {
01015 Info<< "Unused points = " << (nPoints - pointI) << endl;
01016 nPoints = pointI;
01017
01018
01019 inplaceReorder(oldToNew, points_);
01020 points_.setSize(nPoints);
01021
01022
01023 forAll(cellFaces_, cellI)
01024 {
01025 faceList& faces = cellFaces_[cellI];
01026 forAll(faces, i)
01027 {
01028 inplaceRenumber(oldToNew, faces[i]);
01029 }
01030 }
01031
01032
01033 forAll(baffleFaces_, faceI)
01034 {
01035 inplaceRenumber(oldToNew, baffleFaces_[faceI]);
01036 }
01037 }
01038 }
01039
01040
01041
01042
01043 bool Foam::meshReaders::STARCD::readGeometry(const scalar scaleFactor)
01044 {
01045
01046
01047 readPoints(geometryFile_ + ".vrt", scaleFactor);
01048 readCells(geometryFile_ + ".cel");
01049 cullPoints();
01050 readBoundary(geometryFile_ + ".bnd");
01051
01052 return true;
01053 }
01054
01055
01056
01057
01058 Foam::meshReaders::STARCD::STARCD
01059 (
01060 const fileName& prefix,
01061 const objectRegistry& registry,
01062 const scalar scaleFactor
01063 )
01064 :
01065 meshReader(prefix, scaleFactor),
01066 cellShapes_(0),
01067 mapToFoamPointId_(0),
01068 mapToFoamCellId_(0)
01069 {
01070 readAux(registry);
01071 }
01072
01073
01074
01075
01076 Foam::meshReaders::STARCD::~STARCD()
01077 {}
01078
01079
01080