mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Looking for filds to sample in the mesh database
This commit is contained in:
@ -164,19 +164,17 @@ void Foam::sampledSurfaces::write()
|
|||||||
writeGeometry();
|
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<surfaceScalarField>(mesh_);
|
||||||
sampleAndWrite<volVectorField>(objects);
|
sampleAndWrite<surfaceVectorField>(mesh_);
|
||||||
sampleAndWrite<volSphericalTensorField>(objects);
|
sampleAndWrite<surfaceSphericalTensorField>(mesh_);
|
||||||
sampleAndWrite<volSymmTensorField>(objects);
|
sampleAndWrite<surfaceSymmTensorField>(mesh_);
|
||||||
sampleAndWrite<volTensorField>(objects);
|
sampleAndWrite<surfaceTensorField>(mesh_);
|
||||||
|
|
||||||
sampleAndWrite<surfaceScalarField>(objects);
|
|
||||||
sampleAndWrite<surfaceVectorField>(objects);
|
|
||||||
sampleAndWrite<surfaceSphericalTensorField>(objects);
|
|
||||||
sampleAndWrite<surfaceSymmTensorField>(objects);
|
|
||||||
sampleAndWrite<surfaceTensorField>(objects);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -158,9 +158,9 @@ class sampledSurfaces
|
|||||||
const GeometricField<Type, fvsPatchField, surfaceMesh>&
|
const GeometricField<Type, fvsPatchField, surfaceMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Sample and write all the fields of the given type
|
//- Sample and write all sampled fields
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void sampleAndWrite(const IOobjectList& allObjects);
|
void sampleAndWrite(const fvMesh&);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct and assignment
|
//- Disallow default bitwise copy construct and assignment
|
||||||
sampledSurfaces(const sampledSurfaces&);
|
sampledSurfaces(const sampledSurfaces&);
|
||||||
|
|||||||
@ -166,15 +166,13 @@ void Foam::sampledSurfaces::sampleAndWrite
|
|||||||
|
|
||||||
|
|
||||||
template<class GeoField>
|
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];
|
const wordRe field = fieldSelection_[fieldI];
|
||||||
if (field.match(fieldIter()->name()))
|
|
||||||
|
if (mesh.thisDb().foundObject<GeoField>(field))
|
||||||
{
|
{
|
||||||
if (Pstream::master() && verbose_)
|
if (Pstream::master() && verbose_)
|
||||||
{
|
{
|
||||||
@ -183,27 +181,22 @@ void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& allObjects)
|
|||||||
|
|
||||||
if (loadFromFiles_)
|
if (loadFromFiles_)
|
||||||
{
|
{
|
||||||
fieldIter()->readOpt() = IOobject::MUST_READ;
|
const GeoField& geoField =
|
||||||
sampleAndWrite
|
mesh.thisDb().lookupObject<GeoField>(field);
|
||||||
(
|
|
||||||
GeoField
|
const_cast<GeoField&>(geoField).readOpt() = IOobject::MUST_READ;
|
||||||
(
|
sampleAndWrite(geoField);
|
||||||
*fieldIter(),
|
|
||||||
mesh_
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sampleAndWrite
|
sampleAndWrite
|
||||||
(
|
(
|
||||||
mesh_.lookupObject<GeoField>(fieldIter()->name())
|
mesh.thisDb().lookupObject<GeoField>(field)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user