ENH: simplify objectRegistry access names (issue #322)

New name:  findObject(), cfindObject()
  Old name:  lookupObjectPtr()

      Return a const pointer or nullptr on failure.

  New name:  findObject()
  Old name:  --

      Return a non-const pointer or nullptr on failure.

  New name:  getObjectPtr()
  Old name:  lookupObjectRefPtr()

      Return a non-const pointer or nullptr on failure.
      Can be called on a const object and it will perform a
      const_cast.

- use these updated names and functionality in more places

NB: The older methods names are deprecated, but continue to be defined.
This commit is contained in:
Mark Olesen
2018-10-17 16:44:10 +02:00
parent e0255cfff2
commit 8fabc32539
94 changed files with 918 additions and 952 deletions

View File

@ -66,7 +66,7 @@ Foam::functionObjects::setFlow::modeTypeNames
void Foam::functionObjects::setFlow::setPhi(const volVectorField& U)
{
surfaceScalarField* phiptr =
mesh_.lookupObjectRefPtr<surfaceScalarField>(phiName_);
mesh_.getObjectPtr<surfaceScalarField>(phiName_);
if (!phiptr)
{
@ -76,7 +76,7 @@ void Foam::functionObjects::setFlow::setPhi(const volVectorField& U)
if (rhoName_ != "none")
{
const volScalarField* rhoptr =
mesh_.lookupObjectPtr<volScalarField>(rhoName_);
mesh_.findObject<volScalarField>(rhoName_);
if (rhoptr)
{
@ -207,10 +207,11 @@ bool Foam::functionObjects::setFlow::read(const dictionary& dict)
bool Foam::functionObjects::setFlow::execute()
{
volVectorField* Uptr = mesh_.lookupObjectRefPtr<volVectorField>(UName_);
volVectorField* Uptr =
mesh_.getObjectPtr<volVectorField>(UName_);
surfaceScalarField* phiptr =
mesh_.lookupObjectRefPtr<surfaceScalarField>(phiName_);
mesh_.getObjectPtr<surfaceScalarField>(phiName_);
Log << nl << name() << ":" << nl;
@ -431,13 +432,13 @@ bool Foam::functionObjects::setFlow::execute()
bool Foam::functionObjects::setFlow::write()
{
const auto& Uptr = mesh_.lookupObjectRefPtr<volVectorField>(UName_);
const auto* Uptr = mesh_.findObject<volVectorField>(UName_);
if (Uptr)
{
Uptr->write();
}
const auto& phiptr = mesh_.lookupObjectRefPtr<surfaceScalarField>(phiName_);
const auto* phiptr = mesh_.findObject<surfaceScalarField>(phiName_);
if (phiptr)
{
phiptr->write();