Go to the documentation of this file.
36 #ifndef autoSnapDriver_H
37 #define autoSnapDriver_H
49 class refinementParameters;
51 class pointConstraint;
142 const scalar featureCos,
162 template<
class FaceList>
166 const FaceList& faces
196 const scalar featureCos,
265 const scalar featureCos,
283 const scalar featureCos,
340 const scalar featureCos,
352 const scalar concaveCos
356 const scalar featureCos,
357 const scalar concaveCos,
358 const scalar minAreaFraction,
374 const scalar featureCos,
375 const scalar concaveCos,
376 const scalar minAreaFraction,
393 const scalar featureCos,
428 const scalar featureCos,
429 const vector& faceSurfaceNormal,
438 const scalar featureCos,
463 const scalar featureCos,
482 const scalar featureCos,
483 const bool multiRegionFeatureSnap,
508 const bool baffleFeaturePoints,
509 const scalar featureCos,
551 const bool isRegionEdge,
556 const point& estimatedPt,
572 const bool isRegionEdge,
577 const point& estimatedPt,
593 const bool multiRegionFeatureSnap,
595 const bool detectBaffles,
596 const bool baffleFeaturePoints,
597 const bool releasePoints,
598 const bool stringFeatures,
599 const bool avoidDiagonal,
601 const scalar featureCos,
620 const scalar featureCos,
636 const bool alignMeshEdges,
638 const scalar featureCos,
639 const scalar featureAttract,
697 const label nInitErrors,
712 const scalar planarCos,
724 const bool strictRegionSnap,
757 const label nInitErrors,
775 const scalar featureCos,
776 const scalar planarAngle,
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.
const labelList globalToSlavePatch_
From global surface region to slave side patch.
static labelList getZoneSurfacePoints(const fvMesh &mesh, const indirectPrimitivePatch &, const word &zoneName)
Get points both on patch and facezone.
A class for handling words, derived from string.
bool isConcave(const point &c0, const vector &area0, const point &c1, const vector &area1, const scalar concaveCos) const
A class for handling file names.
static pointField smoothLambdaMuPatchDisplacement(const motionSmoother &meshMover, const List< labelPair > &baffles)
Calculate displacement per patch point. Wip.
A class for managing temporary objects.
void determineFeatures(const label iter, const scalar featureCos, const bool multiRegionFeatureSnap, const indirectPrimitivePatch &, const scalarField &snapDist, const vectorField &nearestDisp, const List< List< point > > &pointFaceSurfNormals, const List< List< point > > &pointFaceDisp, const List< List< point > > &pointFaceCentres, const labelListList &pointFacePatchID, List< labelList > &pointAttractor, List< List< pointConstraint > > &pointConstraints, List< List< DynamicList< point > > > &edgeAttractors, List< List< DynamicList< pointConstraint > > > &edgeConstraints, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
Determine geometric features and attraction to equivalent.
meshRefinement & meshRefiner_
Mesh+surface.
bool scaleMesh(const snapParameters &snapParams, const label nInitErrors, const List< labelPair > &baffles, motionSmoother &)
Do the hard work: move the mesh according to displacement,.
autoSnapDriver(const autoSnapDriver &)
Disallow default bitwise copy construct.
Accumulates point constraints through successive applications of the applyConstraint function.
void smoothAndConstrain(const PackedBoolList &isMasterEdge, const indirectPrimitivePatch &pp, const labelList &meshEdges, const List< pointConstraint > &constraints, vectorField &disp) const
void calcNearestFacePointProperties(const label iter, const indirectPrimitivePatch &pp, const vectorField &faceDisp, const vectorField &faceSurfaceNormal, const labelList &faceSurfaceRegion, List< List< point > > &pointFaceSurfNormals, List< List< point > > &pointFaceDisp, List< List< point > > &pointFaceCentres, List< labelList > &pointFacePatchID) const
labelList getInternalOrBaffleDuplicateFace() const
Get per face -1 or label of opposite face if on internal/baffle.
label findNormal(const scalar featureCos, const vector &faceSurfaceNormal, const DynamicList< vector > &surfaceNormals) const
Return index of similar normal.
bool isSplitAlignedWithFeature(const scalar featureCos, const point &newPt0, const pointConstraint &pc0, const point &newPt1, const pointConstraint &pc1) const
autoPtr< mapPolyMesh > mergeZoneBaffles(const List< labelPair > &)
Merge baffles.
void avoidDiagonalAttraction(const label iter, const scalar featureCos, const indirectPrimitivePatch &pp, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
Avoid attraction across face diagonal since would.
faceList mergePatchFaces(const List< DynList< label > > &pfcs, const pointField &polyPoints)
static void dumpMove(const fileName &, const pointField &, const pointField &)
Write displacement as .obj file.
labelPair findDiagonalAttraction(const indirectPrimitivePatch &pp, const vectorField &patchAttraction, const List< pointConstraint > &patchConstraints, const label faceI) const
Detect any diagonal attraction. Returns indices in face.
const labelList globalToMasterPatch_
From global surface region to master side patch.
void checkCoupledFaceZones() const
Check that face zones are synced.
pointIndexHit findMultiPatchPoint(const point &pt, const labelList &patchIDs, const List< point > &faceCentres) const
Return hit if on multiple points.
Tuple2< point, vector > centreAndNormal(const indirectPrimitivePatch &pp, const vectorField &featureAttraction, const vectorField &nearestAttraction, const face &localF) const
void writeStats(const indirectPrimitivePatch &pp, const PackedBoolList &isMasterPoint, const List< pointConstraint > &patchConstraints) const
Write some stats about constraints.
Simple container to keep together snap specific information.
void splitDiagonals(const scalar featureCos, const scalar concaveCos, const scalar minAreaFraction, const indirectPrimitivePatch &pp, const vectorField &nearestAttraction, const vectorField &nearestNormal, vectorField &patchAttraction, List< pointConstraint > &patchConstraints, DynamicList< label > &splitFaces, DynamicList< labelPair > &splits) const
Do all logic on whether to add face cut to diagonal.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
const dimensionedScalar c1
First radiation constant: default SI units: [W/m2].
static scalarField calcSnapDistance(const fvMesh &mesh, const snapParameters &snapParams, const indirectPrimitivePatch &)
Calculate edge length per patch point.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
void reverseAttractMeshPoints(const label iter, const indirectPrimitivePatch &pp, const scalarField &snapDist, const List< labelList > &pointAttractor, const List< List< pointConstraint > > &pointConstraints, const List< List< DynamicList< point > > > &edgeAttractors, const List< List< DynamicList< pointConstraint > > > &, const vectorField &rawPatchAttraction, const List< pointConstraint > &rawPatchConstraints, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
Given a displacement moves the mesh by scaling the displacement back until there are no more mesh err...
Tuple2< label, pointIndexHit > findNearFeaturePoint(const bool isRegionEdge, const indirectPrimitivePatch &pp, const scalarField &snapDist, const label pointI, const point &estimatedPt, List< labelList > &pointAttractor, List< List< pointConstraint > > &pointConstraints, List< List< DynamicList< point > > > &edgeAttractors, List< List< DynamicList< pointConstraint > > > &edgeConstraints, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
Find nearest feature point (within searchDist).
A list of keyword definitions, which are a keyword followed by any number of values (e....
static bool outwardsDisplacement(const indirectPrimitivePatch &, const vectorField &)
Check displacement is outwards pointing.
Mesh data needed to do the Finite Volume discretisation.
Mesh representing a set of points created from polyMesh.
void calcNearest(const label iter, const indirectPrimitivePatch &pp, vectorField &pointDisp, vectorField &pointSurfaceNormal, vectorField &pointRotation) const
void smoothDisplacement(const snapParameters &snapParams, motionSmoother &) const
Smooth the displacement field to the internal.
static tmp< pointField > avgCellCentres(const fvMesh &mesh, const indirectPrimitivePatch &)
Helper: calculate average cell centre per point.
Application of (multi-)patch point contraints.
void featureAttractionUsingFeatureEdges(const label iter, const bool multiRegionFeatureSnap, const bool detectBaffles, const bool baffleFeaturePoints, const bool releasePoints, const bool stringFeatures, const bool avoidDiagonal, const scalar featureCos, const indirectPrimitivePatch &pp, const scalarField &snapDist, const vectorField &nearestDisp, const vectorField &nearestNormal, const List< List< point > > &pointFaceSurfNormals, const List< List< point > > &pointFaceDisp, const List< List< point > > &pointFaceCentres, const labelListList &pointFacePatchID, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
void determineBaffleFeatures(const label iter, const bool baffleFeaturePoints, const scalar featureCos, const indirectPrimitivePatch &pp, const scalarField &snapDist, List< labelList > &pointAttractor, List< List< pointConstraint > > &pointConstraints, List< List< DynamicList< point > > > &edgeAttractors, List< List< DynamicList< pointConstraint > > > &edgeConstraints, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
Determine features originating from bafles and.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
void facePoints(const indirectPrimitivePatch &pp, const vectorField &featureAttraction, const vectorField &nearestAttraction, const face &f, DynamicField< point > &points) const
Tuple2< label, pointIndexHit > findNearFeatureEdge(const bool isRegionEdge, const indirectPrimitivePatch &pp, const scalarField &snapDist, const label pointI, const point &estimatedPt, List< List< DynamicList< point > > > &, List< List< DynamicList< pointConstraint > > > &, vectorField &, List< pointConstraint > &) const
Find point on nearest feature edge (within searchDist).
All to do with snapping to surface.
void detectWarpedFaces(const scalar featureCos, const indirectPrimitivePatch &pp, DynamicList< label > &splitFaces, DynamicList< labelPair > &splits) const
Detect warpage.
static tmp< pointField > smoothInternalDisplacement(const meshRefinement &meshRefiner, const motionSmoother &)
Calculate displacement (over all mesh points) to move points.
An ordered pair of two objects of type <T> with first() and second() elements.
void correctAttraction(const DynamicList< point > &surfacePoints, const DynamicList< label > &surfaceCounts, const point &edgePt, const vector &edgeNormal, const point &pt, vector &edgeOffset) const
static tmp< pointField > smoothPatchDisplacement(const motionSmoother &, const List< labelPair > &)
Calculate displacement per patch point to smooth out patch.
void featureAttractionUsingReconstruction(const label iter, const scalar featureCos, const indirectPrimitivePatch &pp, const scalarField &snapDist, const vectorField &nearestDisp, const label pointI, const List< List< point > > &pointFaceSurfNormals, const List< List< point > > &pointFaceDisp, const List< List< point > > &pointFaceCentres, const labelListList &pointFacePatchID, DynamicList< point > &surfacePoints, DynamicList< vector > &surfaceNormals, labelList &faceToNormalBin, vector &patchAttraction, pointConstraint &patchConstraint) const
Determine attraction and constraints for single point.
ClassName("autoSnapDriver")
Runtime type information.
static void calcNearestSurface(const refinementSurfaces &surfaces, const labelList &surfacesToTest, const labelListList ®ionsToTest, const pointField &localPoints, const labelList &zonePointIndices, scalarField &minSnapDist, labelList &snapSurf, vectorField &patchDisp, pointField &nearestPoint, vectorField &nearestNormal)
Per patch point calculate point on nearest surface.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void calcNearestFace(const label iter, const indirectPrimitivePatch &pp, const scalarField &faceSnapDist, vectorField &faceDisp, vectorField &faceSurfaceNormal, labelList &faceSurfaceRegion) const
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
scalar pyrVol(const indirectPrimitivePatch &pp, const vectorField &featureAttraction, const face &localF, const point &cc) const
void stringFeatureEdges(const label iter, const scalar featureCos, const indirectPrimitivePatch &pp, const scalarField &snapDist, const vectorField &rawPatchAttraction, const List< pointConstraint > &rawPatchConstraints, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
For any reverse (so from feature back to mesh) attraction:
vectorField calcNearestSurfaceFeature(const snapParameters &snapParams, const bool alignMeshEdges, const label iter, const scalar featureCos, const scalar featureAttract, const scalarField &snapDist, const vectorField &nearestDisp, const vectorField &nearestNormal, motionSmoother &meshMover, vectorField &patchAttraction, List< pointConstraint > &patchConstraints, DynamicList< label > &splitFaces, DynamicList< labelPair > &splits) const
Top level feature attraction routine. Gets given.
static label getCollocatedPoints(const scalar tol, const pointField &, PackedBoolList &)
Calculates (geometric) shared points.
autoPtr< mapPolyMesh > repatchToSurface(const snapParameters &snapParams, const labelList &adaptPatchIDs, const labelList &preserveFaces)
Repatch faces according to surface nearest the face centre.
static tmp< scalarField > edgePatchDist(const pointMesh &, const indirectPrimitivePatch &)
Per edge distance to patch.
static tmp< pointField > avg(const indirectPrimitivePatch &, const pointField &)
A face is a list of labels corresponding to mesh vertices.
bool isFeaturePoint(const scalar featureCos, const indirectPrimitivePatch &pp, const PackedBoolList &isFeatureEdge, const label pointI) const
Is point on two feature edges that make a largish angle?
void operator=(const autoSnapDriver &)
Disallow default bitwise assignment.
void releasePointsNextToMultiPatch(const label iter, const scalar featureCos, const indirectPrimitivePatch &pp, const scalarField &snapDist, const List< List< point > > &pointFaceCentres, const labelListList &pointFacePatchID, const vectorField &rawPatchAttraction, const List< pointConstraint > &rawPatchConstraints, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
Remove constraints of points next to multi-patch points.
A 2-tuple for storing two objects of different types.
void doSnap(const dictionary &snapDict, const dictionary &motionDict, const bool mergePatchFaces, const scalar featureCos, const scalar planarAngle, const snapParameters &snapParams)
void preventFaceSqueeze(const label iter, const scalar featureCos, const indirectPrimitivePatch &pp, const scalarField &snapDist, const vectorField &nearestAttraction, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
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.
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
A list of faces which address into the list of points.
static labelList getFacePoints(const indirectPrimitivePatch &pp, const FaceList &faces)
Get points both on patch and facezone.