Go to the documentation of this file.
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),
label index() const noexcept
Return index of model in the model list.
List< label > labelList
A List of labels.
void setName(const label, const word &)
Assign name.
label labelToken() const
Return label value.
bool isLabel() const noexcept
Token is LABEL.
A class for handling words, derived from Foam::string.
A class for handling file names.
static constexpr const zero Zero
Global zero (0)
Input from file stream, using an ISstream.
A List obtained as a section of another List.
Generic input stream using a standard (STL) stream.
Identify cell faces in terms of cell Id and face Id.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A token holds an item read from Istream.
labelList cellTableId_
Cell table id for each cell.
static const cellModel * ptr(const modelType model)
Look up pointer to cellModel by enumeration, or nullptr on failure.
cellTable cellTable_
Cell table persistent data saved as a dictionary.
faceList baffleFaces_
List of each baffle face.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
#define forAll(list, i)
Loop across all elements in list.
bool good() const noexcept
True if next operation might succeed.
labelList origCellId_
Lookup original Cell number for a given cell.
ISstream & get(char &c)
Raw, low-level get character function.
Registry of regIOobjects.
messageStream Info
Information stream (stdout output on master, null elsewhere)
void setSize(const label n)
Alias for resize()
Generic output stream using a standard (STL) stream.
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void setMaterial(const label, const word &)
Assign material Type.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
An analytical geometric cellShape.
errorManip< error > abort(error &err)
void inplaceLower(std::string &s)
Inplace transform string with std::tolower on each character.
This class supports creating polyMeshes with baffles.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void readToNewline(ISstream &is)
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
void clear()
Clear the list, i.e. set size to zero.
virtual Istream & read(token &t)
Return next token from stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
A face is a list of labels corresponding to mesh vertices.
Various functions to operate on Lists.
Maps a geometry to a set of cell primitives.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
faceListList cellFaces_
List of faces for every cell.