STYLE: relocate nonCoupledBoundaryTree into meshSearcher

- use point::uniform in more places
This commit is contained in:
Mark Olesen
2020-02-24 17:41:06 +01:00
parent 3835734f6a
commit a456e9ae92
20 changed files with 165 additions and 169 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -68,8 +69,8 @@ int main(int argc, char *argv[])
efem.points()
);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
labelList allEdges(identity(efem.edges().size()));

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1983,8 +1984,8 @@ void Foam::conformalVoronoiMesh::buildEdgeLocationTree
geometryToConformTo_.globalBounds().extend(rndGen_, 1e-4)
);
overallBb.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.min() -= Foam::point::uniform(ROOTVSMALL);
overallBb.max() += Foam::point::uniform(ROOTVSMALL);
edgeLocationTreePtr_.reset
(
@ -2010,8 +2011,8 @@ void Foam::conformalVoronoiMesh::buildSurfacePtLocationTree
geometryToConformTo_.globalBounds().extend(rndGen_, 1e-4)
);
overallBb.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.min() -= Foam::point::uniform(ROOTVSMALL);
overallBb.max() += Foam::point::uniform(ROOTVSMALL);
surfacePtLocationTreePtr_.reset
(

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -180,8 +181,8 @@ void createBoundaryEdgeTrees
treeBoundBox(UList<point>(surf.localPoints())).extend(rndGen, 1e-4)
);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
bEdgeTrees.set
(

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,12 +49,17 @@ bool Foam::matchPoints
point compareOrigin = origin;
if (origin == point(VGREAT, VGREAT, VGREAT))
if (origin == point::max)
{
if (pts1.size())
{
compareOrigin = sum(pts1)/pts1.size();
}
else
{
// Unusable, but avoid comparison with VGREAT!
compareOrigin = point::zero;
}
}
SortableList<scalar> pts0MagSqr(magSqr(pts0 - compareOrigin));
@ -160,12 +166,17 @@ bool Foam::matchPoints
point compareOrigin = origin;
if (origin == point(VGREAT, VGREAT, VGREAT))
if (origin == point::max)
{
if (pts1.size())
{
compareOrigin = sum(pts1)/pts1.size();
}
else
{
// Unusable, but avoid comparison with VGREAT!
compareOrigin = point::zero;
}
}
SortableList<scalar> pts0MagSqr(magSqr(pts0 - compareOrigin));

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2012 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -58,7 +59,7 @@ bool matchPoints
const UList<scalar>& matchDistance,
const bool verbose,
labelList& from0To1,
const point& origin = point::zero
const point& origin = point::zero //!< point::max = use average origin
);
@ -75,7 +76,7 @@ bool matchPoints
const UList<scalar>& matchDistance,
const bool verbose,
labelList& from0To1,
const point& origin = point::zero
const point& origin = point::zero //!< point::max = use average origin
);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -901,8 +901,8 @@ Foam::polyMesh::cellTree() const
Random rndGen(261782);
overallBb = overallBb.extend(rndGen, 1e-4);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.min() -= point::uniform(ROOTVSMALL);
overallBb.max() += point::uniform(ROOTVSMALL);
cellTreePtr_.reset
(

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -297,8 +298,8 @@ void Foam::refinementFeatures::buildTrees(const label featI)
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
edgeTrees_.set
(
@ -438,8 +439,8 @@ Foam::refinementFeatures::regionEdgeTrees() const
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
trees.set
(

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -3174,8 +3174,8 @@ void Foam::snappySnapDriver::reverseAttractMeshPoints
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
}
// Collect candidate points for attraction

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -848,8 +848,8 @@ Foam::extendedEdgeMesh::pointTree() const
treeBoundBox(points()).extend(rndGen, 1e-4)
);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
const labelList featurePointLabels = identity(nonFeatureStart_);
@ -888,8 +888,8 @@ Foam::extendedEdgeMesh::edgeTree() const
treeBoundBox(points()).extend(rndGen, 1e-4)
);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
labelList allEdges(identity(edges().size()));
@ -932,8 +932,8 @@ Foam::extendedEdgeMesh::edgeTreesByType() const
treeBoundBox(points()).extend(rndGen, 1e-4)
);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
labelListList sliceEdges(nEdgeTypes);

View File

@ -294,8 +294,8 @@ void Foam::mappedPatchBase::findSamples
1e-4
)
);
patchBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
patchBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
patchBb.min() -= point::uniform(ROOTVSMALL);
patchBb.max() += point::uniform(ROOTVSMALL);
indexedOctree<treeDataFace> boundaryTree
(
@ -366,8 +366,8 @@ void Foam::mappedPatchBase::findSamples
1e-4
)
);
patchBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
patchBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
patchBb.min() -= point::uniform(ROOTVSMALL);
patchBb.max() += point::uniform(ROOTVSMALL);
indexedOctree<treeDataPoint> boundaryTree
(

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -603,15 +603,8 @@ Foam::meshSearch::~meshSearch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::indexedOctree<Foam::treeDataFace>&
Foam::meshSearch::boundaryTree() const
const Foam::treeBoundBox& Foam::meshSearch::dataBoundBox() const
{
if (!boundaryTreePtr_.valid())
{
//
// Construct tree
//
if (!overallBbPtr_.valid())
{
Random rndGen(261782);
@ -621,12 +614,22 @@ Foam::meshSearch::boundaryTree() const
);
treeBoundBox& overallBb = overallBbPtr_();
// Extend slightly and make 3D
overallBb = overallBb.extend(rndGen, 1e-4);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.min() -= point::uniform(ROOTVSMALL);
overallBb.max() += point::uniform(ROOTVSMALL);
}
return *overallBbPtr_;
}
const Foam::indexedOctree<Foam::treeDataFace>&
Foam::meshSearch::boundaryTree() const
{
if (!boundaryTreePtr_.valid())
{
// All boundary faces (not just walls)
labelList bndFaces
(
@ -643,7 +646,7 @@ Foam::meshSearch::boundaryTree() const
mesh_,
bndFaces // boundary faces only
),
overallBbPtr_(), // overall search domain
dataBoundBox(), // overall search domain
8, // maxLevel
10, // leafsize
3.0 // duplicity
@ -655,30 +658,57 @@ Foam::meshSearch::boundaryTree() const
}
const Foam::indexedOctree<Foam::treeDataFace>&
Foam::meshSearch::nonCoupledBoundaryTree() const
{
if (!nonCoupledBoundaryTreePtr_.valid())
{
// All non-coupled boundary faces (not just walls)
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
labelList bndFaces(mesh_.nBoundaryFaces());
label bndi = 0;
for (const polyPatch& pp : patches)
{
if (!pp.coupled())
{
forAll(pp, i)
{
bndFaces[bndi++] = pp.start()+i;
}
}
}
bndFaces.setSize(bndi);
nonCoupledBoundaryTreePtr_.reset
(
new indexedOctree<treeDataFace>
(
treeDataFace // all information needed to search faces
(
false, // do not cache bb
mesh_,
bndFaces // boundary faces only
),
dataBoundBox(), // overall search domain
8, // maxLevel
10, // leafsize
3.0 // duplicity
)
);
}
return *nonCoupledBoundaryTreePtr_;
}
const Foam::indexedOctree<Foam::treeDataCell>&
Foam::meshSearch::cellTree() const
{
if (!cellTreePtr_.valid())
{
//
// Construct tree
//
if (!overallBbPtr_.valid())
{
Random rndGen(261782);
overallBbPtr_.reset
(
new treeBoundBox(mesh_.points())
);
treeBoundBox& overallBb = overallBbPtr_();
// Extend slightly and make 3D
overallBb = overallBb.extend(rndGen, 1e-4);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
}
cellTreePtr_.reset
(
new indexedOctree<treeDataCell>
@ -689,7 +719,7 @@ Foam::meshSearch::cellTree() const
mesh_,
cellDecompMode_ // cell decomposition mode for inside tests
),
overallBbPtr_(),
dataBoundBox(), // overall search domain
8, // maxLevel
10, // leafsize
6.0 // duplicity

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,7 +48,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
// Forward Declarations
class treeDataCell;
class treeDataFace;
template<class Type> class indexedOctree;
@ -60,7 +60,7 @@ class treeBoundBox;
class meshSearch
{
// Private data
// Private Data
//- Reference to mesh
const polyMesh& mesh_;
@ -73,6 +73,7 @@ class meshSearch
//- Demand driven octrees
mutable autoPtr<indexedOctree<treeDataFace>> boundaryTreePtr_;
mutable autoPtr<indexedOctree<treeDataFace>> nonCoupledBoundaryTreePtr_;
mutable autoPtr<indexedOctree<treeDataCell>> cellTreePtr_;
@ -98,6 +99,12 @@ class meshSearch
);
// Points
//- Demand-driven bounding box for mesh points
const treeBoundBox& dataBoundBox() const;
// Cells
//- Nearest cell centre using octree
@ -127,7 +134,6 @@ class meshSearch
label findNearestFaceWalk(const point&, const label) const;
// Boundary faces
//- Walk from seed to find nearest boundary face. Gets stuck in
@ -148,11 +154,11 @@ class meshSearch
public:
// Declare name of the class and its debug switch
//- Declare type-name (with debug switch)
ClassName("meshSearch");
// Static data members
// Static Data
//- Tolerance on linear dimensions
static scalar tol_;
@ -160,17 +166,17 @@ public:
// Constructors
//- Construct from components. Constructs bb slightly bigger than
// mesh points bb.
meshSearch
//- Construct from components.
// Constructs bb slightly bigger than mesh points bb.
explicit meshSearch
(
const polyMesh& mesh,
const polyMesh::cellDecomposition = polyMesh::CELL_TETS
);
//- Construct with a custom bounding box. Any mesh element outside
// bb will not be found. Up to user to make sure bb
// extends slightly beyond wanted elements.
//- Construct with a custom bounding box.
// Any mesh element outside bb will not be found.
// Up to user to ensure bb extends slightly beyond wanted elements.
meshSearch
(
const polyMesh& mesh,
@ -178,6 +184,7 @@ public:
const polyMesh::cellDecomposition = polyMesh::CELL_TETS
);
//- Destructor
~meshSearch();
@ -196,11 +203,14 @@ public:
return cellDecompMode_;
}
//- Get (demand driven) reference to octree holding all
// boundary faces
//- Demand-driven reference to octree holding all boundary faces
const indexedOctree<treeDataFace>& boundaryTree() const;
//- Get (demand driven) reference to octree holding all cells
//- Demand-driven reference to octree holding all
//- non-coupled boundary faces
const indexedOctree<treeDataFace>& nonCoupledBoundaryTree() const;
//- Demand-driven reference to octree holding all cells
const indexedOctree<treeDataCell>& cellTree() const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -100,8 +100,8 @@ Foam::searchableExtrudedCircle::searchableExtrudedCircle
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
edgeTree_.reset
(

View File

@ -759,8 +759,8 @@ Foam::triSurfaceMesh::edgeTree() const
// geometry there are less face/edge aligned items.
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015,2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -157,8 +157,8 @@ Foam::triSurfaceRegionSearch::treeByRegion() const
// on symmetric geometry there are fewer face/edge
// aligned items.
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
}
treeByRegion_.set

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2017 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -231,8 +231,8 @@ Foam::triSurfaceSearch::tree() const
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
bb = bb.extend(rndGen, 1e-4);
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
}
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2018 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,7 +34,6 @@ License
#include "treeDataFace.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
@ -90,8 +89,8 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
Random rndGen(123456);
overallBb = overallBb.extend(rndGen, 1e-4);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.min() -= point::uniform(ROOTVSMALL);
overallBb.max() += point::uniform(ROOTVSMALL);
const indexedOctree<treeDataFace> boundaryTree
(

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -120,8 +120,8 @@ void Foam::patchSeedSet::calcSamples
1e-4
)
);
patchBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
patchBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
patchBb.min() -= point::uniform(ROOTVSMALL);
patchBb.max() += point::uniform(ROOTVSMALL);
indexedOctree<treeDataFace> boundaryTree
(

View File

@ -108,61 +108,6 @@ void Foam::sampledTriSurfaceMesh::setZoneMap
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::indexedOctree<Foam::treeDataFace>&
Foam::sampledTriSurfaceMesh::nonCoupledboundaryTree() const
{
// Variant of meshSearch::boundaryTree() that only does non-coupled
// boundary faces.
if (!boundaryTreePtr_.valid())
{
// all non-coupled boundary faces (not just walls)
const polyBoundaryMesh& patches = mesh().boundaryMesh();
labelList bndFaces(patches.nFaces());
label bndI = 0;
for (const polyPatch& pp : patches)
{
if (!pp.coupled())
{
forAll(pp, i)
{
bndFaces[bndI++] = pp.start()+i;
}
}
}
bndFaces.setSize(bndI);
treeBoundBox overallBb(mesh().points());
Random rndGen(123456);
// Extend slightly and make 3D
overallBb = overallBb.extend(rndGen, 1e-4);
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
boundaryTreePtr_.reset
(
new indexedOctree<treeDataFace>
(
treeDataFace // all information needed to search faces
(
false, // do not cache bb
mesh(),
bndFaces // boundary faces only
),
overallBb, // overall search domain
8, // maxLevel
10, // leafsize
3.0 // duplicity
)
);
}
return *boundaryTreePtr_;
}
bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
{
// Find the cells the triangles of the surface are in.
@ -224,10 +169,9 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
{
// Search for nearest boundaryFace
////- Search on all (including coupled) boundary faces
//const indexedOctree<treeDataFace>& bTree = meshSearcher.boundaryTree()
//- Search on all non-coupled boundary faces
const indexedOctree<treeDataFace>& bTree = nonCoupledboundaryTree();
const indexedOctree<treeDataFace>& bTree =
meshSearcher.nonCoupledBoundaryTree();
forAll(fc, triI)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2018 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -169,9 +169,6 @@ private:
// Private Member Functions
//- Get tree of all non-coupled boundary faces
const indexedOctree<treeDataFace>& nonCoupledboundaryTree() const;
//- Sample volume field onto surface faces
template<class Type>
tmp<Field<Type>> sampleOnFaces