Modified bounds functions

This commit is contained in:
graham
2009-04-09 17:20:41 +01:00
parent 195c3fdc75
commit e505efbe82
2 changed files with 21 additions and 45 deletions

View File

@ -79,23 +79,6 @@ bool Foam::distributedTriSurfaceMesh::read()
// Merge distance
mergeDist_ = readScalar(dict_.lookup("mergeDistance"));
// Calculate the overall boundBox of the undistributed surface
point overallMin(VGREAT, VGREAT, VGREAT);
point overallMax(-VGREAT, -VGREAT, -VGREAT);
forAll(procBb_, procI)
{
const List<treeBoundBox>& bbs = procBb_[procI];
forAll(bbs, bbI)
{
overallMin = ::Foam::min(overallMin, bbs[bbI].min());
overallMax = ::Foam::max(overallMax, bbs[bbI].max());
}
}
bounds() = boundBox(overallMin, overallMax);
return true;
}
@ -1357,6 +1340,9 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
{
read();
reduce(bounds().min(), minOp<point>());
reduce(bounds().max(), maxOp<point>());
if (debug)
{
Info<< "Constructed from triSurface:" << endl;
@ -1410,6 +1396,9 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io)
{
read();
reduce(bounds().min(), minOp<point>());
reduce(bounds().max(), maxOp<point>());
if (debug)
{
Info<< "Read distributedTriSurface from " << io.objectPath()
@ -1469,6 +1458,9 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
{
read();
reduce(bounds().min(), minOp<point>());
reduce(bounds().max(), maxOp<point>());
if (debug)
{
Info<< "Read distributedTriSurface from " << io.objectPath()
@ -2189,23 +2181,6 @@ void Foam::distributedTriSurfaceMesh::distribute
{
procBb_.transfer(newProcBb);
dict_.set("bounds", procBb_[Pstream::myProcNo()]);
// Calculate the overall boundBox of the undistributed surface
point overallMin(VGREAT, VGREAT, VGREAT);
point overallMax(-VGREAT, -VGREAT, -VGREAT);
forAll(procBb_, procI)
{
const List<treeBoundBox>& bbs = procBb_[procI];
forAll(bbs, bbI)
{
overallMin = ::Foam::min(overallMin, bbs[bbI].min());
overallMax = ::Foam::max(overallMax, bbs[bbI].max());
}
}
bounds() = boundBox(overallMin, overallMax);
}
}
@ -2454,6 +2429,12 @@ void Foam::distributedTriSurfaceMesh::distribute
clearOut();
// Set the bounds() value to the boundBox of the undecomposed surface
triSurfaceMesh::bounds() = boundBox(points());
reduce(bounds().min(), minOp<point>());
reduce(bounds().max(), maxOp<point>());
// Regions stays same
// Volume type stays same.

View File

@ -71,19 +71,14 @@ Foam::boundBox Foam::searchablePlane::calcBounds() const
{
point max(VGREAT, VGREAT, VGREAT);
if (mag(normal() & vector(1,0,0)) > 1 - SMALL)
for (direction dir = 0; dir < vector::nComponents; dir++)
{
max.x() = 0;
}
if (mag(normal()[dir]) - 1 < SMALL)
{
max[dir] = 0;
if (mag(normal() & vector(0,1,0)) > 1 - SMALL)
{
max.y() = 0;
}
if (mag(normal() & vector(0,0,1)) > 1 - SMALL)
{
max.z() = 0;
break;
}
}
point min = -max;