76 label sizeCoeffToRefinement
78 const scalar level0Coeff,
79 const scalar sizeCoeff
82 return round(::
log(level0Coeff/sizeCoeff)/::
log(2));
91 const label gapLevelIncrement,
92 const scalar level0Coeff
101 const word& geomName = allGeometry.
names()[geomi];
103 if (surfacesDict.
found(geomName))
130 const word& geomName = allGeometry.
names()[geomi];
139 names[surfi] = geomName;
140 surfaces[surfi] = geomi;
147 const word scsFuncName =
148 shapeDict.
get<
word>(
"surfaceCellSizeFunction");
153 const scalar surfaceCellSize =
154 scsDict.
get<scalar>(
"surfaceCellSizeCoeff");
156 const label refLevel = sizeCoeffToRefinement
162 globalMinLevel[surfi] = refLevel;
163 globalMaxLevel[surfi] = refLevel;
164 globalLevelIncr[surfi] = gapLevelIncrement;
180 if (shapeDict.
found(
"patchInfo"))
192 if (shapeDict.
found(
"regions"))
196 allGeometry[surfaces[surfi]].regions();
208 if (regionDict.
found(
"patchInfo"))
210 regionPatchInfo[surfi].insert
221 if (shapeDict.
found(
"regions"))
226 allGeometry[surfaces[surfi]].regions();
233 shapeControlRegionsDict.
subDict 238 const word scsFuncName =
239 shapeControlRegionDict.
get<
word>
241 "surfaceCellSizeFunction" 246 scsFuncName +
"Coeffs" 249 const scalar surfaceCellSize =
250 scsDict.
get<scalar>(
"surfaceCellSizeCoeff");
252 const label refLevel = sizeCoeffToRefinement
258 regionMinLevel[surfi].insert(regioni, refLevel);
259 regionMaxLevel[surfi].insert(regioni, refLevel);
260 regionLevelIncr[surfi].insert(regioni, 0);
274 regionOffset[surfi] = nRegions;
275 nRegions += allGeometry[surfaces[surfi]].regions().
size();
284 forAll(globalMinLevel, surfi)
286 label nRegions = allGeometry[surfaces[surfi]].regions().
size();
289 for (label i = 0; i < nRegions; i++)
291 label globalRegioni = regionOffset[surfi] + i;
292 minLevel[globalRegioni] = globalMinLevel[surfi];
293 maxLevel[globalRegioni] = globalMaxLevel[surfi];
294 gapLevel[globalRegioni] =
295 maxLevel[globalRegioni]
296 + globalLevelIncr[surfi];
298 if (globalPatchInfo.set(surfi))
303 globalPatchInfo[surfi].clone()
311 label globalRegioni = regionOffset[surfi] + iter.key();
313 minLevel[globalRegioni] = iter();
314 maxLevel[globalRegioni] = regionMaxLevel[surfi][iter.key()];
315 gapLevel[globalRegioni] =
316 maxLevel[globalRegioni]
317 + regionLevelIncr[surfi][iter.key()];
323 label globalRegioni = regionOffset[surfi] + iter.key();
324 patchInfo.
set(globalRegioni, iter()().clone());
363 <<
setw(10) <<
"Min Level" 364 <<
setw(10) <<
"Max Level" 365 <<
setw(10) <<
"Gap Level" <<
nl 366 <<
setw(maxLen) <<
"------" 367 <<
setw(10) <<
"---------" 368 <<
setw(10) <<
"---------" 409 for (
const label patchi : includePatches)
412 patchSize.insert(
pp.name(),
pp.size());
424 compactZoneID.insert(iter.key(), compactZoneID.size());
434 label patchi =
bMesh.findPatchID(iter.key());
437 patchToCompactZone[patchi] = iter.val();
444 for (
const label patchi : includePatches)
450 compactZones.append(patchToCompactZone[
pp.index()]);
467 allBoundary.meshPoints(),
468 allBoundary.meshPointMap(),
504 gatheredPoints.clear();
506 faceList allFaces = ListListOps::combine<faceList>
511 gatheredFaces.clear();
513 labelList allZones = ListListOps::combine<labelList>
518 gatheredZones.clear();
526 Info<<
"surfZone " << iter() <<
" : " << surfZones[iter()].name()
547 globalCasePath.
clean();
549 Info<<
"Writing merged surface to " << globalCasePath <<
endl;
551 sortedFace.
write(globalCasePath);
562 label nUnaligned = 0;
566 const face&
f = faces[facei];
572 const scalar magV(
mag(v));
573 if (magV > ROOTVSMALL)
582 const scalar
s(
mag(v[dir]));
583 if (
s > magV*tol &&
s < magV*(1-tol))
597 os <<
"Initial mesh has " << nUnaligned
598 <<
" edges unaligned with any of the coordinate axes" <<
nl <<
endl;
605 scalar getMergeDistance
608 const scalar mergeTol,
613 scalar mergeDist = mergeTol *
meshBb.mag();
616 <<
"Overall mesh bounding box : " <<
meshBb <<
nl 617 <<
"Relative tolerance : " << mergeTol <<
nl 618 <<
"Absolute matching distance : " << mergeDist <<
nl 630 if (mergeTol < writeTol)
633 <<
"Your current settings specify ASCII writing with " 635 <<
"Your merging tolerance (" << mergeTol
636 <<
") is finer than this." <<
nl 637 <<
"Change to binary writeFormat, " 638 <<
"or increase the writePrecision" <<
endl 639 <<
"or adjust the merge tolerance (mergeTol)." 664 if (!isA<processorPolyPatch>(
pp))
668 isA<coupledPolyPatch>(
pp)
673 oldToNew[patchi] = newPatchi++;
682 if (isA<processorPolyPatch>(
pp))
684 oldToNew[patchi] = newPatchi++;
689 const label nKeepPatches = newPatchi;
692 if (nKeepPatches !=
pbm.
size())
699 if (oldToNew[patchi] == -1)
702 <<
" type " <<
pbm[patchi].type()
703 <<
" at position " << patchi <<
endl;
704 oldToNew[patchi] = newPatchi++;
746 Info<<
"Wrote mesh in = " 747 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
751 int main(
int argc,
char *argv[])
755 "Automatic split hex mesher. Refines and snaps to surface" 764 "Check all surface geometry for quality" 768 "Check case set-up only using a single time step" 774 "Simplify the surface using snappyHexMesh starting from a boundBox" 779 "(patch0 .. patchN)",
780 "Only triangulate selected patches (wildcards supported)" 786 "Name of the file to save the simplified surface to" 795 const bool overwrite =
args.
found(
"overwrite");
797 const bool surfaceSimplify =
args.
found(
"surfaceSimplify");
802 Info<<
"Operating in dry-run mode to detect set-up errors" 808 Info<<
"Read mesh in = " 850 const scalar mergeDist = getMergeDistance
853 meshRefinement::get<scalar>
867 const word writerType
872 coordSetWriters::vtkWriter::typeName
890 surfaceWriters::vtkWriter::typeName
901 const scalar maxSizeRatio
937 decomposeDict = *dictPtr;
941 decomposeDict.
add(
"method",
"none");
942 decomposeDict.
add(
"numberOfSubdomains", 1);
1046 Info<<
"Reading refinement surfaces." <<
endl;
1048 if (surfaceSimplify)
1050 addProfiling(surfaceSimplify,
"snappyHexMesh::surfaceSimplify");
1066 "geometryToConformTo" 1070 foamyHexMeshDict.
subDict(
"motionControl");
1073 motionDict.
subDict(
"shapeControlFunctions");
1076 const scalar defaultCellSize =
1077 motionDict.
get<scalar>(
"defaultCellSize");
1079 const scalar initialCellSize =
::pow(
mesh.
V()[0], 1.0/3.0);
1087 createRefinementSurfaces
1093 initialCellSize/defaultCellSize
1108 "refinementSurfaces",
1116 Info<<
"Read refinement surfaces in = " 1134 forAll(surfaceGeometry, surfi)
1136 label geomi = surfaceGeometry[surfi];
1140 forAll(regNames, regioni)
1142 label globalRegioni = surfaces.
globalRegion(surfi, regioni);
1144 if (patchInfo.
set(globalRegioni))
1147 meshRefinement::get<word>
1149 patchInfo[globalRegioni],
1158 patchTypes[geomi][regioni] = wallPolyPatch::typeName;
1187 Info<<
"Checking for geometry size relative to mesh." <<
endl;
1189 forAll(allGeometry, geomi)
1195 if (ratio > maxSizeRatio || ratio < 1.0/maxSizeRatio)
1198 <<
" " << allGeometry.
names()[geomi]
1199 <<
" bounds differ from mesh" 1200 <<
" by more than a factor " << maxSizeRatio <<
":" <<
nl 1201 <<
" bounding box : " << bb <<
nl 1202 <<
" mesh bounding box : " <<
meshBb 1208 <<
" " << allGeometry.
names()[geomi]
1209 <<
" bounds not fully contained in mesh" <<
nl 1210 <<
" bounding box : " << bb <<
nl 1211 <<
" mesh bounding box : " <<
meshBb 1224 Info<<
"Reading refinement shells." <<
endl;
1231 Info<<
"Read refinement shells in = " 1235 Info<<
"Setting refinement level of surface to be consistent" 1236 <<
" with shells." <<
endl;
1238 Info<<
"Checked shell refinement in = " 1247 if (!limitDict.empty())
1249 Info<<
"Reading limit shells." <<
endl;
1254 if (!limitDict.empty())
1256 Info<<
"Read limit shells in = " 1266 unusedGeometries.erase(surfaces.
surfaces());
1267 unusedGeometries.erase(shells.shells());
1268 unusedGeometries.erase(limitShells.shells());
1270 if (unusedGeometries.size())
1273 <<
"The following geometry entries are not used:" <<
nl;
1274 for (
const label geomi : unusedGeometries)
1276 Info<<
" " << allGeomNames[geomi] <<
nl;
1288 Info<<
"Reading features." <<
endl;
1298 Info<<
"Read features in = " 1305 Info<<
"Checking for line geometry size relative to surface geometry." 1309 bool hasErrors = features.checkSizes
1327 <<
"Determining initial surface intersections" <<
nl 1328 <<
"-----------------------------------------" <<
nl 1348 Info<<
"Calculated surface intersections in = " 1353 meshRefiner.
printMeshInfo(debugLevel,
"Initial mesh",
true);
1370 Info<<
"Setting refinement level of surface to be consistent" 1371 <<
" with curvature." <<
endl;
1374 refineParams.curvature(),
1377 Info<<
"Checked curvature refinement in = " 1402 refineParams.addCellZonesToMesh(
mesh);
1417 <<
"Adding patches for surface regions" <<
nl 1418 <<
"----------------------------------" <<
nl 1428 <<
setw(6) <<
"Patch" 1429 <<
setw(20) <<
"Type" 1430 <<
setw(30) <<
"Region" <<
nl 1431 <<
setw(6) <<
"-----" 1432 <<
setw(20) <<
"----" 1440 forAll(surfaceGeometry, surfi)
1442 label geomi = surfaceGeometry[surfi];
1452 surfaces.
surfZones()[surfi].faceZoneNames();
1454 if (fzNames.
empty())
1463 if (surfacePatchInfo.
set(globalRegioni))
1468 surfacePatchInfo[globalRegioni]
1474 patchInfo.
set(
"type", wallPolyPatch::typeName);
1486 <<
setw(6) << patchi
1487 <<
setw(20) <<
pbm[patchi].type()
1488 <<
setw(30) << regNames[i] <<
nl;
1491 globalToMasterPatch[globalRegioni] = patchi;
1492 globalToSlavePatch[globalRegioni] = patchi;
1506 if (surfacePatchInfo.
set(globalRegioni))
1511 surfacePatchInfo[globalRegioni]
1517 patchInfo.
set(
"type", wallPolyPatch::typeName);
1529 <<
setw(6) << patchi
1530 <<
setw(20) <<
pbm[patchi].type()
1531 <<
setw(30) << regNames[i] <<
nl;
1534 globalToMasterPatch[globalRegioni] = patchi;
1538 const word slaveName = regNames[i] +
"_slave";
1541 if (surfacePatchInfo.
set(globalRegioni))
1546 surfacePatchInfo[globalRegioni]
1552 patchInfo.
set(
"type", wallPolyPatch::typeName);
1564 <<
setw(6) << patchi
1565 <<
setw(20) <<
pbm[patchi].type()
1566 <<
setw(30) << slaveName <<
nl;
1569 globalToSlavePatch[globalRegioni] = patchi;
1575 if (regNames.
size())
1579 const word& fzName = fzNames[fzi];
1580 label globalRegioni = surfaces.
globalRegion(surfi, fzi);
1585 pbm[globalToMasterPatch[globalRegioni]].
name(),
1586 pbm[globalToSlavePatch[globalRegioni]].
name(),
1598 Info<<
"Added patches in = " 1621 if (i != string::npos)
1623 word cz0 = fzName.substr(0, i);
1624 word cz1 = fzName.substr(i+4, fzName.size()-i+4);
1625 word slaveName(cz1 +
"_to_" + cz0);
1631 const word slaveName = fzName +
"_slave";
1637 if (faceZoneToPatches.
size())
1659 nFaces +=
pbm[adaptPatchIDs[i]].
size();
1694 <<
"You have selected decomposition method " 1695 << decomposer.typeName
1696 <<
" which is not parallel aware." <<
endl 1697 <<
"Please select one that is (hierarchical, ptscotch)" 1711 const bool wantRefine
1713 meshRefinement::get<bool>(
meshDict,
"castellatedMesh", dryRun)
1717 meshRefinement::get<bool>(
meshDict,
"snap", dryRun)
1719 const bool wantLayers
1721 meshRefinement::get<bool>(
meshDict,
"addLayers", dryRun)
1729 if (errorMsg.size() || IOerrorMsg.size())
1738 <<
"Missing/incorrect required dictionary entries:" <<
nl 1740 << IOerrorMsg.c_str() <<
nl 1741 << errorMsg.c_str() <<
nl <<
nl 1742 <<
"Exiting dry-run" <<
nl <<
endl;
1754 meshRefinement::FaceMergeType::GEOMETRIC;
1756 const bool mergePatchFaces
1761 if (!mergePatchFaces)
1763 Info<<
"Not merging patch-faces of cell to preserve" 1764 <<
" (split)hex cell shape." 1766 mergeType = meshRefinement::FaceMergeType::NONE;
1770 const bool mergeAcrossPatches
1775 if (mergeAcrossPatches)
1777 Info<<
"Merging co-planar patch-faces of cells" 1778 <<
", regardless of patch assignment" 1780 mergeType = meshRefinement::FaceMergeType::IGNOREPATCH;
1796 globalToMasterPatch,
1804 if (!overwrite && !debugLevel)
1810 refineDriver.doRefine
1815 refineParams.handleSnapProblems(),
1821 if (!keepPatches && !wantSnap && !wantLayers)
1837 Info<<
"Mesh refined in = " 1838 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
1850 globalToMasterPatch,
1855 if (!overwrite && !debugLevel)
1861 scalar curvature = refineParams.curvature();
1862 scalar planarAngle = refineParams.planarAngle();
1875 if (!keepPatches && !wantLayers)
1891 Info<<
"Mesh snapped in = " 1892 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
1912 globalToMasterPatch,
1918 const bool preBalance =
1922 if (!overwrite && !debugLevel)
1927 layerDriver.doLayers
1955 Info<<
"Layers added in = " 1956 <<
timer.cpuTimeIncrement() <<
" s." <<
endl;
1966 Info<<
"Checking final mesh ..." <<
endl;
1977 Info<<
"Finished meshing with " << nErrors <<
" illegal faces" 1978 <<
" (concave, zero area or negative cell pyramid volume)" 1984 Info<<
"Finished meshing without any errors" <<
endl;
1991 if (surfaceSimplify)
1993 addProfiling(surfaceSimplify,
"snappyHexMesh::surfaceSimplify");
2001 includePatches =
bMesh.patchSet
2012 if (!isA<processorPolyPatch>(
patch))
2014 includePatches.insert(patchi);
2024 "constant/triSurface/simplifiedSurface.stl" 2040 "internalCellCentres",
2049 cellCentres.
write();
2054 Info<<
"Finished meshing in = " 2063 if (errorMsg.size() || IOerrorMsg.size())
2071 <<
"Missing/incorrect required dictionary entries:" <<
nl 2073 << IOerrorMsg.c_str() <<
nl 2074 << errorMsg.c_str() <<
nl <<
nl 2075 <<
"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.
static void mapCombineGather(const List< commsStruct > &comms, Container &values, const CombineOp &cop, const int tag, const label comm)
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 void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
static 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.
fileName path() const
Return path = rootPath/caseName. Same as TimePaths::path()
Simple container to keep together layer specific information.
void clear() const
Clear any messages.
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
List of names generated by calling name() for each list item and filtered for matches.
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)
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.
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.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
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.
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 writeType writeLevel()
Get/set write level.
virtual const dictionary & dict() const =0
Return dictionary, if entry is a dictionary.
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 labelList addCellZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
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.
Ignore writing from objectRegistry::writeObject()
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
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.
labelList faceLabels(nFaceLabels)
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
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.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
const fvMesh & mesh() const
Reference to mesh.
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...
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.
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.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
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.
#define addProfiling(Name, Descr)
Define profiling trigger with specified name and description string.
vectorField pointField
pointField is a vectorField.
static void gatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
Gather data, but keep individual values separate. Uses the specified communication schedule...
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
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.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
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...
fileName globalPath() const
Return global path for the case = rootPath/globalCaseName. Same as TimePaths::globalPath() ...
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.
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
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.
graph_traits< Graph >::vertices_size_type size_type
const PtrList< surfaceZonesInfo > & surfZones() const
const vectorField & cellCentres() const
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 additional search methods and registered IO...
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
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.
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...
OBJstream os(runTime.globalPath()/outputName)
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.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
static const word canonicalName
The canonical name ("decomposeParDict") under which the MeshObject is registered. ...
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 (in seconds) since last call to cpuTimeIncrement()
static void addFaceZones(meshRefinement &meshRefiner, const refinementParameters &refineParams, const HashTable< Pair< word >> &faceZoneToPatches)
Helper: add faceZones and patches.
void updateIntersections(const labelList &changedFaces)
Find any intersection of surface. Store in surfaceIndex_.
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.
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 (not the indices) of a list.
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.
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. ...
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
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.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
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.
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 (in 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))
void setMinLevelFields(const shellSurfaces &shells)
Calculate minLevelFields according to both surface- and.
Foam::argList args(argc, argv)
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
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.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
static autoPtr< surfaceWriter > New(const word &writeType)
Return a reference to the selected surfaceWriter.
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.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
forAllConstIters(mixture.phases(), phase)
A keyword and a list of tokens is an 'entry'.
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.
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.