61 Foam::label Foam::snappySnapDriver::getCollocatedPoints
65 PackedBoolList& isCollocatedPoint
76 bool hasMerged = (nUnique < points.size());
84 label nCollocated = 0;
89 forAll(pointMap, oldPointi)
91 label newPointi = pointMap[oldPointi];
93 if (firstOldPoint[newPointi] == -1)
98 else if (firstOldPoint[newPointi] == -2)
101 isCollocatedPoint.set(oldPointi, 1u);
107 isCollocatedPoint.set(firstOldPoint[newPointi], 1u);
110 isCollocatedPoint.set(oldPointi, 1u);
124 const motionSmoother& meshMover,
125 const List<labelPair>& baffles
131 PackedBoolList nonManifoldPoint(pp.nPoints());
132 label nNonManifoldPoints = getCollocatedPoints
138 Info<<
"Found " << nNonManifoldPoints <<
" non-manifold point(s)." 156 const labelList& meshPoints = pp.meshPoints();
158 const polyMesh& mesh = meshMover.mesh();
166 label f0 = baffles[i].first();
167 label f1 = baffles[i].second();
169 if (isMasterFace.get(f0))
172 isMasterFace.unset(f1);
174 else if (isMasterFace.get(f1))
176 isMasterFace.unset(f0);
181 <<
"Both sides of baffle consisting of faces " << f0
182 <<
" and " << f1 <<
" are already slave faces." 193 labelList nBoundary(pointFaces.size(), 0);
195 forAll(pointFaces, patchPointi)
197 const labelList& pFaces = pointFaces[patchPointi];
201 label facei = pFaces[pfI];
203 if (isMasterFace.get(pp.addressing()[facei]))
205 avgBoundary[patchPointi] += pp[facei].centre(points);
206 nBoundary[patchPointi]++;
230 avgBoundary[i] /= nBoundary[i];
244 const faceList& faces = mesh.faces();
246 for (
label facei = 0; facei < mesh.nInternalFaces(); facei++)
248 const face& f = faces[facei];
249 const point& fc = mesh.faceCentres()[facei];
253 globalSum[f[fp]] += fc;
259 const polyBoundaryMesh& patches = mesh.boundaryMesh();
265 patches[patchi].coupled()
266 && refCast<const coupledPolyPatch>(patches[patchi]).owner()
269 const coupledPolyPatch& pp =
270 refCast<const coupledPolyPatch>(patches[
patchi]);
276 const face& f = pp[i];
277 const point& fc = faceCentres[i];
281 globalSum[f[fp]] += fc;
303 avgInternal.setSize(meshPoints.size());
304 nInternal.setSize(meshPoints.size());
306 forAll(avgInternal, patchPointi)
308 label meshPointi = meshPoints[patchPointi];
310 nInternal[patchPointi] = globalNum[meshPointi];
312 if (nInternal[patchPointi] == 0)
314 avgInternal[patchPointi] = globalSum[meshPointi];
318 avgInternal[patchPointi] =
319 globalSum[meshPointi]
320 / nInternal[patchPointi];
330 forAll(mesh.faceNeighbour(), facei)
332 label own = mesh.faceOwner()[facei];
333 const face& f = mesh.faces()[facei];
337 anyCell[f[fp]] = own;
340 for (
label facei = mesh.nInternalFaces(); facei < mesh.nFaces(); facei++)
342 label own = mesh.faceOwner()[facei];
344 const face& f = mesh.faces()[facei];
348 anyCell[f[fp]] = own;
358 label meshPointi = meshPoints[i];
359 const point& currentPos = pp.points()[meshPointi];
370 if (!nonManifoldPoint.get(i))
374 scalar internalBlend = 0.1;
379 internalBlend*nInternal[i]*avgInternal[i]
380 +(1-internalBlend)*nBoundary[i]*avgBoundary[i]
382 / (internalBlend*nInternal[i]+(1-internalBlend)*nBoundary[i]);
384 newPos = (1-blend)*avgPos + blend*currentPos;
386 else if (nInternal[i] == 0)
392 const point& cc = mesh.cellCentres()[anyCell[meshPointi]];
394 scalar cellCBlend = 0.8;
397 point avgPos = (1-cellCBlend)*avgBoundary[i] + cellCBlend*cc;
399 newPos = (1-blend)*avgPos + blend*currentPos;
404 scalar internalBlend = 0.9;
408 internalBlend*avgInternal[i]
409 + (1-internalBlend)*avgBoundary[i];
411 newPos = (1-blend)*avgPos + blend*currentPos;
414 patchDisp[i] = newPos - currentPos;
484 const pointMesh& pMesh,
488 const polyMesh& mesh = pMesh();
491 List<pointEdgePoint> wallInfo(pp.nPoints());
493 forAll(pp.localPoints(), ppI)
495 wallInfo[ppI] = pointEdgePoint(pp.localPoints()[ppI], 0.0);
499 List<pointEdgePoint> allPointInfo(mesh.nPoints());
502 List<pointEdgePoint> allEdgeInfo(mesh.nEdges());
504 PointEdgeWave<pointEdgePoint> wallCalc
512 mesh.globalData().nTotalPoints()
516 tmp<scalarField> tedgeDist(
new scalarField(mesh.nEdges()));
519 forAll(allEdgeInfo, edgeI)
521 edgeDist[edgeI] =
Foam::sqrt(allEdgeInfo[edgeI].distSqr());
564 void Foam::snappySnapDriver::dumpMove
566 const fileName& fName,
572 Info<<
"Dumping move direction to " << fName <<
endl;
574 OFstream nearestStream(fName);
586 nearestStream<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
593 bool Foam::snappySnapDriver::outwardsDisplacement
602 forAll(pointFaces, pointi)
604 const labelList& pFaces = pointFaces[pointi];
606 vector disp(patchDisp[pointi]);
608 scalar magDisp =
mag(disp);
618 Warning<<
"Displacement " << patchDisp[pointi]
619 <<
" at mesh point " << pp.meshPoints()[pointi]
620 <<
" coord " << pp.points()[pp.meshPoints()[pointi]]
621 <<
" points through the surrounding patch faces" <<
endl;
636 Foam::snappySnapDriver::snappySnapDriver
643 meshRefiner_(meshRefiner),
644 globalToMasterPatch_(globalToMasterPatch),
645 globalToSlavePatch_(globalToSlavePatch)
663 if (zonedSurfaces.
size() && nBaffles > 0)
666 Info<<
"Converting " << nBaffles <<
" baffles back into zoned faces ..." 669 map = meshRefiner_.mergeBaffles(baffles);
671 Info<<
"Converted baffles in = " 672 << meshRefiner_.mesh().time().cpuTimeIncrement()
693 forAll(pointEdges, pointi)
695 const labelList& pEdges = pointEdges[pointi];
699 const edge&
e = edges[pEdges[pEdgeI]];
701 scalar len = e.
mag(localPoints);
703 maxEdgeLen[pointi] =
max(maxEdgeLen[pointi], len);
724 const label nInitErrors,
733 Info<<
"Smoothing patch points ..." <<
endl;
736 label smoothIter = 0;
741 Info<<
"Smoothing iteration " << smoothIter <<
endl;
745 checkFaces[facei] = facei;
748 pointField patchDisp(smoothPatchDisplacement(meshMover, baffles));
759 scalar oldErrorReduction = -1;
761 for (
label snapIter = 0; snapIter < 2*snapParams.
nSnap(); snapIter++)
763 Info<<
nl <<
"Scaling iteration " << snapIter <<
endl;
765 if (snapIter == snapParams.
nSnap())
767 Info<<
"Displacement scaling for error reduction set to 0." 774 if (meshMover.
scaleMesh(checkFaces, baffles,
true, nInitErrors))
776 Info<<
"Successfully moved mesh" <<
endl;
781 if (oldErrorReduction >= 0)
795 Info<<
"Writing patch smoothed mesh to time " 807 Info<<
"Dumped mesh in = " 811 Info<<
"Patch points smoothed in = " 829 <<
"Cannot find zone " << zoneName
847 label meshPointi = f[fp];
854 label pointi = iter();
855 pointOnZone[pointi] =
true;
880 forAll(pointFaces, pointi)
882 const labelList& pFaces = pointFaces[pointi];
886 label facei = pFaces[pfI];
887 label meshFacei = pp.addressing()[facei];
914 avgBoundary[i] /= nBoundary[i];
970 const scalar planarCos,
978 Info<<
"Detecting near surfaces ..." <<
endl;
983 const fvMesh& mesh = meshRefiner_.mesh();
1264 const pointField avgCc(avgCellCentres(mesh, pp));
1269 forAll(localPoints, pointi)
1271 const point& pt = localPoints[pointi];
1272 const vector d = 2*(avgCc[pointi]-pt);
1273 start[pointi] = pt - d;
1274 end[pointi] = pt + d;
1286 /
"detectNearSurfaces_" + meshRefiner_.timeName() +
".obj" 1301 label nOverride = 0;
1309 meshRefiner_.surfaces().surfZones()
1340 forAll(localPoints, pointi)
1343 const point& pt = localPoints[pointi];
1345 bool override =
false;
1384 if (hit1[pointi].hit() && hit2[pointi].hit())
1391 hit1[pointi].hitPoint(),
1393 hit2[pointi].hitPoint(),
1403 const point& intPt = hit2[pointi].hitPoint();
1408 disp[pointi] = hit2[pointi].hitPoint()-pt;
1413 if (
override && isPatchMasterPoint[pointi])
1435 label zoneSurfI = zonedSurfaces[i];
1437 const word& faceZoneName = surfZones[zoneSurfI].faceZoneName();
1439 const labelList surfacesToTest(1, zoneSurfI);
1444 getZoneSurfacePoints
1482 label pointi = zonePointIndices[i];
1485 const point& pt = localPoints[pointi];
1487 bool override =
false;
1526 if (hit1[i].hit() && hit2[i].hit())
1542 const point& intPt = hit2[i].hitPoint();
1546 disp[pointi] = hit2[i].hitPoint()-pt;
1551 if (
override && isPatchMasterPoint[pointi])
1559 Info<<
"Overriding nearest with intersection of close gaps at " 1562 <<
" points." <<
endl;
1575 Info<<
"Calculating patchDisplacement as distance to nearest surface" 1576 <<
" point ..." <<
endl;
1610 if (nearestNormal.
size() == localPoints.
size())
1627 if (hitInfo[pointi].hit())
1629 nearestPoint[pointi] = hitInfo[pointi].hitPoint();
1630 nearestNormal[pointi] = hitNormal[pointi];
1648 if (hitInfo[pointi].hit())
1651 hitInfo[pointi].hitPoint()
1652 - localPoints[pointi];
1654 snapSurf[pointi] = hitSurface[pointi];
1672 label zoneSurfI = zonedSurfaces[i];
1674 const word& faceZoneName = surfZones[zoneSurfI].faceZoneName();
1676 const labelList surfacesToTest(1, zoneSurfI);
1681 getZoneSurfacePoints
1693 if (nearestNormal.
size() == localPoints.
size())
1710 if (hitInfo[i].hit())
1712 label pointi = zonePointIndices[i];
1713 nearestPoint[pointi] = hitInfo[i].hitPoint();
1714 nearestNormal[pointi] = hitNormal[i];
1732 label pointi = zonePointIndices[i];
1734 if (hitInfo[i].hit())
1737 hitInfo[i].hitPoint()
1738 - localPoints[pointi];
1740 minSnapDist[pointi] =
min 1742 minSnapDist[pointi],
1743 mag(patchDisp[pointi])
1746 snapSurf[pointi] = zoneSurfI;
1754 if (snapSurf[pointi] == -1)
1757 <<
"For point:" << pointi
1758 <<
" coordinate:" << localPoints[pointi]
1759 <<
" did not find any surface within:" 1760 << minSnapDist[pointi]
1761 <<
" metre." <<
endl;
1777 Info<<
"Wanted displacement : average:" 1779 <<
" min:" <<
gMin(magDisp)
1780 <<
" max:" <<
gMax(magDisp) <<
endl;
1784 Info<<
"Calculated surface displacement in = " 1789 forAll(patchDisp, patchPointi)
1791 scalar magDisp =
mag(patchDisp[patchPointi]);
1793 if (magDisp > snapDist[patchPointi])
1795 patchDisp[patchPointi] *= snapDist[patchPointi] / magDisp;
1797 Pout<<
"Limiting displacement for " << patchPointi
1798 <<
" from " << magDisp <<
" to " << snapDist[patchPointi]
1811 vector(GREAT, GREAT, GREAT)
2072 const fvMesh& mesh = meshRefiner_.mesh();
2075 Info<<
"Smoothing displacement ..." <<
endl;
2087 if ((iter % 10) == 0)
2089 Info<<
"Iteration " << iter <<
endl;
2092 meshMover.
smooth(oldDisp, edgeGamma, disp);
2094 Info<<
"Displacement smoothed in = " 2100 Info<<
"Writing smoothed mesh to time " << meshRefiner_.timeName()
2115 mesh.
time().
path()/meshRefiner_.timeName()
2117 Info<<
"Writing displacement field ..." <<
endl;
2122 Info<<
"Writing actual patch displacement ..." <<
endl;
2127 /
"actualPatchDisplacement_" + meshRefiner_.timeName() +
".obj",
2138 const label nInitErrors,
2143 const fvMesh& mesh = meshRefiner_.mesh();
2149 scalar oldErrorReduction = -1;
2151 bool meshOk =
false;
2154 for (
label iter = 0; iter < 2*snapParams.
nSnap(); iter++)
2158 if (iter == snapParams.
nSnap())
2160 Info<<
"Displacement scaling for error reduction set to 0." <<
endl;
2164 meshOk = meshMover.
scaleMesh(checkFaces, baffles,
true, nInitErrors);
2168 Info<<
"Successfully moved mesh" <<
endl;
2174 Info<<
"Writing scaled mesh to time " << meshRefiner_.timeName()
2178 Info<<
"Writing displacement field ..." <<
endl;
2185 if (oldErrorReduction >= 0)
2189 Info<<
"Moved mesh in = " 2208 const fvMesh& mesh = meshRefiner_.mesh();
2211 Info<<
"Repatching faces according to nearest surface ..." <<
endl;
2235 forAll(preserveFaces, facei)
2237 if (preserveFaces[facei] != -1)
2239 isZonedFace.set(facei, 1);
2249 const label zoneSurfI = zonedSurfaces[i];
2250 const faceZone& fZone = fZones[surfZones[zoneSurfI].faceZoneName()];
2254 isZonedFace.set(fZone[i], 1);
2282 forAll(localFaces, facei)
2284 const face& f = localFaces[facei];
2288 faceSnapDist[facei] =
max 2290 faceSnapDist[facei],
2314 label facei = pp.addressing()[i];
2316 if (hitSurface[i] != -1 && !isZonedFace.get(facei))
2318 closestPatch[i] = globalToMasterPatch_
2353 label facei = pp.addressing()[i];
2355 if (closestPatch[i] != -1 && closestPatch[i] != ownPatch[facei])
2357 ownPatch[facei] = closestPatch[i];
2358 neiPatch[facei] = closestPatch[i];
2367 return meshRefiner_.createBaffles(ownPatch, neiPatch);
2371 void Foam::snappySnapDriver::detectWarpedFaces
2373 const scalar featureCos,
2380 const fvMesh& mesh = meshRefiner_.mesh();
2383 const labelList& bFaces = pp.addressing();
2396 forAll(localFaces, facei)
2398 const face& f = localFaces[facei];
2406 scalar minCos(GREAT);
2408 for (
label startFp = 0; startFp < f.
size()-2; startFp++)
2415 endFp < f.
size() && endFp != minFp;
2422 for (
label fp = startFp; fp <= endFp; fp++)
2428 for (
label fp = endFp; fp != startFp; fp = f.
fcIndex(fp))
2432 f1[i1++] = f[startFp];
2438 scalar n0Mag =
mag(n0);
2440 scalar n1Mag =
mag(n1);
2442 if (n0Mag > ROOTVSMALL && n1Mag > ROOTVSMALL)
2444 scalar cosAngle = (n0/n0Mag) & (n1/n1Mag);
2445 if (cosAngle < minCos)
2455 if (minCos < featureCos)
2457 splitFaces.
append(bFaces[facei]);
2469 const scalar featureCos,
2470 const scalar planarAngle,
2474 fvMesh& mesh = meshRefiner_.mesh();
2477 <<
"Morphing phase" <<
nl 2478 <<
"--------------" <<
nl 2482 labelList adaptPatchIDs(meshRefiner_.meshedPatches());
2523 meshRefiner_.createZoneBaffles
2525 globalToMasterPatch_,
2526 globalToSlavePatch_,
2554 label nFilterFaces = 0;
2557 label nDuplicatePoints = 0;
2560 const word& faceZoneName = surfZones[surfI].faceZoneName();
2562 if (faceZoneName.size())
2565 surfZones[surfI].faceType();
2575 const faceZone& fZone = fZones[zoneI];
2578 label facei = fZone[i];
2579 filterFace[facei] = zoneI;
2587 label facei = fZone[i];
2590 duplicateFace[facei] = -1;
2595 if (!duplicatePoint[f[fp]])
2597 duplicatePoint[f[fp]] = 1;
2604 Info<<
"Surface : " << surfaces.
names()[surfI] <<
nl 2605 <<
" faces to become baffle : " 2607 <<
" points to duplicate : " 2632 nDuplicatePoints = 0;
2633 forAll(duplicatePoint, pointi)
2635 if (duplicatePoint[pointi])
2640 labelList candidatePoints(nDuplicatePoints);
2641 nDuplicatePoints = 0;
2642 forAll(duplicatePoint, pointi)
2644 if (duplicatePoint[pointi])
2646 candidatePoints[nDuplicatePoints++] = pointi;
2671 const labelList& reverseFaceMap = mapPtr().reverseFaceMap();
2676 baffle.
first() = reverseFaceMap[baffle.
first()];
2683 Pout<<
"Writing duplicatedPoints mesh to time " 2684 << meshRefiner_.timeName()
2694 mesh.
time().
path()/
"duplicatedPoints" 2707 filterFace[baffle.
first()] == -1
2708 && filterFace[baffles[i].second()] == -1
2711 newBaffles.append(baffle);
2715 if (newBaffles.size() < baffles.size())
2727 bool doFeatures =
false;
2728 label nFeatIter = 1;
2734 Info<<
"Snapping to features in " << nFeatIter
2735 <<
" iterations ..." <<
endl;
2739 bool meshOk =
false;
2753 const scalarField snapDist(calcSnapDistance(mesh, snapParams, ppPtr()));
2757 Info<<
"Constructing mesh displacer ..." <<
endl;
2758 Info<<
"Using mesh parameters " << motionDict <<
nl <<
endl;
2778 Info<<
"Checking initial mesh ..." <<
endl;
2787 Info<<
"Detected " << nInitErrors <<
" illegal faces" 2788 <<
" (concave, zero area or negative cell pyramid volume)" 2792 Info<<
"Checked initial mesh in = " 2814 for (
label iter = 0; iter < nFeatIter; iter++)
3040 <<
"Morph iteration " << iter <<
nl 3041 <<
"-----------------" <<
endl;
3086 disp = calcNearestSurfaceFeature
3092 scalar(iter+1)/nFeatIter,
3102 outwardsDisplacement(pp, disp);
3115 /
"patchDisplacement_" +
name(iter) +
".obj",
3122 smoothDisplacement(snapParams, meshMover);
3136 <<
"Did not succesfully snap mesh." 3137 <<
" Continuing to snap to resolve easy" <<
nl 3138 <<
" surfaces but the" 3139 <<
" resulting mesh will not satisfy your quality" 3140 <<
" constraints" <<
nl <<
endl;
3146 Info<<
"Writing scaled mesh to time " 3147 << meshRefiner_.timeName() <<
endl;
3156 mesh.
time().
path()/meshRefiner_.timeName()
3158 Info<<
"Writing displacement field ..." <<
endl;
3179 forAll(duplicateFace, facei)
3181 if (duplicateFace[facei] != -1)
3183 duplicateFace[facei] = mapPtr().reverseFaceMap()[facei];
3208 label nChanged = meshRefiner_.mergePatchFacesUndo
3212 meshRefiner_.meshedPatches(),
3217 nChanged += meshRefiner_.mergeEdgesUndo(featureCos, motionDict);
3222 Info<<
"Writing patchFace merged mesh to time " 3223 << meshRefiner_.timeName() <<
endl;
3232 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...
static const Vector< scalar > max
List< labelList > labelListList
A List of labelList.
label nPoints() const
Return number of points supporting patch faces.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool scaleMesh(const snapParameters &snapParams, const label nInitErrors, const List< labelPair > &baffles, motionSmoother &)
Do the hard work: move the mesh according to displacement,.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
A face is a list of labels corresponding to mesh vertices.
const double e
Elementary charge.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
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.
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.
Type gMin(const FieldField< Field, Type > &f)
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.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Unit conversion functions.
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
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 Type & second() const
Return second.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static writeType writeLevel()
Get/set write level.
const Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
const Type & first() const
Return first.
Vector< scalar > vector
A scalar version of the templated Vector.
const indirectPrimitivePatch & patch() const
Reference to patch.
label nSmoothDispl() const
Number of mesh displacement smoothing iterations.
Switch detectNearSurfacesSnap() const
const vectorField & faceCentres() const
vector normal(const pointField &) const
Vector normal; magnitude is equal to area of face.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurences of given element. Linear search.
PrimitivePatch< face, IndirectList, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
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.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
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.
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 labelListList & pointEdges() const
Return point-edge addressing.
static const pointMesh & New(const polyMesh &mesh)
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
void correct()
Take over existing mesh position.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
bool write() const
Write mesh and all data.
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...
label findZoneID(const word &zoneName) const
Find zone index given a name.
vectorField pointField
pointField is a vectorField.
void reset(T *=0)
If object pointer already set, delete object and set to given.
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.
label start() const
Return start label of this patch in the polyMesh face list.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void smooth(const GeometricField< Type, pointPatchField, pointMesh > &fld, const scalarField &edgeWeight, GeometricField< Type, pointPatchField, pointMesh > &newFld) const
Fully explicit smoothing of fields (not positions)
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.
label nSmoothPatch() const
Number of patch smoothing iterations before finding.
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 findNearest(const labelList &surfacesToTest, const pointField &samples, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &) const
Find nearest point on surfaces.
void setCapacity(const label)
Alter the size of the underlying storage.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
const vectorField & cellCentres() const
scalar snapTol() const
Relative distance for points to be attracted by surface.
Pair< label > labelPair
Label pair.
const refinementSurfaces & surfaces() const
Reference to surface search engines.
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.
static labelList getUnnamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of unnamed surfaces (surfaces without faceZoneName)
errorManip< error > abort(error &err)
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set).
static scalarField calcSnapDistance(const fvMesh &mesh, const snapParameters &snapParams, const indirectPrimitivePatch &)
Calculate edge length per patch point.
label nSnap() const
Maximum number of snapping relaxation iterations. Should stop.
prefixOSstream Pout(cout,"Pout")
OFstream which keeps track of vertices.
scalar mag(const pointField &) const
Return scalar magnitude.
double cpuTimeIncrement() const
Return CPU time (in seconds) since last call to cpuTimeIncrement()
Type gMax(const FieldField< Field, Type > &f)
defineTypeNameAndDebug(combustionModel, 0)
static tmp< pointField > avgCellCentres(const fvMesh &mesh, const indirectPrimitivePatch &)
Helper: calculate average cell centre per point.
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
const wordList & names() const
Names of surfaces.
word name(const complex &)
Return a string representation of a complex.
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.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
label globalRegion(const label surfI, const label regionI) const
From surface and region on surface to global region.
void setSize(const label)
Reset size of List.
const PtrList< surfaceZonesInfo > & surfZones() const
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.
label nFeatureSnap() const
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Mesh data needed to do the Finite Volume discretisation.
const pointMesh & pMesh() const
Reference to pointMesh.
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.
const labelList & surfaces() const
virtual bool write() const
Write using setting from DB.
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.
const faceZoneMesh & faceZones() const
Return face zone mesh.
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.
static const Vector< scalar > zero
A subset of mesh faces organised as a primitive patch.
const labelListList & pointFaces() const
Return point-face addressing.
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
A class for managing temporary objects.
virtual const labelList & faceOwner() const
Return face owner.
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.
T & ref() const
Return non-const reference or generate a fatal error.
virtual const faceList & faces() const
Return raw faces.
fileName path() const
Return path.
const fvMesh & mesh() const
Reference to mesh.
virtual bool write() const
Write mesh using IO settings from time.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
void smoothDisplacement(const snapParameters &snapParams, motionSmoother &) const
Smooth the displacement field to the internal.
const Time & time() const
Return the top-level database.
word timeName() const
Replacement for Time::timeName() : return oldInstance (if.
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.