ENH: pointInCell, findCell: switchable in-cell algorithm

This commit is contained in:
mattijs
2011-10-28 11:33:30 +01:00
parent 6b44617c68
commit ee11f9c0e8
45 changed files with 496 additions and 268 deletions

View File

@ -102,7 +102,7 @@ void Foam::meshToMesh::calcAddressing()
indexedOctree<treeDataCell> oc
(
treeDataCell(false, fromMesh_),
treeDataCell(false, fromMesh_, polyMesh::FACEDIAGTETS),
shiftedBb, // overall bounding box
8, // maxLevel
10, // leafsize
@ -267,7 +267,7 @@ void Foam::meshToMesh::cellAddresses
cellAddressing_[toI] = -1;
// Check point is actually in the nearest cell
if (fromMesh.pointInCell(p, curCell))
if (fromMesh.pointInCell(p, curCell, polyMesh::FACEDIAGTETS))
{
cellAddressing_[toI] = curCell;
}
@ -292,7 +292,15 @@ void Foam::meshToMesh::cellAddresses
{
// search through all the neighbours.
// If point is in neighbour reset current cell
if (fromMesh.pointInCell(p, neighbours[nI]))
if
(
fromMesh.pointInCell
(
p,
neighbours[nI],
polyMesh::FACEDIAGTETS
)
)
{
cellAddressing_[toI] = neighbours[nI];
found = true;
@ -316,7 +324,15 @@ void Foam::meshToMesh::cellAddresses
{
// search through all the neighbours.
// If point is in neighbour reset current cell
if (fromMesh.pointInCell(p, nn[nI]))
if
(
fromMesh.pointInCell
(
p,
nn[nI],
polyMesh::FACEDIAGTETS
)
)
{
cellAddressing_[toI] = nn[nI];
found = true;

View File

@ -28,7 +28,6 @@ License
#include "IOmanip.H"
// For 'nearInfo' helper class only
#include "mappedPatchBase.H"
//#include "meshSearch.H"
#include "treeBoundBox.H"
#include "treeDataFace.H"

View File

@ -45,7 +45,7 @@ void Foam::probes::findElements(const fvMesh& mesh)
{
const vector& location = operator[](probeI);
elementList_[probeI] = mesh.findCell(location);
elementList_[probeI] = mesh.findCell(location, polyMesh::FACEDIAGTETS);
if (debug && elementList_[probeI] != -1)
{

View File

@ -68,7 +68,7 @@ Foam::label Foam::sampledSet::getCell
{
label cellI = getBoundaryCell(faceI);
if (!mesh().pointInCell(sample, cellI))
if (!mesh().pointInCell(sample, cellI, searchEngine_.decompMode()))
{
FatalErrorIn
(
@ -85,7 +85,7 @@ Foam::label Foam::sampledSet::getCell
label cellI = mesh().faceOwner()[faceI];
if (mesh().pointInCell(sample, cellI))
if (mesh().pointInCell(sample, cellI, searchEngine_.decompMode()))
{
return cellI;
}
@ -93,7 +93,7 @@ Foam::label Foam::sampledSet::getCell
{
cellI = mesh().faceNeighbour()[faceI];
if (mesh().pointInCell(sample, cellI))
if (mesh().pointInCell(sample, cellI, searchEngine_.decompMode()))
{
return cellI;
}
@ -261,12 +261,17 @@ bool Foam::sampledSet::getTrackingPoint
if (bFaceI == -1)
{
// No boundary intersection. Try and find cell samplePt is in
trackCellI = mesh().findCell(samplePt);
trackCellI = mesh().findCell(samplePt, searchEngine_.decompMode());
if
(
(trackCellI == -1)
|| !mesh().pointInCell(samplePt, trackCellI)
|| !mesh().pointInCell
(
samplePt,
trackCellI,
searchEngine_.decompMode()
)
)
{
// Line samplePt - end_ does not intersect domain at all.
@ -316,7 +321,7 @@ bool Foam::sampledSet::getTrackingPoint
// samplePt inside or marginally outside.
trackPt = samplePt;
trackFaceI = -1;
trackCellI = mesh().findCell(trackPt);
trackCellI = mesh().findCell(trackPt, searchEngine_.decompMode());
isGoodSample = true;
}

View File

@ -138,7 +138,7 @@ Foam::sampledSets::sampledSets
mesh_(refCast<const fvMesh>(obr)),
loadFromFiles_(loadFromFiles),
outputPath_(fileName::null),
searchEngine_(mesh_, true),
searchEngine_(mesh_, polyMesh::FACEDIAGTETS),
interpolationScheme_(word::null),
writeFormat_(word::null)
{

View File

@ -53,7 +53,11 @@ void Foam::triSurfaceMeshPointSet::calcSamples
{
forAll(sampleCoords_, sampleI)
{
label cellI = searchEngine().findCell(sampleCoords_[sampleI]);
label cellI = searchEngine().findCell
(
sampleCoords_[sampleI],
polyMesh::FACEDIAGTETS
);
if (cellI != -1)
{

View File

@ -241,7 +241,7 @@ bool Foam::sampledTriSurfaceMesh::update()
const pointField& fc = surface_.faceCentres();
// Mesh search engine, no triangulation of faces.
meshSearch meshSearcher(mesh(), false);
meshSearch meshSearcher(mesh(), polyMesh::FACEPLANES);
List<nearInfo> nearest(fc.size());
@ -435,7 +435,15 @@ bool Foam::sampledTriSurfaceMesh::update()
sampleElements_[pointI] = cellI;
// Check if point inside cell
if (mesh().pointInCell(pt, sampleElements_[pointI]))
if
(
mesh().pointInCell
(
pt,
sampleElements_[pointI],
meshSearcher.decompMode()
)
)
{
samplePoints_[pointI] = pt;
}