Commit ab49c603 authored by mattijs's avatar mattijs
Browse files

instance searching

parent 364e8e00
......@@ -1347,19 +1347,6 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io)
:
triSurfaceMesh(io),
// triSurfaceMesh
// (
// IOobject
// (
// io.name(),
// io.db().time().findInstanceDir(io.local()),
// io.local(),
// io.db(),
// io.readOpt(),
// io.writeOpt(),
// io.registerObject()
// )
// ),
dict_
(
IOobject
......@@ -1385,20 +1372,6 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
)
:
triSurfaceMesh(io, dict),
// triSurfaceMesh
// (
// IOobject
// (
// io.name(),
// io.db().time().findInstanceDir(io.local()),
// io.local(),
// io.db(),
// io.readOpt(),
// io.writeOpt(),
// io.registerObject()
// ),
// dict
// ),
dict_
(
IOobject
......
......@@ -43,6 +43,64 @@ addToRunTimeSelectionTable(searchableSurface, triSurfaceMesh, dict);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
//// Special version of Time::findInstance that does not check headerOk
//// to search for instances of raw files
//Foam::word Foam::triSurfaceMesh::findRawInstance
//(
// const Time& runTime,
// const fileName& dir,
// const word& name
//)
//{
// // Check current time first
// if (isFile(runTime.path()/runTime.timeName()/dir/name))
// {
// return runTime.timeName();
// }
// instantList ts = runTime.times();
// label instanceI;
//
// for (instanceI = ts.size()-1; instanceI >= 0; --instanceI)
// {
// if (ts[instanceI].value() <= runTime.timeOutputValue())
// {
// break;
// }
// }
//
// // continue searching from here
// for (; instanceI >= 0; --instanceI)
// {
// if (isFile(runTime.path()/ts[instanceI].name()/dir/name))
// {
// return ts[instanceI].name();
// }
// }
//
//
// // not in any of the time directories, try constant
//
// // Note. This needs to be a hard-coded constant, rather than the
// // constant function of the time, because the latter points to
// // the case constant directory in parallel cases
//
// if (isFile(runTime.path()/runTime.constant()/dir/name))
// {
// return runTime.constant();
// }
//
// FatalErrorIn
// (
// "searchableSurfaces::findRawInstance"
// "(const Time&, const fileName&, const word&)"
// ) << "Cannot find file \"" << name << "\" in directory "
// << runTime.constant()/dir
// << exit(FatalError);
//
// return runTime.constant();
//}
//- Check file existence
const Foam::fileName& Foam::triSurfaceMesh::checkFile
(
......@@ -149,7 +207,19 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const triSurface& s)
:
searchableSurface(io),
objectRegistry(io),
objectRegistry
(
IOobject
(
io.name(),
io.instance(),
io.local(),
io.db(),
io.readOpt(),
io.writeOpt(),
false // searchableSurface already registered under name
)
),
triSurface(s),
surfaceClosed_(-1)
{}
......@@ -157,8 +227,34 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const triSurface& s)
Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io)
:
searchableSurface(io),
objectRegistry(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()
)
),
// Reused found instance in objectRegistry
objectRegistry
(
IOobject
(
io.name(),
static_cast<const searchableSurface&>(*this).instance(),
io.local(),
io.db(),
io.readOpt(),
io.writeOpt(),
false // searchableSurface already registered under name
)
),
triSurface
(
checkFile
......@@ -177,8 +273,33 @@ Foam::triSurfaceMesh::triSurfaceMesh
const dictionary& dict
)
:
searchableSurface(io),
objectRegistry(io),
searchableSurface
(
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
(
IOobject
(
io.name(),
static_cast<const searchableSurface&>(*this).instance(),
io.local(),
io.db(),
io.readOpt(),
io.writeOpt(),
false // searchableSurface already registered under name
)
),
triSurface
(
checkFile
......
......@@ -76,6 +76,14 @@ private:
// Private Member Functions
////- Helper: find instance of files without header
//static word findRawInstance
//(
// const Time&,
// const fileName&,
// const word&
//);
//- Check file existence
static const fileName& checkFile
(
......@@ -105,10 +113,11 @@ public:
//- Construct from triSurface
triSurfaceMesh(const IOobject&, const triSurface&);
//- Construct read
//- Construct read. Does timeInstance search.
triSurfaceMesh(const IOobject& io);
//- Construct from dictionary (used by searchableSurface)
//- 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