diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 0e52db7fc7..dc695b5a43 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -106,6 +106,20 @@ void Foam::functionObjectList::clear() } +Foam::label Foam::functionObjectList::findObjectID(const word& name) const +{ + forAll(*this, objectI) + { + if (operator[](objectI).name() == name) + { + return objectI; + } + } + + return -1; +} + + void Foam::functionObjectList::on() { execution_ = true; @@ -142,14 +156,9 @@ bool Foam::functionObjectList::execute() read(); } - forAllIter - ( - PtrList, - static_cast&>(*this), - iter - ) + forAll(*this, objectI) { - ok = iter().execute() && ok; + ok = operator[](objectI).execute() && ok; } } @@ -168,14 +177,9 @@ bool Foam::functionObjectList::end() read(); } - forAllIter - ( - PtrList, - static_cast&>(*this), - iter - ) + forAll(*this, objectI) { - ok = iter().end() && ok; + ok = operator[](objectI).end() && ok; } } diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H index 0b3a035464..a033909d31 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H @@ -120,9 +120,8 @@ public: ); - // Destructor - - virtual ~functionObjectList(); + //- Destructor + virtual ~functionObjectList(); // Member Functions @@ -139,6 +138,8 @@ public: //- Clear the list of function objects virtual void clear(); + //- Find the ID of a given function object by name + virtual label findObjectID(const word& name) const; //- Switch the function objects on virtual void on(); @@ -161,7 +162,6 @@ public: //- Read and set the function objects if their data have changed virtual bool read(); - };