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');
86 if (header != fileSignature)
88 Info<<
"header mismatch " << fileSignature <<
" " << is.
name()
100 boundaryRegion_.readDict(registry);
101 cellTable_.readDict(registry);
121 const scalar scaleFactor
124 const word fileSignature =
"PROSTAR_VERTEX";
131 readHeader(is, fileSignature);
136 while ((is >> lineLabel).good())
139 maxId =
max(maxId, lineLabel);
149 mapToFoamPointId_.setSize(maxId+1);
156 mapToFoamPointId_ = -1;
164 readHeader(is, fileSignature);
169 while ((is >> lineLabel).good())
171 is >> points_[pointI].x()
172 >> points_[pointI].y()
173 >> points_[pointI].z();
177 mapToFoamPointId_[lineLabel] = pointI;
189 if (scaleFactor > 1.0 + SMALL || scaleFactor < 1.0 - SMALL)
191 points_ *= scaleFactor;
197 <<
"no points in file " << inputName
246 const word fileSignature =
"PROSTAR_CELL";
247 label nFluids = 0, nSolids = 0, nBaffles = 0, nShells = 0;
250 bool unknownVertices =
false;
258 readHeader(is, fileSignature);
260 label lineLabel, shapeId, nLabels, cellTableId, typeId;
262 while ((is >> lineLabel).good())
264 label starCellId = lineLabel;
280 if (typeId == starcdFluidType)
283 maxId =
max(maxId, starCellId);
285 if (!cellTable_.found(cellTableId))
287 cellTable_.setName(cellTableId);
288 cellTable_.setMaterial(cellTableId,
"fluid");
291 else if (typeId == starcdSolidType)
296 maxId =
max(maxId, starCellId);
299 if (!cellTable_.found(cellTableId))
301 cellTable_.setName(cellTableId);
302 cellTable_.setMaterial(cellTableId,
"solid");
306 else if (typeId == starcdBaffleType)
310 maxId =
max(maxId, starCellId);
312 else if (typeId == starcdShellType)
315 if (!cellTable_.found(cellTableId))
317 cellTable_.setName(cellTableId);
318 cellTable_.setMaterial(cellTableId,
"shell");
325 Info<<
"Number of fluids = " << nFluids <<
nl
326 <<
"Number of baffles = " << nBaffles <<
nl;
329 Info<<
"Number of solids = " << nSolids <<
nl;
333 Info<<
"Ignored solids = " << nSolids <<
nl;
335 Info<<
"Ignored shells = " << nShells <<
endl;
341 nCells = nFluids + nSolids;
348 cellFaces_.setSize(nCells);
349 cellShapes_.setSize(nCells);
350 cellTableId_.setSize(nCells);
353 baffleFaces_.setSize(nBaffles);
356 origCellId_.setSize(nCells + nBaffles);
357 mapToFoamCellId_.setSize(maxId+1);
358 mapToFoamCellId_ = -1;
369 <<
"no cells in file " << inputName
375 readHeader(is, fileSignature);
378 label lineLabel, shapeId, nLabels, cellTableId, typeId;
383 while ((is >> lineLabel).good())
385 label starCellId = lineLabel;
391 if (nLabels > starLabels.
size())
398 for (
label i = 0; i < nLabels; ++i)
408 if (typeId == starcdSolidType && !keepSolids)
420 curModelPtr = hexModel;
423 curModelPtr = prismModel;
426 curModelPtr = tetModel;
429 curModelPtr = pyrModel;
439 for (
label i=0; i < nLabels; ++i)
441 label pointId = mapToFoamPointId_[starLabels[i]];
444 Info<<
"Cells inconsistent with vertex file. "
445 <<
"Star vertex " << starLabels[i]
446 <<
" does not exist" <<
endl;
448 unknownVertices =
true;
450 starLabels[i] = pointId;
459 origCellId_[cellI] = starCellId;
460 mapToFoamCellId_[starCellId] = cellI;
462 cellTableId_[cellI] = cellTableId;
469 cellFaces_[cellI] = cellShapes_[cellI].faces();
472 else if (shapeId == starcdPoly)
475 label nFaces = starLabels[0] - 1;
480 for (
label i=starLabels[0]; i < nLabels; ++i)
482 label pointId = mapToFoamPointId_[starLabels[i]];
485 Info<<
"Cells inconsistent with vertex file. "
486 <<
"Star vertex " << starLabels[i]
487 <<
" does not exist" <<
endl;
489 unknownVertices =
true;
491 starLabels[i] = pointId;
502 for (
label i=0; i < nFaces; ++i)
504 label beg = starLabels[i];
505 label n = starLabels[i+1] - beg;
523 Info<<
"star cell " << starCellId <<
" has "
525 <<
" empty faces - could cause boundary "
526 <<
"addressing problems"
536 <<
"star cell " << starCellId <<
" has " << nFaces
541 origCellId_[cellI] = starCellId;
542 mapToFoamCellId_[starCellId] = cellI;
544 cellTableId_[cellI] = cellTableId;
545 cellShapes_[cellI] = genericShape;
546 cellFaces_[cellI] = faces;
549 else if (typeId == starcdBaffleType)
555 for (
label i=0; i < nLabels; ++i)
557 label pointId = mapToFoamPointId_[starLabels[i]];
560 Info<<
"Baffles inconsistent with vertex file. "
561 <<
"Star vertex " << starLabels[i]
562 <<
" does not exist" <<
endl;
564 unknownVertices =
true;
566 starLabels[i] = pointId;
585 baffleFaces_[baffleI] =
f;
587 mapToFoamCellId_[starCellId] = nCells + baffleI;
588 origCellId_[nCells + baffleI] = starCellId;
594 baffleFaces_.setSize(baffleI);
600 <<
"cells with unknown vertices"
611 mapToFoamPointId_.clear();
637 const word fileSignature =
"PROSTAR_BOUNDARY";
638 label nPatches = 0, nFaces = 0, nBafflePatches = 0, maxId = 0;
639 label lineLabel, starCellId, cellFaceId, starRegion, configNumber;
645 patchTypes_.setSize(1000);
652 faceLookupIndex.insert(hexModel->index(), 0);
653 faceLookupIndex.insert(prismModel->index(), 1);
654 faceLookupIndex.insert(tetModel->index(), 2);
655 faceLookupIndex.insert(pyrModel->index(), 3);
673 readHeader(is, fileSignature);
675 while ((is >> lineLabel).good())
685 label patchLabel = mapToFoamPatchId[starRegion];
686 if (patchLabel == -1)
689 mapToFoamPatchId[starRegion] = patchLabel;
690 origRegion[patchLabel] = starRegion;
691 patchTypes_[patchLabel] = patchType;
693 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;
720 <<
" (including extra for missing)" <<
endl;
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;
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;
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())
898 if (faceLookupIndex.found(index))
900 index = faceLookupIndex[index];
901 cellFaceId = starToFoamFaceAddr[index][cellFaceId];
911 boundaryIds_[patchI][nPatchFaces[patchI]] =
914 #ifdef DEBUG_BOUNDARY
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] = oldCyclicPolyPatch::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();
990 const faceList& faces = cellFaces_[cellI];
996 oldToNew[labels[j]]++;
1005 if (oldToNew[i] >= 0)
1007 oldToNew[i] = pointI++;
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),