ENH: additional variants of IOobjectList findObject()

- cfindObject() for const pointer access.

- getObject() for mutable non-const pointer access, similar to the
     objectRegistry::getObjectPtr()

- cfindObject(), findObject(), getObject() with template type access
  to also check the headerClassName.

  For example,

      cfindObject("U")  ->  good
      cfindObject<volVectorField>("U") -> good
      cfindObject<volScalarField>("U") -> nullptr

  This allows inversion of looping logic.

    1) Obtain the names for a particular Type

       for (const word& objName : objs.sortedNames<Type>())
       {
           const IOobject* io = objs[objName];
           ...
       }

    2) Use previously obtained names and apply to a particular Type

       for (const word& objName : someListOfNames)
       {
           const IOobject* io = objs.cfindObject<Type>(objName);
           if (io)
           {
               ...
           }
       }
This commit is contained in:
Mark Olesen
2018-11-28 11:28:38 +01:00
parent 7477459186
commit b81420e524
7 changed files with 212 additions and 29 deletions

View File

@ -27,7 +27,6 @@ Application
Group
grpPostProcessingUtilitie
Description
Generates a VTK file of particle tracks for cases that were computed using
a steady-state cloud
@ -84,7 +83,7 @@ label validateFields
{
if (ok[i])
{
nOk++;
++nOk;
}
else
{