39Foam::refinementParameters::refinementParameters
62 dict.get<scalar>(
"resolveFeatureAngle")
73 "locationsOutsideMesh",
77 useLeakClosure_(
dict.getOrDefault<bool>(
"useLeakClosure", false)),
78 faceZoneControls_(
dict.subOrEmptyDict(
"faceZoneControls")),
79 allowFreeStandingZoneFaces_
83 useTopologicalSnapDetection_
85 dict.getOrDefault(
"useTopologicalSnapDetection", true)
87 maxLoadUnbalance_(
dict.getOrDefault<scalar>(
"maxLoadUnbalance", 0)),
88 maxCellUnbalance_(
dict.getOrDefault<label>(
"maxCellUnbalance", -1)),
91 dict.getOrDefault<
Switch>(
"handleSnapProblems", true)
95 dict.getOrDefault<
Switch>(
"interfaceRefine", true)
97 nErodeCellZone_(
dict.getOrDefault<label>(
"nCellZoneErodeIter", 0)),
98 nFilterIter_(
dict.getOrDefault<label>(
"nFilterIter", 2)),
99 minCellFraction_(
dict.getOrDefault<scalar>(
"minCellFraction", 0)),
100 nMinCells_(
dict.getOrDefault<label>(
"nMinCells", 0)),
103 dict.getOrDefault(
"balanceAtEnd", false)
107 point locationInMesh;
109 if (
dict.readIfPresent(
"locationInMesh", locationInMesh))
111 locationsInMesh_.append(locationInMesh);
112 zonesInMesh_.append(
"none");
114 if (dict.found(
"locationsInMesh"))
116 FatalIOErrorInFunction(dict)
117 <<
"Cannot both specify 'locationInMesh' and 'locationsInMesh'"
118 << exit(FatalIOError);
121 else if (
dict.readIfPresent(
"locationsInMesh", pointsToZone))
123 List<Tuple2<point, word>> pointsToZone(dict.lookup(
"locationsInMesh"));
124 label nZones = locationsInMesh_.size();
125 locationsInMesh_.setSize(nZones+pointsToZone.size());
126 zonesInMesh_.setSize(locationsInMesh_.size());
128 forAll(pointsToZone, i)
130 locationsInMesh_[nZones] = pointsToZone[i].first();
131 zonesInMesh_[nZones] = pointsToZone[i].second();
132 if (zonesInMesh_[nZones].empty())
134 zonesInMesh_[nZones] =
"none";
142 <<
"No 'locationInMesh' or 'locationsInMesh' provided"
147 const scalar featAngle
152 if (featAngle < 0 || featAngle > 180)
172 patchInfo.
add(
"type", wallPolyPatch::typeName);
175 if (faceZoneControls_.found(fzName))
177 const dictionary& fzDict = faceZoneControls_.subDict(fzName);
179 if (fzDict.found(
"patchInfo"))
181 patchInfo = fzDict.subDict(
"patchInfo");
185 if (fzDict.readIfPresent(
"faceType", faceTypeName))
202 if (!zonesInMesh_[i].empty() && zonesInMesh_[i] !=
"none")
218 const bool checkInsideMesh,
234 const point& location = locations[i];
238 label globalCellI = -1;
240 if (localCellI != -1)
242 globalCellI = globalCells.toGlobal(localCellI);
247 if (checkInsideMesh && globalCellI == -1)
250 <<
"Point " << location
251 <<
" is not inside the mesh or on a face or edge." <<
nl
252 <<
"Bounding box of the mesh:" <<
mesh.
bounds()
257 label procI = globalCells.whichProcID(globalCellI);
258 label procCellI = globalCells.toLocal(procI, globalCellI);
260 Info<<
"Found point " << location <<
" in cell " << procCellI
261 <<
" on processor " << procI <<
endl;
263 if (globalCells.isLocal(globalCellI))
265 cellLabels[i] = localCellI;
285 if (!zonesInMesh[i].empty() && zonesInMesh[i] !=
"none")
303 if (zonesInMesh[i].empty() || zonesInMesh[i] ==
"none")
327 zonesInMesh[i].empty()
331 const point& pt = locationsInMesh[i];
333 const label index = allZoneNames.find(
name);
336 allZoneNames.append(
name);
341 allLocations[index].append(pt);
345 allZoneNames.append(
"outside");
346 allLocations.append(locationsOutsideMesh);
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.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
void size(const label n)
Older name for setAddressableSize.
label find(const T &val) const
Find index of the first occurrence of the value.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
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...
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
label toLocal(const label proci, const label i) const
From global to local on proci.
label whichProcID(const label proci, const label i) const
Which processor does global id come from? Checks proci first (assumed to occur reasonably frequently)...
bool isLocal(const label proci, const label i) const
Is on processor proci.
label toGlobal(const label proci, const label i) const
From local to global on proci.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
static Type get(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt=keyType::REGEX, const Type &deflt=Zero)
Wrapper around dictionary::get which does not exit.
Mesh consisting of general polyhedral cells.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
const boundBox & bounds() const noexcept
Return mesh bounding box.
label nCells() const noexcept
Number of mesh cells.
static labelList unzonedLocations(const wordList &zonesInMesh)
Extract indices of unnamed locations ('keepPoints').
labelList addCellZonesToMesh(polyMesh &) const
Add cellZones to mesh. Return indices of cellZones (or -1).
static labelList zonedLocations(const wordList &zonesInMesh)
Extract indices of named locations (so excludes 'keepPoints').
const pointField & locationsOutsideMesh() const
Optional points which are checked to be outside the mesh.
static labelList findCells(const bool checkInsideMesh, const polyMesh &, const pointField &locations)
Checks that cells are in mesh. Returns cells (or -1) they.
const pointField & locationsInMesh() const
Areas to keep.
static List< pointField > zonePoints(const pointField &locationsInMesh, const wordList &zonesInMesh, const pointField &locationsOutsideMesh)
Helper: per zone (entry in zonesInMesh) the locations with.
dictionary getZoneInfo(const word &fzName, surfaceZonesInfo::faceZoneType &faceType) const
Get patchInfo and faceType for faceZone.
const wordList & zonesInMesh() const
Per area the zone name.
faceZoneType
What to do with faceZone faces.
static const Enum< faceZoneType > faceZoneTypeNames
static label addCellZone(const word &name, const labelList &addressing, polyMesh &mesh)
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelIOList & zoneIDs
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
List< word > wordList
List of word.
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.
constexpr scalar degToRad() noexcept
Multiplication factor for degrees to radians conversion.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
vector point
Point is a vector.
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.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar cos(const dimensionedScalar &ds)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.
Unit conversion functions.