diff --git a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C index aceef22a5e..a870ca8fd5 100644 --- a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C +++ b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C @@ -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& 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()); + reduce(bounds().max(), maxOp()); + if (debug) { Info<< "Constructed from triSurface:" << endl; @@ -1410,6 +1396,9 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io) { read(); + reduce(bounds().min(), minOp()); + reduce(bounds().max(), maxOp()); + if (debug) { Info<< "Read distributedTriSurface from " << io.objectPath() @@ -1469,6 +1458,9 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh { read(); + reduce(bounds().min(), minOp()); + reduce(bounds().max(), maxOp()); + 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& 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()); + reduce(bounds().max(), maxOp()); + // Regions stays same // Volume type stays same. diff --git a/src/meshTools/searchableSurface/searchablePlane.C b/src/meshTools/searchableSurface/searchablePlane.C index 3fb9c458ed..21473ae102 100644 --- a/src/meshTools/searchableSurface/searchablePlane.C +++ b/src/meshTools/searchableSurface/searchablePlane.C @@ -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;