ENH: Looking for filds to sample in the mesh database
This commit is contained in:
parent
6884da6767
commit
84ec2c766b
@ -164,19 +164,17 @@ void Foam::sampledSurfaces::write()
|
||||
writeGeometry();
|
||||
}
|
||||
|
||||
const IOobjectList objects(mesh_, mesh_.time().timeName());
|
||||
sampleAndWrite<volScalarField>(mesh_);
|
||||
sampleAndWrite<volVectorField>(mesh_);
|
||||
sampleAndWrite<volSphericalTensorField>(mesh_);
|
||||
sampleAndWrite<volSymmTensorField>(mesh_);
|
||||
sampleAndWrite<volTensorField>(mesh_);
|
||||
|
||||
sampleAndWrite<volScalarField>(objects);
|
||||
sampleAndWrite<volVectorField>(objects);
|
||||
sampleAndWrite<volSphericalTensorField>(objects);
|
||||
sampleAndWrite<volSymmTensorField>(objects);
|
||||
sampleAndWrite<volTensorField>(objects);
|
||||
|
||||
sampleAndWrite<surfaceScalarField>(objects);
|
||||
sampleAndWrite<surfaceVectorField>(objects);
|
||||
sampleAndWrite<surfaceSphericalTensorField>(objects);
|
||||
sampleAndWrite<surfaceSymmTensorField>(objects);
|
||||
sampleAndWrite<surfaceTensorField>(objects);
|
||||
sampleAndWrite<surfaceScalarField>(mesh_);
|
||||
sampleAndWrite<surfaceVectorField>(mesh_);
|
||||
sampleAndWrite<surfaceSphericalTensorField>(mesh_);
|
||||
sampleAndWrite<surfaceSymmTensorField>(mesh_);
|
||||
sampleAndWrite<surfaceTensorField>(mesh_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,9 +158,9 @@ class sampledSurfaces
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>&
|
||||
);
|
||||
|
||||
//- Sample and write all the fields of the given type
|
||||
//- Sample and write all sampled fields
|
||||
template<class Type>
|
||||
void sampleAndWrite(const IOobjectList& allObjects);
|
||||
void sampleAndWrite(const fvMesh&);
|
||||
|
||||
//- Disallow default bitwise copy construct and assignment
|
||||
sampledSurfaces(const sampledSurfaces&);
|
||||
|
@ -166,40 +166,33 @@ void Foam::sampledSurfaces::sampleAndWrite
|
||||
|
||||
|
||||
template<class GeoField>
|
||||
void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& allObjects)
|
||||
void Foam::sampledSurfaces::sampleAndWrite(const fvMesh& mesh)
|
||||
{
|
||||
IOobjectList fields = allObjects.lookupClass(GeoField::typeName);
|
||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
||||
forAll (fieldSelection_, fieldI)
|
||||
{
|
||||
forAll (fieldSelection_, fieldI)
|
||||
{
|
||||
const wordRe field = fieldSelection_[fieldI];
|
||||
if (field.match(fieldIter()->name()))
|
||||
{
|
||||
if (Pstream::master() && verbose_)
|
||||
{
|
||||
Pout<< "sampleAndWrite: " << field << endl;
|
||||
}
|
||||
const wordRe field = fieldSelection_[fieldI];
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
fieldIter()->readOpt() = IOobject::MUST_READ;
|
||||
sampleAndWrite
|
||||
(
|
||||
GeoField
|
||||
(
|
||||
*fieldIter(),
|
||||
mesh_
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleAndWrite
|
||||
(
|
||||
mesh_.lookupObject<GeoField>(fieldIter()->name())
|
||||
);
|
||||
}
|
||||
if (mesh.thisDb().foundObject<GeoField>(field))
|
||||
{
|
||||
if (Pstream::master() && verbose_)
|
||||
{
|
||||
Pout<< "sampleAndWrite: " << field << endl;
|
||||
}
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
const GeoField& geoField =
|
||||
mesh.thisDb().lookupObject<GeoField>(field);
|
||||
|
||||
const_cast<GeoField&>(geoField).readOpt() = IOobject::MUST_READ;
|
||||
sampleAndWrite(geoField);
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleAndWrite
|
||||
(
|
||||
mesh.thisDb().lookupObject<GeoField>(field)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user