| 631 | \*---------------------------------------------------------------------------*/ |
| 632 | |
| 633 | void Foam::meshReaders::STARCD::readBoundary(const fileName& inputName) |
| 634 | { |
| 635 | const word fileSignature = "PROSTAR_BOUNDARY"; |
| 636 | label nPatches = 0, nFaces = 0, nBafflePatches = 0, maxId = 0; |
| 637 | label lineLabel, starCellId, cellFaceId, starRegion, configNumber; |
| 638 | word patchType; |
| 639 | |
| 640 | labelList mapToFoamPatchId(1000, label(-1)); |
| 641 | labelList nPatchFaces(1000, label(0)); |
| 642 | labelList origRegion(1000, label(0)); |
| 643 | patchTypes_.setSize(1000); |
| 644 | |
| 645 | // this is what we seem to need |
| 646 | // these MUST correspond to starToFoamFaceAddr |
| 647 | // |
| 648 | Map<label> faceLookupIndex; |
| 649 | |
| 650 | faceLookupIndex.insert(hexModel->index(), 0); |
| 651 | faceLookupIndex.insert(prismModel->index(), 1); |
| 652 | faceLookupIndex.insert(tetModel->index(), 2); |
| 653 | faceLookupIndex.insert(pyrModel->index(), 3); |
| 654 | |
| 655 | // Pass 1: |
| 656 | // collect |
| 657 | // no. of faces (nFaces), no. of patches (nPatches) |
| 658 | // and for each of these patches the number of faces |
| 659 | // (nPatchFaces[patchLabel]) |
| 660 | // |
| 661 | // and a conversion table from Star regions to (Foam) patchLabels |
| 662 | // |
| 663 | // additionally note the no. of baffle patches (nBafflePatches) |
| 664 | // so that we sort these to the end of the patch list |
| 665 | // - this makes it easier to transfer them to an adjacent patch if reqd |
| 666 | { |
| 667 | IFstream is(inputName); |
| 668 | |
| 669 | if (is.good()) |
| 670 | { |
| 671 | readHeader(is, fileSignature); |
| 672 | |
| 673 | while ((is >> lineLabel).good()) |
| 674 | { |
| 675 | nFaces++; |
| 676 | is >> starCellId |
| 677 | >> cellFaceId |
| 678 | >> starRegion |
| 679 | >> configNumber |
| 680 | >> patchType; |
| 681 | |
| 682 | // Build translation table to convert star patch to foam patch |
| 683 | label patchLabel = mapToFoamPatchId[starRegion]; |
| 684 | if (patchLabel == -1) |
| 685 | { |
| 686 | patchLabel = nPatches; |
| 687 | mapToFoamPatchId[starRegion] = patchLabel; |
| 688 | origRegion[patchLabel] = starRegion; |
| 689 | patchTypes_[patchLabel] = patchType; |
| 690 |
no test coverage detected