Commit Graph

50 Commits

Author SHA1 Message Date
Mark Olesen
21f037e3a0 ENH: single/double value reset method for MinMax
- resets min/max to be identical to the specified value,
  which can be more convenient (and slightly more efficient) than doing
  a full reset followed by add()

- additional MinMax intersects() query, which works like overlaps()
  but with exclusive checks at the ends

- provide MinMax::operator&=() to replace (unused) intersect() method

ENH: single/double value reset method for boundBox

- boundBox::operator&=() to replace (rarely used) intersect() method.
  Deprecate boundBox::intersect() to avoid confusion with various
  intersects() method

COMP: provide triangleFwd.H
2022-10-31 18:36:14 +01: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
Andrew Heather
fdf8d10ab4 Merge commit 'e9219558d7' into develop-v1906 2019-12-05 11:47:19 +00:00
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
Mark Olesen
1d79c0452c ENH: additional contiguous traits (#1378)
- change contiguous from a series of global functions to separate
  templated traits classes:

    - is_contiguous
    - is_contiguous_label
    - is_contiguous_scalar

  The static constexpr 'value' and a constexpr conversion operator
  allow use in template expressions.  The change also makes it much
  easier to define general traits and to inherit from them.

  The is_contiguous_label and is_contiguous_scalar are special traits
  for handling data of homogeneous components of the respective types.
2019-07-29 11:36:30 +02:00
Mark Olesen
a48dc227d4 STYLE: fix comment 2019-03-21 09:49:56 +01:00
Mark Olesen
ace1491df3 STYLE: narrow represention for boundBox bits enums
- add boundBox::directionBit enum which contains the same values as the
  treeBoundBox::octantBit enum, but without the attached meaning
2019-03-15 16:23:10 +01:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
Mark Olesen
2067014079 ENH: minor consistency improvements for bounding box
- a valid() method (same as !empty() call) for consistency with other
  containers and data types

- a centre() method (same as midpoint() method) for consistency with
  other OpenFOAM geometric entities
2019-01-09 09:32:23 +01:00
Mark Olesen
907dd6d49f STYLE: consistent indentation and template parameters for FixedList 2019-01-08 21:50:12 +01: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
de2eed3e7d ENH: additional methods and improvements to plane
- signedDistance() method is like distance() but retains
  the positive/negative sign for the side of the plane.

- the sign() method returns the sign as -1,0,+1 integer for
  classification purposes where it is important to distinguish between
  a zero value and a positive value (eg, for cutting). Optional
  tolerance can be supplied to round for zero.

- refactor and inlined simple and frequently used methods.

- add boundBox faceCentre() method, which can be useful for creating
  clipping planes from a bounding box.
  Relocated treeBoundBox faceNormals to boundBox since they apply
  equally there - the meaning of the faces (x-min, x-max, etc)
  is the same, even if the point addressing for the faces differs.
2018-08-03 23:17:49 +02:00
Mark Olesen
2aaae74ee1 STYLE: consistent ordering of "inline explicit" vs. "explicit inline"
- resolve in favour of "inline explicit", which had marginally more
  uses and provides consistent prefixing for inline methods.
2018-05-30 12:11:13 +02:00
Mark Olesen
e6c1b394cc ENH: additional boundBox methods (issue #714)
-  boundBox::nDim() to assess dimensionality

- boundBox::intersect(const plane&) to test if plane intersects the
  bounding box
2018-01-29 10:07:44 +01:00
Mark Olesen
f7e502d459 STYLE: relocate some friend operations to be global ones 2017-05-04 02:39:57 +02:00
Mark Olesen
0ffae6461a ENH: creating a bounding box without points yields an inverted box
- The code create a box with a (0,0,0) point.
  The new definition is more logical and makes it very easy to grow
  the bounding box to include new points. It also simplifies much of
  the logic in the constructors.

- Use ROOTVGREAT instead of VGREAT for sizing greatBox and invertedBox.
  Avoids some overflow issues reported by Mattijs (thus GREAT has been
  used in treeBoundBox), but might still need further revision.
2017-02-01 12:15:00 +00: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
Andrew Heather
9fbd612672 GIT: Initial state after latest Foundation merge 2016-09-20 14:49:08 +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
Henry Weller
a4f8f589de Added forward declaration of friend functions 2016-05-29 22:28:37 +01:00
Henry Weller
95d146ecdf Rationalized the indentation of C-preprocessor directives 2016-02-29 15:42:03 +00:00
Henry
db89978ade Updated headers for Laurence and Andy 2012-12-17 11:42:00 +00:00
laurence
44d1ed3eae ENH: boundBox: Change distanceFromBoxSqr to nearest()
Returns the nearest point instead of a distance
2012-12-12 11:07:52 +00:00
laurence
26a9fbb6e1 ENH: boundBox: Move overlaps function from treeBoundBox.
Update indexedOctree::overlaps to use boundBox::overlaps.
2012-12-11 16:49:36 +00:00
laurence
fb138be9eb ENH: boundBox: Add function to return the faces. 2012-02-16 15:03:10 +00:00
andy
4f40cdb7d7 GIT: Resolve conflict 2011-08-16 16:09:56 +01:00
Henry
c2dd153a14 Copyright transfered to the OpenFOAM Foundation 2011-08-14 12:17:30 +01:00
andy
81d380ddac ENH: Initial commit of arbitrary mesh interface (AMI) functionality 2011-07-18 11:24:22 +01:00
andy
eaef8d482b STYLE: Updated 1991 start copyright year to 2004 2011-01-14 16:08:00 +00:00
andy
099cc39e2e Revert "STYLE: 2011 copyright date."
This reverts commit b18f6cc1ce.
2011-01-05 18:24:29 +00:00
graham
b18f6cc1ce STYLE: 2011 copyright date. 2011-01-05 11:14:26 +00:00
Mark Olesen
881b3dafa2 Merge remote branch 'OpenCFD/master' into olesenm
Conflicts:
	applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C
	applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C
	applications/utilities/surface/surfaceCheck/surfaceCheck.C
	src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C
	src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C
	src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C

NOTE: also needed to strip trailing space/lines in various files
2010-12-21 10:19:53 +01:00
graham
63e24812c2 ENH: Renaming "corners" in boundBox to "points". Overridden in treeBoundBox.
Keeping both functions to ensure that the octant ordering specified in
treeBoundBox is obeyed at the octree level, irrespective of the implementation
of the basic boundBox.
2010-12-13 14:39:55 +00:00
Mark Olesen
24a96a21ca ENH: add 'containsAny' and extra 'contains' methods to boundBox 2010-11-29 13:44:59 +01:00
Mark Olesen
f7ce5fbf0c ENH: Construct bounding box as subset of the pointField.
STYLE: move inline functions into boundBoxI.H

STYLE: reduce duplicate methods in treeBoundBox
2010-11-29 11:13:19 +01:00
graham
9b1788ac85 ENH: boundBox volume function. 2010-11-04 16:49:47 +00:00
graham
d79237597e STYLE: Fixing code style requirements for all src. 2010-07-28 13:31:46 +01:00
Mark Olesen
d29c438657 STYLE: use url for FSF license instead of postal address, switch to GPL v3 2010-03-29 14:07:56 +02:00
Mark Olesen
190bbd69de add corners() method to boundBox 2009-12-07 13:06:03 +01:00
mattijs
bb4a182081 comment 2009-04-06 13:27:51 +01:00
Mark Olesen
d5cbc3bf08 cosmetic cleanups
- grammar in comments, namespace qualifiers, etc.
2009-01-16 19:07:14 +01:00
Mark Olesen
973b9ea0ce boundBox, octree cleanup
- added boundBox(const tmp<pointField>&) constructor for use with
    coordinate systems
  - moved some methods from treeBoundBox to boundBox and use VectorSpace ops
2009-01-01 17:03:19 +01:00
Mark Olesen
28b200bcd9 update copyrights for 2009 2008-12-31 19:01:56 +01:00
Mark Olesen
dcc82bf77b boundingBox has mag() and span() methods - use them 2008-12-31 17:58:23 +01:00
Mark Olesen
d6b247a3b1 added static data boundBox::greatBox and boundBox::invertedBox
- boundBox::invertedBox is useful for initializing our own calculations
- NOTE treeBoundBox::greatBox is still in place, since it uses GREAT
  instead of VGREAT. If this is only historical, we can drop it.
2008-11-22 11:15:20 +01:00
mattijs
a8a3ea5475 binary output 2008-09-03 10:56:24 +01:00
mattijs
212a70a17b boundbox intersect renaming 2008-08-28 15:50:11 +01:00
Mark Olesen
02cabc3cf2 updated Copyright (C) \d+-2008 OpenCFD Ltd. 2008-06-25 15:01:46 +02:00
OpenFOAM-admin
3170c7c0c9 Creation of OpenFOAM-dev repository 15/04/2008 2008-04-15 18:56:58 +01:00