diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.C b/src/OpenFOAM/db/IOobjectList/IOobjectList.C index 007b56dc0b..f58bab4214 100644 --- a/src/OpenFOAM/db/IOobjectList/IOobjectList.C +++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,6 +27,7 @@ License #include "Time.H" #include "OSspecific.H" #include "IOList.H" +#include "stringListOps.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -228,7 +229,10 @@ Foam::wordList Foam::IOobjectList::sortedNames() const } -Foam::wordList Foam::IOobjectList::names(const word& ClassName) const +Foam::wordList Foam::IOobjectList::names +( + const word& ClassName +) const { wordList objectNames(size()); @@ -247,7 +251,34 @@ Foam::wordList Foam::IOobjectList::names(const word& ClassName) const } -Foam::wordList Foam::IOobjectList::sortedNames(const word& ClassName) const +Foam::wordList Foam::IOobjectList::names +( + const word& ClassName, + const wordRe& matcher +) const +{ + wordList objNames = names(ClassName); + + return wordList(objNames, findStrings(matcher, objNames)); +} + + +Foam::wordList Foam::IOobjectList::names +( + const word& ClassName, + const wordReList& matcher +) const +{ + wordList objNames = names(ClassName); + + return wordList(objNames, findStrings(matcher, objNames)); +} + + +Foam::wordList Foam::IOobjectList::sortedNames +( + const word& ClassName +) const { wordList sortedLst = names(ClassName); sort(sortedLst); @@ -256,4 +287,30 @@ Foam::wordList Foam::IOobjectList::sortedNames(const word& ClassName) const } +Foam::wordList Foam::IOobjectList::sortedNames +( + const word& ClassName, + const wordRe& matcher +) const +{ + wordList sortedLst = names(ClassName, matcher); + sort(sortedLst); + + return sortedLst; +} + + +Foam::wordList Foam::IOobjectList::sortedNames +( + const word& ClassName, + const wordReList& matcher +) const +{ + wordList sortedLst = names(ClassName, matcher); + sort(sortedLst); + + return sortedLst; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.H b/src/OpenFOAM/db/IOobjectList/IOobjectList.H index 5a0177d197..926135222f 100644 --- a/src/OpenFOAM/db/IOobjectList/IOobjectList.H +++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -55,7 +55,7 @@ class IOobjectList // Private Member Functions //- Disallow default bitwise assignment - void operator=(const IOobjectList&); + void operator=(const IOobjectList&) = delete; public: @@ -104,17 +104,35 @@ public: //- Return the list for all IOobjects of a given class IOobjectList lookupClass(const word& className) const; - //- Return the list of names of the IOobjects + + //- A list of names of the IOobjects wordList names() const; - //- Return the sorted list of names of the IOobjects - wordList sortedNames() const; - - //- Return the list of names of the IOobjects of given class + //- A list of names of IOobjects of the given class wordList names(const word& className) const; - //- Return the sorted list of names of the IOobjects of given class + //- A list of names of IOobjects of the given class, + // and that also satisfy the input matcher + wordList names(const word& className, const wordRe&) const; + + //- A list of names of IOobjects of the given class, + // and that also satisfy the input matchers + wordList names(const word& className, const wordReList&) const; + + + //- A sorted list of names of the IOobjects + wordList sortedNames() const; + + //- A sorted list of names of IOobjects of given class wordList sortedNames(const word& className) const; + + //- A sorted list of names of IOobjects of the given class, + // and that also satisfy the input matcher + wordList sortedNames(const word& className, const wordRe&) const; + + //- A sorted list of names of IOobjects of the given class, + // and that also satisfy the input matchers + wordList sortedNames(const word& className, const wordReList&) const; };