Loading...
Searching...
No Matches
snappySnapDriver Class Reference

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

#include <snappySnapDriver.H>

Public Member Functions

 ClassName ("snappySnapDriver")
 Runtime type information.
 snappySnapDriver (meshRefinement &meshRefiner, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const bool dryRun=false)
 Construct from components.
autoPtr< mapPolyMeshmergeZoneBaffles (const List< labelPair > &)
 Merge baffles.
void detectNearSurfaces (const scalar planarCos, const indirectPrimitivePatch &pp, const pointField &ppLocalPoints, const pointField &nearestPoint, const vectorField &nearestNormal, vectorField &disp) const
 Per patch point override displacement if in gap situation.
void smoothDisplacement (const snapParameters &snapParams, motionSmoother &) const
 Smooth the displacement field to the internal.
bool scaleMesh (const snapParameters &snapParams, const label nInitErrors, const List< labelPair > &baffles, motionSmoother &)
 Do the hard work: move the mesh according to displacement,.
autoPtr< mapPolyMeshrepatchToSurface (const snapParameters &snapParams, const labelList &adaptPatchIDs, const labelList &preserveFaces)
 Repatch faces according to surface nearest the face centre.
void doSnap (const dictionary &snapDict, const dictionary &motionDict, const meshRefinement::FaceMergeType mergeType, const scalar featureCos, const scalar planarAngle, const snapParameters &snapParams)
 Snap onto surface & features.
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.
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 tmp< pointFieldavgCellCentres (const fvMesh &mesh, const indirectPrimitivePatch &)
 Helper: calculate average cell centre per point.
static vectorField calcNearestSurface (const bool strictRegionSnap, const meshRefinement &meshRefiner, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const indirectPrimitivePatch &pp, const pointField &ppLocalPoints, const scalarField &snapDist, pointField &nearestPoint, vectorField &nearestNormal)
 Per patch point calculate point on nearest surface. Set as.

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

Member Function Documentation

◆ ClassName()

ClassName ( "snappySnapDriver" )

Runtime type information.

◆ mergeZoneBaffles()

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

Merge baffles.

References mesh, and pp().

Here is the call graph for this function:

◆ calcSnapDistance()

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

Calculate edge length per patch point.

Definition at line 826 of file snappySnapDriver.C.

References e, forAll, Foam::max(), mesh, pp(), UList< T >::size(), snapParameters::snapTol(), and syncTools::syncPointList().

Referenced by doSnap(), and repatchToSurface().

Here is the call graph for this function:
Here is the caller 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 1028 of file snappySnapDriver.C.

References UList< T >::first(), forAll, weightedPosition::getPoints(), mesh, tmp< T >::New(), pFaces, pp(), UList< T >::size(), and weightedPosition::syncPoints().

Referenced by detectNearSurfaces().

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

◆ detectNearSurfaces()

void detectNearSurfaces ( const scalar planarCos,
const indirectPrimitivePatch & pp,
const pointField & ppLocalPoints,
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 indirectPrimitivePatch & pp,
const pointField & ppLocalPoints,
const scalarField & snapDist,
pointField & nearestPoint,
vectorField & nearestNormal )
static

◆ smoothDisplacement()

void smoothDisplacement ( const snapParameters & snapParams,
motionSmoother & meshMover ) const

Smooth the displacement field to the internal.

Definition at line 2128 of file snappySnapDriver.C.

References motionSmootherData::displacement(), Foam::endl(), Foam::Info, Foam::mag(), meshRefinement::MESH, mesh, Foam::nl, snapParameters::nSmoothDispl(), motionSmootherAlgo::patch(), motionSmootherAlgo::pMesh(), pp(), motionSmootherAlgo::smooth(), regIOobject::write(), meshRefinement::writeLevel(), and meshRefinement::WRITEMESH.

Referenced by doSnap().

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

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

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

Referenced by doSnap().

Here is the call graph for this function:
Here is the caller 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 2269 of file snappySnapDriver.C.

References calcSnapDistance(), Foam::endl(), f(), refinementSurfaces::findNearestRegion(), forAll, surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getUnnamedSurfaces(), refinementSurfaces::globalRegion(), Foam::Info, meshRefinement::makePatch(), Foam::max(), mesh, Foam::nl, patches, pp(), Foam::returnReduce(), bitSet::set(), Foam::sqr(), refinementSurfaces::surfaces(), refinementSurfaces::surfZones(), and bitSet::test().

Referenced by doSnap().

Here is the call graph for this function:
Here is the caller 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 )

Snap onto surface & features.

Not needed: shrinking of mesh since now using intrusion ...

// Move mesh back with thickness. Two purposes: // - avoid mapFaceZonePoints below merging points extraneously // (does not use addPatchCellLayer structure; uses geometric // tolerance) // - see what is happening { pointField newPoints(mesh.points()); const auto& mp = ppPtr().meshPoints(); forAll(mp, i) { newPoints[mp[i]] -= thickness[i]; } mesh.movePoints(newPoints); ppPtr().movePoints(mesh.points());

if (debug & meshRefinement::MESH) { const_cast<Time&>(mesh.time())++; Info<< "Writing shrunk buffer layer mesh to time " << meshRefiner_.timeName() << endl; meshRefiner_.write ( meshRefinement::debugType(debug), meshRefinement::writeType ( meshRefinement::writeLevel() | meshRefinement::WRITEMESH ), meshRefiner_.timeName() ); } }

Only if in feature attraction mode:

Nearest feature

Any faces to split

Indices in face to split across

Patch for both sides of the face

Definition at line 2568 of file snappySnapDriver.C.

References addProfiling, DynamicList< T, SizeMin >::append(), meshRefinement::ATTRACTION, calcSnapDistance(), meshRefinement::CASTELLATEDBUFFERLAYER, meshRefinement::CASTELLATEDBUFFERLAYER2, motionSmootherAlgo::checkMesh(), autoPtr< T >::clear(), DynamicList< T, SizeMin >::clear(), pointConstraints::constrainDisplacement(), motionSmootherAlgo::correct(), Foam::cos(), Foam::degToRad(), detectNearSurfaces(), snapParameters::detectNearSurfacesSnap(), motionSmootherData::displacement(), snappyLayerDriver::dupFaceZonePoints(), e, Foam::endl(), Foam::exit(), Foam::faceMap(), Foam::FatalError, FatalErrorInFunction, localPointRegion::findDuplicateFacePairs(), UList< T >::first(), forAll, Foam::gAverage(), meshRefinement::GEOMETRIC, Foam::identity(), meshRefinement::IGNOREPATCH, Foam::Info, surfaceZonesInfo::INTERNAL, Foam::mag(), meshRefinement::makeDisplacementField(), meshRefinement::makePatch(), meshRefinement::mapBaffles(), snappyLayerDriver::mapFaceZonePoints(), Foam::max(), VectorSpace< Form, Cmpt, Ncmpts >::max, meshRefinement::MESH, mesh, Foam::name(), name, MeshObject< pointMesh, UpdateableMeshObject, pointConstraints >::New(), MeshObject< polyMesh, UpdateableMeshObject, pointMesh >::New(), snapParameters::nFaceSplitInterval(), snapParameters::nFeatureSnap(), Foam::nl, p, pbm, PatchTools::pointNormals(), pp(), preSmoothPatch(), DynamicList< T, SizeMin >::push_uniq(), tmp< T >::ref(), repatchToSurface(), autoPtr< T >::reset(), Foam::returnReduce(), scaleMesh(), DynamicList< T, SizeMin >::setCapacity(), motionSmootherAlgo::setDisplacement(), Foam::setf(), Foam::setprecision(), List< T >::setSize(), Foam::setw(), HashTable< T, Key, Hash >::size(), UList< T >::size(), smoothDisplacement(), snapParameters::strictRegionSnap(), meshRefinement::subsetBaffles(), WarningInFunction, regIOobject::write(), meshRefinement::writeLevel(), meshRefinement::WRITEMESH, and Foam::Zero.

◆ getFacePoints()

template<class FaceList>
Foam::labelList getFacePoints ( const indirectPrimitivePatch & pp,
const FaceList & faces )

Definition at line 27 of file snappySnapDriverTemplates.C.

References f(), Foam::findIndices(), forAll, and pp().

Here is the call graph for this function:

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