From ca4b8c347c271be77c553719d63e0e72b5e9b5cf Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Tue, 8 Nov 2011 17:03:54 +0000 Subject: [PATCH] ENH: polyMesh,meshSearch: default value on findCell, pointInCell --- .../mesh/advanced/selectCells/selectCells.C | 2 +- .../splitMeshRegions/splitMeshRegions.C | 2 +- .../decomposePar/decomposePar.C | 6 +---- src/OpenFOAM/meshes/polyMesh/polyMesh.H | 4 ++-- src/engine/ignition/ignitionSite.C | 2 +- .../basicSource/basicSource/basicSource.C | 6 +---- .../general/findRefCell/findRefCell.C | 8 ++++++- .../dieselSpray/spray/findInjectorCell.H | 21 +++--------------- .../InjectionModel/InjectionModel.C | 10 +-------- .../refinementParameters.C | 2 +- .../meshRefinement/meshRefinement.C | 2 +- .../meshRefinement/meshRefinementBaffles.C | 6 ++--- .../mappedPolyPatch/mappedPatchBase.C | 4 ++-- src/meshTools/octree/octreeDataCell.C | 7 +----- .../cellSources/regionToCell/regionToCell.C | 2 +- .../cellSources/surfaceToCell/surfaceToCell.C | 2 +- src/meshTools/surfaceSets/surfaceSets.C | 2 +- .../field/streamLine/streamLine.C | 2 +- .../calculateMeshToMeshAddressing.C | 22 +++---------------- src/sampling/probes/probes.C | 2 +- .../sampledSet/sampledSets/sampledSets.C | 2 +- .../triSurfaceMeshPointSet.C | 6 +---- 22 files changed, 36 insertions(+), 86 deletions(-) diff --git a/applications/utilities/mesh/advanced/selectCells/selectCells.C b/applications/utilities/mesh/advanced/selectCells/selectCells.C index ae7525f1275..dfa2a5ce243 100644 --- a/applications/utilities/mesh/advanced/selectCells/selectCells.C +++ b/applications/utilities/mesh/advanced/selectCells/selectCells.C @@ -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) diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 2d75cc36efd..b34676fac5c 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -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; diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 1a92c9bc398..fd58570b348 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -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); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.H b/src/OpenFOAM/meshes/polyMesh/polyMesh.H index ed67ef6a32d..d67896744f9 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.H @@ -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; }; diff --git a/src/engine/ignition/ignitionSite.C b/src/engine/ignition/ignitionSite.C index 758d84449da..3ecdd632715 100644 --- a/src/engine/ignition/ignitionSite.C +++ b/src/engine/ignition/ignitionSite.C @@ -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; diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C index 5f454974f2f..da790fab4d9 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C @@ -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); diff --git a/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C b/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C index eb6048f939a..c96f7e5fad2 100644 --- a/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C +++ b/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C @@ -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>()); diff --git a/src/lagrangian/dieselSpray/spray/findInjectorCell.H b/src/lagrangian/dieselSpray/spray/findInjectorCell.H index bf1ca82cecd..9ff2141c4c2 100644 --- a/src/lagrangian/dieselSpray/spray/findInjectorCell.H +++ b/src/lagrangian/dieselSpray/spray/findInjectorCell.H @@ -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>()); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 256ff8d1668..28d211397e8 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C @@ -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(); } diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C index 653e34c1cac..ba8d0f4200e 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C @@ -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; diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index 71349d061e0..059e2a9d6d3 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -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) { diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C index 175ce9ca53b..a9c6badb3b2 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C @@ -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) { diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index b78495e443b..9d7ed47e892 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -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) { diff --git a/src/meshTools/octree/octreeDataCell.C b/src/meshTools/octree/octreeDataCell.C index 9ddf44f9aef..4dcc838a0e5 100644 --- a/src/meshTools/octree/octreeDataCell.C +++ b/src/meshTools/octree/octreeDataCell.C @@ -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]); } diff --git a/src/meshTools/sets/cellSources/regionToCell/regionToCell.C b/src/meshTools/sets/cellSources/regionToCell/regionToCell.C index 375d9d18943..77948ca5a5c 100644 --- a/src/meshTools/sets/cellSources/regionToCell/regionToCell.C +++ b/src/meshTools/sets/cellSources/regionToCell/regionToCell.C @@ -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); diff --git a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C index 16c031f1beb..daf56a94d14 100644 --- a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C +++ b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C @@ -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 diff --git a/src/meshTools/surfaceSets/surfaceSets.C b/src/meshTools/surfaceSets/surfaceSets.C index a9689e0d2a6..850df22698f 100644 --- a/src/meshTools/surfaceSets/surfaceSets.C +++ b/src/meshTools/surfaceSets/surfaceSets.C @@ -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 diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLine.C b/src/postProcessing/functionObjects/field/streamLine/streamLine.C index 67fe11c29a5..30d80525133 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLine.C +++ b/src/postProcessing/functionObjects/field/streamLine/streamLine.C @@ -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 diff --git a/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C b/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C index c93db3f3162..831565bd13e 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C +++ b/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C @@ -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; diff --git a/src/sampling/probes/probes.C b/src/sampling/probes/probes.C index 8bca017d4b1..b0a073e1e40 100644 --- a/src/sampling/probes/probes.C +++ b/src/sampling/probes/probes.C @@ -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) { diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index 68826497821..1a1fc34bfc1 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -138,7 +138,7 @@ Foam::sampledSets::sampledSets mesh_(refCast<const fvMesh>(obr)), loadFromFiles_(loadFromFiles), outputPath_(fileName::null), - searchEngine_(mesh_, polyMesh::FACEDIAGTETS), + searchEngine_(mesh_), interpolationScheme_(word::null), writeFormat_(word::null) { diff --git a/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C b/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C index e88c87ebc73..3704f950e03 100644 --- a/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C +++ b/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C @@ -53,11 +53,7 @@ void Foam::triSurfaceMeshPointSet::calcSamples { forAll(sampleCoords_, sampleI) { - label cellI = searchEngine().findCell - ( - sampleCoords_[sampleI], - polyMesh::FACEDIAGTETS - ); + label cellI = searchEngine().findCell(sampleCoords_[sampleI]); if (cellI != -1) { -- GitLab