mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-robuster-ioobjectlist-construction' into 'develop'
Feature robuster IOobjectList construction See merge request !134
This commit is contained in:
@ -154,14 +154,14 @@ Foam::IOobjectList::IOobjectList
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a list of file names in this directory
|
// Create a list of file names in this directory
|
||||||
fileNameList objNames =
|
const auto objNames =
|
||||||
readDir(db.path(newInstance, db.dbDir()/local), fileName::FILE);
|
readDir(db.path(newInstance, db.dbDir()/local), fileName::FILE);
|
||||||
|
|
||||||
forAll(objNames, i)
|
for (const auto& objName : objNames)
|
||||||
{
|
{
|
||||||
IOobject* objectPtr = new IOobject
|
IOobject* objectPtr = new IOobject
|
||||||
(
|
(
|
||||||
objNames[i],
|
objName,
|
||||||
newInstance,
|
newInstance,
|
||||||
local,
|
local,
|
||||||
db,
|
db,
|
||||||
@ -170,8 +170,23 @@ Foam::IOobjectList::IOobjectList
|
|||||||
registerObject
|
registerObject
|
||||||
);
|
);
|
||||||
|
|
||||||
// Use object with local scope
|
bool ok = false;
|
||||||
if (objectPtr->typeHeaderOk<IOList<label>>(false))
|
const bool throwingIOerr = FatalIOError.throwExceptions();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Use object with local scope and current instance (no searching)
|
||||||
|
ok = objectPtr->typeHeaderOk<IOList<label>>(false, false);
|
||||||
|
}
|
||||||
|
catch (Foam::IOerror& err)
|
||||||
|
{
|
||||||
|
Warning
|
||||||
|
<< err << nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
FatalIOError.throwExceptions(throwingIOerr);
|
||||||
|
|
||||||
|
if (ok)
|
||||||
{
|
{
|
||||||
insert(objectPtr->name(), objectPtr);
|
insert(objectPtr->name(), objectPtr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user