Commit 0f7a1241 authored by graham's avatar graham
Browse files

ENH. Adding more IOFieldFields, using them in decomposePar and

reconstructPar to decompose and reconstruct lagrangian FieldField
data.
parent 81a0568a
......@@ -64,8 +64,11 @@ Usage
#include "IOobjectList.H"
#include "domainDecomposition.H"
#include "labelIOField.H"
#include "labelFieldIOField.H"
#include "scalarIOField.H"
#include "scalarFieldIOField.H"
#include "vectorIOField.H"
#include "vectorFieldIOField.H"
#include "sphericalTensorIOField.H"
#include "symmTensorIOField.H"
#include "tensorIOField.H"
......@@ -374,8 +377,20 @@ int main(int argc, char *argv[])
PtrList< List<SLList<indexedParticle*>*> > cellParticles(cloudDirs.size());
PtrList<PtrList<labelIOField> > lagrangianLabelFields(cloudDirs.size());
PtrList<PtrList<labelIOFieldField> > lagrangianLabelFieldFields
(
cloudDirs.size()
);
PtrList<PtrList<scalarIOField> > lagrangianScalarFields(cloudDirs.size());
PtrList<PtrList<scalarIOFieldField> > lagrangianScalarFieldFields
(
cloudDirs.size()
);
PtrList<PtrList<vectorIOField> > lagrangianVectorFields(cloudDirs.size());
PtrList<PtrList<vectorIOFieldField> > lagrangianVectorFieldFields
(
cloudDirs.size()
);
PtrList<PtrList<sphericalTensorIOField> > lagrangianSphericalTensorFields
(
cloudDirs.size()
......@@ -487,6 +502,13 @@ int main(int argc, char *argv[])
lagrangianLabelFields
);
lagrangianFieldDecomposer::readFieldFields
(
cloudI,
lagrangianObjects,
lagrangianLabelFieldFields
);
lagrangianFieldDecomposer::readFields
(
cloudI,
......@@ -494,6 +516,14 @@ int main(int argc, char *argv[])
lagrangianScalarFields
);
lagrangianFieldDecomposer::readFieldFields
(
cloudI,
lagrangianObjects,
lagrangianScalarFieldFields
);
lagrangianFieldDecomposer::readFields
(
cloudI,
......@@ -501,6 +531,13 @@ int main(int argc, char *argv[])
lagrangianVectorFields
);
lagrangianFieldDecomposer::readFieldFields
(
cloudI,
lagrangianObjects,
lagrangianVectorFieldFields
);
lagrangianFieldDecomposer::readFields
(
cloudI,
......@@ -529,8 +566,11 @@ int main(int argc, char *argv[])
lagrangianPositions.setSize(cloudI);
cellParticles.setSize(cloudI);
lagrangianLabelFields.setSize(cloudI);
lagrangianLabelFieldFields.setSize(cloudI);
lagrangianScalarFields.setSize(cloudI);
lagrangianScalarFieldFields.setSize(cloudI);
lagrangianVectorFields.setSize(cloudI);
lagrangianVectorFieldFields.setSize(cloudI);
lagrangianSphericalTensorFields.setSize(cloudI);
lagrangianSymmTensorFields.setSize(cloudI);
lagrangianTensorFields.setSize(cloudI);
......@@ -725,8 +765,11 @@ int main(int argc, char *argv[])
if
(
lagrangianLabelFields[cloudI].size()
|| lagrangianLabelFieldFields[cloudI].size()
|| lagrangianScalarFields[cloudI].size()
|| lagrangianScalarFieldFields[cloudI].size()
|| lagrangianVectorFields[cloudI].size()
|| lagrangianVectorFieldFields[cloudI].size()
|| lagrangianSphericalTensorFields[cloudI].size()
|| lagrangianSymmTensorFields[cloudI].size()
|| lagrangianTensorFields[cloudI].size()
......@@ -737,16 +780,31 @@ int main(int argc, char *argv[])
cloudDirs[cloudI],
lagrangianLabelFields[cloudI]
);
fieldDecomposer.decomposeFieldFields
(
cloudDirs[cloudI],
lagrangianLabelFieldFields[cloudI]
);
fieldDecomposer.decomposeFields
(
cloudDirs[cloudI],
lagrangianScalarFields[cloudI]
);
fieldDecomposer.decomposeFieldFields
(
cloudDirs[cloudI],
lagrangianScalarFieldFields[cloudI]
);
fieldDecomposer.decomposeFields
(
cloudDirs[cloudI],
lagrangianVectorFields[cloudI]
);
fieldDecomposer.decomposeFieldFields
(
cloudDirs[cloudI],
lagrangianVectorFieldFields[cloudI]
);
fieldDecomposer.decomposeFields
(
cloudDirs[cloudI],
......
......@@ -37,6 +37,7 @@ SourceFiles
#define lagrangianFieldDecomposer_H
#include "Cloud.H"
#include "IOFieldField.H"
#include "indexedParticle.H"
#include "passiveParticle.H"
......@@ -102,6 +103,19 @@ public:
// PtrList<IOField<Type> >& lagrangianFields
);
template<class Type>
static void readFieldFields
(
const label cloudI,
const IOobjectList& lagrangianObjects,
PtrList
<
PtrList<IOFieldField<Field<Type>, Type> >
>& lagrangianFields
// PtrList<IOFieldField<Field<Type>, Type > >& lagrangianFields
);
//- Decompose volume field
template<class Type>
tmp<IOField<Type> > decomposeField
......@@ -110,12 +124,27 @@ public:
const IOField<Type>& field
) const;
template<class Type>
tmp<IOFieldField<Field<Type>, Type> > decomposeFieldField
(
const word& cloudName,
const IOFieldField<Field<Type>, Type>& field
) const;
template<class GeoField>
void decomposeFields
(
const word& cloudName,
const PtrList<GeoField>& fields
) const;
template<class GeoField>
void decomposeFieldFields
(
const word& cloudName,
const PtrList<GeoField>& fields
) const;
};
......
......@@ -63,6 +63,56 @@ void Foam::lagrangianFieldDecomposer::readFields
}
template<class Type>
void Foam::lagrangianFieldDecomposer::readFieldFields
(
const label cloudI,
const IOobjectList& lagrangianObjects,
PtrList<PtrList<IOFieldField<Field<Type>, Type> > >& lagrangianFields
)
{
// Search list of objects for lagrangian fields
IOobjectList lagrangianTypeObjectsA
(
lagrangianObjects.lookupClass(IOField<Field<Type> >::typeName)
);
IOobjectList lagrangianTypeObjectsB
(
lagrangianObjects.lookupClass(IOFieldField<Field<Type>, Type>::typeName)
);
lagrangianFields.set
(
cloudI,
new PtrList<IOFieldField<Field<Type>, Type> >
(
lagrangianTypeObjectsA.size() + lagrangianTypeObjectsB.size()
)
);
label lagrangianFieldi=0;
forAllIter(IOobjectList, lagrangianTypeObjectsA, iter)
{
lagrangianFields[cloudI].set
(
lagrangianFieldi++,
new IOFieldField<Field<Type>, Type>(*iter())
);
}
forAllIter(IOobjectList, lagrangianTypeObjectsB, iter)
{
lagrangianFields[cloudI].set
(
lagrangianFieldi++,
new IOFieldField<Field<Type>, Type>(*iter())
);
}
}
template<class Type>
Foam::tmp<Foam::IOField<Type> >
Foam::lagrangianFieldDecomposer::decomposeField
......@@ -94,6 +144,37 @@ Foam::lagrangianFieldDecomposer::decomposeField
}
template<class Type>
Foam::tmp<Foam::IOFieldField<Foam::Field<Type>, Type> >
Foam::lagrangianFieldDecomposer::decomposeFieldField
(
const word& cloudName,
const IOFieldField<Field<Type>, Type>& field
) const
{
// Create and map the internal field values
Field<Field<Type> > procField(field, particleIndices_);
// Create the field for the processor
return tmp<IOFieldField<Field<Type>, Type> >
(
new IOFieldField<Field<Type>, Type>
(
IOobject
(
field.name(),
procMesh_.time().timeName(),
cloud::prefix/cloudName,
procMesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
procField
)
);
}
template<class GeoField>
void Foam::lagrangianFieldDecomposer::decomposeFields
(
......@@ -111,4 +192,21 @@ void Foam::lagrangianFieldDecomposer::decomposeFields
}
template<class GeoField>
void Foam::lagrangianFieldDecomposer::decomposeFieldFields
(
const word& cloudName,
const PtrList<GeoField>& fields
) const
{
if (particleIndices_.size())
{
forAll(fields, fieldI)
{
decomposeFieldField(cloudName, fields[fieldI])().write();
}
}
}
// ************************************************************************* //
......@@ -402,6 +402,13 @@ int main(int argc, char *argv[])
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFieldFields<label>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFields<scalar>
(
cloudName,
......@@ -409,6 +416,13 @@ int main(int argc, char *argv[])
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFieldFields<scalar>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFields<vector>
(
cloudName,
......@@ -416,6 +430,13 @@ int main(int argc, char *argv[])
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFieldFields<vector>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFields<sphericalTensor>
(
cloudName,
......
......@@ -497,10 +497,15 @@ $(Fields)/scalarField/scalarFieldIOField.C
$(Fields)/vectorField/vectorIOField.C
$(Fields)/vectorField/vectorFieldIOField.C
$(Fields)/vector2DField/vector2DIOField.C
$(Fields)/vector2DField/vector2DFieldIOField.C
$(Fields)/sphericalTensorField/sphericalTensorIOField.C
$(Fields)/sphericalTensorField/sphericalTensorFieldIOField.C
$(Fields)/diagTensorField/diagTensorIOField.C
$(Fields)/diagTensorField/diagTensorFieldIOField.C
$(Fields)/symmTensorField/symmTensorIOField.C
$(Fields)/symmTensorField/symmTensorFieldIOField.C
$(Fields)/tensorField/tensorIOField.C
$(Fields)/tensorField/tensorFieldIOField.C
$(Fields)/transformField/transformField.C
pointPatchFields = fields/pointPatchFields
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
diagTensorField with IO.
\*---------------------------------------------------------------------------*/
#include "diagTensorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
diagTensorFieldIOField,
"diagTensorFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
diagTensorIOFieldField,
"diagTensorCompactFieldField",
0
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::diagTensorFieldIOField
Description
diagTensorFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef diagTensorFieldIOField_H
#define diagTensorFieldIOField_H
#include "diagTensorField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<diagTensorField> diagTensorFieldIOField;
typedef IOFieldField<diagTensorField, diagTensor> diagTensorIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
sphericalTensorField with IO.
\*---------------------------------------------------------------------------*/
#include "sphericalTensorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
sphericalTensorFieldIOField,
"sphericalTensorFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
sphericalTensorIOFieldField,
"sphericalTensorCompactFieldField",
0
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::sphericalTensorFieldIOField
Description
sphericalTensorFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef sphericalTensorFieldIOField_H
#define sphericalTensorFieldIOField_H
#include "sphericalTensorField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<sphericalTensorField> sphericalTensorFieldIOField;
typedef IOFieldField<sphericalTensorField, sphericalTensor>
sphericalTensorIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -32,7 +32,12 @@ Description
namespace Foam
{
defineTemplateTypeNameAndDebugWithName(sphericalTensorIOField, "sphericalTensorField", 0);
defineTemplateTypeNameAndDebugWithName
(
sphericalTensorIOField,
"sphericalTensorField",
0
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under t