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()
121 const scalar scaleFactor
124 const word fileSignature =
"PROSTAR_VERTEX";
136 while ((is >> lineLabel).good())
139 maxId =
max(maxId, lineLabel);
144 Info<<
"Number of points = " << nPoints <<
endl;
169 while ((is >> lineLabel).good())
181 if (nPoints > pointi)
189 if (scaleFactor > 1.0 + SMALL || scaleFactor < 1.0 - SMALL)
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;
260 label lineLabel, shapeId, nLabels, cellTableId, typeId;
262 while ((is >> lineLabel).good())
264 label starCellId = lineLabel;
283 maxId =
max(maxId, starCellId);
296 maxId =
max(maxId, starCellId);
310 maxId =
max(maxId, starCellId);
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;
369 <<
"no cells in file " << inputName
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)
439 for (
label i=0; i < nLabels; ++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;
475 label nFaces = starLabels[0] - 1;
480 for (
label i=starLabels[0]; i < nLabels; ++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
555 for (
label i=0; i < nLabels; ++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;
600 <<
"cells with unknown vertices" 637 const word fileSignature =
"PROSTAR_BOUNDARY";
638 label nPatches = 0, nFaces = 0, nBafflePatches = 0, maxId = 0;
639 label lineLabel, starCellId, cellFaceId, starRegion, configNumber;
675 while ((is >> lineLabel).good())
685 label patchLabel = mapToFoamPatchId[starRegion];
686 if (patchLabel == -1)
689 mapToFoamPatchId[starRegion] = patchLabel;
690 origRegion[patchLabel] = starRegion;
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;
719 Info<<
"Number of patches = " << nPatches
720 <<
" (including extra for missing)" <<
endl;
729 origRegion[nPatches-1] = 0;
730 nPatchFaces[nPatches-1] = 0;
737 bool foundName =
false, foundType =
false;
747 foundType = iter().readIfPresent
753 foundName = iter().readIfPresent
807 oldToNew[sortedIndices[i]] = i;
822 label baffleIndex = (nPatches-1 - nBafflePatches);
824 for (
label i=0; i < oldToNew.
size()-1; ++i)
828 oldToNew[i] = baffleIndex++;
832 oldToNew[i] = newIndex++;
842 mapToFoamPatchId.
setSize(maxId+1, -1);
863 while ((is >> lineLabel).good())
888 <<
"Boundaries inconsistent with cell file. " 889 <<
"Star cell " << starCellId <<
" does not exist" 898 if (faceLookupIndex.
found(index))
900 index = faceLookupIndex[index];
914 #ifdef DEBUG_BOUNDARY 915 Info<<
"bnd " << cellId <<
" " << cellFaceId <<
endl;
938 if (origType ==
"symplane")
943 else if (origType ==
"wall")
948 else if (origType ==
"cyclic")
955 else if (origType ==
"baffle")
968 <<
" (region " << origRegion[
patchi]
996 oldToNew[labels[j]]++;
1005 if (oldToNew[i] >= 0)
1007 oldToNew[i] = pointi++;
1012 if (nPoints > pointi)
1014 Info<<
"Unused points = " << (nPoints - pointi) <<
endl;
1055 Foam::meshReaders::STARCD::STARCD
1059 const scalar scaleFactor
static const char *const defaultSolidBoundaryName
static const cellModel * tetModel
static const char *const defaultBoundaryName
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
List< List< cellFaceIdentifier > > boundaryIds_
Identify boundary faces by cells and their faces.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
wordList patchPhysicalTypes_
Boundary patch physical types.
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
A class for handling file names.
void readAux(const objectRegistry &)
Read auxiliary data from constant/{boundaryRegion,cellTable}.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
A face is a list of labels corresponding to mesh vertices.
virtual ~STARCD()
Destructor.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
labelList mapToFoamCellId_
Cell labels (imported Cell numbering not necessarily contiguous)
An analytical geometric cellShape.
void setName(const label, const word &)
Assign name.
void size(const label)
Override size to be inconsistent with allocated storage.
wordList patchTypes_
Boundary patch types.
bool good() const
Return true if next operation might succeed.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Identify cell faces in terms of cell Id and face Id.
static const int starToFoamFaceAddr[4][6]
Face addressing from pro-STAR faces -> OpenFOAM faces.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
const fileName & name() const
Return the name of the stream.
virtual bool readGeometry(const scalar scaleFactor=1.0)
Read the mesh from the file(s)
static const cellModel * prismModel
static void readToNewline(IFstream &)
Read and discard to newline.
void setMaterial(const label, const word &)
Assign material Type.
pointField points_
Points supporting the mesh.
static const cellModel * unknownModel
Pointers to cell shape models.
virtual void readCells(const fileName &)
Read cell connectivities from file.
Various functions to operate on Lists.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
label collapse()
Collapse face by removing duplicate point labels.
A List obtained as a section of another List.
labelList origCellId_
Lookup original Cell number for a given cell.
wordList patchNames_
Boundary patch names.
void readDict(const objectRegistry &, const word &name="cellTable", const fileName &instance="constant")
Read constant/cellTable.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
boundaryRegion boundaryRegion_
Boundary region data.
List< label > labelList
A List of labels.
static bool readHeader(IFstream &, word fileSignature)
Read header.
static const cellModel * pyrModel
errorManip< error > abort(error &err)
bool found(const Key &) const
Return true if hashedEntry is found in table.
word name(const complex &)
Return a string representation of a complex.
cellTable cellTable_
Cell table persistent data saved as a dictionary.
fileName geometryFile_
Referenced filename.
void readDict(const objectRegistry &, const word &name="boundaryRegion", const fileName &instance="constant")
Read constant/boundaryRegion.
void setSize(const label)
Reset size of List.
static const cellModel * hexModel
faceList baffleFaces_
List of each baffle face.
labelList cellTableId_
Cell table id for each cell.
void readPoints(const fileName &, const scalar scaleFactor)
Read points from file.
Maps a geometry to a set of cell primitives, which enables geometric cell data to be calculated witho...
labelList mapToFoamPointId_
Point labels (imported Point numbering not necessarily contiguous)
cellShapeList cellShapes_
Cell shapes.
Registry of regIOobjects.
void readBoundary(const fileName &)
Read boundary (cell/face) definitions.
faceListList cellFaces_
List of faces for every cell.
static bool keepSolids
Keep solids (default false)
label index() const
Return index of model in the model list.
This class supports creating polyMeshes with baffles.
void cullPoints()
Remove unused points.