mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -539,7 +539,7 @@ int main(int argc, char *argv[])
|
||||
cloud::prefix/cloudDirs[i]
|
||||
);
|
||||
|
||||
IOobject* positionsPtr = sprayObjs.lookup("positions");
|
||||
IOobject* positionsPtr = sprayObjs.lookup(word("positions"));
|
||||
|
||||
if (positionsPtr)
|
||||
{
|
||||
|
||||
@ -529,10 +529,8 @@ int main(int argc, char *argv[])
|
||||
cloud::prefix/cloudDirs[i]
|
||||
);
|
||||
|
||||
IOobject* positionsPtr = sprayObjs.lookup
|
||||
(
|
||||
"positions"
|
||||
);
|
||||
IOobject* positionsPtr =
|
||||
sprayObjs.lookup(word("positions"));
|
||||
|
||||
if (positionsPtr)
|
||||
{
|
||||
|
||||
@ -275,7 +275,7 @@ int main(int argc, char *argv[])
|
||||
cloud::prefix/cloudDirs[cloudI]
|
||||
);
|
||||
|
||||
IOobject* positionsPtr = cloudObjs.lookup("positions");
|
||||
IOobject* positionsPtr = cloudObjs.lookup(word("positions"));
|
||||
|
||||
if (positionsPtr)
|
||||
{
|
||||
|
||||
@ -380,7 +380,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
// check that the positions field is present for this time
|
||||
if (cloudObjs.lookup("positions"))
|
||||
IOobject* positionPtr = cloudObjs.lookup(word("positions"));
|
||||
if (positionPtr != NULL)
|
||||
{
|
||||
ensightParticlePositions
|
||||
(
|
||||
|
||||
@ -448,7 +448,7 @@ int main(int argc, char *argv[])
|
||||
cloud::prefix/cloudDirs[i]
|
||||
);
|
||||
|
||||
IOobject* positionsPtr = sprayObjs.lookup("positions");
|
||||
IOobject* positionsPtr = sprayObjs.lookup(word("positions"));
|
||||
|
||||
if (positionsPtr)
|
||||
{
|
||||
@ -1094,7 +1094,7 @@ int main(int argc, char *argv[])
|
||||
cloud::prefix/cloudName
|
||||
);
|
||||
|
||||
IOobject* positionsPtr = sprayObjs.lookup("positions");
|
||||
IOobject* positionsPtr = sprayObjs.lookup(word("positions"));
|
||||
|
||||
if (positionsPtr)
|
||||
{
|
||||
|
||||
@ -63,7 +63,7 @@ vtkPolyData* Foam::vtkPV398Foam::lagrangianVTKMesh
|
||||
cloud::prefix/cloudName
|
||||
);
|
||||
|
||||
IOobject* positionsPtr = sprayObjs.lookup("positions");
|
||||
IOobject* positionsPtr = sprayObjs.lookup(word("positions"));
|
||||
if (positionsPtr)
|
||||
{
|
||||
Cloud<passiveParticle> parcels(mesh, cloudName, false);
|
||||
|
||||
@ -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
|
||||
@ -63,7 +63,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
|
||||
cloud::prefix/cloudName
|
||||
);
|
||||
|
||||
IOobject* positionsPtr = sprayObjs.lookup("positions");
|
||||
IOobject* positionsPtr = sprayObjs.lookup(word("positions"));
|
||||
if (positionsPtr)
|
||||
{
|
||||
Cloud<passiveParticle> parcels(mesh, cloudName, false);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -120,7 +120,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
|
||||
cloud::prefix/cloudDirs[cloudI]
|
||||
);
|
||||
|
||||
IOobject* positionsPtr = objects.lookup("positions");
|
||||
IOobject* positionsPtr = objects.lookup(word("positions"));
|
||||
|
||||
if (positionsPtr)
|
||||
{
|
||||
|
||||
@ -148,7 +148,7 @@ Foam::IOobject* Foam::IOobjectList::lookup(const word& name) const
|
||||
}
|
||||
|
||||
|
||||
Foam::IOobjectList Foam::IOobjectList::lookupRe(const wordRe& name) const
|
||||
Foam::IOobjectList Foam::IOobjectList::lookup(const wordRe& name) const
|
||||
{
|
||||
IOobjectList objectsOfName(size());
|
||||
|
||||
@ -169,6 +169,29 @@ Foam::IOobjectList Foam::IOobjectList::lookupRe(const wordRe& name) const
|
||||
}
|
||||
|
||||
|
||||
Foam::IOobjectList Foam::IOobjectList::lookup(const wordReList& patterns) const
|
||||
{
|
||||
wordReListMatcher names(patterns);
|
||||
|
||||
IOobjectList objectsOfName(size());
|
||||
|
||||
forAllConstIter(HashPtrTable<IOobject>, *this, iter)
|
||||
{
|
||||
if (names.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());
|
||||
|
||||
@ -37,6 +37,7 @@ SourceFiles
|
||||
|
||||
#include "HashPtrTable.H"
|
||||
#include "IOobject.H"
|
||||
#include "wordReList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -92,7 +93,10 @@ public:
|
||||
IOobject* lookup(const word& name) const;
|
||||
|
||||
//- Return the list for all IOobects whose name matches name
|
||||
IOobjectList lookupRe(const wordRe& name) const;
|
||||
IOobjectList lookup(const wordRe& name) const;
|
||||
|
||||
//- Return the list for all IOobects whose name matches name
|
||||
IOobjectList lookup(const wordReList& patterns) const;
|
||||
|
||||
//- Return the list for all IOobjects of a given class
|
||||
IOobjectList lookupClass(const word& className) const;
|
||||
|
||||
@ -37,6 +37,7 @@ SourceFiles
|
||||
|
||||
#include "HashTable.H"
|
||||
#include "regIOobject.H"
|
||||
#include "wordReList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -147,6 +148,14 @@ public:
|
||||
template<class Type>
|
||||
wordList names() const;
|
||||
|
||||
//- Return the list of objects whose name matches the input regExp
|
||||
template<class Type>
|
||||
wordList names(const wordRe& name) const;
|
||||
|
||||
//- Return the list of objects whose name matches the input regExp
|
||||
template<class Type>
|
||||
wordList names(const wordReList& name) const;
|
||||
|
||||
//- Lookup and return a const sub-objectRegistry. Optionally create
|
||||
// it if it does not exist.
|
||||
const objectRegistry& subRegistry
|
||||
@ -163,10 +172,6 @@ public:
|
||||
template<class Type>
|
||||
HashTable<Type*> lookupClass(const bool strict = false);
|
||||
|
||||
//- Return the list of objects whose name matches the input regExp
|
||||
template<class Type>
|
||||
wordList foundObjectRe(const wordRe& name) const;
|
||||
|
||||
//- Is the named Type found?
|
||||
template<class Type>
|
||||
bool foundObject(const word& name) const;
|
||||
|
||||
@ -24,7 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "objectRegistry.H"
|
||||
|
||||
#include "stringListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -48,6 +48,40 @@ Foam::wordList Foam::objectRegistry::names() const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::wordList Foam::objectRegistry::names(const wordRe& name) const
|
||||
{
|
||||
wordList objectNames(size());
|
||||
|
||||
label count = 0;
|
||||
forAllConstIter(HashTable<regIOobject*>, *this, iter)
|
||||
{
|
||||
if (isA<Type>(*iter()))
|
||||
{
|
||||
const word& objectName = iter()->name();
|
||||
|
||||
if (name.match(objectName))
|
||||
{
|
||||
objectNames[count++] = objectName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
objectNames.setSize(count);
|
||||
|
||||
return objectNames;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::wordList Foam::objectRegistry::names(const wordReList& patterns) const
|
||||
{
|
||||
wordList names(this->names<Type>());
|
||||
|
||||
return wordList(names, findStrings(patterns, names));
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::HashTable<const Type*> Foam::objectRegistry::lookupClass
|
||||
(
|
||||
@ -127,31 +161,6 @@ bool Foam::objectRegistry::foundObject(const word& name) const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::wordList Foam::objectRegistry::foundObjectRe(const wordRe& name) const
|
||||
{
|
||||
wordList objectNames(size());
|
||||
|
||||
label count = 0;
|
||||
forAllConstIter(HashTable<regIOobject*>, *this, iter)
|
||||
{
|
||||
if (isA<Type>(*iter()))
|
||||
{
|
||||
const word& objectName = iter()->name();
|
||||
|
||||
if (name.match(objectName))
|
||||
{
|
||||
objectNames[count++] = objectName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
objectNames.setSize(count);
|
||||
|
||||
return objectNames;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
const Type& Foam::objectRegistry::lookupObject(const word& name) const
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -737,7 +737,7 @@ Foam::labelHashSet Foam::polyBoundaryMesh::patchSet
|
||||
|
||||
forAll(patchNames, i)
|
||||
{
|
||||
const word& patchName = patchNames[i];
|
||||
const wordRe& patchName = patchNames[i];
|
||||
|
||||
// Treat the given patch names as wild-cards and search the set
|
||||
// of all patch names for matches
|
||||
|
||||
@ -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
|
||||
@ -123,7 +123,7 @@ public:
|
||||
inline wordRe(const keyType&, const compOption=LITERAL);
|
||||
|
||||
//- Construct as copy of word
|
||||
inline wordRe(const word&);
|
||||
inline explicit wordRe(const word&);
|
||||
|
||||
//- Construct as copy of character array
|
||||
// Optionally specify how it should be treated.
|
||||
|
||||
Reference in New Issue
Block a user