Commit 71fd1058 authored by mattijs's avatar mattijs
Browse files

BUG: patchProbes : split off nearInfo

parent 65a1c946
......@@ -35,6 +35,7 @@ License
#include "polyMesh.H"
#include "polyPatch.H"
#include "Time.H"
#include "mapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -64,34 +65,6 @@ namespace Foam
const NamedEnum<directMappedPatchBase::offsetMode, 3>
directMappedPatchBase::offsetModeNames_;
//- Private class for finding nearest
// - point+local index
// - sqr(distance)
// - processor
typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo;
class nearestEqOp
{
public:
void operator()(nearInfo& x, const nearInfo& y) const
{
if (y.first().hit())
{
if (!x.first().hit())
{
x = y;
}
else if (y.second().first() < x.second().first())
{
x = y;
}
}
}
};
}
......
......@@ -70,8 +70,6 @@ SourceFiles
#include "pointField.H"
#include "Tuple2.H"
#include "pointIndexHit.H"
#include "mapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -80,6 +78,7 @@ namespace Foam
class polyPatch;
class polyMesh;
class mapDistribute;
/*---------------------------------------------------------------------------*\
Class directMappedPatchBase Declaration
......@@ -106,6 +105,34 @@ public:
NORMAL // use face normal + distance
};
//- Helper class for finding nearest
// - point+local index
// - sqr(distance)
// - processor
typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo;
class nearestEqOp
{
public:
void operator()(nearInfo& x, const nearInfo& y) const
{
if (y.first().hit())
{
if (!x.first().hit())
{
x = y;
}
else if (y.second().first() < x.second().first())
{
x = y;
}
}
}
};
private:
// Private data
......
......@@ -25,10 +25,10 @@ License
#include "patchProbes.H"
#include "volFields.H"
#include "dictionary.H"
#include "Time.H"
#include "IOmanip.H"
#include "directMappedPatchBase.C"
// For 'nearInfo' helper class only
#include "directMappedPatchBase.H"
#include "meshSearch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -41,11 +41,10 @@ namespace Foam
void Foam::patchProbes::findElements(const fvMesh& mesh)
{
elementList_.clear();
elementList_.setSize(size());
// All the info for nearest. Construct to miss
List<nearInfo> nearest(this->size());
List<directMappedPatchBase::nearInfo> nearest(this->size());
// Octree based search engine
meshSearch meshSearchEngine(mesh, false);
......@@ -75,7 +74,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
// Find nearest.
Pstream::listCombineGather(nearest, nearestEqOp());
Pstream::listCombineGather(nearest, directMappedPatchBase::nearestEqOp());
Pstream::listCombineScatter(nearest);
if (debug)
......@@ -118,7 +117,6 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::patchProbes::patchProbes
......
......@@ -37,11 +37,6 @@ SourceFiles
#ifndef patchProbes_H
#define patchProbes_H
#include "HashPtrTable.H"
#include "OFstream.H"
#include "polyMesh.H"
#include "pointField.H"
#include "volFieldsFwd.H"
#include "probes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
Markdown is supported
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