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)),
90 dict.getOrDefault<
Switch>(
"handleSnapProblems", true)
94 dict.getOrDefault<
Switch>(
"interfaceRefine", true)
96 nErodeCellZone_(
dict.getOrDefault<label>(
"nCellZoneErodeIter", 0)),
97 nFilterIter_(
dict.getOrDefault<label>(
"nFilterIter", 2)),
98 minCellFraction_(
dict.getOrDefault<scalar>(
"minCellFraction", 0)),
99 nMinCells_(
dict.getOrDefault<label>(
"nMinCells", 0)),
102 point locationInMesh;
104 if (
dict.readIfPresent(
"locationInMesh", locationInMesh))
106 locationsInMesh_.
append(locationInMesh);
107 zonesInMesh_.
append(
"none");
109 if (
dict.found(
"locationsInMesh"))
112 <<
"Cannot both specify 'locationInMesh' and 'locationsInMesh'" 116 else if (
dict.readIfPresent(
"locationsInMesh", pointsToZone))
119 label nZones = locationsInMesh_.
size();
120 locationsInMesh_.
setSize(nZones+pointsToZone.
size());
125 locationsInMesh_[nZones] = pointsToZone[i].
first();
126 zonesInMesh_[nZones] = pointsToZone[i].second();
129 zonesInMesh_[nZones] =
"none";
137 <<
"No 'locationInMesh' or 'locationsInMesh' provided" 142 const scalar featAngle
144 meshRefinement::get<scalar>(
dict,
"resolveFeatureAngle", dryRun)
147 if (featAngle < 0 || featAngle > 180)
166 dictionary patchInfo;
167 patchInfo.
add(
"type", wallPolyPatch::typeName);
170 if (faceZoneControls_.found(fzName))
172 const dictionary& fzDict = faceZoneControls_.subDict(fzName);
174 if (fzDict.found(
"patchInfo"))
176 patchInfo = fzDict.subDict(
"patchInfo");
180 if (fzDict.readIfPresent(
"faceType", faceTypeName))
197 if (zonesInMesh_[i] !=
word::null && zonesInMesh_[i] !=
"none")
213 const bool checkInsideMesh,
214 const polyMesh&
mesh,
229 const point& location = locations[i];
233 label globalCellI = -1;
235 if (localCellI != -1)
237 globalCellI = globalCells.toGlobal(localCellI);
240 reduce(globalCellI, maxOp<label>());
242 if (checkInsideMesh && globalCellI == -1)
245 <<
"Point " << location
246 <<
" is not inside the mesh or on a face or edge." <<
nl 247 <<
"Bounding box of the mesh:" <<
mesh.
bounds()
252 label procI = globalCells.whichProcID(globalCellI);
253 label procCellI = globalCells.toLocal(procI, globalCellI);
255 Info<<
"Found point " << location <<
" in cell " << procCellI
256 <<
" on processor " << procI <<
endl;
258 if (globalCells.isLocal(globalCellI))
260 cellLabels[i] = localCellI;
276 DynamicList<label> indices(zonesInMesh.size());
283 && zonesInMesh[i] !=
"none" 298 DynamicList<label> indices(0);
305 || zonesInMesh[i] ==
"none" 323 DynamicList<pointField> allLocations(zonesInMesh.size()+1);
324 DynamicList<word> allZoneNames(allLocations.size());
330 zonesInMesh[i].empty()
334 const point& pt = locationsInMesh[i];
336 const label index = allZoneNames.find(
name);
339 allZoneNames.append(
name);
344 allLocations[index].append(pt);
348 allZoneNames.append(
"outside");
349 allLocations.append(locationsOutsideMesh);
351 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.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
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 INVALID.
static labelList zonedLocations(const wordList &zonesInMesh)
Extract indices of named locations (so excludes 'keepPoints')
static const word null
An empty word.
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
A List of words.
const boundBox & bounds() const
Return mesh bounding box.
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.
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.
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)
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.
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)