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< mapPolyMesh > | mergeZoneBaffles (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< mapPolyMesh > | repatchToSurface (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< pointField > | avgCellCentres (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. | |
All to do with snapping to surface.
Definition at line 59 of file snappySnapDriver.H.
| snappySnapDriver | ( | meshRefinement & | meshRefiner, |
| const labelList & | globalToMasterPatch, | ||
| const labelList & | globalToSlavePatch, | ||
| const bool | dryRun = false ) |
Construct from components.
Definition at line 809 of file snappySnapDriver.C.
| ClassName | ( | "snappySnapDriver" | ) |
Runtime type information.
| autoPtr< mapPolyMesh > mergeZoneBaffles | ( | const List< labelPair > & | ) |
|
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().


|
static |
Smooth the mesh (patch and internal) to increase visibility.
of surface points (on castellated mesh) w.r.t. surface.
Definition at line 866 of file snappySnapDriver.C.
References addProfiling, motionSmootherAlgo::correct(), Foam::endl(), forAll, Foam::Info, meshRefinement::MESH, meshRefinement::mesh(), mesh, Foam::nl, snapParameters::nSmoothInternal(), snapParameters::nSmoothPatch(), snapParameters::nSnap(), motionSmootherAlgo::pointDisplacement(), GeometricField< Type, PatchField, GeoMesh >::primitiveFieldRef(), motionSmootherAlgo::scaleMesh(), motionSmootherAlgo::setDisplacement(), motionSmootherAlgo::setErrorReduction(), List< T >::setSize(), meshRefinement::timeName(), meshRefinement::write(), meshRefinement::writeLevel(), and meshRefinement::WRITEMESH.
Referenced by doSnap().


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


| 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.
Definition at line 1113 of file snappySnapDriver.C.
References meshRefinement::ATTRACTION, avgCellCentres(), Foam::endl(), refinementSurfaces::findNearestIntersection(), forAll, meshRefinement::getMasterPoints(), surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getUnnamedSurfaces(), Foam::Info, mesh, pp(), autoPtr< T >::reset(), Foam::returnReduce(), refinementSurfaces::surfaces(), refinementSurfaces::surfZones(), and bitSet::toc().
Referenced by doSnap().


|
static |
Per patch point calculate point on nearest surface. Set as.
boundary conditions of motionSmoother displacement field. Return displacement of patch points.
Definition at line 1791 of file snappySnapDriver.C.
References Foam::endl(), refinementSurfaces::findNearest(), refinementSurfaces::findNearestRegion(), forAll, meshRefinement::gAverage(), refinementSurfaces::geometry(), meshRefinement::getMasterPoints(), surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getUnnamedSurfaces(), refinementSurfaces::globalRegion(), Foam::gMinMax(), Foam::identity(), Foam::Info, limits, Foam::mag(), meshRefinement::mesh(), mesh, Foam::nl, Foam::Pout, pp(), Foam::returnReduceOr(), UList< T >::size(), UPtrList< T >::size(), Foam::sqr(), meshRefinement::surfaces(), refinementSurfaces::surfaces(), refinementSurfaces::surfZones(), syncTools::syncPointList(), bitSet::toc(), WarningInFunction, and Foam::Zero.

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


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


| Foam::autoPtr< Foam::mapPolyMesh > repatchToSurface | ( | const snapParameters & | snapParams, |
| const labelList & | adaptPatchIDs, | ||
| const labelList & | preserveFaces ) |
Repatch faces according to surface nearest the face centre.
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().


| 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.
| Foam::labelList getFacePoints | ( | const indirectPrimitivePatch & | pp, |
| const FaceList & | faces ) |
Definition at line 27 of file snappySnapDriverTemplates.C.
References f(), Foam::findIndices(), forAll, and pp().
