ENH: Updated wildcard handling for function object field entries

This commit is contained in:
Andrew Heather
2017-12-13 20:57:56 +00:00
parent b37fc2d4b1
commit 3da2aee4ef
8 changed files with 71 additions and 23 deletions

View File

@ -101,12 +101,6 @@ public:
return selection_;
}
//- Return the current field selection
wordHashSet& selection()
{
return selection_;
}
//- Read the fieldSelection data from dictionary
virtual bool read(const dictionary& dict);

View File

@ -29,6 +29,43 @@ License
#include "fvPatchField.H"
#include "surfaceMesh.H"
#include "fvsPatchField.H"
#include "pointMesh.H"
#include "pointPatchField.H"
#include "UniformDimensionedField.H"
void Foam::functionObjects::fileFieldSelection::addInternalFieldTypes
(
wordHashSet& set
) const
{
const fvMesh& mesh = static_cast<const fvMesh&>(obr_);
const IOobjectList allObjects(mesh, mesh.time().timeName());
addFromFile<DimensionedField<scalar, volMesh>>(allObjects, set);
addFromFile<DimensionedField<vector, volMesh>>(allObjects, set);
addFromFile<DimensionedField<sphericalTensor, volMesh>>(allObjects, set);
addFromFile<DimensionedField<symmTensor, volMesh>>(allObjects, set);
addFromFile<DimensionedField<tensor, volMesh>>(allObjects, set);
}
void Foam::functionObjects::fileFieldSelection::addUniformFieldTypes
(
wordHashSet& set
) const
{
const fvMesh& mesh = static_cast<const fvMesh&>(obr_);
const IOobjectList allObjects(mesh, mesh.time().timeName());
addFromFile<UniformDimensionedField<scalar>>(allObjects, set);
addFromFile<UniformDimensionedField<vector>>(allObjects, set);
addFromFile<UniformDimensionedField<sphericalTensor>>(allObjects, set);
addFromFile<UniformDimensionedField<symmTensor>>(allObjects, set);
addFromFile<UniformDimensionedField<tensor>>(allObjects, set);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -54,8 +91,16 @@ bool Foam::functionObjects::fileFieldSelection::updateSelection()
wordHashSet oldSet;
oldSet.swap(selection_);
addFileGeoFields<fvPatchField, volMesh>(selection_);
addFileGeoFields<fvsPatchField, surfaceMesh>(selection_);
// Geometric fields
addGeoFieldTypes<fvPatchField, volMesh>(selection_);
addGeoFieldTypes<fvsPatchField, surfaceMesh>(selection_);
addGeoFieldTypes<pointPatchField, pointMesh>(selection_);
// Internal fields
addInternalFieldTypes(selection_);
// Uniform fields
addUniformFieldTypes(selection_);
return selection_ != oldSet;
}

View File

@ -69,7 +69,13 @@ protected:
//- Add registered GeometricField types to selection
template<template<class> class PatchType, class MeshType>
void addFileGeoFields(wordHashSet& set) const;
void addGeoFieldTypes(wordHashSet& set) const;
//- Add registered Internal types to selection
void addInternalFieldTypes(wordHashSet& set) const;
//- Add registered uniform types to selection
void addUniformFieldTypes(wordHashSet& set) const;
//- Add objects of a given type
template<class Type>

View File

@ -37,7 +37,7 @@ void Foam::functionObjects::fileFieldSelection::addFromFile
wordHashSet& set
) const
{
DynamicList<word> names;
DynamicList<word> names(this->size());
for (const wordRe& fieldName : *this)
{
@ -49,7 +49,7 @@ void Foam::functionObjects::fileFieldSelection::addFromFile
template<template<class> class PatchType, class MeshType>
void Foam::functionObjects::fileFieldSelection::addFileGeoFields
void Foam::functionObjects::fileFieldSelection::addGeoFieldTypes
(
wordHashSet& set
) const