added find(name) method + general updates

This commit is contained in:
andy 2009-09-02 17:24:46 +01:00
parent 8feabf5e81
commit 40e22860e9
2 changed files with 22 additions and 18 deletions

View File

@ -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() void Foam::functionObjectList::on()
{ {
execution_ = true; execution_ = true;
@ -142,14 +156,9 @@ bool Foam::functionObjectList::execute()
read(); read();
} }
forAllIter forAll(*this, objectI)
(
PtrList<functionObject>,
static_cast<PtrList<functionObject>&>(*this),
iter
)
{ {
ok = iter().execute() && ok; ok = operator[](objectI).execute() && ok;
} }
} }
@ -168,14 +177,9 @@ bool Foam::functionObjectList::end()
read(); read();
} }
forAllIter forAll(*this, objectI)
(
PtrList<functionObject>,
static_cast<PtrList<functionObject>&>(*this),
iter
)
{ {
ok = iter().end() && ok; ok = operator[](objectI).end() && ok;
} }
} }

View File

@ -120,9 +120,8 @@ public:
); );
// Destructor //- Destructor
virtual ~functionObjectList();
virtual ~functionObjectList();
// Member Functions // Member Functions
@ -139,6 +138,8 @@ public:
//- Clear the list of function objects //- Clear the list of function objects
virtual void clear(); 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 //- Switch the function objects on
virtual void on(); virtual void on();
@ -161,7 +162,6 @@ public:
//- Read and set the function objects if their data have changed //- Read and set the function objects if their data have changed
virtual bool read(); virtual bool read();
}; };