diff --git a/applications/utilities/mesh/generation/CV3DMesher/CV3D.C b/applications/utilities/mesh/generation/CV3DMesher/CV3D.C index 494a71e643..9e64e02172 100644 --- a/applications/utilities/mesh/generation/CV3DMesher/CV3D.C +++ b/applications/utilities/mesh/generation/CV3DMesher/CV3D.C @@ -51,6 +51,7 @@ void Foam::CV3D::reinsertPoints(const pointField& points) Info<< nl << "Reinserting points after motion. "; startOfInternalPoints_ = number_of_vertices(); + label nVert = startOfInternalPoints_; // Add the points and index them @@ -660,6 +661,8 @@ void Foam::CV3D::relaxPoints(const scalar relaxation) scalarField weightAccumulator(startOfSurfacePointPairs_, 0); + List pointToBeRetained(startOfSurfacePointPairs_, true); + label dualVerti = 0; // Find the dual point of each tetrahedron and assign it an index. @@ -1087,16 +1090,6 @@ void Foam::CV3D::relaxPoints(const scalar relaxation) delta *= faceAreaWeight(faceArea); - if (vA->internalPoint()) - { - displacementAccumulator[vA->index()] += delta; - } - if (vB->internalPoint()) - { - displacementAccumulator[vB->index()] += -delta; - } - - // Point insertion criteria if ( rABMag > 1.55*targetCellSize @@ -1106,6 +1099,8 @@ void Foam::CV3D::relaxPoints(const scalar relaxation) && alignmentDotProd > 0.93 ) { + // Point insertion criteria + // Info<< nl<< "Long edge match = " // << rABMag // << nl << dVA @@ -1114,22 +1109,44 @@ void Foam::CV3D::relaxPoints(const scalar relaxation) insertionPoints.append(0.5*(dVA + dVB)); } - - // Point removal criteria - if + else if ( - rABMag < 0.7*targetCellSize - && vA->internalPoint() - && vB->internalPoint() + rABMag < 0.65*targetCellSize + && (vA->internalPoint() || vB->internalPoint()) // && faceArea > 0.0025*targetFaceArea // && alignmentDotProd > 0.93 ) { - Info<< nl<< "Short edge match = " - << rABMag - << nl << dVA - << nl << dVB - << endl; + // Point removal criteria + + // Info<< nl<< "Short edge match = " + // << rABMag + // << nl << dVA + // << nl << dVB + // << endl; + + //insertionPoints.append(0.5*(dVA + dVB)); + + if (vA->internalPoint()) + { + pointToBeRetained[vA->index()] = false; + } + + if (vB->internalPoint()) + { + pointToBeRetained[vB->index()] = false; + } + } + else + { + if (vA->internalPoint()) + { + displacementAccumulator[vA->index()] += delta; + } + if (vB->internalPoint()) + { + displacementAccumulator[vB->index()] += -delta; + } } } } @@ -1344,6 +1361,101 @@ void Foam::CV3D::relaxPoints(const scalar relaxation) // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Scan dual cells for those with SMALL volumes or lots of faces + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // for + // ( + // Triangulation::Finite_vertices_iterator vit = + // finite_vertices_begin(); + // vit != finite_vertices_end(); + // vit++ + // ) + // { + // if (vit->internalPoint()) + // { + // std::list incidentEdges; + + // incident_edges(vit, std::back_inserter(incidentEdges)); + + // if (incidentEdges.size() > 47) + // { + // Info<< "Highly connected cell removed " + // << nl << "incidentEdges = " << incidentEdges.size() + // << ", position = " << topoint(vit->point()) + // << endl; + + // pointToBeRetained[vit->index()] = false; + // } + // else + // { + // faceList faces(incidentEdges.size()); + + // label faceI = 0; + + // labelList faceLabels(incidentEdges.size(), -1); + + // for + // ( + // std::list::iterator eit = incidentEdges.begin(); + // eit != incidentEdges.end(); + // ++eit + // ) + // { + // Cell_circulator ccStart = incident_cells(*eit); + // Cell_circulator cc = ccStart; + + // DynamicList