77 label sizeCoeffToRefinement
79 const scalar level0Coeff,
80 const scalar sizeCoeff
83 return round(::
log(level0Coeff/sizeCoeff)/::
log(2));
92 const label gapLevelIncrement,
93 const scalar level0Coeff
102 const word& geomName = allGeometry.
names()[geomi];
104 if (surfacesDict.
found(geomName))
131 const word& geomName = allGeometry.
names()[geomi];
140 names[surfi] = geomName;
141 surfaces[surfi] = geomi;
148 const word scsFuncName =
149 shapeDict.
get<
word>(
"surfaceCellSizeFunction");
154 const scalar surfaceCellSize =
155 scsDict.
get<scalar>(
"surfaceCellSizeCoeff");
157 const label refLevel = sizeCoeffToRefinement
163 globalMinLevel[surfi] = refLevel;
164 globalMaxLevel[surfi] = refLevel;
165 globalLevelIncr[surfi] = gapLevelIncrement;
181 if (shapeDict.
found(
"patchInfo"))
193 if (shapeDict.
found(
"regions"))
197 allGeometry[surfaces[surfi]].regions();
209 if (regionDict.
found(
"patchInfo"))
211 regionPatchInfo[surfi].insert
222 if (shapeDict.
found(
"regions"))
227 allGeometry[surfaces[surfi]].regions();
234 shapeControlRegionsDict.
subDict 239 const word scsFuncName =
240 shapeControlRegionDict.
get<
word>
242 "surfaceCellSizeFunction" 247 scsFuncName +
"Coeffs" 250 const scalar surfaceCellSize =
251 scsDict.
get<scalar>(
"surfaceCellSizeCoeff");
253 const label refLevel = sizeCoeffToRefinement
259 regionMinLevel[surfi].insert(regioni, refLevel);
260 regionMaxLevel[surfi].insert(regioni, refLevel);
261 regionLevelIncr[surfi].insert(regioni, 0);
275 regionOffset[surfi] = nRegions;
276 nRegions += allGeometry[surfaces[surfi]].regions().
size();
285 forAll(globalMinLevel, surfi)
287 label nRegions = allGeometry[surfaces[surfi]].regions().
size();
290 for (label i = 0; i < nRegions; i++)
292 label globalRegioni = regionOffset[surfi] + i;
293 minLevel[globalRegioni] = globalMinLevel[surfi];
294 maxLevel[globalRegioni] = globalMaxLevel[surfi];
295 gapLevel[globalRegioni] =
296 maxLevel[globalRegioni]
297 + globalLevelIncr[surfi];
299 if (globalPatchInfo.set(surfi))
304 globalPatchInfo[surfi].clone()
312 label globalRegioni = regionOffset[surfi] + iter.key();
314 minLevel[globalRegioni] = iter();
315 maxLevel[globalRegioni] = regionMaxLevel[surfi][iter.key()];
316 gapLevel[globalRegioni] =
317 maxLevel[globalRegioni]
318 + regionLevelIncr[surfi][iter.key()];
324 label globalRegioni = regionOffset[surfi] + iter.key();
325 patchInfo.
set(globalRegioni, iter()().clone());
364 <<
setw(10) <<
"Min Level" 365 <<
setw(10) <<
"Max Level" 366 <<
setw(10) <<
"Gap Level" <<
nl 367 <<
setw(maxLen) <<
"------" 368 <<
setw(10) <<
"---------" 369 <<
setw(10) <<
"---------" 410 for (
const label patchi : includePatches)
413 patchSize.insert(
pp.name(),
pp.size());
425 compactZoneID.insert(iter.key(), compactZoneID.size());
435 label patchi =
bMesh.findPatchID(iter.key());
438 patchToCompactZone[patchi] = iter.val();
445 for (
const label patchi : includePatches)
451 compactZones.append(patchToCompactZone[
pp.index()]);
468 allBoundary.meshPoints(),
469 allBoundary.meshPointMap(),
505 gatheredPoints.clear();
507 faceList allFaces = ListListOps::combine<faceList>
512 gatheredFaces.clear();
514 labelList allZones = ListListOps::combine<labelList>
519 gatheredZones.clear();
527 Info<<
"surfZone " << iter() <<
" : " << surfZones[iter()].name()
548 globalCasePath.
clean();
550 Info<<
"Writing merged surface to " << globalCasePath <<
endl;
552 sortedFace.
write(globalCasePath);
563 label nUnaligned = 0;
567 const face&
f = faces[facei];
573 const scalar magV(
mag(v));
574 if (magV > ROOTVSMALL)
583 const scalar
s(
mag(v[dir]));
584 if (
s > magV*tol &&
s < magV*(1-tol))
598 os <<
"Initial mesh has " << nUnaligned
599 <<
" edges unaligned with any of the coordinate axes" <<
nl <<
endl;
606 scalar getMergeDistance
609 const scalar mergeTol,
614 scalar mergeDist = mergeTol *
meshBb.mag();
617 <<
"Overall mesh bounding box : " <<
meshBb <<
nl 618 <<
"Relative tolerance : " << mergeTol <<
nl 619 <<
"Absolute matching distance : " << mergeDist <<
nl 631 if (mergeTol < writeTol)
634 <<
"Your current settings specify ASCII writing with " 636 <<
"Your merging tolerance (" << mergeTol
637 <<
") is finer than this." <<
nl 638 <<
"Change to binary writeFormat, " 639 <<
"or increase the writePrecision" <<
endl 640 <<
"or adjust the merge tolerance (mergeTol)." 665 if (!isA<processorPolyPatch>(
pp))
669 isA<coupledPolyPatch>(
pp)
674 oldToNew[patchi] = newPatchi++;
683 if (isA<processorPolyPatch>(
pp))
685 oldToNew[patchi] = newPatchi++;
690 const label nKeepPatches = newPatchi;
693 if (nKeepPatches !=
pbm.
size())
700 if (oldToNew[patchi] == -1)
703 <<
" type " <<
pbm[patchi].type()
704 <<
" at position " << patchi <<
endl;
705 oldToNew[patchi] = newPatchi++;
751 Info<<
"Wrote mesh in = " 752 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
757 int main(
int argc,
char *argv[])
761 "Automatic split hex mesher. Refines and snaps to surface" 770 "Check all surface geometry for quality" 774 "no-intermediate-write",
775 "Do not write intermediate meshes after castellate and snap steps",
780 "Check case set-up only using a single time step" 786 "Simplify the surface using snappyHexMesh starting from a boundBox" 791 "(patch0 .. patchN)",
792 "Only triangulate selected patches (wildcards supported)" 798 "Name of the file to save the simplified surface to" 807 const bool overwrite =
args.
found(
"overwrite");
809 const bool surfaceSimplify =
args.
found(
"surfaceSimplify");
810 const bool noIntermediateWrite =
args.
found(
"no-intermediate-write");
812 const bool optProfiling =
args.
found(
"profiling");
816 Info<<
"Operating in dry-run mode to detect set-up errors" 822 Info<<
"Read mesh in = " 878 const scalar mergeDist = getMergeDistance
881 meshRefinement::get<scalar>
895 const word writerType
900 coordSetWriters::vtkWriter::typeName
918 surfaceWriters::vtkWriter::typeName
929 const scalar maxSizeRatio
965 decomposeDict = *dictPtr;
969 decomposeDict.
add(
"method",
"none");
970 decomposeDict.
add(
"numberOfSubdomains", 1);
1074 Info<<
"Reading refinement surfaces." <<
endl;
1076 if (surfaceSimplify)
1078 addProfiling(surfaceSimplify,
"snappyHexMesh::surfaceSimplify");
1094 "geometryToConformTo" 1098 foamyHexMeshDict.
subDict(
"motionControl");
1101 motionDict.
subDict(
"shapeControlFunctions");
1104 const scalar defaultCellSize =
1105 motionDict.
get<scalar>(
"defaultCellSize");
1107 const scalar initialCellSize =
::pow(
mesh.
V()[0], 1.0/3.0);
1115 createRefinementSurfaces
1121 initialCellSize/defaultCellSize
1136 "refinementSurfaces",
1144 Info<<
"Read refinement surfaces in = " 1162 forAll(surfaceGeometry, surfi)
1164 label geomi = surfaceGeometry[surfi];
1168 forAll(regNames, regioni)
1170 label globalRegioni = surfaces.
globalRegion(surfi, regioni);
1172 if (patchInfo.
set(globalRegioni))
1175 meshRefinement::get<word>
1177 patchInfo[globalRegioni],
1186 patchTypes[geomi][regioni] = wallPolyPatch::typeName;
1215 Info<<
"Checking for geometry size relative to mesh." <<
endl;
1217 forAll(allGeometry, geomi)
1223 if (ratio > maxSizeRatio || ratio < 1.0/maxSizeRatio)
1226 <<
" " << allGeometry.
names()[geomi]
1227 <<
" bounds differ from mesh" 1228 <<
" by more than a factor " << maxSizeRatio <<
":" <<
nl 1229 <<
" bounding box : " << bb <<
nl 1230 <<
" mesh bounding box : " <<
meshBb 1236 <<
" " << allGeometry.
names()[geomi]
1237 <<
" bounds not fully contained in mesh" <<
nl 1238 <<
" bounding box : " << bb <<
nl 1239 <<
" mesh bounding box : " <<
meshBb 1252 Info<<
"Reading refinement shells." <<
endl;
1259 Info<<
"Read refinement shells in = " 1263 Info<<
"Setting refinement level of surface to be consistent" 1264 <<
" with shells." <<
endl;
1266 Info<<
"Checked shell refinement in = " 1275 if (!limitDict.empty())
1277 Info<<
"Reading limit shells." <<
endl;
1282 if (!limitDict.empty())
1284 Info<<
"Read limit shells in = " 1294 unusedGeometries.erase(surfaces.
surfaces());
1295 unusedGeometries.erase(shells.shells());
1296 unusedGeometries.erase(limitShells.shells());
1298 if (unusedGeometries.size())
1301 <<
"The following geometry entries are not used:" <<
nl;
1302 for (
const label geomi : unusedGeometries)
1304 Info<<
" " << allGeomNames[geomi] <<
nl;
1316 Info<<
"Reading features." <<
endl;
1326 Info<<
"Read features in = " 1333 Info<<
"Checking for line geometry size relative to surface geometry." 1337 bool hasErrors = features.checkSizes
1355 <<
"Determining initial surface intersections" <<
nl 1356 <<
"-----------------------------------------" <<
nl 1377 Info<<
"Calculated surface intersections in = " 1382 meshRefiner.
printMeshInfo(debugLevel,
"Initial mesh",
true);
1399 Info<<
"Setting refinement level of surface to be consistent" 1400 <<
" with curvature." <<
endl;
1403 refineParams.curvature(),
1406 Info<<
"Checked curvature refinement in = " 1431 refineParams.addCellZonesToMesh(
mesh);
1446 <<
"Adding patches for surface regions" <<
nl 1447 <<
"----------------------------------" <<
nl 1457 <<
setw(6) <<
"Patch" 1458 <<
setw(20) <<
"Type" 1459 <<
setw(30) <<
"Region" <<
nl 1460 <<
setw(6) <<
"-----" 1461 <<
setw(20) <<
"----" 1469 forAll(surfaceGeometry, surfi)
1471 label geomi = surfaceGeometry[surfi];
1481 surfaces.
surfZones()[surfi].faceZoneNames();
1483 if (fzNames.
empty())
1492 if (surfacePatchInfo.
set(globalRegioni))
1497 surfacePatchInfo[globalRegioni]
1503 patchInfo.
set(
"type", wallPolyPatch::typeName);
1515 <<
setw(6) << patchi
1516 <<
setw(20) <<
pbm[patchi].type()
1517 <<
setw(30) << regNames[i] <<
nl;
1520 globalToMasterPatch[globalRegioni] = patchi;
1521 globalToSlavePatch[globalRegioni] = patchi;
1535 if (surfacePatchInfo.
set(globalRegioni))
1540 surfacePatchInfo[globalRegioni]
1546 patchInfo.
set(
"type", wallPolyPatch::typeName);
1558 <<
setw(6) << patchi
1559 <<
setw(20) <<
pbm[patchi].type()
1560 <<
setw(30) << regNames[i] <<
nl;
1563 globalToMasterPatch[globalRegioni] = patchi;
1567 const word slaveName = regNames[i] +
"_slave";
1570 if (surfacePatchInfo.
set(globalRegioni))
1575 surfacePatchInfo[globalRegioni]
1581 patchInfo.
set(
"type", wallPolyPatch::typeName);
1593 <<
setw(6) << patchi
1594 <<
setw(20) <<
pbm[patchi].type()
1595 <<
setw(30) << slaveName <<
nl;
1598 globalToSlavePatch[globalRegioni] = patchi;
1604 if (regNames.
size())
1608 const word& fzName = fzNames[fzi];
1609 label globalRegioni = surfaces.
globalRegion(surfi, fzi);
1614 pbm[globalToMasterPatch[globalRegioni]].
name(),
1615 pbm[globalToSlavePatch[globalRegioni]].
name(),
1627 Info<<
"Added patches in = " 1650 if (i != string::npos)
1652 word cz0 = fzName.substr(0, i);
1653 word cz1 = fzName.substr(i+4, fzName.size()-i+4);
1654 word slaveName(cz1 +
"_to_" + cz0);
1660 const word slaveName = fzName +
"_slave";
1666 if (faceZoneToPatches.
size())
1688 nFaces +=
pbm[adaptPatchIDs[i]].
size();
1723 <<
"You have selected decomposition method " 1724 << decomposer.typeName
1725 <<
" which is not parallel aware." <<
endl 1726 <<
"Please select one that is (hierarchical, ptscotch)" 1740 const bool wantRefine
1742 meshRefinement::get<bool>(
meshDict,
"castellatedMesh", dryRun)
1746 meshRefinement::get<bool>(
meshDict,
"snap", dryRun)
1748 const bool wantLayers
1750 meshRefinement::get<bool>(
meshDict,
"addLayers", dryRun)
1758 if (errorMsg.size() || IOerrorMsg.size())
1767 <<
"Missing/incorrect required dictionary entries:" <<
nl 1769 << IOerrorMsg.c_str() <<
nl 1770 << errorMsg.c_str() <<
nl <<
nl 1771 <<
"Exiting dry-run" <<
nl <<
endl;
1783 meshRefinement::FaceMergeType::GEOMETRIC;
1785 const bool mergePatchFaces
1790 if (!mergePatchFaces)
1792 Info<<
"Not merging patch-faces of cell to preserve" 1793 <<
" (split)hex cell shape." 1795 mergeType = meshRefinement::FaceMergeType::NONE;
1799 const bool mergeAcrossPatches
1804 if (mergeAcrossPatches)
1806 Info<<
"Merging co-planar patch-faces of cells" 1807 <<
", regardless of patch assignment" 1809 mergeType = meshRefinement::FaceMergeType::IGNOREPATCH;
1825 globalToMasterPatch,
1833 if (!overwrite && !debugLevel)
1839 refineDriver.doRefine
1844 refineParams.handleSnapProblems(),
1850 if (!keepPatches && !wantSnap && !wantLayers)
1863 !(noIntermediateWrite && (wantSnap || wantLayers))
1867 Info<<
"Mesh refined in = " 1868 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
1885 globalToMasterPatch,
1890 if (!overwrite && !debugLevel)
1896 scalar curvature = refineParams.curvature();
1897 scalar planarAngle = refineParams.planarAngle();
1910 if (!keepPatches && !wantLayers)
1923 !(noIntermediateWrite && wantLayers)
1927 Info<<
"Mesh snapped in = " 1928 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
1953 globalToMasterPatch,
1959 const bool preBalance =
1963 if (!overwrite && !debugLevel)
1968 layerDriver.doLayers
1996 Info<<
"Layers added in = " 1997 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
2011 Info<<
"Checking final mesh ..." <<
endl;
2022 Info<<
"Finished meshing with " << nErrors <<
" illegal faces" 2023 <<
" (concave, zero area or negative cell pyramid volume)" 2029 Info<<
"Finished meshing without any errors" <<
endl;
2036 if (surfaceSimplify)
2038 addProfiling(surfaceSimplify,
"snappyHexMesh::surfaceSimplify");
2046 includePatches =
bMesh.patchSet
2057 if (!isA<processorPolyPatch>(
patch))
2059 includePatches.insert(patchi);
2069 "constant/triSurface/simplifiedSurface.stl" 2085 "internalCellCentres",
2094 cellCentres.
write();
2099 Info<<
"Finished meshing in = " 2103 Info<<
"Memory per-node = " 2111 if (errorMsg.size() || IOerrorMsg.size())
2119 <<
"Missing/incorrect required dictionary entries:" <<
nl 2121 << IOerrorMsg.c_str() <<
nl 2122 << errorMsg.c_str() <<
nl <<
nl 2123 <<
"Exiting dry-run" <<
nl <<
endl;
const IOdictionary & meshDict
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces, const bool dryRun=false)
Check mesh with mesh settings in dict. Collects incorrect faces.
const polyBoundaryMesh & pbm
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
label addFaceZone(const word &fzName, const word &masterPatch, const word &slavePatch, const surfaceZonesInfo::faceZoneType &fzType)
Add/lookup faceZone and update information. Return index of.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
static FOAM_NO_DANGLING_REFERENCE const dictionary & subDict(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt=keyType::REGEX)
Wrapper around dictionary::subDict which does not exit.
Simple container to keep together layer specific information.
void clear() const
Clear any accumulated error messages.
A class for handling file names.
const labelList & surfaces() const
Ostream & indent(Ostream &os)
Indent stream.
virtual bool parallelAware() const =0
Is method parallel aware?
Identifies a surface patch/zone by name and index, with optional geometric type.
label checkTopology(const bool report) const
All topological checks. Return number of failed checks.
dimensionedScalar log(const dimensionedScalar &ds)
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
MeshType
Enumeration for how to operate.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
fileName path() const
The path for the case = rootPath/caseName.
bool getFaceZoneInfo(const word &fzName, label &masterPatchID, label &slavePatchID, surfaceZonesInfo::faceZoneType &fzType) const
Lookup faceZone information. Return false if no information.
const word & name() const noexcept
Return the object name.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void printMeshInfo(const bool debug, const string &msg, const bool printCellLevel) const
Print some mesh stats.
constexpr char nl
The newline '\n' character (0x0a)
static ITstream & lookup(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt=keyType::REGEX)
Wrapper around dictionary::lookup which does not exit.
Implements a timeout mechanism via sigalarm.
bool empty() const noexcept
True if List is empty (ie, size() is zero)
wordList patchTypes(nPatches)
const word dictName("faMeshDefinition")
Object access operator or list access operator (default is pass-through)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static autoPtr< surfaceWriter > New(const word &writeType)
Select construct a surfaceWriter.
List< T > getList(const label index) const
Get a List of values from the argument at index.
static bool & parRun() noexcept
Test if this a parallel run.
static int myProcNo(label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
#define addProfiling(Name,...)
Define profiling trigger with specified name and description string. The description is generated by ...
static writeType writeLevel()
Get/set write level.
virtual const dictionary & dict() const =0
Return dictionary, if entry is a dictionary, otherwise Fatal.
static unsigned int defaultPrecision() noexcept
Return the default precision.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
bool store()
Register object with its registry and transfer ownership to the registry.
static bool writeNow()
Write profiling information now.
static const Enum< MeshType > MeshTypeNames
static const word canonicalName
The canonical name ("decomposeParDict") under which the MeshObject is registered. ...
static labelList addCellZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
fileName globalPath() const
The global path for the case = rootPath/globalCaseName.
A bounding box defined in terms of min/max extrema points.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
const labelList & minLevel() const
From global region number to refinement level.
static void broadcast(Type &value, const int communicator=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
Ignore writing from objectRegistry::writeObject()
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
const Time & time() const
Return the top-level database.
label nFaces() const noexcept
Number of mesh faces.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
Simple container to keep together refinement specific information.
const bool writeData(pdfDictionary.get< bool >("writeData"))
labelList faceLabels(nFaceLabels)
bool contains(const T &val) const
True if the value is contained in the list.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for managing references or pointers (no reference counting)
autoPtr< dictionary > clone() const
Construct and return clone.
bool processorCase() const noexcept
True if this is a processor case.
scalar level0EdgeLength() const
Typical edge length between unrefined points.
wordList toc() const
Return the table of contents.
const fvMesh & mesh() const
Reference to mesh.
static void gatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate.
void reduce(T &value, [[maybe_unused]] BinaryOp bop, [[maybe_unused]] const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce)
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
Foam::string str() const
Get the string. As Foam::string instead of std::string (may change in future)
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
static const Enum< writeType > writeTypeNames
Encapsulates queries for features.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
static autoPtr< coordSetWriter > New(const word &writeFormat)
Return a reference to the selected writer.
A list of faces which address into the list of points.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
const keyType & keyword() const noexcept
Return keyword.
FaceMergeType
Enumeration for what to do with co-planar patch faces on a single.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Simple container to keep together snap specific information.
int dryRun() const noexcept
Return the dry-run flag.
const labelList & gapLevel() const
From global region number to small gap refinement level.
const List< wordList > & regionNames() const
Region names per surface.
scalar mag() const
The magnitude/length of the bounding box diagonal.
label size() const noexcept
The number of entries in the list.
string message() const
The accumulated error message.
const word & system() const noexcept
Return system name.
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
static const word null
An empty word.
Container for searchableSurfaces. The collection is specified as a dictionary. For example...
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
const globalMeshData & globalData() const
Return parallel info (demand-driven)
Abstract base class for domain decomposition.
Encapsulates queries for volume refinement ('refine all cells within shell').
virtual const faceList & faces() const
Return raw faces.
static void mapCombineGather(Container &values, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Forwards to Pstream::mapGather with an in-place cop.
graph_traits< Graph >::vertices_size_type size_type
const PtrList< surfaceZonesInfo > & surfZones() const
const vectorField & cellCentres() const
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
word timeName() const
Replacement for Time::timeName() that returns oldInstance (if overwrite_)
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh...
const hexRef8 & meshCutter() const
Reference to meshcutting engine.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Istream and Ostream manipulators taking arguments.
static int readFlags(const EnumContainer &namedEnum, const wordList &words)
Helper: convert wordList into bit pattern using provided Enum.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Smanip< std::ios_base::fmtflags > setf(std::ios_base::fmtflags flags)
const word & constant() const noexcept
Return constant name.
int debug
Static debugging option.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
static bool clean(std::string &str)
Cleanup filename string, possibly applies other transformations such as changing the path separator e...
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
labelList meshedPatches() const
Get patchIDs for patches added in addMeshedPatch.
const wordList edge
Standard (finite-area) edge field types (scalar, vector, tensor, etc)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
virtual void rename(const word &newName)
Rename.
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
Find and return a sub-dictionary as a copy, otherwise return an empty dictionary. ...
All to do with adding layers.
double cpuTimeIncrement() const
Return CPU time [seconds] since last call to cpuTimeIncrement(), resetCpuTimeIncrement().
static void addFaceZones(meshRefinement &meshRefiner, const refinementParameters &refineParams, const HashTable< Pair< word >> &faceZoneToPatches)
Helper: add faceZones and patches.
static List< int64_t > list_mem_hwm(const bool useMaxValue=false)
List of the per-node memory high-water mark values. These are summed per-node and aggregated across a...
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional 'FOAM Warning' header text...
void setCurvatureMinLevelFields(const scalar cosAngle, const scalar level0EdgeLength)
Update minLevelFields according to (triSurface-only) curvature.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
bool erase(T *item)
Remove the specified element from the list and delete it.
void updateIntersections(const labelUList &changedFaces)
Find any intersection of surface. Store in surfaceIndex_.
All to do with snapping to surface.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
static autoPtr< decompositionMethod > New(const dictionary &decompDict, const word ®ionName="")
Return a reference to the selected decomposition method, optionally region-specific.
const wordList & names() const
Names of surfaces.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
static label nProcs(label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
label checkGeometry(const scalar maxRatio, const scalar tolerance, autoPtr< coordSetWriter > &setWriter, const scalar minQuality, const bool report) const
All geometric checks. Return number of failed checks.
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
label nCells() const noexcept
Number of mesh cells.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
const wordList & names() const
Surface names, not region names.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
Automatically write from objectRegistry::writeObject()
const std::string patch
OpenFOAM patch number as a std::string.
label globalRegion(const label surfI, const label regionI) const
From surface and region on surface to global region.
const entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
static const Enum< debugType > debugTypeNames
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName)
messageStream Info
Information stream (stdout output on master, null elsewhere)
const PtrList< dictionary > & patchInfo() const
From global region number to patch type.
static bool master(label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
writeType
Enumeration for what to write. Used as a bit-pattern.
const boundBox & bounds() const noexcept
Return mesh bounding box.
faceZoneType
What to do with faceZone faces.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
debugType
Enumeration for what to debug. Used as a bit-pattern.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Mesh consisting of general polyhedral cells.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
Omanip< int > setw(const int i)
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
bool write() const
Write mesh and all data.
double elapsedCpuTime() const
Return CPU time [seconds] from the start.
IOstreamOption::streamFormat writeFormat() const noexcept
Get write stream format.
List< label > labelList
A List of labels.
A patch is a list of labels that address the faces in the global face list.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define PrintMemoryIn(functionName)
Report memory high-water mark using Foam::error::Pout_mem_hwm() for functionName in file __FILE__ at ...
void setMinLevelFields(const shellSurfaces &shells)
Calculate minLevelFields according to both surface- and.
Foam::argList args(argc, argv)
void writeStats(const List< wordList > &, Ostream &) const
Write some stats.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Request registration (bool: true)
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
A primitive field of type <T> with automated input and output.
void setSize(label n)
Alias for resize()
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
bool found(const word &optName) const
Return true if the named option is found.
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
forAllConstIters(mixture.phases(), phase)
A keyword and a list of tokens is an 'entry'.
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...
static IOobject selectIO(const IOobject &io, const fileName &altFile, const word &ioName="")
Return the IOobject, but also consider an alternative file name.
A HashTable to objects of type <T> with a label key.
const labelList & maxLevel() const
From global region number to refinement level.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
label checkGeometry(const polyMesh &mesh, const bool allGeometry, autoPtr< surfaceWriter > &surfWriter, autoPtr< coordSetWriter > &setWriter)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)
Starts timing CPU usage and return elapsed time from start.