ENH: support objectRegistry::checkOut(const word& name)

- similar to what erase() does, but as a mutable operation (#1180)

- replace basicThermo lookupAndCheckout (commit 880c98757d) with
  the new objectRegistry::checkOut() method.
This commit is contained in:
Mark Olesen
2019-02-06 12:01:29 +01:00
parent 988e4cad7f
commit 0767409988
8 changed files with 27 additions and 56 deletions

View File

@ -49,24 +49,6 @@ namespace Foam
bool Foam::surfMeshSamplers::verbose_ = false;
void Foam::surfMeshSamplers::checkOutNames
(
const objectRegistry& registry,
const UList<word>& names
)
{
objectRegistry& reg = const_cast<objectRegistry&>(registry);
for (const word& fldName : names)
{
objectRegistry::iterator iter = reg.find(fldName);
if (iter.found())
{
registry.checkOut(*iter());
}
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -297,7 +279,11 @@ bool Foam::surfMeshSamplers::execute()
}
}
checkOutNames(db, cleanup);
// Cleanup any locally introduced names
for (const word& fieldName : cleanup)
{
db.checkOut(fieldName);
}
return true;
}

View File

@ -157,14 +157,6 @@ class surfMeshSamplers
// Private Member Functions
//- Remove items by name from objectRegistry
static void checkOutNames
(
const objectRegistry& registry,
const UList<word>& names
);
//- Hard-coded derived field (rho * U)
// \return true if field did not previously exist
bool add_rhoU(const word& derivedName);