From 106d1447faaaa8d35ebfa2650251130711cb7aa5 Mon Sep 17 00:00:00 2001 From: mattijs <m.janssens@opencfd.co.uk> Date: Wed, 9 Jul 2008 10:08:50 +0100 Subject: [PATCH] no meshed surfaces --- .../autoHexMeshDriver/autoSnapDriver.C | 178 +++++++++--------- 1 file changed, 91 insertions(+), 87 deletions(-) diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index 85b4f9d5d7a..cc866d13ca4 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -1004,120 +1004,124 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface const refinementSurfaces& surfaces = meshRefiner_.surfaces(); const fvMesh& mesh = meshRefiner_.mesh(); - // Divide surfaces into zoned and unzoned - labelList zonedSurfaces; - labelList unzonedSurfaces; - getZonedSurfaces(zonedSurfaces, unzonedSurfaces); - // Displacement per patch point vectorField patchDisp(localPoints.size(), vector::zero); - // 1. All points to non-interface surfaces - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - + if (returnReduce(localPoints.size(), sumOp<label>()) > 0) { - List<pointIndexHit> hitInfo; - labelList hitSurface; - surfaces.findNearest - ( - unzonedSurfaces, - localPoints, - sqr(4*snapDist), // sqr of attract distance - hitSurface, - hitInfo - ); + // Divide surfaces into zoned and unzoned + labelList zonedSurfaces; + labelList unzonedSurfaces; + getZonedSurfaces(zonedSurfaces, unzonedSurfaces); + + + // 1. All points to non-interface surfaces + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - forAll(hitInfo, pointI) { - if (hitInfo[pointI].hit()) + List<pointIndexHit> hitInfo; + labelList hitSurface; + surfaces.findNearest + ( + unzonedSurfaces, + localPoints, + sqr(4*snapDist), // sqr of attract distance + hitSurface, + hitInfo + ); + + forAll(hitInfo, pointI) { - patchDisp[pointI] = - hitInfo[pointI].hitPoint() - - localPoints[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; + //} } - //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 - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // 2. All points on zones to their respective surface + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Surfaces with zone information - const wordList& faceZoneNames = surfaces.faceZoneNames(); + // Surfaces with zone information + const wordList& faceZoneNames = surfaces.faceZoneNames(); - forAll(zonedSurfaces, i) - { - label zoneSurfI = zonedSurfaces[i]; + forAll(zonedSurfaces, i) + { + label zoneSurfI = zonedSurfaces[i]; - const labelList surfacesToTest(1, zoneSurfI); + const labelList surfacesToTest(1, zoneSurfI); - // Get indices of points both on faceZone and on pp. - labelList zonePointIndices - ( - getZoneSurfacePoints + // Get indices of points both on faceZone and on pp. + labelList zonePointIndices ( - 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 - ); + getZoneSurfacePoints + ( + pp, + faceZoneNames[zoneSurfI] + ) + ); - forAll(hitInfo, pointI) - { - if (hitInfo[pointI].hit()) + pointField zonePoints(zonePointIndices.size()); + forAll(zonePointIndices, i) { - patchDisp[pointI] = - hitInfo[pointI].hitPoint() - - localPoints[pointI]; + zonePoints[i] = localPoints[zonePointIndices[i]]; } - else + + // 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) { - WarningIn("autoSnapDriver::calcNearestSurface(..)") - << "For point:" << pointI - << " coordinate:" << localPoints[pointI] - << " did not find any surface within:" - << 4*snapDist[pointI] - << " meter." << endl; + 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)); + { + scalarField magDisp(mag(patchDisp)); - Info<< "Wanted displacement : average:" - << gSum(magDisp)/returnReduce(patchDisp.size(), sumOp<label>()) - << " min:" << gMin(magDisp) - << " max:" << gMax(magDisp) << endl; + Info<< "Wanted displacement : average:" + << gSum(magDisp)/returnReduce(patchDisp.size(), sumOp<label>()) + << " min:" << gMin(magDisp) + << " max:" << gMax(magDisp) << endl; + } } Info<< "Calculated surface displacement in = " -- GitLab