From ace1491df332f3c43b61141862ddd2e885dfdeba Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 15 Mar 2019 16:23:10 +0100 Subject: [PATCH] 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 --- src/OpenFOAM/meshes/boundBox/boundBox.H | 12 +++++++-- .../meshes/treeBoundBox/treeBoundBox.H | 26 +++++++++---------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.H b/src/OpenFOAM/meshes/boundBox/boundBox.H index e1165d9896..62739a1f71 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.H +++ b/src/OpenFOAM/meshes/boundBox/boundBox.H @@ -47,7 +47,7 @@ Note namespace Foam { -// Forward declarations +// Forward Declarations class boundBox; class plane; template class tmp; @@ -69,7 +69,15 @@ class boundBox public: - // Static data members + // Static Data Members + + //- Bits used for (x/y/z) direction encoding. + enum directionBit : direction + { + XDIR = 0x1, //!< 0: x-direction (vector component 0) + YDIR = 0x2, //!< 2: y-direction (vector component 1) + ZDIR = 0x4 //!< 4: z-direction (vector component 2) + }; //- A large boundBox: min/max == -/+ ROOTVGREAT static const boundBox greatBox; diff --git a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H index 0a2c26917f..b106d97fc5 100644 --- a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H +++ b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -73,7 +73,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations class Random; class treeBoundBox; Istream& operator>>(Istream& is, treeBoundBox& bb); @@ -91,11 +91,11 @@ class treeBoundBox public: - // Static data members + // Static Data Members - //- Bits used for octant/point coding. + //- Bits used for octant/point encoding. // Every octant/corner point is the combination of three faces. - enum octantBit + enum octantBit : direction { RIGHTHALF = 0x1, TOPHALF = 0x2, @@ -114,16 +114,16 @@ public: FRONT = 5 //!< 5: z-max, front }; - //- Bits used for face coding - enum faceBit + //- Bits used for face encoding + enum faceBit : direction { 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 + LEFTBIT = 0x1 << LEFT, //!< 1: x-min, left + RIGHTBIT = 0x1 << RIGHT, //!< 2: x-max, right + BOTTOMBIT = 0x1 << BOTTOM, //!< 4: y-min, bottom + TOPBIT = 0x1 << TOP, //!< 8: y-max, top + BACKBIT = 0x1 << BACK, //!< 16: z-min, back + FRONTBIT = 0x1 << FRONT //!< 32: z-max, front }; //- Edges codes.