mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: incorrect face order/orientation in boundBox (issue #196)
- was fortunately not used anywhere previously
This commit is contained in:
3
applications/test/boundBox/Make/files
Normal file
3
applications/test/boundBox/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Test-boundBox.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/Test-boundBox
|
||||||
7
applications/test/boundBox/Make/options
Normal file
7
applications/test/boundBox/Make/options
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools
|
||||||
67
applications/test/boundBox/Test-boundBox.C
Normal file
67
applications/test/boundBox/Test-boundBox.C
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
|
\\/ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Test bounding box behaviour
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
|
#include "boundBox.H"
|
||||||
|
#include "treeBoundBox.H"
|
||||||
|
#include "cellModeller.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
//- simple helper to create a cube
|
||||||
|
boundBox cube(scalar start, scalar width)
|
||||||
|
{
|
||||||
|
return boundBox
|
||||||
|
(
|
||||||
|
point(start, start, start),
|
||||||
|
point(start + width, start + width, start + width)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
// #include "createTime.H"
|
||||||
|
// #include "createMesh.H"
|
||||||
|
|
||||||
|
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||||
|
|
||||||
|
Info<<"boundBox faces: " << boundBox::faces << endl;
|
||||||
|
Info<<"hex faces: " << hex.modelFaces() << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,6 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
|
#include "ListOps.H"
|
||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
#include "tmp.H"
|
#include "tmp.H"
|
||||||
|
|
||||||
@ -45,6 +46,27 @@ const Foam::boundBox Foam::boundBox::invertedBox
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//! \cond ignoreDocumentation
|
||||||
|
//- Skip documentation : local scope only
|
||||||
|
const Foam::label facesArray[6][4] =
|
||||||
|
{
|
||||||
|
// point and face order as per hex cellmodel
|
||||||
|
{0, 4, 7, 3}, // x-min
|
||||||
|
{1, 2, 6, 5}, // x-max
|
||||||
|
{0, 1, 5, 4}, // y-min
|
||||||
|
{3, 7, 6, 2}, // y-max
|
||||||
|
{0, 3, 2, 1}, // z-min
|
||||||
|
{4, 5, 6, 7} // z-max
|
||||||
|
};
|
||||||
|
//! \endcond
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::faceList Foam::boundBox::faces
|
||||||
|
(
|
||||||
|
initListList<face, label, 6, 4>(facesArray)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::boundBox::calculate(const UList<point>& points, const bool doReduce)
|
void Foam::boundBox::calculate(const UList<point>& points, const bool doReduce)
|
||||||
@ -164,49 +186,6 @@ Foam::tmp<Foam::pointField> Foam::boundBox::points() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::faceList Foam::boundBox::faces()
|
|
||||||
{
|
|
||||||
faceList faces(6);
|
|
||||||
|
|
||||||
forAll(faces, fI)
|
|
||||||
{
|
|
||||||
faces[fI].setSize(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
faces[0][0] = 0;
|
|
||||||
faces[0][1] = 1;
|
|
||||||
faces[0][2] = 2;
|
|
||||||
faces[0][3] = 3;
|
|
||||||
|
|
||||||
faces[1][0] = 2;
|
|
||||||
faces[1][1] = 6;
|
|
||||||
faces[1][2] = 7;
|
|
||||||
faces[1][3] = 3;
|
|
||||||
|
|
||||||
faces[2][0] = 0;
|
|
||||||
faces[2][1] = 4;
|
|
||||||
faces[2][2] = 5;
|
|
||||||
faces[2][3] = 1;
|
|
||||||
|
|
||||||
faces[3][0] = 4;
|
|
||||||
faces[3][1] = 7;
|
|
||||||
faces[3][2] = 6;
|
|
||||||
faces[3][3] = 5;
|
|
||||||
|
|
||||||
faces[4][0] = 3;
|
|
||||||
faces[4][1] = 7;
|
|
||||||
faces[4][2] = 4;
|
|
||||||
faces[4][3] = 0;
|
|
||||||
|
|
||||||
faces[5][0] = 1;
|
|
||||||
faces[5][1] = 5;
|
|
||||||
faces[5][2] = 6;
|
|
||||||
faces[5][3] = 2;
|
|
||||||
|
|
||||||
return faces;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::boundBox::inflate(const scalar s)
|
void Foam::boundBox::inflate(const scalar s)
|
||||||
{
|
{
|
||||||
vector ext = vector::one*s*mag();
|
vector ext = vector::one*s*mag();
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -79,6 +79,9 @@ public:
|
|||||||
//- A very large inverted boundBox: min/max == +/- VGREAT
|
//- A very large inverted boundBox: min/max == +/- VGREAT
|
||||||
static const boundBox invertedBox;
|
static const boundBox invertedBox;
|
||||||
|
|
||||||
|
//- Faces to point addressing, as per a 'hex' cell
|
||||||
|
static const faceList faces;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
@ -158,12 +161,9 @@ public:
|
|||||||
//- Average length/height/width dimension
|
//- Average length/height/width dimension
|
||||||
inline scalar avgDim() const;
|
inline scalar avgDim() const;
|
||||||
|
|
||||||
//- Return corner points in an order corresponding to a 'hex' cell
|
//- Corner points in an order corresponding to a 'hex' cell
|
||||||
tmp<pointField> points() const;
|
tmp<pointField> points() const;
|
||||||
|
|
||||||
//- Return faces with correct point order
|
|
||||||
static faceList faces();
|
|
||||||
|
|
||||||
|
|
||||||
// Manipulate
|
// Manipulate
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user