ENH: boundBox 'reduce' method (related to #196)

reduce()
- parallel reduction of min/max values.
  Reduces coding for the callers.

  Eg,
      bb.reduce();

  instead of the previous method:
      reduce(bb.min(), minOp<point>());
      reduce(bb.max(), maxOp<point>());

STYLE:

- use initializer list for creating static content
- use point::min/point::max when defining standard boxes
This commit is contained in:
Mark Olesen
2017-01-25 18:52:37 +01:00
parent ec94c078e3
commit 17d76e6261
6 changed files with 46 additions and 55 deletions

View File

@ -60,6 +60,18 @@ int main(int argc, char *argv[])
Info<<"boundBox faces: " << boundBox::faces << endl;
Info<<"hex faces: " << hex.modelFaces() << endl;
boundBox bb = boundBox::greatBox;
Info<<"great box: " << bb << endl;
if (Pstream::parRun())
{
bb = cube(Pstream::myProcNo(), 1.1);
Pout<<"box: " << bb << endl;
bb.reduce();
Pout<<"reduced: " << bb << endl;
}
return 0;
}

View File

@ -569,8 +569,7 @@ Foam::label Foam::checkTopology
bb.min() = min(bb.min(), pts[mp[i]]);
bb.max() = max(bb.max(), pts[mp[i]]);
}
reduce(bb.min(), minOp<vector>());
reduce(bb.max(), maxOp<vector>());
bb.reduce();
Info<< ' ' << bb;
}
}