mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
no meshed surfaces
This commit is contained in:
@ -1004,120 +1004,124 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
|
|||||||
const refinementSurfaces& surfaces = meshRefiner_.surfaces();
|
const refinementSurfaces& surfaces = meshRefiner_.surfaces();
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
// Divide surfaces into zoned and unzoned
|
|
||||||
labelList zonedSurfaces;
|
|
||||||
labelList unzonedSurfaces;
|
|
||||||
getZonedSurfaces(zonedSurfaces, unzonedSurfaces);
|
|
||||||
|
|
||||||
// Displacement per patch point
|
// Displacement per patch point
|
||||||
vectorField patchDisp(localPoints.size(), vector::zero);
|
vectorField patchDisp(localPoints.size(), vector::zero);
|
||||||
|
|
||||||
|
|
||||||
// 1. All points to non-interface surfaces
|
if (returnReduce(localPoints.size(), sumOp<label>()) > 0)
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
{
|
{
|
||||||
List<pointIndexHit> hitInfo;
|
// Divide surfaces into zoned and unzoned
|
||||||
labelList hitSurface;
|
labelList zonedSurfaces;
|
||||||
surfaces.findNearest
|
labelList unzonedSurfaces;
|
||||||
(
|
getZonedSurfaces(zonedSurfaces, unzonedSurfaces);
|
||||||
unzonedSurfaces,
|
|
||||||
localPoints,
|
|
||||||
sqr(4*snapDist), // sqr of attract distance
|
// 1. All points to non-interface surfaces
|
||||||
hitSurface,
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
hitInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(hitInfo, pointI)
|
|
||||||
{
|
{
|
||||||
if (hitInfo[pointI].hit())
|
List<pointIndexHit> hitInfo;
|
||||||
{
|
labelList hitSurface;
|
||||||
patchDisp[pointI] =
|
surfaces.findNearest
|
||||||
hitInfo[pointI].hitPoint()
|
|
||||||
- localPoints[pointI];
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// WarningIn("autoSnapDriver::calcNearestSurface(..)")
|
|
||||||
// << "For point:" << pointI
|
|
||||||
// << " coordinate:" << localPoints[pointI]
|
|
||||||
// << " did not find any surface within:"
|
|
||||||
// << 4*snapDist[pointI]
|
|
||||||
// << " meter." << endl;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 2. All points on zones to their respective surface
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
// Surfaces with zone information
|
|
||||||
const wordList& faceZoneNames = surfaces.faceZoneNames();
|
|
||||||
|
|
||||||
forAll(zonedSurfaces, i)
|
|
||||||
{
|
|
||||||
label zoneSurfI = zonedSurfaces[i];
|
|
||||||
|
|
||||||
const labelList surfacesToTest(1, zoneSurfI);
|
|
||||||
|
|
||||||
// Get indices of points both on faceZone and on pp.
|
|
||||||
labelList zonePointIndices
|
|
||||||
(
|
|
||||||
getZoneSurfacePoints
|
|
||||||
(
|
(
|
||||||
pp,
|
unzonedSurfaces,
|
||||||
faceZoneNames[zoneSurfI]
|
localPoints,
|
||||||
)
|
sqr(4*snapDist), // sqr of attract distance
|
||||||
);
|
hitSurface,
|
||||||
|
hitInfo
|
||||||
|
);
|
||||||
|
|
||||||
pointField zonePoints(zonePointIndices.size());
|
forAll(hitInfo, pointI)
|
||||||
forAll(zonePointIndices, i)
|
|
||||||
{
|
|
||||||
zonePoints[i] = localPoints[zonePointIndices[i]];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find nearest for points both on faceZone and pp.
|
|
||||||
List<pointIndexHit> hitInfo;
|
|
||||||
labelList hitSurface;
|
|
||||||
surfaces.findNearest
|
|
||||||
(
|
|
||||||
labelList(1, zoneSurfI),
|
|
||||||
zonePoints,
|
|
||||||
sqr(4*snapDist),
|
|
||||||
hitSurface,
|
|
||||||
hitInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(hitInfo, pointI)
|
|
||||||
{
|
|
||||||
if (hitInfo[pointI].hit())
|
|
||||||
{
|
{
|
||||||
patchDisp[pointI] =
|
if (hitInfo[pointI].hit())
|
||||||
hitInfo[pointI].hitPoint()
|
{
|
||||||
- localPoints[pointI];
|
patchDisp[pointI] =
|
||||||
}
|
hitInfo[pointI].hitPoint()
|
||||||
else
|
- localPoints[pointI];
|
||||||
{
|
}
|
||||||
WarningIn("autoSnapDriver::calcNearestSurface(..)")
|
//else
|
||||||
<< "For point:" << pointI
|
//{
|
||||||
<< " coordinate:" << localPoints[pointI]
|
// WarningIn("autoSnapDriver::calcNearestSurface(..)")
|
||||||
<< " did not find any surface within:"
|
// << "For point:" << pointI
|
||||||
<< 4*snapDist[pointI]
|
// << " coordinate:" << localPoints[pointI]
|
||||||
<< " meter." << endl;
|
// << " did not find any surface within:"
|
||||||
|
// << 4*snapDist[pointI]
|
||||||
|
// << " meter." << endl;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
scalarField magDisp(mag(patchDisp));
|
|
||||||
|
|
||||||
Info<< "Wanted displacement : average:"
|
// 2. All points on zones to their respective surface
|
||||||
<< gSum(magDisp)/returnReduce(patchDisp.size(), sumOp<label>())
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
<< " min:" << gMin(magDisp)
|
|
||||||
<< " max:" << gMax(magDisp) << endl;
|
// Surfaces with zone information
|
||||||
|
const wordList& faceZoneNames = surfaces.faceZoneNames();
|
||||||
|
|
||||||
|
forAll(zonedSurfaces, i)
|
||||||
|
{
|
||||||
|
label zoneSurfI = zonedSurfaces[i];
|
||||||
|
|
||||||
|
const labelList surfacesToTest(1, zoneSurfI);
|
||||||
|
|
||||||
|
// Get indices of points both on faceZone and on pp.
|
||||||
|
labelList zonePointIndices
|
||||||
|
(
|
||||||
|
getZoneSurfacePoints
|
||||||
|
(
|
||||||
|
pp,
|
||||||
|
faceZoneNames[zoneSurfI]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
pointField zonePoints(zonePointIndices.size());
|
||||||
|
forAll(zonePointIndices, i)
|
||||||
|
{
|
||||||
|
zonePoints[i] = localPoints[zonePointIndices[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find nearest for points both on faceZone and pp.
|
||||||
|
List<pointIndexHit> hitInfo;
|
||||||
|
labelList hitSurface;
|
||||||
|
surfaces.findNearest
|
||||||
|
(
|
||||||
|
labelList(1, zoneSurfI),
|
||||||
|
zonePoints,
|
||||||
|
sqr(4*snapDist),
|
||||||
|
hitSurface,
|
||||||
|
hitInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(hitInfo, pointI)
|
||||||
|
{
|
||||||
|
if (hitInfo[pointI].hit())
|
||||||
|
{
|
||||||
|
patchDisp[pointI] =
|
||||||
|
hitInfo[pointI].hitPoint()
|
||||||
|
- localPoints[pointI];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WarningIn("autoSnapDriver::calcNearestSurface(..)")
|
||||||
|
<< "For point:" << pointI
|
||||||
|
<< " coordinate:" << localPoints[pointI]
|
||||||
|
<< " did not find any surface within:"
|
||||||
|
<< 4*snapDist[pointI]
|
||||||
|
<< " meter." << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
scalarField magDisp(mag(patchDisp));
|
||||||
|
|
||||||
|
Info<< "Wanted displacement : average:"
|
||||||
|
<< gSum(magDisp)/returnReduce(patchDisp.size(), sumOp<label>())
|
||||||
|
<< " min:" << gMin(magDisp)
|
||||||
|
<< " max:" << gMax(magDisp) << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Calculated surface displacement in = "
|
Info<< "Calculated surface displacement in = "
|
||||||
|
|||||||
Reference in New Issue
Block a user