56 Foam::label Foam::snappySnapDriver::getCollocatedPoints
60 PackedBoolList& isCollocatedPoint
71 bool hasMerged = (nUnique < points.size());
79 label nCollocated = 0;
84 forAll(pointMap, oldPointi)
86 label newPointi = pointMap[oldPointi];
88 if (firstOldPoint[newPointi] == -1)
93 else if (firstOldPoint[newPointi] == -2)
96 isCollocatedPoint.set(oldPointi, 1u);
102 isCollocatedPoint.set(firstOldPoint[newPointi], 1u);
105 isCollocatedPoint.set(oldPointi, 1u);
118 const motionSmoother& meshMover,
119 const List<labelPair>& baffles
125 PackedBoolList nonManifoldPoint(pp.nPoints());
126 label nNonManifoldPoints = getCollocatedPoints
132 Info<<
"Found " << nNonManifoldPoints <<
" non-manifold point(s)." 150 const labelList& meshPoints = pp.meshPoints();
152 const polyMesh& mesh = meshMover.mesh();
160 label f0 = baffles[i].first();
161 label f1 = baffles[i].second();
163 if (isMasterFace.get(f0))
166 isMasterFace.unset(f1);
168 else if (isMasterFace.get(f1))
170 isMasterFace.unset(f0);
175 <<
"Both sides of baffle consisting of faces " << f0
176 <<
" and " << f1 <<
" are already slave faces." 187 labelList nBoundary(pointFaces.size(), 0);
189 forAll(pointFaces, patchPointi)
191 const labelList& pFaces = pointFaces[patchPointi];
195 label facei = pFaces[pfI];
197 if (isMasterFace.get(pp.addressing()[facei]))
199 avgBoundary[patchPointi] += pp[facei].centre(points);
200 nBoundary[patchPointi]++;
224 avgBoundary[i] /= nBoundary[i];
238 const faceList& faces = mesh.faces();
240 for (
label facei = 0; facei < mesh.nInternalFaces(); facei++)
242 const face& f = faces[facei];
243 const point& fc = mesh.faceCentres()[facei];
247 globalSum[f[fp]] += fc;
253 const polyBoundaryMesh& patches = mesh.boundaryMesh();
259 patches[patchi].coupled()
260 && refCast<const coupledPolyPatch>(patches[patchi]).owner()
263 const coupledPolyPatch& pp =
264 refCast<const coupledPolyPatch>(patches[
patchi]);
270 const face& f = pp[i];
271 const point& fc = faceCentres[i];
275 globalSum[f[fp]] += fc;
297 avgInternal.setSize(meshPoints.size());
298 nInternal.setSize(meshPoints.size());
300 forAll(avgInternal, patchPointi)
302 label meshPointi = meshPoints[patchPointi];
304 nInternal[patchPointi] = globalNum[meshPointi];
306 if (nInternal[patchPointi] == 0)
308 avgInternal[patchPointi] = globalSum[meshPointi];
312 avgInternal[patchPointi] =
313 globalSum[meshPointi]
314 / nInternal[patchPointi];
324 forAll(mesh.faceNeighbour(), facei)
326 label own = mesh.faceOwner()[facei];
327 const face& f = mesh.faces()[facei];
331 anyCell[f[fp]] = own;
334 for (
label facei = mesh.nInternalFaces(); facei < mesh.nFaces(); facei++)
336 label own = mesh.faceOwner()[facei];
338 const face& f = mesh.faces()[facei];
342 anyCell[f[fp]] = own;
352 label meshPointi = meshPoints[i];
353 const point& currentPos = pp.points()[meshPointi];
364 if (!nonManifoldPoint.get(i))
368 scalar internalBlend = 0.1;
373 internalBlend*nInternal[i]*avgInternal[i]
374 +(1-internalBlend)*nBoundary[i]*avgBoundary[i]
376 / (internalBlend*nInternal[i]+(1-internalBlend)*nBoundary[i]);
378 newPos = (1-blend)*avgPos + blend*currentPos;
380 else if (nInternal[i] == 0)
386 const point& cc = mesh.cellCentres()[anyCell[meshPointi]];
388 scalar cellCBlend = 0.8;
391 point avgPos = (1-cellCBlend)*avgBoundary[i] + cellCBlend*cc;
393 newPos = (1-blend)*avgPos + blend*currentPos;
398 scalar internalBlend = 0.9;
402 internalBlend*avgInternal[i]
403 + (1-internalBlend)*avgBoundary[i];
405 newPos = (1-blend)*avgPos + blend*currentPos;
408 patchDisp[i] = newPos - currentPos;
417 const pointMesh& pMesh,
421 const polyMesh& mesh = pMesh();
424 List<pointEdgePoint> wallInfo(pp.nPoints());
426 forAll(pp.localPoints(), ppI)
428 wallInfo[ppI] = pointEdgePoint(pp.localPoints()[ppI], 0.0);
432 List<pointEdgePoint> allPointInfo(mesh.nPoints());
435 List<pointEdgePoint> allEdgeInfo(mesh.nEdges());
437 PointEdgeWave<pointEdgePoint> wallCalc
445 mesh.globalData().nTotalPoints()
449 tmp<scalarField> tedgeDist(
new scalarField(mesh.nEdges()));
452 forAll(allEdgeInfo, edgeI)
454 edgeDist[edgeI] =
Foam::sqrt(allEdgeInfo[edgeI].distSqr());
497 void Foam::snappySnapDriver::dumpMove
499 const fileName& fName,
505 Info<<
"Dumping move direction to " << fName <<
endl;
507 OFstream nearestStream(fName);
519 nearestStream<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
524 bool Foam::snappySnapDriver::outwardsDisplacement
533 forAll(pointFaces, pointi)
535 const labelList& pFaces = pointFaces[pointi];
537 vector disp(patchDisp[pointi]);
539 scalar magDisp =
mag(disp);
549 Warning<<
"Displacement " << patchDisp[pointi]
550 <<
" at mesh point " << pp.meshPoints()[pointi]
551 <<
" coord " << pp.points()[pp.meshPoints()[pointi]]
552 <<
" points through the surrounding patch faces" <<
endl;
574 meshRefiner_(meshRefiner),
575 globalToMasterPatch_(globalToMasterPatch),
576 globalToSlavePatch_(globalToSlavePatch)
594 if (zonedSurfaces.
size() && nBaffles > 0)
597 Info<<
"Converting " << nBaffles <<
" baffles back into zoned faces ..." 600 map = meshRefiner_.mergeBaffles(baffles);
602 Info<<
"Converted baffles in = " 603 << meshRefiner_.mesh().time().cpuTimeIncrement()
624 forAll(pointEdges, pointi)
626 const labelList& pEdges = pointEdges[pointi];
630 const edge&
e = edges[pEdges[pEdgeI]];
632 scalar len = e.
mag(localPoints);
634 maxEdgeLen[pointi] =
max(maxEdgeLen[pointi], len);
655 const label nInitErrors,
664 Info<<
"Smoothing patch points ..." <<
endl;
667 label smoothIter = 0;
672 Info<<
"Smoothing iteration " << smoothIter <<
endl;
676 checkFaces[facei] = facei;
679 pointField patchDisp(smoothPatchDisplacement(meshMover, baffles));
690 scalar oldErrorReduction = -1;
692 for (
label snapIter = 0; snapIter < 2*snapParams.
nSnap(); snapIter++)
694 Info<<
nl <<
"Scaling iteration " << snapIter <<
endl;
696 if (snapIter == snapParams.
nSnap())
698 Info<<
"Displacement scaling for error reduction set to 0." 705 if (meshMover.
scaleMesh(checkFaces, baffles,
true, nInitErrors))
707 Info<<
"Successfully moved mesh" <<
endl;
712 if (oldErrorReduction >= 0)
726 Info<<
"Writing patch smoothed mesh to time " 738 Info<<
"Dumped mesh in = " 742 Info<<
"Patch points smoothed in = " 759 <<
"Cannot find zone " << zoneName
777 label meshPointi = f[fp];
784 label pointi = iter();
785 pointOnZone[pointi] =
true;
810 forAll(pointFaces, pointi)
812 const labelList& pFaces = pointFaces[pointi];
816 label facei = pFaces[pfI];
817 label meshFacei = pp.addressing()[facei];
844 avgBoundary[i] /= nBoundary[i];
852 const scalar planarCos,
860 Info<<
"Detecting near surfaces ..." <<
endl;
865 const fvMesh& mesh = meshRefiner_.mesh();
1146 const pointField avgCc(avgCellCentres(mesh, pp));
1151 forAll(localPoints, pointi)
1153 const point& pt = localPoints[pointi];
1154 const vector d = 2*(avgCc[pointi]-pt);
1155 start[pointi] = pt - d;
1156 end[pointi] = pt + d;
1168 /
"detectNearSurfaces_" + meshRefiner_.timeName() +
".obj" 1183 label nOverride = 0;
1191 meshRefiner_.surfaces().surfZones()
1222 forAll(localPoints, pointi)
1225 const point& pt = localPoints[pointi];
1227 bool override =
false;
1266 if (hit1[pointi].hit() && hit2[pointi].hit())
1273 hit1[pointi].hitPoint(),
1275 hit2[pointi].hitPoint(),
1285 const point& intPt = hit2[pointi].hitPoint();
1290 disp[pointi] = hit2[pointi].hitPoint()-pt;
1295 if (
override && isPatchMasterPoint[pointi])
1317 label zoneSurfI = zonedSurfaces[i];
1319 const word& faceZoneName = surfZones[zoneSurfI].faceZoneName();
1321 const labelList surfacesToTest(1, zoneSurfI);
1326 getZoneSurfacePoints
1364 label pointi = zonePointIndices[i];
1367 const point& pt = localPoints[pointi];
1369 bool override =
false;
1408 if (hit1[i].hit() && hit2[i].hit())
1424 const point& intPt = hit2[i].hitPoint();
1428 disp[pointi] = hit2[i].hitPoint()-pt;
1433 if (
override && isPatchMasterPoint[pointi])
1441 Info<<
"Overriding nearest with intersection of close gaps at " 1444 <<
" points." <<
endl;
1457 Info<<
"Calculating patchDisplacement as distance to nearest surface" 1458 <<
" point ..." <<
endl;
1492 if (nearestNormal.
size() == localPoints.
size())
1509 if (hitInfo[pointi].hit())
1511 nearestPoint[pointi] = hitInfo[pointi].hitPoint();
1512 nearestNormal[pointi] = hitNormal[pointi];
1530 if (hitInfo[pointi].hit())
1533 hitInfo[pointi].hitPoint()
1534 - localPoints[pointi];
1536 snapSurf[pointi] = hitSurface[pointi];
1554 label zoneSurfI = zonedSurfaces[i];
1556 const word& faceZoneName = surfZones[zoneSurfI].faceZoneName();
1558 const labelList surfacesToTest(1, zoneSurfI);
1563 getZoneSurfacePoints
1575 if (nearestNormal.
size() == localPoints.
size())
1592 if (hitInfo[i].hit())
1594 label pointi = zonePointIndices[i];
1595 nearestPoint[pointi] = hitInfo[i].hitPoint();
1596 nearestNormal[pointi] = hitNormal[i];
1614 label pointi = zonePointIndices[i];
1616 if (hitInfo[i].hit())
1619 hitInfo[i].hitPoint()
1620 - localPoints[pointi];
1622 minSnapDist[pointi] =
min 1624 minSnapDist[pointi],
1625 mag(patchDisp[pointi])
1628 snapSurf[pointi] = zoneSurfI;
1636 if (snapSurf[pointi] == -1)
1639 <<
"For point:" << pointi
1640 <<
" coordinate:" << localPoints[pointi]
1641 <<
" did not find any surface within:" 1642 << minSnapDist[pointi]
1643 <<
" metre." <<
endl;
1659 Info<<
"Wanted displacement : average:" 1661 <<
" min:" <<
gMin(magDisp)
1662 <<
" max:" <<
gMax(magDisp) <<
endl;
1666 Info<<
"Calculated surface displacement in = " 1671 forAll(patchDisp, patchPointi)
1673 scalar magDisp =
mag(patchDisp[patchPointi]);
1675 if (magDisp > snapDist[patchPointi])
1677 patchDisp[patchPointi] *= snapDist[patchPointi] / magDisp;
1679 Pout<<
"Limiting displacement for " << patchPointi
1680 <<
" from " << magDisp <<
" to " << snapDist[patchPointi]
1693 vector(great, great, great)
1706 const fvMesh& mesh = meshRefiner_.mesh();
1709 Info<<
"Smoothing displacement ..." <<
endl;
1721 if ((iter % 10) == 0)
1723 Info<<
"Iteration " << iter <<
endl;
1726 meshMover.
smooth(oldDisp, edgeGamma, disp);
1728 Info<<
"Displacement smoothed in = " 1734 Info<<
"Writing smoothed mesh to time " << meshRefiner_.timeName()
1749 mesh.
time().
path()/meshRefiner_.timeName()
1751 Info<<
"Writing displacement field ..." <<
endl;
1756 Info<<
"Writing actual patch displacement ..." <<
endl;
1761 /
"actualPatchDisplacement_" + meshRefiner_.timeName() +
".obj",
1772 const label nInitErrors,
1777 const fvMesh& mesh = meshRefiner_.mesh();
1783 scalar oldErrorReduction = -1;
1785 bool meshOk =
false;
1788 for (
label iter = 0; iter < 2*snapParams.
nSnap(); iter++)
1792 if (iter == snapParams.
nSnap())
1794 Info<<
"Displacement scaling for error reduction set to 0." <<
endl;
1798 meshOk = meshMover.
scaleMesh(checkFaces, baffles,
true, nInitErrors);
1802 Info<<
"Successfully moved mesh" <<
endl;
1808 Info<<
"Writing scaled mesh to time " << meshRefiner_.timeName()
1812 Info<<
"Writing displacement field ..." <<
endl;
1819 if (oldErrorReduction >= 0)
1823 Info<<
"Moved mesh in = " 1837 const fvMesh& mesh = meshRefiner_.mesh();
1840 Info<<
"Repatching faces according to nearest surface ..." <<
endl;
1864 forAll(preserveFaces, facei)
1866 if (preserveFaces[facei] != -1)
1868 isZonedFace.set(facei, 1);
1878 const label zoneSurfI = zonedSurfaces[i];
1879 const faceZone& fZone = fZones[surfZones[zoneSurfI].faceZoneName()];
1883 isZonedFace.set(fZone[i], 1);
1911 forAll(localFaces, facei)
1913 const face& f = localFaces[facei];
1917 faceSnapDist[facei] =
max 1919 faceSnapDist[facei],
1943 label facei = pp.addressing()[i];
1945 if (hitSurface[i] != -1 && !isZonedFace.get(facei))
1947 closestPatch[i] = globalToMasterPatch_
1982 label facei = pp.addressing()[i];
1984 if (closestPatch[i] != -1 && closestPatch[i] != ownPatch[facei])
1986 ownPatch[facei] = closestPatch[i];
1987 neiPatch[facei] = closestPatch[i];
1996 return meshRefiner_.createBaffles(ownPatch, neiPatch);
2000 void Foam::snappySnapDriver::detectWarpedFaces
2002 const scalar featureCos,
2009 const fvMesh& mesh = meshRefiner_.mesh();
2012 const labelList& bFaces = pp.addressing();
2025 forAll(localFaces, facei)
2027 const face& f = localFaces[facei];
2035 scalar minCos(great);
2037 for (
label startFp = 0; startFp < f.
size()-2; startFp++)
2044 endFp < f.
size() && endFp != minFp;
2051 for (
label fp = startFp; fp <= endFp; fp++)
2057 for (
label fp = endFp; fp != startFp; fp = f.
fcIndex(fp))
2061 f1[i1++] = f[startFp];
2067 const scalar n0Mag =
mag(n0);
2069 const scalar n1Mag =
mag(n1);
2071 if (n0Mag > rootVSmall && n1Mag > rootVSmall)
2073 scalar cosAngle = (n0/n0Mag) & (n1/n1Mag);
2074 if (cosAngle < minCos)
2084 if (minCos < featureCos)
2086 splitFaces.
append(bFaces[facei]);
2098 const scalar featureCos,
2099 const scalar planarAngle,
2103 fvMesh& mesh = meshRefiner_.mesh();
2106 <<
"Morphing phase" <<
nl 2107 <<
"--------------" <<
nl 2111 labelList adaptPatchIDs(meshRefiner_.meshedPatches());
2152 meshRefiner_.createZoneBaffles
2154 globalToMasterPatch_,
2155 globalToSlavePatch_,
2183 label nFilterFaces = 0;
2186 label nDuplicatePoints = 0;
2189 const word& faceZoneName = surfZones[surfI].faceZoneName();
2191 if (faceZoneName.size())
2194 surfZones[surfI].faceType();
2204 const faceZone& fZone = fZones[zoneI];
2207 label facei = fZone[i];
2208 filterFace[facei] = zoneI;
2216 label facei = fZone[i];
2219 duplicateFace[facei] = -1;
2224 if (!duplicatePoint[f[fp]])
2226 duplicatePoint[f[fp]] = 1;
2233 Info<<
"Surface : " << surfaces.
names()[surfI] <<
nl 2234 <<
" faces to become baffle : " 2236 <<
" points to duplicate : " 2261 nDuplicatePoints = 0;
2262 forAll(duplicatePoint, pointi)
2264 if (duplicatePoint[pointi])
2269 labelList candidatePoints(nDuplicatePoints);
2270 nDuplicatePoints = 0;
2271 forAll(duplicatePoint, pointi)
2273 if (duplicatePoint[pointi])
2275 candidatePoints[nDuplicatePoints++] = pointi;
2300 const labelList& reverseFaceMap = mapPtr().reverseFaceMap();
2305 baffle.
first() = reverseFaceMap[baffle.
first()];
2312 Pout<<
"Writing duplicatedPoints mesh to time " 2313 << meshRefiner_.timeName()
2323 mesh.
time().
path()/
"duplicatedPoints" 2336 filterFace[baffle.
first()] == -1
2337 && filterFace[baffles[i].second()] == -1
2340 newBaffles.append(baffle);
2344 if (newBaffles.size() < baffles.size())
2356 bool doFeatures =
false;
2357 label nFeatIter = 1;
2363 Info<<
"Snapping to features in " << nFeatIter
2364 <<
" iterations ..." <<
endl;
2368 bool meshOk =
false;
2382 const scalarField snapDist(calcSnapDistance(mesh, snapParams, ppPtr()));
2386 Info<<
"Constructing mesh displacer ..." <<
endl;
2387 Info<<
"Using mesh parameters " << motionDict <<
nl <<
endl;
2407 Info<<
"Checking initial mesh ..." <<
endl;
2416 Info<<
"Detected " << nInitErrors <<
" illegal faces" 2417 <<
" (concave, zero area or negative cell pyramid volume)" 2421 Info<<
"Checked initial mesh in = " 2443 for (
label iter = 0; iter < nFeatIter; iter++)
2669 <<
"Morph iteration " << iter <<
nl 2670 <<
"-----------------" <<
endl;
2715 disp = calcNearestSurfaceFeature
2721 scalar(iter+1)/nFeatIter,
2731 outwardsDisplacement(pp, disp);
2744 /
"patchDisplacement_" +
name(iter) +
".obj",
2751 smoothDisplacement(snapParams, meshMover);
2765 <<
"Did not successfully snap mesh." 2766 <<
" Continuing to snap to resolve easy" <<
nl 2767 <<
" surfaces but the" 2768 <<
" resulting mesh will not satisfy your quality" 2769 <<
" constraints" <<
nl <<
endl;
2775 Info<<
"Writing scaled mesh to time " 2776 << meshRefiner_.timeName() <<
endl;
2785 mesh.
time().
path()/meshRefiner_.timeName()
2787 Info<<
"Writing displacement field ..." <<
endl;
2808 forAll(duplicateFace, facei)
2810 if (duplicateFace[facei] != -1)
2812 duplicateFace[facei] = mapPtr().reverseFaceMap()[facei];
2837 label nChanged = meshRefiner_.mergePatchFacesUndo
2841 meshRefiner_.meshedPatches(),
2846 nChanged += meshRefiner_.mergeEdgesUndo(featureCos, motionDict);
2851 Info<<
"Writing patchFace merged mesh to time " 2852 << meshRefiner_.timeName() <<
endl;
2861 meshRefiner_.timeName()
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces)
Check mesh with mesh settings in dict. Collects incorrect faces.
Given a displacement moves the mesh by scaling the displacement back until there are no more mesh err...
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const labelListList & pointEdges() const
Return point-edge addressing.
Switch detectNearSurfacesSnap() const
List< labelList > labelListList
A List of labelList.
label nPoints() const
Return number of points supporting patch faces.
const refinementSurfaces & surfaces() const
Reference to surface search engines.
#define forAll(list, i)
Loop across all elements in list.
fileName path() const
Return path.
label nSmoothDispl() const
Number of mesh displacement smoothing iterations.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const labelList & surfaces() const
bool scaleMesh(const snapParameters &snapParams, const label nInitErrors, const List< labelPair > &baffles, motionSmoother &)
Do the hard work: move the mesh according to displacement,.
snappySnapDriver(meshRefinement &meshRefiner, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch)
Construct from components.
const faceZoneMesh & faceZones() const
Return face zone mesh.
static const Vector< scalar > max
errorManipArg< error, int > exit(error &err, const int errNo=1)
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
A face is a list of labels corresponding to mesh vertices.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type gMin(const FieldField< Field, Type > &f)
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
static void setDisplacement(const labelList &patchIDs, const indirectPrimitivePatch &pp, pointField &patchDisp, pointVectorField &displacement)
Set displacement field from displacement on patch points.
autoPtr< mapPolyMesh > mergeZoneBaffles(const List< labelPair > &)
Merge baffles.
T & ref() const
Return non-const reference or generate a fatal error.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Unit conversion functions.
bool scaleMesh(labelList &checkFaces, const bool smoothMesh=true, const label nAllow=0)
Move mesh with given scale. Return true if mesh ok or has.
void doSnap(const dictionary &snapDict, const dictionary &motionDict, const scalar featureCos, const scalar planarAngle, const snapParameters &snapParams)
void size(const label)
Override size to be inconsistent with allocated storage.
const pointMesh & pMesh() const
Reference to pointMesh.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
label nSmoothPatch() const
Number of patch smoothing iterations before finding.
void detectNearSurfaces(const scalar planarCos, const indirectPrimitivePatch &, const pointField &nearestPoint, const vectorField &nearestNormal, vectorField &disp) const
Per patch point override displacement if in gap situation.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static writeType writeLevel()
Get/set write level.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Vector< scalar > vector
A scalar version of the templated Vector.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
const Time & time() const
Return the top-level database.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
void findNearest(const labelList &surfacesToTest, const pointField &samples, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &) const
Find nearest point on surfaces.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
label nFeatureSnap() const
static labelList getZoneSurfacePoints(const fvMesh &mesh, const indirectPrimitivePatch &, const word &zoneName)
Get points both on patch and facezone.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Takes mesh with 'baffles' (= boundary faces sharing points). Determines for selected points on bounda...
const fvMesh & mesh() const
Reference to mesh.
static const pointMesh & New(const polyMesh &mesh)
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
void correct()
Take over existing mesh position.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
A list of faces which address into the list of points.
Determines the 'side' for every face and connected to a singly-connected (through edges) region of fa...
const Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
vectorField pointField
pointField is a vectorField.
scalar setErrorReduction(const scalar)
Set the errorReduction (by how much to scale the displacement.
An ordered pair of two objects of type <T> with first() and second() elements.
dimensionedScalar cos(const dimensionedScalar &ds)
line< point, const point & > linePointRef
Line using referred points.
void findNearestRegion(const labelList &surfacesToTest, const pointField &samples, const scalarField &nearestDistSqr, labelList &hitSurface, labelList &hitRegion) const
Find nearest point on surfaces. Return surface and region on.
label findZoneID(const word &zoneName) const
Find zone index given a name.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Simple container to keep together snap specific information.
double cpuTimeIncrement() const
Return CPU time (in seconds) since last call to cpuTimeIncrement()
autoPtr< mapPolyMesh > repatchToSurface(const snapParameters &snapParams, const labelList &adaptPatchIDs, const labelList &preserveFaces)
Repatch faces according to surface nearest the face centre.
void transfer(const FixedList< T, Size > &)
Copy (not transfer) the argument contents.
void setCapacity(const label)
Alter the size of the underlying storage.
virtual const labelList & faceOwner() const
Return face owner.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void smoothDisplacement(const snapParameters &snapParams, motionSmoother &) const
Smooth the displacement field to the internal.
Pair< label > labelPair
Label pair.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
List< label > labelList
A List of labels.
static void preSmoothPatch(const meshRefinement &meshRefiner, const snapParameters &snapParams, const label nInitErrors, const List< labelPair > &baffles, motionSmoother &)
Smooth the mesh (patch and internal) to increase visibility.
scalar mag(const pointField &) const
Return scalar magnitude.
virtual const faceList & faces() const
Return raw faces.
const PtrList< surfaceZonesInfo > & surfZones() const
const vectorField & cellCentres() const
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
static labelList getUnnamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of unnamed surfaces (surfaces without faceZoneName)
errorManip< error > abort(error &err)
void smooth(const GeometricField< Type, pointPatchField, pointMesh > &fld, const scalarField &edgeWeight, GeometricField< Type, pointPatchField, pointMesh > &newFld) const
Fully explicit smoothing of fields (not positions)
word timeName() const
Replacement for Time::timeName() : return oldInstance (if.
static scalarField calcSnapDistance(const fvMesh &mesh, const snapParameters &snapParams, const indirectPrimitivePatch &)
Calculate edge length per patch point.
const labelListList & pointFaces() const
Return point-face addressing.
vector area(const pointField &) const
Return vector area.
OFstream which keeps track of vertices.
Type gMax(const FieldField< Field, Type > &f)
defineTypeNameAndDebug(combustionModel, 0)
const indirectPrimitivePatch & patch() const
Reference to patch.
static tmp< pointField > avgCellCentres(const fvMesh &mesh, const indirectPrimitivePatch &)
Helper: calculate average cell centre per point.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
word name(const complex &)
Return a string representation of a complex.
const Type & second() const
Return second.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
const vectorField & faceCentres() const
label nSnap() const
Maximum number of snapping relaxation iterations. Should stop.
void setSize(const label)
Reset size of List.
const wordList & names() const
Names of surfaces.
scalar snapTol() const
Relative distance for points to be attracted by surface.
static T gAverage(const PackedBoolList &isMasterElem, const UList< T > &values)
Helper: calculate average.
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
prefixOSstream Pout(cout, "Pout")
const List< FaceType > & localFaces() const
Return patch faces addressing into local point list.
Mesh data needed to do the Finite Volume discretisation.
label start() const
Return start label of this patch in the polyMesh face list.
label mergePoints(const UList< Type > &points, const scalar mergeTol, const bool verbose, labelList &pointMap, const Type &origin=Type::zero)
Sorts and merges points. All points closer than/equal mergeTol get merged.
label globalRegion(const label surfI, const label regionI) const
From surface and region on surface to global region.
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName)
SubField< vector > subField
Declare type of subField.
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
faceZoneType
What to do with faceZone faces.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual Ostream & write(const token &)=0
Write next token to stream.
const doubleScalar e
Elementary charge.
A subset of mesh faces organised as a primitive patch.
bool write() const
Write mesh and all data.
virtual bool write(const bool write=true) const
Write using setting from DB.
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
static PackedBoolList getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
void clear()
Clear the addressed list, i.e. set the size to zero.
void findNearestIntersection(const labelList &surfacesToTest, const pointField &start, const pointField &end, labelList &surface1, List< pointIndexHit > &hit1, labelList ®ion1, labelList &surface2, List< pointIndexHit > &hit2, labelList ®ion2) const
Find intersection nearest to the endpoints. surface1,2 are.
const Type & first() const
Return first.
static const Vector< scalar > zero
A HashTable to objects of type <T> with a label key.
pointVectorField & displacement()
Reference to displacement field.
static vectorField calcNearestSurface(const meshRefinement &meshRefiner, const scalarField &snapDist, const indirectPrimitivePatch &, pointField &nearestPoint, vectorField &nearestNormal)
Per patch point calculate point on nearest surface. Set as.