/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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.
Note
When a bounding box is created without any points, it creates an inverted
bounding box. Points can be added later and the bounding box will grow to
include them.
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 Random;
// Forward declaration of friend functions and operators
class treeBoundBox;
bool operator==(const treeBoundBox& a, const treeBoundBox& b);
bool operator!=(const treeBoundBox& a, const treeBoundBox& b);
Istream& operator>>(Istream& is, treeBoundBox& bb);
Ostream& operator<<(Ostream& os, const treeBoundBox& bb);
/*---------------------------------------------------------------------------*\
Class treeBoundBox Declaration
\*---------------------------------------------------------------------------*/
class treeBoundBox
:
public boundBox
{
public:
// Static data members
//- Bits used for octant/point coding.
// Every octant/corner point is the combination of three faces.
enum octantBit
{
RIGHTHALF = 0x1 << 0,
TOPHALF = 0x1 << 1,
FRONTHALF = 0x1 << 2
};
//- Face codes
enum faceId
{
LEFT = 0,
RIGHT = 1,
BOTTOM = 2,
TOP = 3,
BACK = 4,
FRONT = 5
};
//- Bits used for face coding
enum faceBit
{
NOFACE = 0,
LEFTBIT = 0x1 << LEFT, //1
RIGHTBIT = 0x1 << RIGHT, //2
BOTTOMBIT = 0x1 << BOTTOM, //4
TOPBIT = 0x1 << TOP, //8
BACKBIT = 0x1 << BACK, //16
FRONTBIT = 0x1 << FRONT, //32
};
//- Edges codes.
// E01 = edge between 0 and 1.
enum edgeId
{
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;
//- The unit normal per face
static const FixedList faceNormals;
// Constructors
//- Construct null setting points to zero
inline treeBoundBox();
//- Construct from a boundBox
explicit inline treeBoundBox(const boundBox& bb);
//- Construct a bounding box containing a single initial point
explicit inline treeBoundBox(const point& pt);
//- 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& points);
//- Construct as subset of points
// Local processor domain only (no reduce as in boundBox)
treeBoundBox(const UList& points, 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& points,
const FixedList