ENH: Robustness and correctness improvements.

This commit is contained in:
graham
2011-03-16 14:10:45 +00:00
parent 25cfcf1476
commit 6244a72748
4 changed files with 41 additions and 38 deletions

View File

@ -783,7 +783,7 @@ Foam::conformalVoronoiMesh::featurePointTree() const
{ {
treeBoundBox overallBb treeBoundBox overallBb
( (
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen_, 1E-4) geometryToConformTo_.globalBounds().extend(rndGen_, 1E-4)
); );
overallBb.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL); overallBb.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);

View File

@ -1793,6 +1793,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
{ {
patchNames = geometryToConformTo_.patchNames(); patchNames = geometryToConformTo_.patchNames();
patchTypes.setSize(patchNames.size(), wallPolyPatch::typeName); patchTypes.setSize(patchNames.size(), wallPolyPatch::typeName);
procNeighbours.setSize(patchNames.size(), -1);
label nProcPatches = 0; label nProcPatches = 0;
@ -1825,10 +1826,9 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
label nNonProcPatches = patchNames.size(); label nNonProcPatches = patchNames.size();
patchTypes.setSize(nNonProcPatches + nProcPatches); patchTypes.setSize(nNonProcPatches + nProcPatches);
procNeighbours.setSize(nNonProcPatches + nProcPatches, -1);
patchNames.setSize(nNonProcPatches + nProcPatches); patchNames.setSize(nNonProcPatches + nProcPatches);
procNeighbours.setSize(patchNames.size() + 1, -1);
label procAddI = 0; label procAddI = 0;
forAll(procUsed, pUI) forAll(procUsed, pUI)
@ -1852,11 +1852,13 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
} }
patchTypes.setSize(patchNames.size() + 1); patchTypes.setSize(patchNames.size() + 1);
procNeighbours.setSize(patchNames.size() + 1);
patchNames.setSize(patchNames.size() + 1); patchNames.setSize(patchNames.size() + 1);
label defaultPatchIndex = patchNames.size() - 1; label defaultPatchIndex = patchNames.size() - 1;
patchTypes[defaultPatchIndex] = wallPolyPatch::typeName; patchTypes[defaultPatchIndex] = wallPolyPatch::typeName;
procNeighbours[defaultPatchIndex] = -1;
patchNames[defaultPatchIndex] = "cvMesh_defaultPatch"; patchNames[defaultPatchIndex] = "cvMesh_defaultPatch";
Pout<< patchTypes << " " << patchNames << endl; Pout<< patchTypes << " " << patchNames << endl;

View File

@ -153,6 +153,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
); );
// Pout<< "vert " << vert << endl; // Pout<< "vert " << vert << endl;
// Pout<< " surfHit " << surfHit << endl;
if (surfHit.hit()) if (surfHit.hit())
{ {
@ -178,8 +179,6 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
); );
} }
} }
// Pout<< " surfHit " << surfHit << endl;
} }
} }
@ -375,7 +374,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
// ( // (
// std::list<Vertex_handle>::iterator ivit = // std::list<Vertex_handle>::iterator ivit =
// incidentVertices.begin(); // incidentVertices.begin();
// ivit != incidentVertices.end(); // ivit !=incidentVertices.end();
// ++ivit // ++ivit
// ) // )
// { // {
@ -418,29 +417,35 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
vit++ vit++
) )
{ {
// If a vertex has been marked to go to another processor, if (!vit->referred())
// then send it
label vIndex = vit->index();
const DynamicList<label>& vertexToProc =
verticesToProc[vIndex];
if (!verticesToProc.empty())
{ {
forAll(vertexToProc, vTPI) // If a vertex has been marked to go to another processor,
// then send it
label vIndex = vit->index();
const DynamicList<label>& vertexToProc =
verticesToProc[vIndex];
if (!verticesToProc.empty())
{ {
parallelInterfacePoints.append(topoint(vit->point())); forAll(vertexToProc, vTPI)
targetProcessor.append(vertexToProc[vTPI]);
if (vit->internalOrBoundaryPoint())
{ {
parallelInterfaceIndices.append(vit->index()); parallelInterfacePoints.append
} (
else topoint(vit->point())
{ );
parallelInterfaceIndices.append(-1);
targetProcessor.append(vertexToProc[vTPI]);
if (vit->internalOrBoundaryPoint())
{
parallelInterfaceIndices.append(vit->index());
}
else
{
parallelInterfaceIndices.append(-1);
}
} }
} }
} }
@ -448,7 +453,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
writePoints writePoints
( (
"parallelInterfacePointsToSend.obj", "parallelInterfacePointsToSend_" + name(nIter) + ".obj",
parallelInterfacePoints parallelInterfacePoints
); );
@ -537,7 +542,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
writePoints writePoints
( (
"parallelInterfacePointsReceived.obj", "parallelInterfacePointsReceived_"+ name(nIter) + ".obj",
parallelInterfacePoints parallelInterfacePoints
); );
@ -872,7 +877,7 @@ bool Foam::conformalVoronoiMesh::dualCellSurfaceAnyIntersection
|| is_infinite(fit->first->neighbor(fit->second)) || is_infinite(fit->first->neighbor(fit->second))
) )
{ {
return true; continue;
} }
Foam::point dE0 = topoint(dual(fit->first)); Foam::point dE0 = topoint(dual(fit->first));
@ -913,7 +918,7 @@ Foam::conformalVoronoiMesh::parallelInterfaceIntersection
|| is_infinite(fit->first->neighbor(fit->second)) || is_infinite(fit->first->neighbor(fit->second))
) )
{ {
return procs; continue;
} }
Foam::point dE0 = topoint(dual(fit->first)); Foam::point dE0 = topoint(dual(fit->first));
@ -957,7 +962,7 @@ Foam::conformalVoronoiMesh::parallelInterfaceIntersection
// meshTools::writeOBJ(Pout, dE0); // meshTools::writeOBJ(Pout, dE0);
// meshTools::writeOBJ(Pout, dE1); // meshTools::writeOBJ(Pout, dE1);
// meshTools::writeOBJ(Pout, boxPt); // meshTools::writeOBJ(Pout, boxPt);
// Pout << "l 1 2" << endl; // Pout << "l dE0 dE1" << endl;
} }
} }
@ -1290,7 +1295,7 @@ void Foam::conformalVoronoiMesh::buildEdgeLocationTree
{ {
treeBoundBox overallBb treeBoundBox overallBb
( (
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen_, 1E-4) geometryToConformTo_.globalBounds().extend(rndGen_, 1E-4)
); );
overallBb.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL); overallBb.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
@ -1314,7 +1319,7 @@ void Foam::conformalVoronoiMesh::buildSizeAndAlignmentTree() const
{ {
treeBoundBox overallBb treeBoundBox overallBb
( (
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen_, 1E-4) geometryToConformTo_.globalBounds().extend(rndGen_, 1E-4)
); );
overallBb.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL); overallBb.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);

View File

@ -765,11 +765,7 @@ hierarchicalDensityWeightedStochastic::initialPoints() const
{ {
const conformationSurfaces& geometry = cvMesh_.geometryToConformTo(); const conformationSurfaces& geometry = cvMesh_.geometryToConformTo();
treeBoundBox hierBB = treeBoundBox(geometry.bounds()).extend treeBoundBox hierBB = geometry.bounds().extend(cvMesh_.rndGen(), 1e-6);
(
cvMesh_.rndGen(),
1E-4
);
std::vector<Vb::Point> initialPoints; std::vector<Vb::Point> initialPoints;