39 Foam::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"))
117 <<
"Cannot both specify 'locationInMesh' and 'locationsInMesh'" 121 else if (
dict.readIfPresent(
"locationsInMesh", pointsToZone))
124 label nZones = locationsInMesh_.
size();
125 locationsInMesh_.
setSize(nZones+pointsToZone.
size());
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
149 meshRefinement::get<scalar>(
dict,
"resolveFeatureAngle", dryRun)
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,
219 const polyMesh&
mesh,
234 const point& location = locations[i];
238 label globalCellI = -1;
240 if (localCellI != -1)
242 globalCellI = globalCells.toGlobal(localCellI);
245 reduce(globalCellI, maxOp<label>());
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;
281 DynamicList<label> indices(zonesInMesh.size());
285 if (!zonesInMesh[i].empty() && zonesInMesh[i] !=
"none")
299 DynamicList<label> indices(0);
303 if (zonesInMesh[i].empty() || zonesInMesh[i] ==
"none")
320 DynamicList<pointField> allLocations(zonesInMesh.size()+1);
321 DynamicList<word> allZoneNames(allLocations.size());
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);
348 return List<pointField>(std::move(allLocations));
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
void size(const label n)
Older name for setAddressableSize.
const labelIOList & zoneIDs
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Unit conversion functions.
constexpr char nl
The newline '\n' character (0x0a)
T & first()
Access first element of the list, position [0].
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
static const Enum< faceZoneType > faceZoneTypeNames
dictionary getZoneInfo(const word &fzName, surfaceZonesInfo::faceZoneType &faceType) const
Get patchInfo and faceType for faceZone.
labelList addCellZonesToMesh(polyMesh &) const
Add cellZones to mesh. Return indices of cellZones (or -1)
#define forAll(list, i)
Loop across all elements in list.
vectorField pointField
pointField is a vectorField.
void setSize(const label n)
Alias for resize()
dimensionedScalar cos(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
static labelList zonedLocations(const wordList &zonesInMesh)
Extract indices of named locations (so excludes 'keepPoints')
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
List< word > wordList
List of word.
vector point
Point is a vector.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
label nCells() const noexcept
Number of mesh cells.
static labelList findCells(const bool checkInsideMesh, const polyMesh &, const pointField &locations)
Checks that cells are in mesh. Returns cells (or -1) they.
static List< pointField > zonePoints(const pointField &locationsInMesh, const wordList &zonesInMesh, const pointField &locationsOutsideMesh)
Helper: per zone (entry in zonesInMesh) the locations with.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
messageStream Info
Information stream (stdout output on master, null elsewhere)
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.
List< label > labelList
A List of labels.
static labelList unzonedLocations(const wordList &zonesInMesh)
Extract indices of unnamed locations ('keepPoints')
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static label addCellZone(const word &name, const labelList &addressing, polyMesh &mesh)