ENH: polyMesh,meshSearch: default value on findCell, pointInCell

This commit is contained in:
mattijs
2011-11-08 17:03:54 +00:00
parent b7155f785e
commit ca4b8c347c
22 changed files with 36 additions and 86 deletions

View File

@ -381,7 +381,7 @@ int main(int argc, char *argv[])
(void)edgeCalc.minLen(Info); (void)edgeCalc.minLen(Info);
// Search engine on mesh. Face decomposition since faces might be warped. // Search engine on mesh. Face decomposition since faces might be warped.
meshSearch queryMesh(mesh, polyMesh::FACEDIAGTETS); meshSearch queryMesh(mesh);
// Check all 'outside' points // Check all 'outside' points
forAll(outsidePts, outsideI) forAll(outsidePts, outsideI)

View File

@ -2194,7 +2194,7 @@ int main(int argc, char *argv[])
label regionI = -1; label regionI = -1;
label cellI = mesh.findCell(insidePoint, polyMesh::FACEDIAGTETS); label cellI = mesh.findCell(insidePoint);
Info<< nl << "Found point " << insidePoint << " in cell " << cellI Info<< nl << "Found point " << insidePoint << " in cell " << cellI
<< endl; << endl;

View File

@ -528,11 +528,7 @@ int main(int argc, char *argv[])
<< "Cell number should be between 0 and " << "Cell number should be between 0 and "
<< mesh.nCells()-1 << nl << mesh.nCells()-1 << nl
<< "On this mesh the particle should be in cell " << "On this mesh the particle should be in cell "
<< mesh.findCell << mesh.findCell(iter().position())
(
iter().position(),
polyMesh::FACEDIAGTETS
)
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -558,14 +558,14 @@ public:
( (
const point&, const point&,
label cellI, label cellI,
const cellRepresentation const cellRepresentation = FACEDIAGTETS
) const; ) const;
//- Find cell enclosing this location (-1 if not in mesh) //- Find cell enclosing this location (-1 if not in mesh)
label findCell label findCell
( (
const point&, const point&,
const cellRepresentation const cellRepresentation = FACEDIAGTETS
) const; ) const;
}; };

View File

@ -36,7 +36,7 @@ void Foam::ignitionSite::findIgnitionCells(const fvMesh& mesh)
const volVectorField& centres = mesh.C(); const volVectorField& centres = mesh.C();
const scalarField& vols = mesh.V(); const scalarField& vols = mesh.V();
label ignCell = mesh.findCell(location_, polyMesh::FACEDIAGTETS); label ignCell = mesh.findCell(location_);
if (ignCell == -1) if (ignCell == -1)
{ {
return; return;

View File

@ -104,11 +104,7 @@ void Foam::basicSource::setCellSet()
forAll(points_, i) forAll(points_, i)
{ {
label cellI = mesh_.findCell label cellI = mesh_.findCell(points_[i]);
(
points_[i],
polyMesh::FACEDIAGTETS
);
if (cellI >= 0) if (cellI >= 0)
{ {
selectedCells.insert(cellI); selectedCells.insert(cellI);

View File

@ -76,10 +76,16 @@ void Foam::setRefCell
else if (dict.found(refPointName)) else if (dict.found(refPointName))
{ {
point refPointi(dict.lookup(refPointName)); point refPointi(dict.lookup(refPointName));
// Note: find reference cell using facePlanes to avoid constructing
// face decomposition structure. Most likely the reference
// cell is an undistorted one so this should not be a
// problem.
refCelli = field.mesh().findCell refCelli = field.mesh().findCell
( (
refPointi, refPointi,
polyMesh::FACEDIAGTETS polyMesh::FACEPLANES
); );
label hasRef = (refCelli >= 0 ? 1 : 0); label hasRef = (refCelli >= 0 ? 1 : 0);
label sumHasRef = returnReduce<label>(hasRef, sumOp<label>()); label sumHasRef = returnReduce<label>(hasRef, sumOp<label>());

View File

@ -6,12 +6,7 @@ if (injectorCell >= 0)
const vector& C = mesh_.C()[injectorCell]; const vector& C = mesh_.C()[injectorCell];
injectionPosition += 1.0e-9*(C - injectionPosition); injectionPosition += 1.0e-9*(C - injectionPosition);
foundCell = mesh_.pointInCell foundCell = mesh_.pointInCell(injectionPosition, injectorCell);
(
injectionPosition,
injectorCell,
polyMesh::FACEDIAGTETS
);
} }
reduce(foundCell, orOp<bool>()); reduce(foundCell, orOp<bool>());
@ -37,12 +32,7 @@ if (!foundCell)
const vector& C = mesh_.C()[injectorCell]; const vector& C = mesh_.C()[injectorCell];
injectionPosition += 1.0e-6*(C - injectionPosition); injectionPosition += 1.0e-6*(C - injectionPosition);
foundCell = mesh_.pointInCell foundCell = mesh_.pointInCell(injectionPosition, injectorCell);
(
injectionPosition,
injectorCell,
polyMesh::FACEDIAGTETS
);
} }
reduce(foundCell, orOp<bool>()); reduce(foundCell, orOp<bool>());
@ -60,12 +50,7 @@ if (!foundCell)
const vector& C = mesh_.C()[injectorCell]; const vector& C = mesh_.C()[injectorCell];
injectionPosition += 1.0e-9*(C - injectionPosition); injectionPosition += 1.0e-9*(C - injectionPosition);
foundCell = mesh_.pointInCell foundCell = mesh_.pointInCell(injectionPosition, injectorCell);
(
injectionPosition,
injectorCell,
polyMesh::FACEDIAGTETS
);
} }
reduce(foundCell, orOp<bool>()); reduce(foundCell, orOp<bool>());

View File

@ -205,15 +205,7 @@ bool Foam::InjectionModel<CloudType>::findCellAtPosition
{ {
position += SMALL*(cellCentres[cellI] - position); position += SMALL*(cellCentres[cellI] - position);
if if (this->owner().mesh().pointInCell(position, cellI))
(
this->owner().mesh().pointInCell
(
position,
cellI,
polyMesh::FACEDIAGTETS
)
)
{ {
procI = Pstream::myProcNo(); procI = Pstream::myProcNo();
} }

View File

@ -86,7 +86,7 @@ Foam::labelList Foam::refinementParameters::findCells(const polyMesh& mesh)
{ {
const point& keepPoint = keepPoints_[i]; const point& keepPoint = keepPoints_[i];
label localCellI = mesh.findCell(keepPoint, polyMesh::FACEDIAGTETS); label localCellI = mesh.findCell(keepPoint);
label globalCellI = -1; label globalCellI = -1;

View File

@ -1825,7 +1825,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
label regionI = -1; label regionI = -1;
label cellI = mesh_.findCell(keepPoint, polyMesh::FACEDIAGTETS); label cellI = mesh_.findCell(keepPoint);
if (cellI != -1) if (cellI != -1)
{ {

View File

@ -1248,7 +1248,7 @@ void Foam::meshRefinement::findCellZoneInsideWalk
// Find the region containing the insidePoint // Find the region containing the insidePoint
label keepRegionI = -1; label keepRegionI = -1;
label cellI = mesh_.findCell(insidePoint, polyMesh::FACEDIAGTETS); label cellI = mesh_.findCell(insidePoint);
if (cellI != -1) if (cellI != -1)
{ {
@ -1418,7 +1418,7 @@ void Foam::meshRefinement::findCellZoneTopo
// Find the region containing the keepPoint // Find the region containing the keepPoint
label keepRegionI = -1; label keepRegionI = -1;
label cellI = mesh_.findCell(keepPoint, polyMesh::FACEDIAGTETS); label cellI = mesh_.findCell(keepPoint);
if (cellI != -1) if (cellI != -1)
{ {
@ -1959,7 +1959,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
// Find the region containing the keepPoint // Find the region containing the keepPoint
label keepRegionI = -1; label keepRegionI = -1;
label cellI = mesh_.findCell(keepPoint, polyMesh::FACEDIAGTETS); label cellI = mesh_.findCell(keepPoint);
if (cellI != -1) if (cellI != -1)
{ {

View File

@ -174,7 +174,7 @@ void Foam::mappedPatchBase::findSamples
} }
// Octree based search engine // Octree based search engine
meshSearch meshSearchEngine(mesh, polyMesh::FACEDIAGTETS); meshSearch meshSearchEngine(mesh);
forAll(samples, sampleI) forAll(samples, sampleI)
{ {
@ -291,7 +291,7 @@ void Foam::mappedPatchBase::findSamples
} }
// Octree based search engine // Octree based search engine
meshSearch meshSearchEngine(mesh, polyMesh::FACEDIAGTETS); meshSearch meshSearchEngine(mesh);
forAll(samples, sampleI) forAll(samples, sampleI)
{ {

View File

@ -116,12 +116,7 @@ bool Foam::octreeDataCell::contains
const point& sample const point& sample
) const ) const
{ {
return mesh_.pointInCell return mesh_.pointInCell(sample, cellLabels_[index]);
(
sample,
cellLabels_[index],
polyMesh::FACEDIAGTETS
);
} }

View File

@ -60,7 +60,7 @@ Foam::topoSetSource::addToUsageTable Foam::regionToCell::usage_
void Foam::regionToCell::combine(topoSet& set, const bool add) const void Foam::regionToCell::combine(topoSet& set, const bool add) const
{ {
label cellI = mesh_.findCell(insidePoint_, polyMesh::FACEDIAGTETS); label cellI = mesh_.findCell(insidePoint_);
// Load the subset of cells // Load the subset of cells
boolList blockedFace(mesh_.nFaces(), false); boolList blockedFace(mesh_.nFaces(), false);

View File

@ -166,7 +166,7 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
// Construct search engine on mesh // Construct search engine on mesh
meshSearch queryMesh(mesh_, polyMesh::FACEDIAGTETS); meshSearch queryMesh(mesh_);
// Check all 'outside' points // Check all 'outside' points

View File

@ -235,7 +235,7 @@ void Foam::surfaceSets::getSurfaceSets
) )
{ {
// Construct search engine on mesh // Construct search engine on mesh
meshSearch queryMesh(mesh, polyMesh::FACEDIAGTETS); meshSearch queryMesh(mesh);
// Cut faces with surface and classify cells // Cut faces with surface and classify cells
cellClassification cellType cellClassification cellType

View File

@ -363,7 +363,7 @@ void Foam::streamLine::read(const dictionary& dict)
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_); const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
meshSearchPtr_.reset(new meshSearch(mesh, polyMesh::FACEDIAGTETS)); meshSearchPtr_.reset(new meshSearch(mesh));
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs"); const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
sampledSetPtr_ = sampledSet::New sampledSetPtr_ = sampledSet::New

View File

@ -267,7 +267,7 @@ void Foam::meshToMesh::cellAddresses
cellAddressing_[toI] = -1; cellAddressing_[toI] = -1;
// Check point is actually in the nearest cell // Check point is actually in the nearest cell
if (fromMesh.pointInCell(p, curCell, polyMesh::FACEDIAGTETS)) if (fromMesh.pointInCell(p, curCell))
{ {
cellAddressing_[toI] = curCell; cellAddressing_[toI] = curCell;
} }
@ -292,15 +292,7 @@ void Foam::meshToMesh::cellAddresses
{ {
// search through all the neighbours. // search through all the neighbours.
// If point is in neighbour reset current cell // If point is in neighbour reset current cell
if if (fromMesh.pointInCell(p, neighbours[nI]))
(
fromMesh.pointInCell
(
p,
neighbours[nI],
polyMesh::FACEDIAGTETS
)
)
{ {
cellAddressing_[toI] = neighbours[nI]; cellAddressing_[toI] = neighbours[nI];
found = true; found = true;
@ -324,15 +316,7 @@ void Foam::meshToMesh::cellAddresses
{ {
// search through all the neighbours. // search through all the neighbours.
// If point is in neighbour reset current cell // If point is in neighbour reset current cell
if if (fromMesh.pointInCell(p, nn[nI]))
(
fromMesh.pointInCell
(
p,
nn[nI],
polyMesh::FACEDIAGTETS
)
)
{ {
cellAddressing_[toI] = nn[nI]; cellAddressing_[toI] = nn[nI];
found = true; found = true;

View File

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

View File

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

View File

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