Commit ca4b8c34 authored by mattijs's avatar mattijs
Browse files

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

parent b7155f78
......@@ -381,7 +381,7 @@ int main(int argc, char *argv[])
(void)edgeCalc.minLen(Info);
// Search engine on mesh. Face decomposition since faces might be warped.
meshSearch queryMesh(mesh, polyMesh::FACEDIAGTETS);
meshSearch queryMesh(mesh);
// Check all 'outside' points
forAll(outsidePts, outsideI)
......
......@@ -2194,7 +2194,7 @@ int main(int argc, char *argv[])
label regionI = -1;
label cellI = mesh.findCell(insidePoint, polyMesh::FACEDIAGTETS);
label cellI = mesh.findCell(insidePoint);
Info<< nl << "Found point " << insidePoint << " in cell " << cellI
<< endl;
......
......@@ -528,11 +528,7 @@ int main(int argc, char *argv[])
<< "Cell number should be between 0 and "
<< mesh.nCells()-1 << nl
<< "On this mesh the particle should be in cell "
<< mesh.findCell
(
iter().position(),
polyMesh::FACEDIAGTETS
)
<< mesh.findCell(iter().position())
<< exit(FatalError);
}
......
......@@ -558,14 +558,14 @@ public:
(
const point&,
label cellI,
const cellRepresentation
const cellRepresentation = FACEDIAGTETS
) const;
//- Find cell enclosing this location (-1 if not in mesh)
label findCell
(
const point&,
const cellRepresentation
const cellRepresentation = FACEDIAGTETS
) const;
};
......
......@@ -36,7 +36,7 @@ void Foam::ignitionSite::findIgnitionCells(const fvMesh& mesh)
const volVectorField& centres = mesh.C();
const scalarField& vols = mesh.V();
label ignCell = mesh.findCell(location_, polyMesh::FACEDIAGTETS);
label ignCell = mesh.findCell(location_);
if (ignCell == -1)
{
return;
......
......@@ -104,11 +104,7 @@ void Foam::basicSource::setCellSet()
forAll(points_, i)
{
label cellI = mesh_.findCell
(
points_[i],
polyMesh::FACEDIAGTETS
);
label cellI = mesh_.findCell(points_[i]);
if (cellI >= 0)
{
selectedCells.insert(cellI);
......
......@@ -76,10 +76,16 @@ void Foam::setRefCell
else if (dict.found(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
(
refPointi,
polyMesh::FACEDIAGTETS
polyMesh::FACEPLANES
);
label hasRef = (refCelli >= 0 ? 1 : 0);
label sumHasRef = returnReduce<label>(hasRef, sumOp<label>());
......
......@@ -6,12 +6,7 @@ if (injectorCell >= 0)
const vector& C = mesh_.C()[injectorCell];
injectionPosition += 1.0e-9*(C - injectionPosition);
foundCell = mesh_.pointInCell
(
injectionPosition,
injectorCell,
polyMesh::FACEDIAGTETS
);
foundCell = mesh_.pointInCell(injectionPosition, injectorCell);
}
reduce(foundCell, orOp<bool>());
......@@ -37,12 +32,7 @@ if (!foundCell)
const vector& C = mesh_.C()[injectorCell];
injectionPosition += 1.0e-6*(C - injectionPosition);
foundCell = mesh_.pointInCell
(
injectionPosition,
injectorCell,
polyMesh::FACEDIAGTETS
);
foundCell = mesh_.pointInCell(injectionPosition, injectorCell);
}
reduce(foundCell, orOp<bool>());
......@@ -60,12 +50,7 @@ if (!foundCell)
const vector& C = mesh_.C()[injectorCell];
injectionPosition += 1.0e-9*(C - injectionPosition);
foundCell = mesh_.pointInCell
(
injectionPosition,
injectorCell,
polyMesh::FACEDIAGTETS
);
foundCell = mesh_.pointInCell(injectionPosition, injectorCell);
}
reduce(foundCell, orOp<bool>());
......
......@@ -205,15 +205,7 @@ bool Foam::InjectionModel<CloudType>::findCellAtPosition
{
position += SMALL*(cellCentres[cellI] - position);
if
(
this->owner().mesh().pointInCell
(
position,
cellI,
polyMesh::FACEDIAGTETS
)
)
if (this->owner().mesh().pointInCell(position, cellI))
{
procI = Pstream::myProcNo();
}
......
......@@ -86,7 +86,7 @@ Foam::labelList Foam::refinementParameters::findCells(const polyMesh& mesh)
{
const point& keepPoint = keepPoints_[i];
label localCellI = mesh.findCell(keepPoint, polyMesh::FACEDIAGTETS);
label localCellI = mesh.findCell(keepPoint);
label globalCellI = -1;
......
......@@ -1825,7 +1825,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
label regionI = -1;
label cellI = mesh_.findCell(keepPoint, polyMesh::FACEDIAGTETS);
label cellI = mesh_.findCell(keepPoint);
if (cellI != -1)
{
......
......@@ -1248,7 +1248,7 @@ void Foam::meshRefinement::findCellZoneInsideWalk
// Find the region containing the insidePoint
label keepRegionI = -1;
label cellI = mesh_.findCell(insidePoint, polyMesh::FACEDIAGTETS);
label cellI = mesh_.findCell(insidePoint);
if (cellI != -1)
{
......@@ -1418,7 +1418,7 @@ void Foam::meshRefinement::findCellZoneTopo
// Find the region containing the keepPoint
label keepRegionI = -1;
label cellI = mesh_.findCell(keepPoint, polyMesh::FACEDIAGTETS);
label cellI = mesh_.findCell(keepPoint);
if (cellI != -1)
{
......@@ -1959,7 +1959,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
// Find the region containing the keepPoint
label keepRegionI = -1;
label cellI = mesh_.findCell(keepPoint, polyMesh::FACEDIAGTETS);
label cellI = mesh_.findCell(keepPoint);
if (cellI != -1)
{
......
......@@ -174,7 +174,7 @@ void Foam::mappedPatchBase::findSamples
}
// Octree based search engine
meshSearch meshSearchEngine(mesh, polyMesh::FACEDIAGTETS);
meshSearch meshSearchEngine(mesh);
forAll(samples, sampleI)
{
......@@ -291,7 +291,7 @@ void Foam::mappedPatchBase::findSamples
}
// Octree based search engine
meshSearch meshSearchEngine(mesh, polyMesh::FACEDIAGTETS);
meshSearch meshSearchEngine(mesh);
forAll(samples, sampleI)
{
......
......@@ -116,12 +116,7 @@ bool Foam::octreeDataCell::contains
const point& sample
) const
{
return mesh_.pointInCell
(
sample,
cellLabels_[index],
polyMesh::FACEDIAGTETS
);
return mesh_.pointInCell(sample, cellLabels_[index]);
}
......
......@@ -60,7 +60,7 @@ Foam::topoSetSource::addToUsageTable Foam::regionToCell::usage_
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
boolList blockedFace(mesh_.nFaces(), false);
......
......@@ -166,7 +166,7 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
// Construct search engine on mesh
meshSearch queryMesh(mesh_, polyMesh::FACEDIAGTETS);
meshSearch queryMesh(mesh_);
// Check all 'outside' points
......
......@@ -235,7 +235,7 @@ void Foam::surfaceSets::getSurfaceSets
)
{
// Construct search engine on mesh
meshSearch queryMesh(mesh, polyMesh::FACEDIAGTETS);
meshSearch queryMesh(mesh);
// Cut faces with surface and classify cells
cellClassification cellType
......
......@@ -363,7 +363,7 @@ void Foam::streamLine::read(const dictionary& dict)
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");
sampledSetPtr_ = sampledSet::New
......
......@@ -267,7 +267,7 @@ void Foam::meshToMesh::cellAddresses
cellAddressing_[toI] = -1;
// Check point is actually in the nearest cell
if (fromMesh.pointInCell(p, curCell, polyMesh::FACEDIAGTETS))
if (fromMesh.pointInCell(p, curCell))
{
cellAddressing_[toI] = curCell;
}
......@@ -292,15 +292,7 @@ void Foam::meshToMesh::cellAddresses
{
// search through all the neighbours.
// If point is in neighbour reset current cell
if
(
fromMesh.pointInCell
(
p,
neighbours[nI],
polyMesh::FACEDIAGTETS
)
)
if (fromMesh.pointInCell(p, neighbours[nI]))
{
cellAddressing_[toI] = neighbours[nI];
found = true;
......@@ -324,15 +316,7 @@ void Foam::meshToMesh::cellAddresses
{
// search through all the neighbours.
// If point is in neighbour reset current cell
if
(
fromMesh.pointInCell
(
p,
nn[nI],
polyMesh::FACEDIAGTETS
)
)
if (fromMesh.pointInCell(p, nn[nI]))
{
cellAddressing_[toI] = nn[nI];
found = true;
......
......@@ -45,7 +45,7 @@ void Foam::probes::findElements(const fvMesh& mesh)
{
const vector& location = operator[](probeI);
elementList_[probeI] = mesh.findCell(location, polyMesh::FACEDIAGTETS);
elementList_[probeI] = mesh.findCell(location);
if (debug && elementList_[probeI] != -1)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment