snappySnapDriver Class Reference

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

Public Member Functions

 ClassName ("snappySnapDriver")
 Runtime type information. More...
 
 snappySnapDriver (meshRefinement &meshRefiner, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const bool dryRun=false)
 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 meshRefinement::FaceMergeType mergeType, 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...
 

Detailed Description

All to do with snapping to surface.

Source files

Definition at line 59 of file snappySnapDriver.H.

Constructor & Destructor Documentation

◆ snappySnapDriver()

snappySnapDriver ( meshRefinement meshRefiner,
const labelList globalToMasterPatch,
const labelList globalToSlavePatch,
const bool  dryRun = false 
)

Construct from components.

Definition at line 815 of file snappySnapDriver.C.

Member Function Documentation

◆ ClassName()

ClassName ( "snappySnapDriver"  )

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

Calculate edge length per patch point.

Definition at line 832 of file snappySnapDriver.C.

References e, PrimitivePatch< FaceList, PointField >::edges(), forAll, PrimitivePatch< FaceList, PointField >::localPoints(), Foam::max(), mesh, PrimitivePatch< FaceList, PointField >::meshPoints(), PrimitivePatch< FaceList, PointField >::pointEdges(), UList< T >::size(), snapParameters::snapTol(), and syncTools::syncPointList().

Here is the call graph for this function:

◆ 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 1034 of file snappySnapDriver.C.

References primitiveMesh::cellCentres(), polyMesh::faceOwner(), UList< T >::first(), forAll, weightedPosition::getPoints(), mesh, PrimitivePatch< FaceList, PointField >::meshPoints(), pFaces, PrimitivePatch< FaceList, PointField >::pointFaces(), tmp< T >::ref(), UList< T >::size(), and weightedPosition::syncPoints().

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()

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 2208 of file snappySnapDriver.C.

References addProfiling, cpuTimeCxx::cpuTimeIncrement(), motionSmootherData::displacement(), Foam::endl(), Foam::identity(), Foam::Info, Foam::mag(), mesh, meshRefinement::MESH, primitiveMesh::nFaces(), Foam::nl, snapParameters::nSnap(), motionSmootherAlgo::scaleMesh(), motionSmootherAlgo::setErrorReduction(), fvMesh::time(), fvMesh::write(), and regIOobject::write().

Here is the call graph for this function:

◆ repatchToSurface()

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

Repatch faces according to surface nearest the face centre.

  • calculate face-wise snap distance as max of point-wise

calculate face-wise nearest surface point

  • repatch face according to patch for surface point.

Definition at line 2275 of file snappySnapDriver.C.

References polyMesh::boundaryMesh(), cpuTimeCxx::cpuTimeIncrement(), Foam::endl(), f(), primitiveMesh::faceCentres(), polyMesh::faceZones(), refinementSurfaces::findNearestRegion(), forAll, surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getUnnamedSurfaces(), refinementSurfaces::globalRegion(), Foam::Info, PrimitivePatch< FaceList, PointField >::localFaces(), meshRefinement::makePatch(), Foam::max(), mesh, primitiveMesh::nFaces(), Foam::nl, patches, Foam::returnReduce(), bitSet::set(), Foam::sqr(), polyPatch::start(), refinementSurfaces::surfaces(), refinementSurfaces::surfZones(), bitSet::test(), and fvMesh::time().

Here is the call graph for this function:

◆ doSnap()

void doSnap ( const dictionary snapDict,
const dictionary motionDict,
const meshRefinement::FaceMergeType  mergeType,
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 2574 of file snappySnapDriver.C.

References addProfiling, DynamicList< T, SizeMin >::append(), meshRefinement::ATTRACTION, hexRef8::checkMesh(), DynamicList< T, SizeMin >::clear(), autoPtr< T >::clear(), motionSmootherAlgo::correct(), Foam::cos(), cpuTimeCxx::cpuTimeIncrement(), Foam::degToRad(), snapParameters::detectNearSurfacesSnap(), motionSmootherData::displacement(), Foam::endl(), Foam::exit(), primitiveMesh::faceCentres(), polyMesh::faceZones(), Foam::FatalError, FatalErrorInFunction, localPointRegion::findDuplicateFacePairs(), forAll, meshRefinement::GEOMETRIC, Foam::identity(), meshRefinement::IGNOREPATCH, Foam::Info, surfaceZonesInfo::INTERNAL, PrimitivePatch< FaceList, PointField >::localPoints(), Foam::mag(), meshRefinement::makeDisplacementField(), meshRefinement::makePatch(), pTraits< complex >::max, mesh, meshRefinement::MESH, Foam::name(), Time::New(), primitiveMesh::nFaces(), snapParameters::nFaceSplitInterval(), snapParameters::nFeatureSnap(), Foam::nl, PrimitivePatch< FaceList, PointField >::nPoints(), p, Time::path(), autoPtr< T >::reset(), Foam::returnReduce(), motionSmootherAlgo::setDisplacement(), List< T >::setSize(), HashTable< T, Key, Hash >::size(), UPtrList< T >::size(), UList< T >::size(), snapParameters::strictRegionSnap(), fvMesh::time(), WarningInFunction, regIOobject::write(), Ostream::write(), meshRefinement::writeLevel(), meshRefinement::WRITEMESH, and Foam::Zero.

Here is the call graph for this function:

◆ getFacePoints()

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

Definition at line 34 of file snappySnapDriverTemplates.C.

References HashTable< T, Key, Hash >::cfind(), f(), Foam::findIndices(), forAll, PrimitivePatch< FaceList, PointField >::meshPointMap(), and PrimitivePatch< FaceList, PointField >::nPoints().

Here is the call graph for this function:

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