All to do with snapping to surface. More...
Public Member Functions | |
ClassName ("autoSnapDriver") | |
Runtime type information. More... | |
autoSnapDriver (meshRefinement &meshRefiner, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch) | |
Construct from components. More... | |
autoPtr< mapPolyMesh > | mergeZoneBaffles (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< mapPolyMesh > | repatchToSurface (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 scalar featureCos, const scalar planarAngle, const snapParameters &snapParams) |
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 labelList | getZoneSurfacePoints (const fvMesh &mesh, const indirectPrimitivePatch &, const word &zoneName) |
Get points both on patch and facezone. More... | |
static tmp< pointField > | avgCellCentres (const fvMesh &mesh, const indirectPrimitivePatch &) |
Helper: calculate average cell centre per point. More... | |
static vectorField | calcNearestSurface (const meshRefinement &meshRefiner, const scalarField &snapDist, const indirectPrimitivePatch &, pointField &nearestPoint, vectorField &nearestNormal) |
Per patch point calculate point on nearest surface. Set as. More... | |
autoSnapDriver | ( | meshRefinement & | meshRefiner, |
const labelList & | globalToMasterPatch, | ||
const labelList & | globalToSlavePatch | ||
) |
Construct from components.
Definition at line 637 of file autoSnapDriver.C.
References autoSnapDriver::mergeZoneBaffles().
ClassName | ( | "autoSnapDriver" | ) |
Runtime type information.
Foam::autoPtr< Foam::mapPolyMesh > mergeZoneBaffles | ( | const List< labelPair > & | baffles | ) |
Merge baffles.
Definition at line 652 of file autoSnapDriver.C.
References autoSnapDriver::calcSnapDistance(), Foam::endl(), surfaceZonesInfo::getNamedSurfaces(), Foam::Info, Foam::nl, Foam::returnReduce(), and List< T >::size().
Referenced by autoSnapDriver::autoSnapDriver().
|
static |
Calculate edge length per patch point.
Definition at line 681 of file autoSnapDriver.C.
References Foam::e, PrimitivePatch< Face, FaceList, PointField, PointType >::edges(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), edge::mag(), Foam::max(), PrimitivePatch< Face, FaceList, PointField, PointType >::meshPoints(), PrimitivePatch< Face, FaceList, PointField, PointType >::pointEdges(), autoSnapDriver::preSmoothPatch(), List< T >::size(), snapParameters::snapTol(), and syncTools::syncPointList().
Referenced by autoSnapDriver::mergeZoneBaffles().
|
static |
Smooth the mesh (patch and internal) to increase visibility.
of surface points (on castellated mesh) w.r.t. surface.
Definition at line 721 of file autoSnapDriver.C.
References motionSmootherAlgo::correct(), cpuTime::cpuTimeIncrement(), Foam::endl(), forAll, autoSnapDriver::getZoneSurfacePoints(), Foam::Info, meshRefinement::MESH, meshRefinement::mesh(), primitiveMesh::nFaces(), Foam::nl, snapParameters::nSmoothPatch(), snapParameters::nSnap(), Time::path(), motionSmootherAlgo::scaleMesh(), motionSmootherAlgo::setDisplacement(), motionSmootherAlgo::setErrorReduction(), List< T >::setSize(), fvMesh::time(), meshRefinement::timeName(), meshRefinement::write(), meshRefinement::writeLevel(), and meshRefinement::WRITEMESH.
Referenced by autoSnapDriver::calcSnapDistance().
|
static |
Get points both on patch and facezone.
Definition at line 818 of file autoSnapDriver.C.
References autoSnapDriver::avgCellCentres(), HashTableCore::end(), Foam::exit(), polyMesh::faces(), polyMesh::faceZones(), Foam::FatalError, FatalErrorIn, HashTable< T, Key, Hash >::find(), Foam::findIndices(), ZoneMesh< ZoneType, MeshType >::findZoneID(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::meshPointMap(), and PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints().
Referenced by autoSnapDriver::preSmoothPatch().
|
static |
Helper: calculate average cell centre per point.
Definition at line 868 of file autoSnapDriver.C.
References primitiveMesh::cellCentres(), autoSnapDriver::detectNearSurfaces(), polyMesh::faceOwner(), forAll, PrimitivePatch< Face, FaceList, PointField, PointType >::meshPoints(), PrimitivePatch< Face, FaceList, PointField, PointType >::pointFaces(), List< T >::size(), syncTools::syncPointList(), and Vector< Cmpt >::zero.
Referenced by autoSnapDriver::getZoneSurfacePoints().
void detectNearSurfaces | ( | const scalar | planarCos, |
const indirectPrimitivePatch & | pp, | ||
const pointField & | nearestPoint, | ||
const vectorField & | nearestNormal, | ||
vectorField & | disp | ||
) | const |
Per patch point override displacement if in gap situation.
Definition at line 972 of file autoSnapDriver.C.
References meshRefinement::ATTRACTION, autoSnapDriver::calcNearestSurface(), Foam::endl(), refinementSurfaces::findNearestIntersection(), forAll, meshRefinement::getMasterPoints(), surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getUnnamedSurfaces(), Foam::Info, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), PrimitivePatch< Face, FaceList, PointField, PointType >::meshPoints(), PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints(), Time::path(), autoPtr< T >::reset(), Foam::returnReduce(), refinementSurfaces::surfaces(), refinementSurfaces::surfZones(), fvMesh::time(), and autoPtr< T >::valid().
Referenced by autoSnapDriver::avgCellCentres().
|
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 1570 of file autoSnapDriver.C.
References cpuTime::cpuTimeIncrement(), Foam::endl(), refinementSurfaces::findNearest(), refinementSurfaces::findNearestRegion(), forAll, meshRefinement::gAverage(), meshRefinement::getMasterPoints(), surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getUnnamedSurfaces(), Foam::gMax(), Foam::gMin(), Foam::Info, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mag(), meshRefinement::mesh(), PrimitivePatch< Face, FaceList, PointField, PointType >::meshPoints(), Foam::min(), Foam::nl, Foam::Pout, Foam::returnReduce(), List< T >::size(), autoSnapDriver::smoothDisplacement(), Foam::sqr(), meshRefinement::surfaces(), refinementSurfaces::surfZones(), syncTools::syncPointList(), fvMesh::time(), WarningIn, and Vector< Cmpt >::zero.
Referenced by autoSnapDriver::detectNearSurfaces().
void smoothDisplacement | ( | const snapParameters & | snapParams, |
motionSmoother & | meshMover | ||
) | const |
Smooth the displacement field to the internal.
Definition at line 2070 of file autoSnapDriver.C.
References cpuTime::cpuTimeIncrement(), motionSmootherData::displacement(), Foam::endl(), Foam::Info, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mag(), meshRefinement::MESH, PrimitivePatch< Face, FaceList, PointField, PointType >::meshPoints(), Foam::nl, snapParameters::nSmoothDispl(), motionSmootherAlgo::patch(), Time::path(), motionSmootherAlgo::pMesh(), autoSnapDriver::scaleMesh(), motionSmootherAlgo::smooth(), fvMesh::time(), Ostream::write(), meshRefinement::writeLevel(), and meshRefinement::WRITEMESH.
Referenced by autoSnapDriver::calcNearestSurface().
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 2139 of file autoSnapDriver.C.
References cpuTime::cpuTimeIncrement(), motionSmootherData::displacement(), Foam::endl(), Foam::identity(), Foam::Info, Foam::mag(), meshRefinement::MESH, primitiveMesh::nFaces(), Foam::nl, snapParameters::nSnap(), autoSnapDriver::repatchToSurface(), motionSmootherAlgo::scaleMesh(), motionSmootherAlgo::setErrorReduction(), fvMesh::time(), regIOobject::write(), and fvMesh::write().
Referenced by autoSnapDriver::smoothDisplacement().
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 2205 of file autoSnapDriver.C.
References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), polyMesh::boundaryMesh(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::clear(), cpuTime::cpuTimeIncrement(), autoSnapDriver::doSnap(), Foam::endl(), f1, primitiveMesh::faceCentres(), polyMesh::faceZones(), UList< T >::fcIndex(), refinementSurfaces::findNearestRegion(), forAll, surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getUnnamedSurfaces(), refinementSurfaces::globalRegion(), Foam::Info, PrimitivePatch< Face, FaceList, PointField, PointType >::localFaces(), PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mag(), meshRefinement::makePatch(), Foam::max(), primitiveMesh::nFaces(), Foam::nl, face::normal(), PatchTools::pointNormals(), UList< T >::rcIndex(), Foam::returnReduce(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::setCapacity(), List< T >::setSize(), List< T >::size(), Foam::sqr(), polyPatch::start(), refinementSurfaces::surfaces(), refinementSurfaces::surfZones(), and fvMesh::time().
Referenced by autoSnapDriver::scaleMesh().
void doSnap | ( | const dictionary & | snapDict, |
const dictionary & | motionDict, | ||
const scalar | featureCos, | ||
const scalar | planarAngle, | ||
const snapParameters & | snapParams | ||
) |
Only if in feature attraction mode:
Nearest feature
Definition at line 2469 of file autoSnapDriver.C.
References meshRefinement::ATTRACTION, surfaceZonesInfo::BAFFLE, surfaceZonesInfo::BOUNDARY, motionSmootherAlgo::checkMesh(), motionSmootherAlgo::correct(), Foam::cos(), cpuTime::cpuTimeIncrement(), Foam::degToRad(), snapParameters::detectNearSurfacesSnap(), motionSmootherData::displacement(), Foam::endl(), Foam::faceMap(), polyMesh::faces(), polyMesh::faceZones(), ZoneMesh< ZoneType, MeshType >::findZoneID(), Pair< Type >::first(), forAll, Foam::Info, PrimitivePatch< Face, FaceList, PointField, PointType >::localPoints(), Foam::mag(), meshRefinement::makeDisplacementField(), meshRefinement::makePatch(), Vector< Cmpt >::max, meshRefinement::MESH, Foam::name(), refinementSurfaces::names(), MeshObject< polyMesh, UpdateableMeshObject, pointMesh >::New(), primitiveMesh::nFaces(), snapParameters::nFeatureSnap(), Foam::nl, PrimitivePatch< Face, FaceList, PointField, PointType >::nPoints(), primitiveMesh::nPoints(), Time::path(), Foam::Pout, Foam::returnReduce(), Pair< Type >::second(), motionSmootherAlgo::setDisplacement(), List< T >::setSize(), refinementSurfaces::surfaces(), refinementSurfaces::surfZones(), syncTools::syncFaceList(), syncTools::syncPointList(), fvMesh::time(), FixedList< T, Size >::transfer(), meshRefinement::updateList(), autoPtr< T >::valid(), WarningIn, Ostream::write(), regIOobject::write(), meshRefinement::writeLevel(), meshRefinement::WRITEMESH, and Vector< Cmpt >::zero.
Referenced by autoSnapDriver::repatchToSurface().