39 const scalar scaleFactor
45 Info<<
"Number of points = " <<
n <<
endl;
46 if (scaleFactor > 1.0 + SMALL || scaleFactor < 1.0 - SMALL)
55 const label nFaces = getFireLabel(is);
56 Info<<
"Number of faces = " << nFaces <<
endl;
57 meshFaces_.setSize(nFaces);
63 const label size = getFireLabel(is);
65 face&
f = meshFaces_[faceI];
69 f[fp] = getFireLabel(is);
79 <<
"no faces in file " << is.
name()
87 const label nCells = getFireLabel(is);
88 Info<<
"Number of cells = " << nCells <<
endl;
90 owner_.setSize(meshFaces_.size());
91 neigh_.setSize(meshFaces_.size());
98 for (label cellI = 0; cellI < nCells; ++cellI)
100 const label nface = getFireLabel(is);
102 for (label i = 0; i < nface; ++i)
104 const label faceI = getFireLabel(is);
106 if (owner_[faceI] == -1)
108 owner_[faceI] = cellI;
110 else if (neigh_[faceI] == -1)
112 neigh_[faceI] = cellI;
117 <<
"bad cell connectivity for face " << faceI
118 <<
" on cell " << cellI
127 <<
"no cells in file " << is.
name()
131 cellTableId_.setSize(nCells);
138 const label nSelect = getFireLabel(is);
139 Info<<
"Number of select = " << nSelect <<
endl;
141 label nCellSelections = 0;
142 label nFaceSelections = 0;
144 faceZoneId_.setSize(meshFaces_.size());
149 for (label selI = 0; selI < nSelect; ++selI)
151 std::string
name = getFireString(is);
152 const label selType = getFireLabel(is);
153 const label count = getFireLabel(is);
158 const label selId = ++nCellSelections;
161 cellTable_.setMaterial(selId,
"fluid");
163 for (label i = 0; i < count; ++i)
165 const label
cellId = getFireLabel(is);
167 cellTableId_[
cellId] = selId;
173 const label selId = nFaceSelections++;
177 for (label i = 0; i < count; ++i)
179 const label
faceId = getFireLabel(is);
181 faceZoneId_[
faceId] = selId;
187 for (label i = 0; i <
count; ++i)
194 Info<< nFaceSelections <<
" face selections" <<
endl;
195 Info<< nCellSelections <<
" cell selections" <<
endl;
198 faceNames.
append(
"__MISSED_FACES__");
211 if (neigh_[faceI] != -1)
215 if (owner_[faceI] > neigh_[faceI])
217 std::swap(owner_[faceI], neigh_[faceI]);
222 label posInternal = 0;
223 label posExternal = nInternalFaces_;
225 labelList oldToNew(meshFaces_.size(), -1);
231 if (neigh_[faceI] == -1)
233 oldToNew[faceI] = posExternal++;
237 oldToNew[faceI] = posInternal++;
248 const label zoneMissed = faceNames_.size() - 1;
249 patchSizes_.setSize(faceNames_.size());
252 patchStarts_.setSize(patchSizes_.size());
255 for (label faceI = nInternalFaces_; faceI < meshFaces_.size(); ++faceI)
257 label zoneI = faceZoneId_[faceI];
260 ++patchSizes_[zoneMissed];
264 ++patchSizes_[zoneI];
268 if (patchSizes_[zoneMissed])
270 Info<<
"collecting " << patchSizes_[zoneMissed]
271 <<
" missed boundary faces to final patch" <<
endl;
278 label
pos = nInternalFaces_;
280 forAll(patchStarts_, patchI)
282 patchStarts_[patchI] =
pos;
283 pos += patchSizes_[patchI];
286 forAll(patchSizes_, patchI)
288 patchSizes_[patchI] = 0;
293 for (label faceI = nInternalFaces_; faceI < meshFaces_.size(); ++faceI)
295 label patchI = faceZoneId_[faceI];
299 patchStarts_[zoneMissed] + patchSizes_[zoneMissed];
300 ++patchSizes_[zoneMissed];
304 oldToNew[faceI] = patchStarts_[patchI] + patchSizes_[patchI];
305 ++patchSizes_[patchI];
319 patchNames_.setSize(patchSizes_.size());
323 forAll(patchSizes_, patchI)
325 if (patchSizes_[patchI])
327 patchNames_[
nPatches] = faceNames_[patchI];
348 label meshFaceI = nInternalFaces_;
350 forAll(patchStarts_, patchI)
352 Info<<
"patch " << patchI
353 <<
" (start: " << meshFaceI <<
" size: " << patchSizes_[patchI]
354 <<
") name: " << patchNames_[patchI]
372 meshFaceI += patchSizes_[patchI];
375 mesh.addPatches(newPatches);
385 const word ext(geometryFile_.ext());
410 <<
"File-type '" << ext
411 <<
"' is not supported for reading as a FIRE mesh." <<
nl
412 <<
"If it is a compressed file, use gunzip first."
416 IFstream is(geometryFile_, fmt);
418 readPoints(is, scaleFactor);
431 readGeometry(scaleFactor_);
434 Info<<
"Creating a polyMesh" <<
endl;
447 std::move(meshFaces_),
456 cellTable_.addCellZones(
mesh, cellTableId_);
468 const scalar scaleFactor
Various functions to operate on Lists.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
@ NO_READ
Nothing to be read.
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
streamFormat
Data format (ascii | binary | coherent).
@ ASCII
"ascii" (normal default)
Generic input stream using a standard (STL) stream.
virtual const fileName & name() const override
The name of the input serial stream. (eg, the name of the Fstream file name).
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
This class supports creating polyMeshes with baffles.
scalar scaleFactor_
Geometry scaling.
faceList meshFaces_
Global face list for polyMesh.
wordList patchNames_
Boundary patch names.
label nInternalFaces_
Number of internal faces for polyMesh.
cellTable cellTable_
Cell table persistent data saved as a dictionary.
labelList cellTableId_
Cell table id for each cell.
pointField points_
Points supporting the mesh.
labelList patchStarts_
Polyhedral mesh boundary patch start indices and dimensions.
fileName geometryFile_
Referenced filename.
Registry of regIOobjects.
Mesh consisting of general polyhedral cells.
static word defaultRegion
Return the default region name.
A patch is a list of labels that address the faces in the global face list.
A class for handling words, derived from Foam::string.
static word validate(const std::string &s, const bool prefix=false)
Construct validated word (no invalid characters).
static const word null
An empty word.
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
dimensionedScalar pos(const dimensionedScalar &ds)
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
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.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional 'FOAM Warning' header text.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.