Commit Graph

8 Commits

Author SHA1 Message Date
Mark Olesen
1339c3357b ENH: general boundBox/treeBoundBox improvements
- null() static method
  * as const reference to the invertedBox with the appropriate casting.

- boundBox inflate(random)
  * refactored from treeBoundBox::extend, but allows in-place modification

- boundBox::hexFaces() instead of boundBox::faces
  * rarely used, but avoids confusion with treeBoundBox::faces
    and reuses hexCell face definitions without code duplication

- boundBox::hexCorners() for corner points corresponding to a hexCell.
  Can also be accessed from a treeBoundBox without ambiguity with
  points(), which could be hex corners (boundBox) or octant corners
  (treeBoundBox)

- boundBox::add with pairs of points
  * convenient (for example) when adding edges or a 'box' that has
    been extracted from a primitive mesh shape.

- declare boundBox nPoints(), nFaces(), nEdges() as per hexCell

ENH: return invertedBox instead of FatalError for empty trees

- similar to #2612

ENH: cellShape(HEX, ...) + boundBox hexCorners for block meshes

STYLE: cellModel::ref(...) instead of de-reference cellModel::ptr(...)
2022-11-24 12:21:01 +00:00
Mark Olesen
61deacd24d ENH: boundBox improvements (#2609)
- construct boundBox from Pair<point> of min/max limits,
  make sortable

- additional bounding box intersections (linePointRef), add noexcept

- templated access for boundBox hex-corners
  (used to avoid temporary point field).
  Eg, unrolled plane/bound-box intersection with early exit

- bounding box grow() to expand box by absolute amounts
  Eg,

      bb.grow(ROOTVSMALL);   // Or: bb.grow(point::uniform(ROOTVSMALL));
  vs
      bb.min() -= point::uniform(ROOTVSMALL);
      bb.max() += point::uniform(ROOTVSMALL);

- treeBoundBox bounding box extend with two or three parameters.
  The three parameter version includes grow(...) for reduced writing.
  Eg,

      bb = bb.extend(rndGen, 1e-4, ROOTVSMALL);

  vs
      bb = bb.extend(rndGen, 1e-4);
      bb.min() -= point::uniform(ROOTVSMALL);
      bb.max() += point::uniform(ROOTVSMALL);

  This also permits use as const variables or parameter passing.
  Eg,

      const treeBoundBox bb
      (
          treeBoundBox(some_points).extend(rndGen, 1e-4, ROOTVSMALL)
      );
2022-10-12 13:19:44 +02:00
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
Mark Olesen
822acaf6ef ENH: make indices for boundBox::add() a templated parameter
- allows use with any container with begin(), end() and where the
  "*iterator" dereference returns a label, which is used for indexing
  into the list of points.
  This container could be labelUList, bitSet, labelHashSet, etc
2018-08-07 22:23:16 +02:00
Mark Olesen
8730a7622a ENH: enumerations for known cell models in cellModel, ptr/ref lookups
- this provides a better typesafe means of locating predefined cell
  models than relying on strings. The lookup is now ptr() or ref()
  directly. The lookup functions behave like on-demand singletons when
  loading "etc/cellModels".

  Functionality is now located entirely in cellModel but a forwarding
  version of cellModeller is provided for API (but not ABI) compatibility
  with older existing user code.

STYLE: use constexpr for cellMatcher constants
2017-11-18 11:05:05 +01:00
Mark Olesen
722d23f59c ENH: additional methods/operators for boundBox (related to #196)
- Constructor for bounding box of a single point.

- add(boundBox), add(point) ...
  -> Extend box to enclose the second box or point(s).

  Eg,
      bb.add(pt);
  vs.
      bb.min() = Foam::min(bb.min(), pt);
      bb.max() = Foam::max(bb.max(), pt);

Also works with other bounding boxes.
  Eg,
      bb.add(bb2);
      // OR
      bb += bb2;
  vs.
      bb.min() = Foam::min(bb.min(), bb2.min());
      bb.max() = Foam::max(bb.max(), bb2.max());

'+=' operator allows the reduction to be used in parallel
gather/scatter operations.

A global '+' operator is not currently needed.

Note: may be useful in the future to have a 'clear()' method
that resets to a zero-sized (inverted) box.

STYLE: make many bounding box constructors explicit
2017-01-25 19:26:50 +01:00
Mark Olesen
17d76e6261 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
2017-01-25 18:52:37 +01:00
Mark Olesen
2b5e73fbce BUG: incorrect face order/orientation in boundBox (issue #196)
- was fortunately not used anywhere previously
2016-07-28 07:00:33 +02:00