From 288cf7d3c6bc145dc307e9a1caa69654090d39b8 Mon Sep 17 00:00:00 2001 From: graham Date: Mon, 6 Jul 2009 13:57:27 +0100 Subject: [PATCH] Implemented feature non-overpopulation functions, including some reordering of existing tests. Mixed feature point edge group insertions done using the same functions as feature edge conformation. --- .../conformalVoronoiMesh.C | 180 ++++++------------ .../conformalVoronoiMesh.H | 5 +- 2 files changed, 66 insertions(+), 119 deletions(-) diff --git a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index bce75509f0..39ab6ad353 100644 --- a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -583,71 +583,18 @@ void Foam::conformalVoronoiMesh::insertMixedFeaturePoints() const point& pt(feMesh.points()[ptI]); - scalar ppDist = pointPairDistance(pt); - scalar edgeGroupDistance = mixedFeaturePointDistance(pt); forAll(pEds, e) { label edgeI = pEds[e]; - const vectorField& feNormals = feMesh.normals(); - const labelList& edNormalIs = - feMesh.edgeNormals()[edgeI]; - - // As this is an external or internal edge, there are two - // normals by definition - const vector& nA = feNormals[edNormalIs[0]]; - const vector& nB = feNormals[edNormalIs[1]]; - point edgePt = pt + edgeGroupDistance*feMesh.edgeDirection(edgeI, ptI); - // Concave. master and reflected points inside the domain. - point refPt = - edgePt - ppDist*(nA + nB)/(1 + (nA & nB) + VSMALL); + pointIndexHit edgeHit(true, edgePt, edgeI); - featureEdgeMesh::edgeStatus edStatus = - feMesh.getEdgeStatus(edgeI); - - if (edStatus == featureEdgeMesh::INTERNAL) - { - // Generate reflected master to be outside. - point reflMasterPt = refPt + 2*(edgePt - refPt); - - // Reflect reflMasterPt in both faces. - point reflectedA = reflMasterPt - 2*ppDist*nA; - - point reflectedB = reflMasterPt - 2*ppDist*nB; - - // index of reflMaster - label reflectedMaster = number_of_vertices() + 2; - - // Master A is inside. - label reflectedAI = - insertPoint(reflectedA, reflectedMaster); - - // Master B is inside. - insertPoint(reflectedB, reflectedMaster); - - // Slave is outside. - insertPoint(reflMasterPt, reflectedAI); - } - else if (edStatus == featureEdgeMesh::EXTERNAL) - { - // Insert the master point referring the the first slave - label masterPtIndex = - insertPoint(refPt, number_of_vertices() + 1); - - // Insert the slave points by reflecting refPt in both - // faces. with each slave refering to the master - - point reflectedA = refPt + 2*ppDist*nA; - insertPoint(reflectedA, masterPtIndex); - - point reflectedB = refPt + 2*ppDist*nB; - insertPoint(reflectedB, masterPtIndex); - } + insertEdgePointGroup(feMesh, edgeHit); } } } @@ -897,9 +844,19 @@ bool Foam::conformalVoronoiMesh::nearFeatureEdgeLocation autoPtr >& edgeLocationTree ) const { - scalar exclusionRangeSqr = sqr(0.1); - if (newEdgeLocations.size() >= max(0.01*existingEdgeLocations.size(), 100)) + scalar exclusionRangeCoeff = 0.2; + + scalar exclusionRangeSqr = sqr(exclusionRangeCoeff*targetCellSize(pt)); + + // 0.01 and 1000 determined from speed tests, varying the indexedOctree + // rebuild frequency and balance of additions to queries. + + if + ( + newEdgeLocations.size() + >= max(0.01*existingEdgeLocations.size(), 1000) + ) { existingEdgeLocations.append(newEdgeLocations); @@ -966,7 +923,10 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits DynamicList& surfaceHits, DynamicList