Commit 0d899d92 authored by mattijs's avatar mattijs
Browse files

instance searching

parent f644d9d2
......@@ -1341,27 +1341,53 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
dict_(io, dict)
{
read();
if (debug)
{
Info<< "Constructed from triSurface:" << endl;
writeStats(Info);
}
}
Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io)
:
triSurfaceMesh(io),
//triSurfaceMesh(io),
triSurfaceMesh
(
IOobject
(
io.name(),
io.time().findInstance(io.local(), word::null),
io.local(),
io.db(),
io.readOpt(),
io.writeOpt(),
io.registerObject()
)
),
dict_
(
IOobject
(
searchableSurface::name() + "Dict",
searchableSurface::instance(),
searchableSurface::local(),
searchableSurface::db(),
searchableSurface::readOpt(),
searchableSurface::writeOpt(),
searchableSurface::registerObject()
triSurfaceMesh::name() + "Dict",
triSurfaceMesh::instance(),
triSurfaceMesh::local(),
triSurfaceMesh::db(),
triSurfaceMesh::readOpt(),
triSurfaceMesh::writeOpt(),
triSurfaceMesh::registerObject()
)
)
{
read();
if (debug)
{
Info<< "Read distributedTriSurface from " << io.objectPath()
<< ':' << endl;
writeStats(Info);
}
}
......@@ -1371,22 +1397,43 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
const dictionary& dict
)
:
triSurfaceMesh(io, dict),
//triSurfaceMesh(io, dict),
triSurfaceMesh
(
IOobject
(
io.name(),
io.time().findInstance(io.local(), word::null),
io.local(),
io.db(),
io.readOpt(),
io.writeOpt(),
io.registerObject()
),
dict
),
dict_
(
IOobject
(
searchableSurface::name() + "Dict",
searchableSurface::instance(),
searchableSurface::local(),
searchableSurface::db(),
searchableSurface::readOpt(),
searchableSurface::writeOpt(),
searchableSurface::registerObject()
triSurfaceMesh::name() + "Dict",
triSurfaceMesh::instance(),
triSurfaceMesh::local(),
triSurfaceMesh::db(),
triSurfaceMesh::readOpt(),
triSurfaceMesh::writeOpt(),
triSurfaceMesh::registerObject()
)
)
{
read();
if (debug)
{
Info<< "Read distributedTriSurface from " << io.objectPath()
<< " and dictionary:" << endl;
writeStats(Info);
}
}
......
......@@ -317,10 +317,11 @@ public:
const dictionary& dict
);
//- Construct read
//- Construct read. Does findInstance to find io.local().
distributedTriSurfaceMesh(const IOobject& io);
//- Construct from dictionary (used by searchableSurface)
//- Construct from dictionary (used by searchableSurface).
// Does read. Does findInstance to find io.local().
distributedTriSurfaceMesh
(
const IOobject& io,
......
......@@ -52,8 +52,15 @@ Foam::pointIndexHit Foam::searchableSphere::findNearest
scalar magN = mag(n);
if (nearestDistSqr > sqr(magN-radius_))
{
if (magN < ROOTVSMALL)
{
info.rawPoint() = centre_ + vector(1,0,0)/magN*radius_;
}
else
{
info.rawPoint() = centre_ + n/magN*radius_;
}
info.setHit();
info.setIndex(0);
}
......
......@@ -228,19 +228,19 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const triSurface& s)
Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io)
:
// Find instance for triSurfaceMesh
searchableSurface
(
IOobject
(
io.name(),
io.time().findInstance(io.local(), word::null),
io.local(),
io.db(),
io.readOpt(),
io.writeOpt(),
io.registerObject()
)
),
searchableSurface(io),
//(
// IOobject
// (
// io.name(),
// io.time().findInstance(io.local(), word::null),
// io.local(),
// io.db(),
// io.readOpt(),
// io.writeOpt(),
// io.registerObject()
// )
//),
// Reused found instance in objectRegistry
objectRegistry
(
......@@ -273,19 +273,19 @@ Foam::triSurfaceMesh::triSurfaceMesh
const dictionary& dict
)
:
searchableSurface
(
IOobject
(
io.name(),
io.time().findInstance(io.local(), word::null),
io.local(),
io.db(),
io.readOpt(),
io.writeOpt(),
io.registerObject()
)
),
searchableSurface(io),
//(
// IOobject
// (
// io.name(),
// io.time().findInstance(io.local(), word::null),
// io.local(),
// io.db(),
// io.readOpt(),
// io.writeOpt(),
// io.registerObject()
// )
//),
// Reused found instance in objectRegistry
objectRegistry
(
......
......@@ -117,7 +117,6 @@ public:
triSurfaceMesh(const IOobject& io);
//- Construct from IO and dictionary (used by searchableSurface).
// Does timeInstance search.
// Dictionary may contain a 'scale' entry (eg, 0.001: mm -> m)
triSurfaceMesh
(
......
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