ENH: distributedTriSurfaceMesh: auto-decomposition; inside/outside support

This commit is contained in:
mattijs
2019-02-18 13:29:01 +00:00
parent c3a4648452
commit 77e51249c7
29 changed files with 4142 additions and 520 deletions

View File

@ -471,6 +471,12 @@ public:
return nodes_[0].bb_;
}
//- Per node, per octant whether is fully inside/outside/mixed.
PackedList<2>& nodeTypes() const
{
return nodeTypes_;
}
// Conversions for entries in subNodes_.

View File

@ -330,10 +330,10 @@ public:
mapDistribute();
//- Copy construct
mapDistribute(const mapDistribute& map);
explicit mapDistribute(const mapDistribute& map);
//- Move construct
mapDistribute(mapDistribute&& map);
explicit mapDistribute(mapDistribute&& map);
//- Move construct from components
mapDistribute

View File

@ -128,6 +128,11 @@ public:
{
return true;
}
//- What is type of points outside bounds
virtual volumeType outsideVolumeType() const
{
return volumeType::OUTSIDE;
}
//- Range of local indices that can be returned.
virtual label size() const

View File

@ -186,6 +186,12 @@ public:
return true;
}
//- What is type of points outside bounds
virtual volumeType outsideVolumeType() const
{
return volumeType::OUTSIDE;
}
//- Range of local indices that can be returned.
virtual label size() const
{

View File

@ -158,6 +158,12 @@ public:
return true;
}
//- What is type of points outside bounds
virtual volumeType outsideVolumeType() const
{
return volumeType::OUTSIDE;
}
//- Range of local indices that can be returned.
virtual label size() const
{

View File

@ -141,6 +141,12 @@ public:
return false;
}
//- What is type of points outside bounds
virtual volumeType outsideVolumeType() const
{
return volumeType::UNKNOWN;
}
//- Range of local indices that can be returned.
virtual label size() const
{

View File

@ -124,6 +124,12 @@ public:
return true;
}
//- What is type of points outside bounds
virtual volumeType outsideVolumeType() const
{
return volumeType::OUTSIDE;
}
//- Range of local indices that can be returned.
virtual label size() const;

View File

@ -126,6 +126,12 @@ public:
return false;
}
//- What is type of points outside bounds
virtual volumeType outsideVolumeType() const
{
return volumeType::UNKNOWN;
}
//- Range of local indices that can be returned.
virtual label size() const
{

View File

@ -152,6 +152,12 @@ public:
return false;
}
//- What is type of points outside bounds
virtual volumeType outsideVolumeType() const
{
return volumeType::UNKNOWN;
}
//- Range of local indices that can be returned.
virtual label size() const
{

View File

@ -131,6 +131,12 @@ public:
return true;
}
//- What is type of points outside bounds
virtual volumeType outsideVolumeType() const
{
return volumeType::OUTSIDE;
}
//- Range of local indices that can be returned.
virtual label size() const
{

View File

@ -144,6 +144,12 @@ public:
return true;
}
//- What is type of points outside bounds
virtual volumeType outsideVolumeType() const
{
return volumeType::OUTSIDE;
}
//- Range of local indices that can be returned.
virtual label size() const
{

View File

@ -176,13 +176,13 @@ public:
}
//- Return const reference to boundBox
const boundBox& bounds() const
virtual const boundBox& bounds() const
{
return bounds_;
}
//- Return non-const access to the boundBox to allow it to be set.
boundBox& bounds()
virtual boundBox& bounds()
{
return bounds_;
}
@ -194,6 +194,10 @@ public:
// This is false for the base class.
virtual bool hasVolumeType() const;
//- If surface supports volume queries, what is type of points outside
// bounds
virtual volumeType outsideVolumeType() const = 0;
//- Range of local indices that can be returned
virtual label size() const = 0;

View File

@ -181,6 +181,12 @@ public:
return false;
}
//- What is type of points outside bounds
virtual volumeType outsideVolumeType() const
{
return volumeType::UNKNOWN;
}
//- Range of local indices that can be returned.
virtual label size() const;

View File

@ -166,6 +166,12 @@ public:
return surface().hasVolumeType();
}
//- What is type of points outside bounds
virtual volumeType outsideVolumeType() const
{
return surface().outsideVolumeType();
}
//- Range of local indices that can be returned.
virtual label size() const
{

View File

@ -71,7 +71,7 @@ Foam::fileName Foam::triSurfaceMesh::checkFile
Foam::fileName Foam::triSurfaceMesh::relativeFilePath
(
const regIOobject& io,
const IOobject& io,
const fileName& f,
const bool isGlobal
)
@ -96,7 +96,7 @@ Foam::fileName Foam::triSurfaceMesh::relativeFilePath
Foam::fileName Foam::triSurfaceMesh::checkFile
(
const regIOobject& io,
const IOobject& io,
const dictionary& dict,
const bool isGlobal
)
@ -156,6 +156,13 @@ bool Foam::triSurfaceMesh::addFaceToEdge
bool Foam::triSurfaceMesh::isSurfaceClosed() const
{
if (debug)
{
Pout<< "triSurfaceMesh::isSurfaceClosed:"
<< " determining closedness for surface with "
<< triSurface::size() << " triangles" << endl;
}
const pointField& pts = triSurface::points();
// Construct pointFaces. Let's hope surface has compact point
@ -196,6 +203,11 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
if (!okFace)
{
if (debug)
{
Pout<< "triSurfaceMesh::isSurfaceClosed :"
<< " surface is open" << endl;
}
return false;
}
}
@ -213,6 +225,11 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
if (!okFace)
{
if (debug)
{
Pout<< "triSurfaceMesh::isSurfaceClosed :"
<< " surface is open" << endl;
}
return false;
}
}
@ -223,11 +240,21 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
{
if (iter.val() != 2)
{
if (debug)
{
Pout<< "triSurfaceMesh::isSurfaceClosed :"
<< " surface is open" << endl;
}
return false;
}
}
}
if (debug)
{
Pout<< "triSurfaceMesh::isSurfaceClosed :"
<< " surface is closed" << endl;
}
return true;
}
@ -358,7 +385,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
}
Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const bool isGlobal)
Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const readAction r)
:
// Find instance for triSurfaceMesh
searchableSurface(io),
@ -376,18 +403,79 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const bool isGlobal)
false // searchableSurface already registered under name
)
),
triSurface
(
checkFile(static_cast<const searchableSurface&>(*this), isGlobal)
),
triSurface(), // construct null
triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
minQuality_(-1),
surfaceClosed_(-1),
outsideVolType_(volumeType::UNKNOWN)
{
const pointField& pts = triSurface::points();
// Check IO flags
if (io.readOpt() != IOobject::NO_READ)
{
const bool searchGlobal(r == localOrGlobal || r == masterOnly);
bounds() = boundBox(pts, isGlobal);
const fileName actualFile
(
searchGlobal
? io.globalFilePath(typeName)
: io.localFilePath(typeName)
);
if (debug)
{
Pout<< "triSurfaceMesh(const IOobject& io) :"
<< " loading surface " << io.objectPath()
<< " local filePath:" << io.localFilePath(typeName)
<< " from:" << actualFile << endl;
}
if (searchGlobal && Pstream::parRun())
{
// Check where surface was found
const fileName localFile(io.localFilePath(typeName));
if (r == masterOnly && (actualFile != localFile))
{
// Found undecomposed surface. Load on master only
if (Pstream::master())
{
triSurface s2(actualFile);
triSurface::transfer(s2);
}
Pstream::scatter(triSurface::patches());
if (debug)
{
Pout<< "triSurfaceMesh(const IOobject& io) :"
<< " loaded triangles:" << triSurface::size() << endl;
}
}
else
{
// Read on all processors
triSurface s2(actualFile);
triSurface::transfer(s2);
if (debug)
{
Pout<< "triSurfaceMesh(const IOobject& io) :"
<< " loaded triangles:" << triSurface::size() << endl;
}
}
}
else
{
// Read on all processors
triSurface s2(actualFile);
triSurface::transfer(s2);
if (debug)
{
Pout<< "triSurfaceMesh(const IOobject& io) :"
<< " loaded triangles:" << triSurface::size() << endl;
}
}
}
const pointField& pts = triSurface::points();
bounds() = boundBox(pts, false);
}
@ -395,7 +483,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
(
const IOobject& io,
const dictionary& dict,
const bool isGlobal
const readAction r
)
:
searchableSurface(io),
@ -413,26 +501,91 @@ Foam::triSurfaceMesh::triSurfaceMesh
false // searchableSurface already registered under name
)
),
triSurface
(
checkFile(static_cast<const searchableSurface&>(*this), dict, isGlobal)
),
triSurface(), // construct null
triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict),
minQuality_(-1),
surfaceClosed_(-1),
outsideVolType_(volumeType::UNKNOWN)
{
// Reading from supplied file name instead of objectPath/filePath
if (dict.readIfPresent("file", fName_, keyType::LITERAL))
// Check IO flags
if (io.readOpt() != IOobject::NO_READ)
{
fName_ = relativeFilePath
const bool searchGlobal(r == localOrGlobal || r == masterOnly);
fileName actualFile
(
static_cast<const searchableSurface&>(*this),
fName_,
isGlobal
searchGlobal
? io.globalFilePath(typeName)
: io.localFilePath(typeName)
);
// Reading from supplied file name instead of objectPath/filePath
if (dict.readIfPresent("file", fName_, keyType::LITERAL))
{
fName_ = relativeFilePath
(
static_cast<const searchableSurface&>(*this),
fName_,
searchGlobal
);
actualFile = fName_;
}
if (debug)
{
Pout<< "triSurfaceMesh(const IOobject& io, const dictionary&) :"
<< " loading surface " << io.objectPath()
<< " local filePath:" << io.localFilePath(typeName)
<< " from:" << actualFile << endl;
}
if (searchGlobal && Pstream::parRun())
{
// Check where surface was found
const fileName localFile(io.localFilePath(typeName));
if (r == masterOnly && (actualFile != localFile))
{
// Surface not loaded from processor directories -> undecomposed
// surface. Load on master only
if (Pstream::master())
{
triSurface s2(actualFile);
triSurface::transfer(s2);
}
Pstream::scatter(triSurface::patches());
if (debug)
{
Pout<< "triSurfaceMesh(const IOobject& io) :"
<< " loaded triangles:" << triSurface::size() << endl;
}
}
else
{
// Read on all processors
triSurface s2(actualFile);
triSurface::transfer(s2);
if (debug)
{
Pout<< "triSurfaceMesh(const IOobject& io) :"
<< " loaded triangles:" << triSurface::size() << endl;
}
}
}
else
{
// Read on all processors
triSurface s2(actualFile);
triSurface::transfer(s2);
if (debug)
{
Pout<< "triSurfaceMesh(const IOobject& io) :"
<< " loaded triangles:" << triSurface::size() << endl;
}
}
}
scalar scaleFactor = 0;
// Allow rescaling of the surface points
@ -445,8 +598,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
}
const pointField& pts = triSurface::points();
bounds() = boundBox(pts, isGlobal);
bounds() = boundBox(pts, false);
// Have optional minimum quality for normal calculation
if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0)
@ -468,7 +620,7 @@ Foam::triSurfaceMesh::~triSurfaceMesh()
void Foam::triSurfaceMesh::clearOut()
{
outsideVolType_ = volumeType::UNKNOWN;
// Do not clear closedness status
triSurfaceRegionSearch::clearOut();
edgeTree_.clear();
triSurface::clearOut();
@ -539,7 +691,14 @@ bool Foam::triSurfaceMesh::overlaps(const boundBox& bb) const
void Foam::triSurfaceMesh::movePoints(const pointField& newPoints)
{
outsideVolType_ = volumeType::UNKNOWN;
if (debug)
{
Pout<< "triSurfaceMesh::movePoints :"
<< " moving at time " << objectRegistry::time().timeName()
<< endl;
}
// Preserve topological point status (surfaceClosed_, outsideVolType_)
// Update local information (instance, event number)
searchableSurface::instance() = objectRegistry::time().timeName();
@ -555,6 +714,10 @@ void Foam::triSurfaceMesh::movePoints(const pointField& newPoints)
triSurface::movePoints(newPoints);
bounds() = boundBox(triSurface::points(), false);
if (debug)
{
Pout<< "triSurfaceMesh::movePoints: finished moving points" << endl;
}
}
@ -563,6 +726,13 @@ Foam::triSurfaceMesh::edgeTree() const
{
if (edgeTree_.empty())
{
if (debug)
{
Pout<< "triSurfaceMesh::edgeTree :"
<< " constructing tree for " << nEdges() - nInternalEdges()
<< " boundary edges" << endl;
}
// Boundary edges
labelList bEdges
(
@ -592,6 +762,13 @@ Foam::triSurfaceMesh::edgeTree() const
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
}
if (debug)
{
Pout<< "triSurfaceMesh::edgeTree : "
<< "calculating edge tree for bb:" << bb << endl;
}
scalar oldTol = indexedOctree<treeDataEdge>::perturbTol();
indexedOctree<treeDataEdge>::perturbTol() = tolerance();
@ -614,6 +791,14 @@ Foam::triSurfaceMesh::edgeTree() const
);
indexedOctree<treeDataEdge>::perturbTol() = oldTol;
if (debug)
{
Pout<< "triSurfaceMesh::edgeTree :"
<< " finished constructing tree for "
<< nEdges() - nInternalEdges()
<< " boundary edges" << endl;
}
}
return *edgeTree_;
@ -652,6 +837,40 @@ bool Foam::triSurfaceMesh::hasVolumeType() const
}
Foam::volumeType Foam::triSurfaceMesh::outsideVolumeType() const
{
if (outsideVolType_ == volumeType::UNKNOWN)
{
// Get point outside bounds()
const point outsidePt(bounds().max() + 0.5*bounds().span());
if (debug)
{
Pout<< "triSurfaceMesh::outsideVolumeType :"
<< " triggering outsidePoint:" << outsidePt
<< " orientation" << endl;
}
//outsideVolType_ = tree().shapes().getVolumeType(tree(), outsidePt);
// Note: do not use tree directly so e.g. distributedTriSurfaceMesh
// has opportunity to intercept
List<volumeType> outsideVolTypes;
getVolumeType(pointField(1, outsidePt), outsideVolTypes);
outsideVolType_ = outsideVolTypes[0];
if (debug)
{
Pout<< "triSurfaceMesh::outsideVolumeType :"
<< " finished outsidePoint:" << outsidePt
<< " orientation:" << volumeType::names[outsideVolType_]
<< endl;
}
}
return outsideVolType_;
}
void Foam::triSurfaceMesh::findNearest
(
const pointField& samples,
@ -659,7 +878,21 @@ void Foam::triSurfaceMesh::findNearest
List<pointIndexHit>& info
) const
{
if (debug)
{
Pout<< "triSurfaceMesh::findNearest :"
<< " trying to find nearest for " << samples.size()
<< " samples with max sphere "
<< (samples.size() ? Foam::sqrt(max(nearestDistSqr)) : Zero)
<< endl;
}
triSurfaceSearch::findNearest(samples, nearestDistSqr, info);
if (debug)
{
Pout<< "triSurfaceMesh::findNearest :"
<< " finished trying to find nearest for " << samples.size()
<< " samples" << endl;
}
}
@ -671,6 +904,14 @@ void Foam::triSurfaceMesh::findNearest
List<pointIndexHit>& info
) const
{
if (debug)
{
Pout<< "triSurfaceMesh::findNearest :"
<< " trying to find nearest and region for " << samples.size()
<< " samples with max sphere "
<< (samples.size() ? Foam::sqrt(max(nearestDistSqr)) : Zero)
<< endl;
}
triSurfaceRegionSearch::findNearest
(
samples,
@ -678,6 +919,12 @@ void Foam::triSurfaceMesh::findNearest
regionIndices,
info
);
if (debug)
{
Pout<< "triSurfaceMesh::findNearest :"
<< " finished trying to find nearest and region for "
<< samples.size() << " samples" << endl;
}
}
@ -688,7 +935,19 @@ void Foam::triSurfaceMesh::findLine
List<pointIndexHit>& info
) const
{
if (debug)
{
Pout<< "triSurfaceMesh::findLine :"
<< " intersecting with "
<< start.size() << " rays" << endl;
}
triSurfaceSearch::findLine(start, end, info);
if (debug)
{
Pout<< "triSurfaceMesh::findLine :"
<< " finished intersecting with "
<< start.size() << " rays" << endl;
}
}
@ -699,7 +958,19 @@ void Foam::triSurfaceMesh::findLineAny
List<pointIndexHit>& info
) const
{
if (debug)
{
Pout<< "triSurfaceMesh::findLineAny :"
<< " intersecting with "
<< start.size() << " rays" << endl;
}
triSurfaceSearch::findLineAny(start, end, info);
if (debug)
{
Pout<< "triSurfaceMesh::findLineAny :"
<< " finished intersecting with "
<< start.size() << " rays" << endl;
}
}
@ -710,7 +981,19 @@ void Foam::triSurfaceMesh::findLineAll
List<List<pointIndexHit>>& info
) const
{
if (debug)
{
Pout<< "triSurfaceMesh::findLineAll :"
<< " intersecting with "
<< start.size() << " rays" << endl;
}
triSurfaceSearch::findLineAll(start, end, info);
if (debug)
{
Pout<< "triSurfaceMesh::findLineAll :"
<< " finished intersecting with "
<< start.size() << " rays" << endl;
}
}
@ -720,6 +1003,12 @@ void Foam::triSurfaceMesh::getRegion
labelList& region
) const
{
if (debug)
{
Pout<< "triSurfaceMesh::getRegion :"
<< " getting region for "
<< info.size() << " triangles" << endl;
}
region.setSize(info.size());
forAll(info, i)
{
@ -732,6 +1021,12 @@ void Foam::triSurfaceMesh::getRegion
region[i] = -1;
}
}
if (debug)
{
Pout<< "triSurfaceMesh::getRegion :"
<< " finished getting region for "
<< info.size() << " triangles" << endl;
}
}
@ -741,6 +1036,13 @@ void Foam::triSurfaceMesh::getNormal
vectorField& normal
) const
{
if (debug)
{
Pout<< "triSurfaceMesh::getNormal :"
<< " getting normal for "
<< info.size() << " triangles" << endl;
}
const triSurface& s = *this;
const pointField& pts = s.points();
@ -803,6 +1105,12 @@ void Foam::triSurfaceMesh::getNormal
}
}
}
if (debug)
{
Pout<< "triSurfaceMesh::getNormal :"
<< " finished getting normal for "
<< info.size() << " triangles" << endl;
}
}
@ -835,6 +1143,12 @@ void Foam::triSurfaceMesh::setField(const labelList& values)
// Store field on triMesh
fldPtr->store();
}
if (debug)
{
Pout<< "triSurfaceMesh::setField :"
<< " finished setting field for "
<< values.size() << " triangles" << endl;
}
}
@ -860,6 +1174,12 @@ void Foam::triSurfaceMesh::getField
}
}
}
if (debug)
{
Pout<< "triSurfaceMesh::setField :"
<< " finished getting field for "
<< info.size() << " triangles" << endl;
}
}
@ -872,6 +1192,13 @@ void Foam::triSurfaceMesh::getVolumeType
const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
indexedOctree<treeDataTriSurface>::perturbTol() = tolerance();
if (debug)
{
Pout<< "triSurfaceMesh::getVolumeType :"
<< " finding orientation for " << points.size()
<< " samples" << endl;
}
volType.setSize(points.size());
forAll(points, pointi)
@ -900,6 +1227,12 @@ void Foam::triSurfaceMesh::getVolumeType
}
indexedOctree<treeDataTriSurface>::perturbTol() = oldTol;
if (debug)
{
Pout<< "triSurfaceMesh::getVolumeType :"
<< " finished finding orientation for " << points.size()
<< " samples" << endl;
}
}

View File

@ -52,8 +52,8 @@ SourceFiles
#ifndef triSurfaceMesh_H
#define triSurfaceMesh_H
#include "treeBoundBox.H"
#include "searchableSurface.H"
#include "treeBoundBox.H"
#include "objectRegistry.H"
#include "indexedOctree.H"
#include "treeDataTriSurface.H"
@ -79,6 +79,8 @@ class triSurfaceMesh
public triSurface,
public triSurfaceRegionSearch
{
protected:
// Private member data
//- Supplied fileName override
@ -110,7 +112,7 @@ class triSurfaceMesh
// IOobject
static fileName relativeFilePath
(
const regIOobject&,
const IOobject&,
const fileName&,
const bool isGlobal
);
@ -118,7 +120,7 @@ class triSurfaceMesh
//- Return fileName to load IOobject from. Optional override of fileName
static fileName checkFile
(
const regIOobject&,
const IOobject&,
const dictionary&,
const bool isGlobal
);
@ -179,15 +181,22 @@ public:
// Special constructors for use by distributedTriSurface. File search
// status (local/global) supplied.
// method supplied:
triSurfaceMesh(const IOobject& io, const bool isGlobal);
enum readAction
{
localOnly, // load from (processor-)local file only
localOrGlobal, // load from (processor-)local or global file
masterOnly // as localOrGlobal but only load on master
};
triSurfaceMesh(const IOobject& io, const readAction r);
triSurfaceMesh
(
const IOobject& io,
const dictionary& dict,
const bool isGlobal
const readAction r
);
@ -216,6 +225,9 @@ public:
//- Whether supports volume type (below) - i.e. whether is closed.
virtual bool hasVolumeType() const;
//- If surface is closed, what is type of points outside bounds
virtual volumeType outsideVolumeType() const;
//- Range of local indices that can be returned.
virtual label size() const
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011, 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011, 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
@ -42,6 +42,15 @@ Description
more communication.
- frozen : no change
Note: addressing used:
distributedTriSurfaceMesh: none
triSurfaceMesh:
- surf.pointFaces() : edge addressing (for volume tests only)
- surf.edges() : edgeTree
- surf.faceFaces() : only if minQuality > 0
SourceFiles
distributedTriSurfaceMesh.C
@ -55,6 +64,7 @@ SourceFiles
#include "IOdictionary.H"
#include "Pair.H"
#include "globalIndex.H"
#include "DynamicField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -86,7 +96,8 @@ public:
{
FOLLOW = 0,
INDEPENDENT = 1,
FROZEN = 2
DISTRIBUTED = 2,
FROZEN = 3
};
static const Enum<distributionType> distributionTypeNames_;
@ -112,14 +123,22 @@ private:
//- Global triangle numbering
mutable autoPtr<globalIndex> globalTris_;
//- The distribution type.
//- The (wanted) distribution type.
distributionType distType_;
//- The (current) distribution type. Used to trigger re-distribution
// when starting from undecomposed surface.
distributionType currentDistType_;
// Private Member Functions
// Read
//- Search for io.local directory (=triSurface) either in case
// directory or in parent directory
static word findLocalInstance(const IOobject& io);
//- Read my additional data
bool read();
@ -183,6 +202,9 @@ private:
// Triangle index
//- Helper: convert local triangle indices to global ones
void convertTriIndices(List<pointIndexHit>& info) const;
//- Obtains global indices from pointIndexHit and swaps them back
// to their original processor. Used to calculate local region
// and normal.
@ -195,6 +217,24 @@ private:
// Nearest
//- Is location inside any of the bounding boxes
bool contains
(
const List<treeBoundBox>& bbs,
const point& sample
) const;
//- Is location inside any of the processors bb or if not
// does it overlap
Tuple2<label, scalar> findBestProcs
(
const point& centre,
const scalar radiusSqr,
boolList& procContains,
boolList& procOverlaps,
label& minProci
) const;
label calcOverlappingProcs
(
const point& centre,
@ -202,8 +242,10 @@ private:
boolList& overlaps
) const;
//- Calculate map to send centres+radius to processors
autoPtr<mapDistribute> calcLocalQueries
(
const bool includeLocalProcessor,
const pointField& centres,
const scalarField& radiusSqr,
@ -213,8 +255,71 @@ private:
) const;
// Side
//- Side of nearest point w.r.t. edge between face0 and face1
volumeType edgeSide
(
const point& sample,
const point& nearestPoint,
const label face0,
const label face1
) const;
//- Find edge-connected face
label findOtherFace
(
const labelListList& pointFaces,
const label nearFacei,
const label nearLabel
) const;
//- Side of nearest point on faces w.r.t. samples. Handles nearest
// on edge/point
void surfaceSide
(
const pointField& samples,
const List<pointIndexHit>& nearestInfo,
List<volumeType>& region
) const;
// Caching of volume type (based on indexedOctree)
//- Collect mid points of tree boxes
void collectLeafMids
(
const label nodeI,
DynamicField<point>& midPoints
) const;
//- Find volume type of tree boxes
volumeType calcVolumeType
(
const List<volumeType>& midPointTypes,
label& index,
PackedList<2>& nodeTypes,
const label nodeI
) const;
//- Look up any cached data. Return unknown if cannot be determined.
volumeType cachedVolumeType
(
const label nodeI,
const point& sample
) const;
// Surface redistribution
//- Calculate face-faces
static void calcFaceFaces
(
const triSurface& s,
const labelListList& pointFaces,
labelListList& faceFaces
);
//- Finds new bounds based on an independent decomposition.
List<List<treeBoundBox>> independentlyDistributedBbs
(
@ -344,13 +449,6 @@ public:
// searchableSurface implementation
//- Whether supports volume type below. I.e. whether is closed.
// Not supported.
virtual bool hasVolumeType() const
{
return false;
}
//- Range of global indices that can be returned.
virtual label globalSize() const
{
@ -364,6 +462,16 @@ public:
List<pointIndexHit>&
) const;
//- Find the nearest locations for the supplied points to a
// particular region in the searchable surface.
virtual void findNearest
(
const pointField& samples,
const scalarField& nearestDistSqr,
const labelList& regionIndices,
List<pointIndexHit>& info
) const;
virtual void findLine
(
const pointField& start,
@ -434,6 +542,14 @@ public:
// indices) get the specified field. Misses do not get set.
virtual void getField(const List<pointIndexHit>&, labelList&) const;
//- Calculate the triangles that are overlapping bounds.
static void overlappingSurface
(
const triSurface&,
const List<treeBoundBox>&,
boolList& includedFace
);
//- Subset the part of surface that is overlapping bounds.
static triSurface overlappingSurface
(