Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
autoSnapDriver Class Reference

All to do with snapping to surface. More...

Collaboration diagram for autoSnapDriver:
Collaboration graph
[legend]

Public Member Functions

 ClassName ("autoSnapDriver")
 Runtime type information. More...
 
 autoSnapDriver (meshRefinement &meshRefiner, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch)
 Construct from components. More...
 
autoPtr< mapPolyMeshmergeZoneBaffles (const List< labelPair > &)
 Merge baffles. More...
 
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. More...
 
void smoothDisplacement (const snapParameters &snapParams, motionSmoother &) const
 Smooth the displacement field to the internal. More...
 
bool scaleMesh (const snapParameters &snapParams, const label nInitErrors, const List< labelPair > &baffles, motionSmoother &)
 Do the hard work: move the mesh according to displacement,. More...
 
autoPtr< mapPolyMeshrepatchToSurface (const snapParameters &snapParams, const labelList &adaptPatchIDs, const labelList &preserveFaces)
 Repatch faces according to surface nearest the face centre. More...
 
void doSnap (const dictionary &snapDict, const dictionary &motionDict, const bool mergePatchFaces, const scalar featureCos, const scalar planarAngle, const snapParameters &snapParams)
 
template<class FaceList >
Foam::labelList getFacePoints (const indirectPrimitivePatch &pp, const FaceList &faces)
 

Static Public Member Functions

static scalarField calcSnapDistance (const fvMesh &mesh, const snapParameters &snapParams, const indirectPrimitivePatch &)
 Calculate edge length per patch point. More...
 
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. More...
 
static tmp< pointFieldavgCellCentres (const fvMesh &mesh, const indirectPrimitivePatch &)
 Helper: calculate average cell centre per point. More...
 
static vectorField calcNearestSurface (const bool strictRegionSnap, const meshRefinement &meshRefiner, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const scalarField &snapDist, const indirectPrimitivePatch &, pointField &nearestPoint, vectorField &nearestNormal)
 Per patch point calculate point on nearest surface. Set as. More...
 

Private Member Functions

void checkCoupledFaceZones () const
 Check that face zones are synced. More...
 
void detectWarpedFaces (const scalar featureCos, const indirectPrimitivePatch &pp, DynamicList< label > &splitFaces, DynamicList< labelPair > &splits) const
 Detect warpage. More...
 
labelList getInternalOrBaffleDuplicateFace () const
 Get per face -1 or label of opposite face if on internal/baffle. More...
 
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? More...
 
void smoothAndConstrain (const PackedBoolList &isMasterEdge, const indirectPrimitivePatch &pp, const labelList &meshEdges, const List< pointConstraint > &constraints, vectorField &disp) const
 
void calcNearest (const label iter, const indirectPrimitivePatch &pp, vectorField &pointDisp, vectorField &pointSurfaceNormal, vectorField &pointRotation) const
 
void calcNearestFace (const label iter, const indirectPrimitivePatch &pp, const scalarField &faceSnapDist, vectorField &faceDisp, vectorField &faceSurfaceNormal, labelList &faceSurfaceRegion) 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
 
void correctAttraction (const DynamicList< point > &surfacePoints, const DynamicList< label > &surfaceCounts, const point &edgePt, const vector &edgeNormal, const point &pt, vector &edgeOffset) 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: More...
 
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. More...
 
labelPair findDiagonalAttraction (const indirectPrimitivePatch &pp, const vectorField &patchAttraction, const List< pointConstraint > &patchConstraints, const label faceI) const
 Detect any diagonal attraction. Returns indices in face. More...
 
scalar pyrVol (const indirectPrimitivePatch &pp, const vectorField &featureAttraction, const face &localF, const point &cc) const
 
void facePoints (const indirectPrimitivePatch &pp, const vectorField &featureAttraction, const vectorField &nearestAttraction, const face &f, DynamicField< point > &points) const
 
scalar pyrVol (const indirectPrimitivePatch &pp, const vectorField &featureAttraction, const vectorField &nearestAttraction, const face &localF, const point &cc) const
 
Tuple2< point, vectorcentreAndNormal (const indirectPrimitivePatch &pp, const vectorField &featureAttraction, const vectorField &nearestAttraction, const face &localF) const
 
bool isSplitAlignedWithFeature (const scalar featureCos, const point &newPt0, const pointConstraint &pc0, const point &newPt1, const pointConstraint &pc1) const
 
bool isConcave (const point &c0, const vector &area0, const point &c1, const vector &area1, const scalar concaveCos) const
 
labelPair findDiagonalAttraction (const scalar featureCos, const scalar concaveCos, const scalar minAreaFraction, const indirectPrimitivePatch &pp, const vectorField &patchAttraction, const List< pointConstraint > &patchConstraints, const vectorField &nearestAttraction, const vectorField &nearestNormal, const label faceI, DynamicField< point > &points0, DynamicField< point > &points1) const
 
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. More...
 
void avoidDiagonalAttraction (const label iter, const scalar featureCos, const indirectPrimitivePatch &pp, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
 Avoid attraction across face diagonal since would. More...
 
void writeStats (const indirectPrimitivePatch &pp, const PackedBoolList &isMasterPoint, const List< pointConstraint > &patchConstraints) const
 Write some stats about constraints. More...
 
pointIndexHit findMultiPatchPoint (const point &pt, const labelList &patchIDs, const List< point > &faceCentres) const
 Return hit if on multiple points. More...
 
pointIndexHit findMultiPatchPoint (const point &pt, const labelList &pfPatchID, const DynamicList< vector > &surfaceNormals, const labelList &faceToNormalBin) const
 Return hit if faces-on-the-same-normalplane are on multiple. More...
 
label findNormal (const scalar featureCos, const vector &faceSurfaceNormal, const DynamicList< vector > &surfaceNormals) const
 Return index of similar normal. More...
 
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. More...
 
void featureAttractionUsingReconstruction (const label iter, const scalar featureCos, const indirectPrimitivePatch &pp, const scalarField &snapDist, const vectorField &nearestDisp, const List< List< point > > &pointFaceSurfNormals, const List< List< point > > &pointFaceDisp, const List< List< point > > &pointFaceCentres, const labelListList &pointFacePatchID, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
 Determine attraction and constraints for all points. More...
 
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. More...
 
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. More...
 
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
 
Tuple2< label, pointIndexHitfindNearFeatureEdge (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). More...
 
Tuple2< label, pointIndexHitfindNearFeaturePoint (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). More...
 
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 preventFaceSqueeze (const label iter, const scalar featureCos, const indirectPrimitivePatch &pp, const scalarField &snapDist, const vectorField &nearestAttraction, vectorField &patchAttraction, List< pointConstraint > &patchConstraints) const
 
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. More...
 
 autoSnapDriver (const autoSnapDriver &)
 Disallow default bitwise copy construct. More...
 
void operator= (const autoSnapDriver &)
 Disallow default bitwise assignment. More...
 

Static Private Member Functions

static label getCollocatedPoints (const scalar tol, const pointField &, PackedBoolList &)
 Calculates (geometric) shared points. More...
 
static tmp< pointFieldsmoothInternalDisplacement (const meshRefinement &meshRefiner, const motionSmoother &)
 Calculate displacement (over all mesh points) to move points. More...
 
static tmp< pointFieldsmoothPatchDisplacement (const motionSmoother &, const List< labelPair > &)
 Calculate displacement per patch point to smooth out patch. More...
 
static tmp< pointFieldavg (const indirectPrimitivePatch &, const pointField &)
 
static pointField smoothLambdaMuPatchDisplacement (const motionSmoother &meshMover, const List< labelPair > &baffles)
 Calculate displacement per patch point. Wip. More...
 
static tmp< scalarFieldedgePatchDist (const pointMesh &, const indirectPrimitivePatch &)
 Per edge distance to patch. More...
 
static void dumpMove (const fileName &, const pointField &, const pointField &)
 Write displacement as .obj file. More...
 
static bool outwardsDisplacement (const indirectPrimitivePatch &, const vectorField &)
 Check displacement is outwards pointing. More...
 
static labelList getZoneSurfacePoints (const fvMesh &mesh, const indirectPrimitivePatch &, const word &zoneName)
 Get points both on patch and facezone. More...
 
template<class FaceList >
static labelList getFacePoints (const indirectPrimitivePatch &pp, const FaceList &faces)
 Get points both on patch and facezone. More...
 
static void calcNearestSurface (const refinementSurfaces &surfaces, const labelList &surfacesToTest, const labelListList &regionsToTest, const pointField &localPoints, const labelList &zonePointIndices, scalarField &minSnapDist, labelList &snapSurf, vectorField &patchDisp, pointField &nearestPoint, vectorField &nearestNormal)
 Per patch point calculate point on nearest surface. More...
 

Private Attributes

meshRefinementmeshRefiner_
 Mesh+surface. More...
 
const labelList globalToMasterPatch_
 From global surface region to master side patch. More...
 
const labelList globalToSlavePatch_
 From global surface region to slave side patch. More...
 

Detailed Description

All to do with snapping to surface.

Source files

Definition at line 56 of file autoSnapDriver.H.

Constructor & Destructor Documentation

◆ autoSnapDriver() [1/2]

autoSnapDriver ( const autoSnapDriver )
private

Disallow default bitwise copy construct.

◆ autoSnapDriver() [2/2]

autoSnapDriver ( meshRefinement meshRefiner,
const labelList globalToMasterPatch,
const labelList globalToSlavePatch 
)

Construct from components.

Definition at line 772 of file autoSnapDriver.C.

Member Function Documentation

◆ getCollocatedPoints()

Foam::label getCollocatedPoints ( const scalar  tol,
const pointField points,
PackedBoolList isCollocatedPoint 
)
staticprivate

Calculates (geometric) shared points.

Definition at line 64 of file autoSnapDriver.C.

References forAll, Foam::mergePoints(), points, Foam::returnReduce(), and PackedBoolList::set().

Here is the call graph for this function:

◆ smoothInternalDisplacement()

Foam::tmp< Foam::pointField > smoothInternalDisplacement ( const meshRefinement meshRefiner,
const motionSmoother meshMover 
)
staticprivate

Calculate displacement (over all mesh points) to move points.

to average of connected cell centres

Definition at line 124 of file autoSnapDriver.C.

References hexRef8::cellLevel(), Foam::endl(), f(), forAll, Foam::Info, mesh, motionSmootherAlgo::mesh(), meshRefinement::meshCutter(), PrimitivePatch< Face, FaceList, PointField, PointType >::meshPoints(), motionSmootherAlgo::patch(), and Foam::reduce().

Here is the call graph for this function:

◆ smoothPatchDisplacement()

Foam::tmp< Foam::pointField > smoothPatchDisplacement ( const motionSmoother meshMover,
const List< labelPair > &  baffles 
)
staticprivate

◆ avg()

static tmp<pointField> avg ( const indirectPrimitivePatch ,
const pointField  
)
staticprivate

◆ smoothLambdaMuPatchDisplacement()

static pointField smoothLambdaMuPatchDisplacement ( const motionSmoother meshMover,
const List< labelPair > &  baffles 
)
staticprivate

Calculate displacement per patch point. Wip.

◆ checkCoupledFaceZones()

void checkCoupledFaceZones ( ) const
private

Check that face zones are synced.

◆ edgePatchDist()

Foam::tmp< Foam::scalarField > edgePatchDist ( const pointMesh pMesh,
const indirectPrimitivePatch pp 
)
staticprivate

◆ dumpMove()

void dumpMove ( const fileName fName,
const pointField meshPts,
const pointField surfPts 
)
staticprivate

Write displacement as .obj file.

Definition at line 700 of file autoSnapDriver.C.

References Foam::endl(), forAll, Foam::Info, Foam::nl, and writeOBJ().

Here is the call graph for this function:

◆ outwardsDisplacement()

bool outwardsDisplacement ( const indirectPrimitivePatch pp,
const vectorField patchDisp 
)
staticprivate

◆ detectWarpedFaces()

void detectWarpedFaces ( const scalar  featureCos,
const indirectPrimitivePatch pp,
DynamicList< label > &  splitFaces,
DynamicList< labelPair > &  splits 
) const
private

◆ getInternalOrBaffleDuplicateFace()

Foam::labelList getInternalOrBaffleDuplicateFace ( ) const
private

Get per face -1 or label of opposite face if on internal/baffle.

faceZone

Definition at line 2493 of file autoSnapDriver.C.

References surfaceZonesInfo::BAFFLE, localPointRegion::findDuplicateFacePairs(), forAll, meshRefinement::getZones(), surfaceZonesInfo::INTERNAL, mesh, meshRefinement::mesh(), autoSnapDriver::meshRefiner_, p, and meshRefinement::subsetBaffles().

Here is the call graph for this function:

◆ getZoneSurfacePoints()

Foam::labelList getZoneSurfacePoints ( const fvMesh mesh,
const indirectPrimitivePatch pp,
const word zoneName 
)
staticprivate

◆ getFacePoints() [1/2]

static labelList getFacePoints ( const indirectPrimitivePatch pp,
const FaceList &  faces 
)
staticprivate

Get points both on patch and facezone.

◆ calcNearestSurface() [1/2]

void calcNearestSurface ( const refinementSurfaces surfaces,
const labelList surfacesToTest,
const labelListList regionsToTest,
const pointField localPoints,
const labelList zonePointIndices,
scalarField minSnapDist,
labelList snapSurf,
vectorField patchDisp,
pointField nearestPoint,
vectorField nearestNormal 
)
staticprivate

Per patch point calculate point on nearest surface.

Return displacement of patch points.

Definition at line 1692 of file autoSnapDriver.C.

References refinementSurfaces::findNearest(), refinementSurfaces::findNearestRegion(), forAll, Foam::mag(), scalarField(), and Foam::sqr().

Here is the call graph for this function:

◆ isFeaturePoint()

bool isFeaturePoint ( const scalar  featureCos,
const indirectPrimitivePatch pp,
const PackedBoolList isFeatureEdge,
const label  pointI 
) const
private

◆ smoothAndConstrain()

void smoothAndConstrain ( const PackedBoolList isMasterEdge,
const indirectPrimitivePatch pp,
const labelList meshEdges,
const List< pointConstraint > &  constraints,
vectorField disp 
) const
private

◆ calcNearest()

void calcNearest ( const label  iter,
const indirectPrimitivePatch pp,
vectorField pointDisp,
vectorField pointSurfaceNormal,
vectorField pointRotation 
) const
private

◆ calcNearestFace()

void calcNearestFace ( const label  iter,
const indirectPrimitivePatch pp,
const scalarField faceSnapDist,
vectorField faceDisp,
vectorField faceSurfaceNormal,
labelList faceSurfaceRegion 
) const
private

◆ calcNearestFacePointProperties()

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
private

◆ correctAttraction()

void correctAttraction ( const DynamicList< point > &  surfacePoints,
const DynamicList< label > &  surfaceCounts,
const point edgePt,
const vector edgeNormal,
const point pt,
vector edgeOffset 
) const
private

Definition at line 691 of file autoSnapDriverFeature.C.

References Foam::mag(), and Foam::sortedOrder().

Here is the call graph for this function:

◆ stringFeatureEdges()

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
private

◆ releasePointsNextToMultiPatch()

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
private

Remove constraints of points next to multi-patch points.

to give a bit more freedom of the mesh to conform to the multi-patch points. Bit dodgy for simple cases.

Definition at line 1402 of file autoSnapDriverFeature.C.

References Foam::endl(), f(), forAll, PointIndexHit< Point >::hit(), Foam::Info, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::name(), Foam::reduce(), autoPtr::reset(), and autoPtr::valid().

Here is the call graph for this function:

◆ findDiagonalAttraction() [1/2]

Foam::labelPair findDiagonalAttraction ( const indirectPrimitivePatch pp,
const vectorField patchAttraction,
const List< pointConstraint > &  patchConstraints,
const label  faceI 
) const
private

Detect any diagonal attraction. Returns indices in face.

or (-1, -1) if none

Definition at line 1533 of file autoSnapDriverFeature.C.

References f(), and PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces().

Here is the call graph for this function:

◆ pyrVol() [1/2]

scalar pyrVol ( const indirectPrimitivePatch pp,
const vectorField featureAttraction,
const face localF,
const point cc 
) const
private

◆ facePoints()

void facePoints ( const indirectPrimitivePatch pp,
const vectorField featureAttraction,
const vectorField nearestAttraction,
const face f,
DynamicField< point > &  points 
) const
private

◆ pyrVol() [2/2]

scalar pyrVol ( const indirectPrimitivePatch pp,
const vectorField featureAttraction,
const vectorField nearestAttraction,
const face localF,
const point cc 
) const
private

◆ centreAndNormal()

Tuple2<point, vector> centreAndNormal ( const indirectPrimitivePatch pp,
const vectorField featureAttraction,
const vectorField nearestAttraction,
const face localF 
) const
private

◆ isSplitAlignedWithFeature()

bool isSplitAlignedWithFeature ( const scalar  featureCos,
const point newPt0,
const pointConstraint pc0,
const point newPt1,
const pointConstraint pc1 
) const
private

Definition at line 1576 of file autoSnapDriverFeature.C.

References Tuple2::first(), Foam::mag(), and Tuple2::second().

Here is the call graph for this function:

◆ isConcave()

bool isConcave ( const point c0,
const vector area0,
const point c1,
const vector area1,
const scalar  concaveCos 
) const
private

Definition at line 1616 of file autoSnapDriverFeature.C.

References Foam::constant::physicoChemical::c1, and Foam::mag().

Here is the call graph for this function:

◆ findDiagonalAttraction() [2/2]

Foam::labelPair findDiagonalAttraction ( const scalar  featureCos,
const scalar  concaveCos,
const scalar  minAreaFraction,
const indirectPrimitivePatch pp,
const vectorField patchAttraction,
const List< pointConstraint > &  patchConstraints,
const vectorField nearestAttraction,
const vectorField nearestNormal,
const label  faceI,
DynamicField< point > &  points0,
DynamicField< point > &  points1 
) const
private

◆ splitDiagonals()

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
private

Do all logic on whether to add face cut to diagonal.

attraction

Definition at line 1885 of file autoSnapDriverFeature.C.

References DynamicList::append(), DynamicList::clear(), f(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), DynamicList::setCapacity(), and List::size().

Here is the call graph for this function:

◆ avoidDiagonalAttraction()

void avoidDiagonalAttraction ( const label  iter,
const scalar  featureCos,
const indirectPrimitivePatch pp,
vectorField patchAttraction,
List< pointConstraint > &  patchConstraints 
) const
private

Avoid attraction across face diagonal since would.

cause face squeeze

Definition at line 1970 of file autoSnapDriverFeature.C.

References Foam::diag(), f(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mag(), and Foam::magSqr().

Here is the call graph for this function:

◆ writeStats()

void writeStats ( const indirectPrimitivePatch pp,
const PackedBoolList isMasterPoint,
const List< pointConstraint > &  patchConstraints 
) const
private

Write some stats about constraints.

Definition at line 866 of file autoSnapDriverFeature.C.

References Foam::endl(), forAll, Foam::Info, Foam::nl, and Foam::reduce().

Here is the call graph for this function:

◆ findMultiPatchPoint() [1/2]

Foam::pointIndexHit findMultiPatchPoint ( const point pt,
const labelList patchIDs,
const List< point > &  faceCentres 
) const
private

Return hit if on multiple points.

Definition at line 729 of file autoSnapDriverFeature.C.

References Foam::labelMax, and List::size().

Here is the call graph for this function:

◆ findMultiPatchPoint() [2/2]

Foam::pointIndexHit findMultiPatchPoint ( const point pt,
const labelList pfPatchID,
const DynamicList< vector > &  surfaceNormals,
const labelList faceToNormalBin 
) const
private

Return hit if faces-on-the-same-normalplane are on multiple.

patches

Definition at line 786 of file autoSnapDriverFeature.C.

References forAll, and List::size().

Here is the call graph for this function:

◆ findNormal()

Foam::label findNormal ( const scalar  featureCos,
const vector faceSurfaceNormal,
const DynamicList< vector > &  surfaceNormals 
) const
private

Return index of similar normal.

Definition at line 753 of file autoSnapDriverFeature.C.

References forAll, and n.

◆ featureAttractionUsingReconstruction() [1/2]

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
private

Determine attraction and constraints for single point.

using sampled surrounding of the point

Bins of differing normals:

  • one normal : flat(tish) surface

two normals : geometric feature edge

  • three normals: geometric feature point
  • four normals : too complex a feature

From face to above normals bin

Definition at line 914 of file autoSnapDriverFeature.C.

References DynamicList::append(), pointConstraint::applyConstraint(), DynamicList::clear(), plane::ray::dir(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mag(), Foam::magSqr(), n, plane::planeIntersect(), plane::planePlaneIntersect(), plane::ray::refPoint(), List::setSize(), List::size(), Foam::sqr(), and Foam::sqrt().

Here is the call graph for this function:

◆ featureAttractionUsingReconstruction() [2/2]

void featureAttractionUsingReconstruction ( const label  iter,
const scalar  featureCos,
const indirectPrimitivePatch pp,
const scalarField snapDist,
const vectorField nearestDisp,
const List< List< point > > &  pointFaceSurfNormals,
const List< List< point > > &  pointFaceDisp,
const List< List< point > > &  pointFaceCentres,
const labelListList pointFacePatchID,
vectorField patchAttraction,
List< pointConstraint > &  patchConstraints 
) const
private

Determine attraction and constraints for all points.

using sampled surrounding of the point

Definition at line 1107 of file autoSnapDriverFeature.C.

References Foam::endl(), Tuple2::first(), forAll, Foam::Info, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::magSqr(), Foam::name(), autoPtr::reset(), and autoPtr::valid().

Here is the call graph for this function:

◆ determineFeatures()

void determineFeatures ( const label  iter,
const scalar  featureCos,
const bool  multiRegionFeatureSnap,
const indirectPrimitivePatch pp,
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
private

◆ determineBaffleFeatures()

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
private

Determine features originating from bafles and.

and add attraction to equivalent surface features

Baffle edges will be too ragged to sensibly determine feature points

forAll(pp.pointEdges(), pointI) { if ( isFeaturePoint ( featureCos, pp, isBaffleEdge, pointI ) ) { Pout<< "Detected feature point:" << pp.localPoints()[pointI] << endl; -TEMPORARILY DISABLED: pointStatus[pointI] = 1; } }

MEJ:

2: optionally override with nearest feature point. On baffles we don't have enough normals to construct a feature point so assume all feature edges are close to feature points

Definition at line 2784 of file autoSnapDriverFeature.C.

References Foam::cos(), Foam::degToRad(), Foam::constant::electromagnetic::e, PrimitivePatch< Face, FaceList, PointField, PointType >::edgeFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), Foam::endl(), PrimitivePatch< Face, FaceList, PointField, PointType >::faceNormals(), refinementFeatures::findNearestPoint(), Tuple2::first(), forAll, Foam::Info, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::magSqr(), mesh, PrimitivePatch< Face, FaceList, PointField, PointType >::meshEdges(), Foam::name(), PrimitivePatch< Face, FaceList, PointField, PointType >::nEdges(), Foam::nl, PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints(), Foam::reduce(), autoPtr::reset(), Foam::returnReduce(), scalarField(), Tuple2::second(), List::setSize(), List::size(), Foam::sqr(), and autoPtr::valid().

Here is the call graph for this function:

◆ reverseAttractMeshPoints()

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 > > > &  edgeConstraints,
const vectorField rawPatchAttraction,
const List< pointConstraint > &  rawPatchConstraints,
vectorField patchAttraction,
List< pointConstraint > &  patchConstraints 
) const
private

◆ findNearFeatureEdge()

Foam::Tuple2< Foam::label, Foam::pointIndexHit > findNearFeatureEdge ( const bool  isRegionEdge,
const indirectPrimitivePatch pp,
const scalarField snapDist,
const label  pointI,
const point estimatedPt,
List< List< DynamicList< point > > > &  edgeAttractors,
List< List< DynamicList< pointConstraint > > > &  edgeConstraints,
vectorField patchAttraction,
List< pointConstraint > &  patchConstraints 
) const
private

Find point on nearest feature edge (within searchDist).

Return point and feature and store feature-edge to mesh-point and vice versa

Definition at line 2069 of file autoSnapDriverFeature.C.

References List::append(), Foam::constant::universal::c, refinementFeatures::findNearestEdge(), refinementFeatures::findNearestRegionEdge(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), scalarField(), and Foam::sqr().

Here is the call graph for this function:

◆ findNearFeaturePoint()

Foam::Tuple2< Foam::label, Foam::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
private

Find nearest feature point (within searchDist).

Return feature point and store feature-point to mesh-point and vice versa. If another mesh point already referring to this feature point and further away, reset that one to a near feature edge (using findNearFeatureEdge above)

Definition at line 2136 of file autoSnapDriverFeature.C.

References refinementFeatures::findNearestPoint(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::magSqr(), scalarField(), and Foam::sqr().

Here is the call graph for this function:

◆ featureAttractionUsingFeatureEdges()

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
private

◆ preventFaceSqueeze()

void preventFaceSqueeze ( const label  iter,
const scalar  featureCos,
const indirectPrimitivePatch pp,
const scalarField snapDist,
const vectorField nearestAttraction,
vectorField patchAttraction,
List< pointConstraint > &  patchConstraints 
) const
private

◆ calcNearestSurfaceFeature()

Foam::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
private

◆ operator=()

void operator= ( const autoSnapDriver )
private

Disallow default bitwise assignment.

◆ ClassName()

ClassName ( "autoSnapDriver"  )

Runtime type information.

◆ mergeZoneBaffles()

autoPtr<mapPolyMesh> mergeZoneBaffles ( const List< labelPair > &  )

Merge baffles.

◆ calcSnapDistance()

Foam::scalarField calcSnapDistance ( const fvMesh mesh,
const snapParameters snapParams,
const indirectPrimitivePatch pp 
)
static

◆ preSmoothPatch()

void preSmoothPatch ( const meshRefinement meshRefiner,
const snapParameters snapParams,
const label  nInitErrors,
const List< labelPair > &  baffles,
motionSmoother meshMover 
)
static

◆ avgCellCentres()

Foam::tmp< Foam::pointField > avgCellCentres ( const fvMesh mesh,
const indirectPrimitivePatch pp 
)
static

Helper: calculate average cell centre per point.

Definition at line 990 of file autoSnapDriver.C.

References forAll, mesh, PrimitivePatch< Face, FaceList, PointField, PointType >::meshPoints(), pFaces, PrimitivePatch< Face, FaceList, PointField, PointType >::pointFaces(), and List::size().

Here is the call graph for this function:

◆ detectNearSurfaces()

void detectNearSurfaces ( const scalar  planarCos,
const indirectPrimitivePatch pp,
const pointField nearestPoint,
const vectorField nearestNormal,
vectorField disp 
) const

◆ calcNearestSurface() [2/2]

Foam::vectorField calcNearestSurface ( const bool  strictRegionSnap,
const meshRefinement meshRefiner,
const labelList globalToMasterPatch,
const labelList globalToSlavePatch,
const scalarField snapDist,
const indirectPrimitivePatch pp,
pointField nearestPoint,
vectorField nearestNormal 
)
static

◆ smoothDisplacement()

void smoothDisplacement ( const snapParameters snapParams,
motionSmoother meshMover 
) const

◆ scaleMesh()

bool scaleMesh ( const snapParameters snapParams,
const label  nInitErrors,
const List< labelPair > &  baffles,
motionSmoother meshMover 
)

Do the hard work: move the mesh according to displacement,.

locally relax the displacement. Return true if ended up with correct mesh, false if not.

Definition at line 2164 of file autoSnapDriver.C.

References motionSmootherData::displacement(), Foam::endl(), Foam::identity(), Foam::Info, Foam::mag(), mesh, MESH, Foam::nl, snapParameters::nSnap(), motionSmootherAlgo::scaleMesh(), and motionSmootherAlgo::setErrorReduction().

Here is the call graph for this function:

◆ repatchToSurface()

Foam::autoPtr< Foam::mapPolyMesh > repatchToSurface ( const snapParameters snapParams,
const labelList adaptPatchIDs,
const labelList preserveFaces 
)

◆ doSnap()

void doSnap ( const dictionary snapDict,
const dictionary motionDict,
const bool  mergePatchFaces,
const scalar  featureCos,
const scalar  planarAngle,
const snapParameters snapParams 
)

Only if in feature attraction mode:

Nearest feature

Any faces to split

Indices in face to split across

Definition at line 2528 of file autoSnapDriver.C.

References DynamicList::append(), meshRefinement::ATTRACTION, motionSmootherAlgo::checkMesh(), autoPtr::clear(), DynamicList::clear(), motionSmootherAlgo::correct(), Foam::cos(), cpuTime::cpuTimeIncrement(), Foam::degToRad(), snapParameters::detectNearSurfacesSnap(), motionSmootherData::displacement(), Foam::endl(), Foam::exit(), primitiveMesh::faceCentres(), polyMesh::faceZones(), Foam::FatalError, FatalErrorInFunction, localPointRegion::findDuplicateFacePairs(), forAll, Foam::identity(), Foam::Info, surfaceZonesInfo::INTERNAL, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mag(), meshRefinement::makeDisplacementField(), meshRefinement::makePatch(), Vector< scalar >::max, Foam::help::mergePatchFaces(), mesh, meshRefinement::MESH, Foam::name(), MeshObject< polyMesh, UpdateableMeshObject, pointMesh >::New(), primitiveMesh::nFaces(), snapParameters::nFaceSplitInterval(), snapParameters::nFeatureSnap(), Foam::nl, PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints(), p, Time::path(), autoPtr::reset(), Foam::returnReduce(), motionSmootherAlgo::setDisplacement(), HashTable::size(), snapParameters::strictRegionSnap(), fvMesh::time(), autoPtr::valid(), WarningInFunction, Ostream::write(), meshRefinement::writeLevel(), meshRefinement::WRITEMESH, DynamicList::xfer(), and Vector< scalar >::zero.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFacePoints() [2/2]

Foam::labelList getFacePoints ( const indirectPrimitivePatch pp,
const FaceList &  faces 
)

Field Documentation

◆ meshRefiner_

meshRefinement& meshRefiner_
private

Mesh+surface.

Definition at line 61 of file autoSnapDriver.H.

Referenced by autoSnapDriver::getInternalOrBaffleDuplicateFace().

◆ globalToMasterPatch_

const labelList globalToMasterPatch_
private

From global surface region to master side patch.

Definition at line 64 of file autoSnapDriver.H.

◆ globalToSlavePatch_

const labelList globalToSlavePatch_
private

From global surface region to slave side patch.

Definition at line 67 of file autoSnapDriver.H.


The documentation for this class was generated from the following files: