53 while ((is) && ch !=
'\n');
66 boundaryRegion_.readDict(registry);
67 cellTable_.readDict(registry);
87 const scalar scaleFactor
97 readHeader(is, STARCDCore::HEADER_VRT);
107 maxId =
max(maxId, starVertexId);
115 <<
"No points in file " << inputName <<
nl
124 mapToFoamPointId_.setSize(maxId+1);
131 mapToFoamPointId_ = -1;
138 readHeader(is, STARCDCore::HEADER_VRT);
145 is >> points_[pointi].x()
146 >> points_[pointi].y()
147 >> points_[pointi].z();
151 mapToFoamPointId_[starVertexId] = pointi;
166 && (scaleFactor > 1.0 + SMALL || scaleFactor < 1.0 - SMALL)
169 points_ *= scaleFactor;
219 label nFluids = 0, nSolids = 0, nBaffles = 0, nShells = 0;
223 bool unknownVertices =
false;
233 label shapeId, nLabels, cellTableId, typeId;
257 maxId =
max(maxId, starCellId);
270 maxId =
max(maxId, starCellId);
283 maxId =
max(maxId, starCellId);
297 const label nCells = nFluids + (keepSolids_ ? nSolids : 0);
299 Info<<
"Number of fluids = " << nFluids <<
nl
300 <<
"Number of baffles = " << nBaffles <<
nl
301 <<
"Number of solids = " << nSolids
302 << (keepSolids_ ?
" (treat as fluid)" :
" (ignored)") <<
nl
303 <<
"Number of shells = " << nShells <<
" (ignored)" <<
nl;
309 err <<
"No cells in file " << inputName <<
nl;
313 err <<
"Consists of shells only (typeId=4)." <<
nl;
346 label ignoredLabel, shapeId, nLabels, cellTableId, typeId;
348 label celli = 0, bafflei = 0;
359 if (nLabels > starLabels.size())
366 for (label i = 0; i < nLabels; ++i)
411 for (label i=0; i < nLabels; ++i)
416 Info<<
"Cells inconsistent with vertex file. "
417 <<
"Star vertex " << starLabels[i]
418 <<
" does not exist" <<
endl;
420 unknownVertices =
true;
422 starLabels[i] = pointId;
447 label nFaces = starLabels[0] - 1;
452 for (label i=starLabels[0]; i < nLabels; ++i)
457 Info<<
"Cells inconsistent with vertex file. "
458 <<
"Star vertex " << starLabels[i]
459 <<
" does not exist" <<
endl;
461 unknownVertices =
true;
463 starLabels[i] = pointId;
474 for (label i=0; i < nFaces; ++i)
476 label beg = starLabels[i];
477 label
n = starLabels[i+1] - beg;
495 Info<<
"star cell " << starCellId <<
" has "
497 <<
" empty faces - could cause boundary "
498 <<
"addressing problems"
508 <<
"star cell " << starCellId <<
" has " << nFaces
527 for (label i=0; i < nLabels; ++i)
532 Info<<
"Baffles inconsistent with vertex file. "
533 <<
"Star vertex " << starLabels[i]
534 <<
" does not exist" <<
endl;
536 unknownVertices =
true;
538 starLabels[i] = pointId;
572 <<
"cells with unknown vertices"
612 label
nPatches = 0, nFaces = 0, nBafflePatches = 0, maxId = 0;
613 label starCellId, cellFaceId, starRegion, configNumber;
617 labelList mapToFoamPatchId(1000, label(-1));
620 patchTypes_.setSize(1000);
665 label patchLabel = mapToFoamPatchId[starRegion];
666 if (patchLabel == -1)
669 mapToFoamPatchId[starRegion] = patchLabel;
670 origRegion[patchLabel] = starRegion;
671 patchTypes_[patchLabel] = patchType;
673 maxId =
max(maxId, starRegion);
676 if (patchType ==
"BAFF")
683 ++nPatchFaces[patchLabel];
688 Info<<
"No boundary faces in file " << inputName <<
endl;
693 Info<<
"Could not read boundary file " << inputName <<
endl;
700 <<
" (including extra for missing)" <<
endl;
715 forAll(patchTypes_, patchi)
717 bool fndName =
false, fndType =
false;
719 auto iter = boundaryRegion_.cfind(origRegion[patchi]);
725 fndType =
dict.readIfPresent(
"BoundaryType", patchTypes_[patchi]);
726 fndName =
dict.readIfPresent(
"Label", patchNames_[patchi]);
734 if (patchTypes_[patchi] ==
"symp")
736 patchTypes_[patchi] =
"symplane";
738 else if (patchTypes_[patchi] ==
"cycl")
740 patchTypes_[patchi] =
"cyclic";
742 else if (patchTypes_[patchi] ==
"baff")
744 patchTypes_[patchi] =
"baffle";
746 else if (patchTypes_[patchi] ==
"moni")
748 patchTypes_[patchi] =
"monitoring";
755 patchNames_[patchi] =
756 patchTypes_[patchi] +
"_" +
name(origRegion[patchi]);
761 patchNames_[
nPatches-1] = defaultBoundaryName;
774 oldToNew[sortedIndices[i]] = i;
789 label baffleIndex = (
nPatches-1 - nBafflePatches);
791 for (label i=0; i < oldToNew.size()-1; ++i)
793 if (patchTypes_[i] ==
"baffle")
795 oldToNew[i] = baffleIndex++;
799 oldToNew[i] = newIndex++;
809 mapToFoamPatchId.
setSize(maxId+1, -1);
810 forAll(origRegion, patchi)
812 mapToFoamPatchId[origRegion[patchi]] = patchi;
816 forAll(boundaryIds_, patchi)
818 boundaryIds_[patchi].setSize(nPatchFaces[patchi]);
819 nPatchFaces[patchi] = 0;
825 if (
nPatches > 1 && mapToFoamCellId_.size() > 1)
841 label patchi = mapToFoamPatchId[starRegion];
849 if (starCellId < mapToFoamCellId_.size())
851 cellId = mapToFoamCellId_[starCellId];
857 <<
"Boundaries inconsistent with cell file. "
858 <<
"Star cell " << starCellId <<
" does not exist"
864 if (
cellId < cellShapes_.size())
866 label mapIndex = cellShapes_[
cellId].model().index();
867 if (shapeLookup.found(mapIndex))
869 mapIndex = shapeLookup[mapIndex];
872 [mapIndex][cellFaceId];
882 boundaryIds_[patchi][nPatchFaces[patchi]] =
885 #ifdef DEBUG_BOUNDARY
889 ++nPatchFaces[patchi];
895 patchPhysicalTypes_.setSize(patchTypes_.size());
898 forAll(boundaryIds_, patchi)
901 if (nPatchFaces[patchi] < boundaryIds_[patchi].size())
903 boundaryIds_[patchi].setSize(nPatchFaces[patchi]);
906 word origType = patchTypes_[patchi];
907 patchPhysicalTypes_[patchi] = origType;
909 if (origType ==
"symplane")
911 patchTypes_[patchi] = symmetryPolyPatch::typeName;
912 patchPhysicalTypes_[patchi] = patchTypes_[patchi];
914 else if (origType ==
"wall")
916 patchTypes_[patchi] = wallPolyPatch::typeName;
917 patchPhysicalTypes_[patchi] = patchTypes_[patchi];
919 else if (origType ==
"cyclic")
923 patchTypes_[patchi] = oldCyclicPolyPatch::typeName;
924 patchPhysicalTypes_[patchi] = patchTypes_[patchi];
926 else if (origType ==
"baffle")
930 patchTypes_[patchi] = emptyPolyPatch::typeName;
931 patchPhysicalTypes_[patchi] =
"baffle";
935 patchTypes_[patchi] = polyPatch::typeName;
938 Info<<
"patch " << patchi
939 <<
" (region " << origRegion[patchi]
940 <<
": " << origType <<
") type: '" << patchTypes_[patchi]
941 <<
"' name: " << patchNames_[patchi] <<
endl;
945 mapToFoamCellId_.clear();
955 label
nPoints = points_.size();
961 const faceList& faces = cellFaces_[celli];
967 oldToNew[labels[j]]++;
976 if (oldToNew[i] >= 0)
978 oldToNew[i] = pointi++;
995 for (
face&
f : faces)
1002 for (
face&
f : baffleFaces_)
1039 const scalar scaleFactor,
1040 const bool keepSolids
1044 keepSolids_(keepSolids),
1046 mapToFoamPointId_(0),