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__");
199 faceNames_.transfer(faceNames);
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
static word validate(const std::string &s, const bool prefix=false)
Construct validated word (no invalid characters).
A class for handling file names.
virtual const fileName & name() const
The name of the input serial stream. (eg, the name of the Fstream file name)
A face is a list of labels corresponding to mesh vertices.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool found(const word &enumName) const
Same as contains()
pointField points_
Points supporting the mesh.
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
dimensionedScalar pos(const dimensionedScalar &ds)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
A class for handling words, derived from Foam::string.
static word defaultRegion
Return the default region name.
static const word null
An empty word.
void append(const T &val)
Copy append an element to the end of this list.
errorManip< error > abort(error &err)
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional 'FOAM Warning' header text...
Generic input stream using a standard (STL) stream.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Automatically write from objectRegistry::writeObject()
streamFormat
Data format (ascii | binary)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
Registry of regIOobjects.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A patch is a list of labels that address the faces in the global face list.
Defines the attributes of an object for which implicit objectRegistry management is supported...
This class supports creating polyMeshes with baffles.