53 while ((is) && ch !=
'\n');
87 const scalar scaleFactor
107 maxId =
max(maxId, starVertexId);
115 <<
"No points in file " << inputName <<
nl
166 && (scaleFactor > 1.0 + SMALL || scaleFactor < 1.0 - SMALL)
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));
665 label patchLabel = mapToFoamPatchId[starRegion];
666 if (patchLabel == -1)
669 mapToFoamPatchId[starRegion] = patchLabel;
670 origRegion[patchLabel] = starRegion;
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) with "
701 << nFaces <<
" faces" <<
endl;
718 bool fndName =
false, fndType =
false;
775 oldToNew[sortedIndices[i]] = i;
790 label baffleIndex = (
nPatches-1 - nBafflePatches);
792 for (label i=0; i < oldToNew.
size()-1; ++i)
796 oldToNew[i] = baffleIndex++;
800 oldToNew[i] = newIndex++;
810 mapToFoamPatchId.
setSize(maxId+1, -1);
811 forAll(origRegion, patchi)
813 mapToFoamPatchId[origRegion[patchi]] = patchi;
820 nPatchFaces[patchi] = 0;
842 label patchi = mapToFoamPatchId[starRegion];
858 <<
"Boundaries inconsistent with cell file. "
859 <<
"Star cell " << starCellId <<
" does not exist"
868 if (shapeLookup.
found(mapIndex))
870 mapIndex = shapeLookup[mapIndex];
873 [mapIndex][cellFaceId];
890 ++nPatchFaces[patchi];
910 if (origType ==
"symplane")
915 else if (origType ==
"wall")
920 else if (origType ==
"cyclic")
924 patchTypes_[patchi] = oldCyclicPolyPatch::typeName;
927 else if (origType ==
"baffle")
939 Info<<
"patch " << patchi
940 <<
" (region " << origRegion[patchi]
941 <<
": " << origType <<
") type: '" <<
patchTypes_[patchi]
968 oldToNew[labels[j]]++;
977 if (oldToNew[i] >= 0)
979 oldToNew[i] = pointi++;
996 for (
face&
f : faces)
1040 const scalar scaleFactor,
1041 const bool keepSolids
1044 meshReader(prefix, scaleFactor),
1045 keepSolids_(keepSolids),
Various functions to operate on Lists.
bool found(const Key &key) const
Same as contains().
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
bool good() const noexcept
True if next operation might succeed.
Generic input stream using a standard (STL) stream.
ISstream & get(char &c)
Raw, low-level get character function.
virtual Istream & read(token &t) override
Return next token from stream.
void setSize(label n)
Alias for resize().
A HashTable to objects of type <T> with a label key.
Generic output stream using a standard (STL) stream.
A non-owning sub-view of a List (allocated or unallocated storage).
void size(const label n)
Older name for setAddressableSize.
void readDict(const objectRegistry &obr, const word &name="boundaryRegion", const fileName &instance="constant")
Read constant/boundaryRegion.
Maps a geometry to a set of cell primitives.
label index() const noexcept
Return index of model in the model list.
static const cellModel * ptr(const modelType model)
Look up pointer to cellModel by enumeration, or nullptr on failure.
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
An analytical geometric cellShape.
void readDict(const objectRegistry &, const word &name="cellTable", const fileName &instance="constant")
Read constant/cellTable.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
Identify cell faces in terms of cell Id and face Id.
List< List< cellFaceIdentifier > > boundaryIds_
Identify boundary faces by cells and their faces.
wordList patchPhysicalTypes_
Boundary patch physical types.
wordList patchNames_
Boundary patch names.
cellTable cellTable_
Cell table persistent data saved as a dictionary.
labelList cellTableId_
Cell table id for each cell.
labelList origCellId_
Lookup original Cell number for a given cell.
pointField points_
Points supporting the mesh.
faceList baffleFaces_
List of each baffle face.
faceListList cellFaces_
List of faces for every cell.
fileName geometryFile_
Referenced filename.
wordList patchTypes_
Boundary patch types.
Registry of regIOobjects.
A token holds an item read from Istream.
bool isLabel() const noexcept
Integral token is convertible to Foam::label.
label labelToken() const
Return integer type as label value or Error.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void inplaceLower(std::string &s)
Inplace transform string with std::tolower on each character.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
List< label > labelList
A List of labels.
static void readToNewline(ISstream &is)
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.