Commit 193feb95 authored by andy's avatar andy
Browse files

ENH: Added lookupRe function

parent f66f9e9d
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -148,6 +148,27 @@ Foam::IOobject* Foam::IOobjectList::lookup(const word& name) const
}
Foam::IOobjectList Foam::IOobjectList::lookupRe(const wordRe& name) const
{
IOobjectList objectsOfName(size());
forAllConstIter(HashPtrTable<IOobject>, *this, iter)
{
if (name.match(iter()->name()))
{
if (IOobject::debug)
{
Info<< "IOobjectList::lookupRe : found " << iter.key() << endl;
}
objectsOfName.insert(iter.key(), new IOobject(*iter()));
}
}
return objectsOfName;
}
Foam::IOobjectList Foam::IOobjectList::lookupClass(const word& ClassName) const
{
IOobjectList objectsOfClass(size());
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -44,7 +44,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class IOobjectList Declaration
Class IOobjectList Declaration
\*---------------------------------------------------------------------------*/
class IOobjectList
......@@ -91,6 +91,9 @@ public:
//- Lookup a given name and return IOobject ptr if found else NULL
IOobject* lookup(const word& name) const;
//- Return the list for all IOobects whose name matches name
IOobjectList lookupRe(const wordRe& name) const;
//- Return the list for all IOobjects of a given class
IOobjectList lookupClass(const word& className) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment