/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
Class
Foam::treeBoundBox
Description
Standard boundBox + extra functionality for use in octree.
Numbering of corner points is according to octant numbering.
On the back plane (z=0):
\verbatim
Y
^
|
+--------+
|2 3|
| |
| |
| |
|0 1|
+--------+->X
\endverbatim
For the front plane add 4 to the point labels.
SourceFiles
treeBoundBoxI.H
treeBoundBox.C
treeBoundBoxTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef treeBoundBox_H
#define treeBoundBox_H
#include "boundBox.H"
#include "direction.H"
#include "pointField.H"
#include "faceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class randomGenerator;
// Forward declaration of friend functions and operators
class treeBoundBox;
bool operator==(const treeBoundBox&, const treeBoundBox&);
bool operator!=(const treeBoundBox&, const treeBoundBox&);
Istream& operator>>(Istream& is, treeBoundBox&);
Ostream& operator<<(Ostream& os, const treeBoundBox&);
/*---------------------------------------------------------------------------*\
Class treeBoundBox Declaration
\*---------------------------------------------------------------------------*/
class treeBoundBox
:
public boundBox
{
//- To initialise edges.
static edgeList calcEdges(const label[12][2]);
//- To initialise faceNormals.
static FixedList calcFaceNormals();
public:
// Static Data Members
//- As per boundBox::greatBox, but with great instead of vGreat
static const treeBoundBox greatBox;
//- As per boundBox::invertedBox, but with great instead of vGreat
static const treeBoundBox invertedBox;
//- Bits used for octant/point coding.
// Every octant/corner point is the combination of three faces.
struct octantBit
{
enum
{
rightHalf = 0x1 << 0,
topHalf = 0x1 << 1,
frontHalf = 0x1 << 2
};
};
//- Face codes
struct faceId
{
enum
{
left = 0,
right = 1,
bottom = 2,
top = 3,
back = 4,
front = 5
};
};
//- Bits used for face coding
struct faceBit
{
enum
{
noFace = 0,
left = 0x1 << faceId::left, //1
right = 0x1 << faceId::right, //2
bottom = 0x1 << faceId::bottom, //4
top = 0x1 << faceId::top, //8
back = 0x1 << faceId::back, //16
front = 0x1 << faceId::front, //32
};
};
//- Edges codes.
// e01 = edge between 0 and 1.
struct edgeId
{
enum
{
e01 = 0,
e13 = 1,
e23 = 2,
e02 = 3,
e45 = 4,
e57 = 5,
e67 = 6,
e46 = 7,
e04 = 8,
e15 = 9,
e37 = 10,
e26 = 11
};
};
//- Face to point addressing
static const faceList faces;
//- Edge to point addressing
static const edgeList edges;
//- Per face the unit normal
static const FixedList faceNormals;
// Constructors
//- Construct null setting points to zero
inline treeBoundBox();
//- Construct from a boundBox
explicit inline treeBoundBox(const boundBox& bb);
//- Construct from components
inline treeBoundBox(const point& min, const point& max);
//- Construct as the bounding box of the given pointField.
// Local processor domain only (no reduce as in boundBox)
explicit treeBoundBox(const UList&);
//- Construct as subset of points
// Local processor domain only (no reduce as in boundBox)
treeBoundBox(const UList&, const labelUList& indices);
//- Construct as subset of points
// The indices could be from edge/triFace etc.
// Local processor domain only (no reduce as in boundBox)
template
treeBoundBox
(
const UList&,
const FixedList