mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH. Adding more IOFieldFields, using them in decomposePar and
reconstructPar to decompose and reconstruct lagrangian FieldField data.
This commit is contained in:
@ -38,6 +38,7 @@ SourceFiles
|
||||
#include "cloud.H"
|
||||
#include "polyMesh.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "IOFieldField.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -67,6 +68,16 @@ tmp<IOField<Type> > reconstructLagrangianField
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<IOFieldField<Field<Type>, Type> > reconstructLagrangianFieldField
|
||||
(
|
||||
const word& cloudName,
|
||||
const polyMesh& mesh,
|
||||
const PtrList<fvMesh>& meshes,
|
||||
const word& fieldName
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
void reconstructLagrangianFields
|
||||
(
|
||||
@ -77,6 +88,16 @@ void reconstructLagrangianFields
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
void reconstructLagrangianFieldFields
|
||||
(
|
||||
const word& cloudName,
|
||||
const polyMesh& mesh,
|
||||
const PtrList<fvMesh>& meshes,
|
||||
const IOobjectList& objects
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -24,6 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IOField.H"
|
||||
#include "IOFieldField.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
@ -87,6 +88,67 @@ Foam::tmp<Foam::IOField<Type> > Foam::reconstructLagrangianField
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::IOFieldField<Field<Type>, Type> >
|
||||
Foam::reconstructLagrangianFieldField
|
||||
(
|
||||
const word& cloudName,
|
||||
const polyMesh& mesh,
|
||||
const PtrList<fvMesh>& meshes,
|
||||
const word& fieldName
|
||||
)
|
||||
{
|
||||
// Construct empty field on mesh
|
||||
tmp<IOFieldField<Field<Type>, Type > > tfield
|
||||
(
|
||||
new IOFieldField<Field<Type>, Type>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
Field<Field<Type> >(0)
|
||||
)
|
||||
);
|
||||
Field<Field<Type> >& field = tfield();
|
||||
|
||||
forAll(meshes, i)
|
||||
{
|
||||
// Check object on local mesh
|
||||
IOobject localIOobject
|
||||
(
|
||||
fieldName,
|
||||
meshes[i].time().timeName(),
|
||||
cloud::prefix/cloudName,
|
||||
meshes[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (localIOobject.headerOk())
|
||||
{
|
||||
IOFieldField<Field<Type>, Type> fieldi(localIOobject);
|
||||
|
||||
label offset = field.size();
|
||||
field.setSize(offset + fieldi.size());
|
||||
|
||||
forAll(fieldi, j)
|
||||
{
|
||||
field[offset + j] = fieldi[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tfield;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::reconstructLagrangianFields
|
||||
(
|
||||
@ -122,4 +184,67 @@ void Foam::reconstructLagrangianFields
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::reconstructLagrangianFieldFields
|
||||
(
|
||||
const word& cloudName,
|
||||
const polyMesh& mesh,
|
||||
const PtrList<fvMesh>& meshes,
|
||||
const IOobjectList& objects
|
||||
)
|
||||
{
|
||||
{
|
||||
const word fieldClassName(IOFieldField<Field<Type>, Type>::typeName);
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
||||
|
||||
if (fields.size())
|
||||
{
|
||||
Info<< " Reconstructing lagrangian "
|
||||
<< fieldClassName << "s\n" << endl;
|
||||
|
||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
||||
{
|
||||
Info<< " " << fieldIter()->name() << endl;
|
||||
reconstructLagrangianFieldField<Type>
|
||||
(
|
||||
cloudName,
|
||||
mesh,
|
||||
meshes,
|
||||
fieldIter()->name()
|
||||
)().write();
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const word fieldClassName(IOField<Field<Type> >::typeName);
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
||||
|
||||
if (fields.size())
|
||||
{
|
||||
Info<< " Reconstructing lagrangian "
|
||||
<< fieldClassName << "s\n" << endl;
|
||||
|
||||
forAllConstIter(IOobjectList, fields, fieldIter)
|
||||
{
|
||||
Info<< " " << fieldIter()->name() << endl;
|
||||
reconstructLagrangianFieldField<Type>
|
||||
(
|
||||
cloudName,
|
||||
mesh,
|
||||
meshes,
|
||||
fieldIter()->name()
|
||||
)().write();
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user