39 "Default_Boundary_Region";
42 "Default_Boundary_Solid";
49 { 0, 1, 4, -1, 2, 3 },
50 { 3, -1, 2, -1, 1, 0 },
64 while ((is) && ch !=
'\n');
73 <<
"cannot read " << fileSignature <<
" " << is.
name()
87 if (header != fileSignature)
89 Info<<
"header mismatch " << fileSignature <<
" " << is.
name()
101 boundaryRegion_.readDict(registry);
102 cellTable_.readDict(registry);
122 const scalar scaleFactor
125 const word fileSignature =
"PROSTAR_VERTEX";
132 readHeader(is, fileSignature);
137 while ((is >> lineLabel).good())
140 maxId =
max(maxId, lineLabel);
145 Info<<
"Number of points = " << nPoints <<
endl;
149 points_.setSize(nPoints);
150 mapToFoamPointId_.setSize(maxId+1);
157 mapToFoamPointId_ = -1;
165 readHeader(is, fileSignature);
170 while ((is >> lineLabel).good())
172 is >> points_[pointI].x()
173 >> points_[pointI].y()
174 >> points_[pointI].z();
178 mapToFoamPointId_[lineLabel] = pointI;
182 if (nPoints > pointI)
185 points_.setSize(nPoints);
190 if (scaleFactor > 1.0 + SMALL || scaleFactor < 1.0 - SMALL)
192 points_ *= scaleFactor;
198 <<
"no points in file " << inputName
247 const word fileSignature =
"PROSTAR_CELL";
248 label nFluids = 0, nSolids = 0, nBaffles = 0, nShells = 0;
251 bool unknownVertices =
false;
259 readHeader(is, fileSignature);
261 label lineLabel, shapeId, nLabels, cellTableId, typeId;
263 while ((is >> lineLabel).good())
265 label starCellId = lineLabel;
281 if (typeId == starcdFluidType)
284 maxId =
max(maxId, starCellId);
286 if (!cellTable_.found(cellTableId))
288 cellTable_.setName(cellTableId);
289 cellTable_.setMaterial(cellTableId,
"fluid");
292 else if (typeId == starcdSolidType)
297 maxId =
max(maxId, starCellId);
300 if (!cellTable_.found(cellTableId))
302 cellTable_.setName(cellTableId);
303 cellTable_.setMaterial(cellTableId,
"solid");
307 else if (typeId == starcdBaffleType)
311 maxId =
max(maxId, starCellId);
313 else if (typeId == starcdShellType)
316 if (!cellTable_.found(cellTableId))
318 cellTable_.setName(cellTableId);
319 cellTable_.setMaterial(cellTableId,
"shell");
326 Info<<
"Number of fluids = " << nFluids <<
nl
327 <<
"Number of baffles = " << nBaffles <<
nl;
330 Info<<
"Number of solids = " << nSolids <<
nl;
334 Info<<
"Ignored solids = " << nSolids <<
nl;
336 Info<<
"Ignored shells = " << nShells <<
endl;
342 nCells = nFluids + nSolids;
349 cellFaces_.setSize(nCells);
350 cellShapes_.setSize(nCells);
351 cellTableId_.setSize(nCells);
354 baffleFaces_.setSize(nBaffles);
357 origCellId_.setSize(nCells + nBaffles);
358 mapToFoamCellId_.setSize(maxId+1);
359 mapToFoamCellId_ = -1;
370 <<
"no cells in file " << inputName
376 readHeader(is, fileSignature);
379 label lineLabel, shapeId, nLabels, cellTableId, typeId;
384 while ((is >> lineLabel).good())
386 label starCellId = lineLabel;
392 if (nLabels > starLabels.
size())
399 for (label i = 0; i < nLabels; ++i)
409 if (typeId == starcdSolidType && !keepSolids)
421 curModelPtr = hexModel;
424 curModelPtr = prismModel;
427 curModelPtr = tetModel;
430 curModelPtr = pyrModel;
440 for (label i=0; i < nLabels; ++i)
442 label pointId = mapToFoamPointId_[starLabels[i]];
445 Info<<
"Cells inconsistent with vertex file. "
446 <<
"Star vertex " << starLabels[i]
447 <<
" does not exist" <<
endl;
449 unknownVertices =
true;
451 starLabels[i] = pointId;
460 origCellId_[cellI] = starCellId;
461 mapToFoamCellId_[starCellId] = cellI;
463 cellTableId_[cellI] = cellTableId;
470 cellFaces_[cellI] = cellShapes_[cellI].faces();
473 else if (shapeId == starcdPoly)
476 label nFaces = starLabels[0] - 1;
481 for (label i=starLabels[0]; i < nLabels; ++i)
483 label pointId = mapToFoamPointId_[starLabels[i]];
486 Info<<
"Cells inconsistent with vertex file. "
487 <<
"Star vertex " << starLabels[i]
488 <<
" does not exist" <<
endl;
490 unknownVertices =
true;
492 starLabels[i] = pointId;
503 for (label i=0; i < nFaces; ++i)
505 label beg = starLabels[i];
506 label n = starLabels[i+1] - beg;
524 Info<<
"star cell " << starCellId <<
" has "
526 <<
" empty faces - could cause boundary "
527 <<
"addressing problems"
537 <<
"star cell " << starCellId <<
" has " << nFaces
542 origCellId_[cellI] = starCellId;
543 mapToFoamCellId_[starCellId] = cellI;
545 cellTableId_[cellI] = cellTableId;
546 cellShapes_[cellI] = genericShape;
547 cellFaces_[cellI] = faces;
550 else if (typeId == starcdBaffleType)
556 for (label i=0; i < nLabels; ++i)
558 label pointId = mapToFoamPointId_[starLabels[i]];
561 Info<<
"Baffles inconsistent with vertex file. "
562 <<
"Star vertex " << starLabels[i]
563 <<
" does not exist" <<
endl;
565 unknownVertices =
true;
567 starLabels[i] = pointId;
586 baffleFaces_[baffleI] =
f;
588 mapToFoamCellId_[starCellId] = nCells + baffleI;
589 origCellId_[nCells + baffleI] = starCellId;
595 baffleFaces_.setSize(baffleI);
601 <<
"cells with unknown vertices"
612 mapToFoamPointId_.clear();
638 const word fileSignature =
"PROSTAR_BOUNDARY";
639 label
nPatches = 0, nFaces = 0, nBafflePatches = 0, maxId = 0;
640 label lineLabel, starCellId, cellFaceId, starRegion, configNumber;
646 patchTypes_.setSize(1000);
653 faceLookupIndex.
insert(hexModel->index(), 0);
654 faceLookupIndex.
insert(prismModel->index(), 1);
655 faceLookupIndex.
insert(tetModel->index(), 2);
656 faceLookupIndex.
insert(pyrModel->index(), 3);
674 readHeader(is, fileSignature);
676 while ((is >> lineLabel).good())
686 label patchLabel = mapToFoamPatchId[starRegion];
687 if (patchLabel == -1)
690 mapToFoamPatchId[starRegion] = patchLabel;
691 origRegion[patchLabel] = starRegion;
692 patchTypes_[patchLabel] = patchType;
694 maxId =
max(maxId, starRegion);
696 if (patchType ==
"BAFF")
703 nPatchFaces[patchLabel]++;
708 Info<<
"No boundary faces in file " << inputName <<
endl;
713 Info<<
"Could not read boundary file " << inputName <<
endl;
719 Info<<
"Number of patches = " << nPatches
720 <<
" (including extra for missing)" <<
endl;
724 patchTypes_.setSize(nPatches);
725 patchNames_.setSize(nPatches);
729 origRegion[nPatches-1] = 0;
730 nPatchFaces[nPatches-1] = 0;
731 patchTypes_[nPatches-1] =
"none";
735 forAll(patchTypes_, patchI)
737 bool foundName =
false, foundType =
false;
740 iter = boundaryRegion_.
find(origRegion[patchI]);
744 iter != boundaryRegion_.
end()
747 foundType = iter().readIfPresent
753 foundName = iter().readIfPresent
769 if (patchTypes_[patchI] ==
"symp")
771 patchTypes_[patchI] =
"symplane";
773 else if (patchTypes_[patchI] ==
"cycl")
775 patchTypes_[patchI] =
"cyclic";
777 else if (patchTypes_[patchI] ==
"baff")
779 patchTypes_[patchI] =
"baffle";
781 else if (patchTypes_[patchI] ==
"moni")
783 patchTypes_[patchI] =
"monitoring";
790 patchNames_[patchI] =
791 patchTypes_[patchI] +
"_" +
name(origRegion[patchI]);
796 patchNames_[nPatches-1] = defaultBoundaryName;
807 oldToNew[sortedIndices[i]] = i;
822 label baffleIndex = (nPatches-1 - nBafflePatches);
824 for (label i=0; i < oldToNew.
size()-1; ++i)
826 if (patchTypes_[i] ==
"baffle")
828 oldToNew[i] = baffleIndex++;
832 oldToNew[i] = newIndex++;
842 mapToFoamPatchId.
setSize(maxId+1, -1);
843 forAll(origRegion, patchI)
845 mapToFoamPatchId[origRegion[patchI]] = patchI;
848 boundaryIds_.
setSize(nPatches);
849 forAll(boundaryIds_, patchI)
851 boundaryIds_[patchI].setSize(nPatchFaces[patchI]);
852 nPatchFaces[patchI] = 0;
858 if (nPatches > 1 && mapToFoamCellId_.size() > 1)
861 readHeader(is, fileSignature);
863 while ((is >> lineLabel).good())
872 label patchI = mapToFoamPatchId[starRegion];
880 if (starCellId < mapToFoamCellId_.size())
882 cellId = mapToFoamCellId_[starCellId];
888 <<
"Boundaries inconsistent with cell file. "
889 <<
"Star cell " << starCellId <<
" does not exist"
895 if (cellId < cellShapes_.size())
897 label index = cellShapes_[cellId].model().index();
898 if (faceLookupIndex.
found(index))
900 index = faceLookupIndex[index];
901 cellFaceId = starToFoamFaceAddr[index][cellFaceId];
911 boundaryIds_[patchI][nPatchFaces[patchI]] =
914 #ifdef DEBUG_BOUNDARY
915 Info<<
"bnd " << cellId <<
" " << cellFaceId <<
endl;
918 nPatchFaces[patchI]++;
924 patchPhysicalTypes_.setSize(patchTypes_.size());
927 forAll(boundaryIds_, patchI)
930 if (nPatchFaces[patchI] < boundaryIds_[patchI].size())
932 boundaryIds_[patchI].setSize(nPatchFaces[patchI]);
935 word origType = patchTypes_[patchI];
936 patchPhysicalTypes_[patchI] = origType;
938 if (origType ==
"symplane")
940 patchTypes_[patchI] = symmetryPolyPatch::typeName;
941 patchPhysicalTypes_[patchI] = patchTypes_[patchI];
943 else if (origType ==
"wall")
945 patchTypes_[patchI] = wallPolyPatch::typeName;
946 patchPhysicalTypes_[patchI] = patchTypes_[patchI];
948 else if (origType ==
"cyclic")
952 patchTypes_[patchI] = cyclicPolyPatch::typeName;
953 patchPhysicalTypes_[patchI] = patchTypes_[patchI];
955 else if (origType ==
"baffle")
959 patchTypes_[patchI] = emptyPolyPatch::typeName;
960 patchPhysicalTypes_[patchI] =
"baffle";
964 patchTypes_[patchI] = polyPatch::typeName;
967 Info<<
"patch " << patchI
968 <<
" (region " << origRegion[patchI]
969 <<
": " << origType <<
") type: '" << patchTypes_[patchI]
970 <<
"' name: " << patchNames_[patchI] <<
endl;
974 mapToFoamCellId_.clear();
984 label
nPoints = points_.size();
990 const faceList& faces = cellFaces_[cellI];
996 oldToNew[labels[j]]++;
1005 if (oldToNew[i] >= 0)
1007 oldToNew[i] = pointI++;
1012 if (nPoints > pointI)
1014 Info<<
"Unused points = " << (nPoints - pointI) <<
endl;
1019 points_.setSize(nPoints);
1022 forAll(cellFaces_, cellI)
1024 faceList& faces = cellFaces_[cellI];
1032 forAll(baffleFaces_, faceI)
1046 readPoints(geometryFile_ +
".vrt", scaleFactor);
1047 readCells(geometryFile_ +
".cel");
1049 readBoundary(geometryFile_ +
".bnd");
1061 const scalar scaleFactor
1066 mapToFoamPointId_(0),