diff --git a/applications/utilities/parallelProcessing/decomposePar/Make/files b/applications/utilities/parallelProcessing/decomposePar/Make/files index 076ecd41bf0d9d5dc6c407fe6090941a978a6197..125f6b81e70155299ceff3857b31f7c0326d7090 100644 --- a/applications/utilities/parallelProcessing/decomposePar/Make/files +++ b/applications/utilities/parallelProcessing/decomposePar/Make/files @@ -2,6 +2,7 @@ decomposePar.C domainDecomposition.C domainDecompositionMesh.C domainDecompositionDistribute.C +dimFieldDecomposer.C fvFieldDecomposer.C pointFieldDecomposer.C lagrangianFieldDecomposer.C diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 8c8b1dfc88098b785dca569a064be21da8f8f950..ea306917e5c01600f240eb1b841cf1a550a18bf5 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -81,6 +81,7 @@ Usage #include "pointFields.H" #include "readFields.H" +#include "dimFieldDecomposer.H" #include "fvFieldDecomposer.H" #include "pointFieldDecomposer.H" #include "lagrangianFieldDecomposer.H" @@ -354,6 +355,25 @@ int main(int argc, char *argv[]) readFields(mesh, objects, volTensorFields); + // Construct the dimensioned fields + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + PtrList<DimensionedField<scalar, volMesh> > dimScalarFields; + readFields(mesh, objects, dimScalarFields); + + PtrList<DimensionedField<vector, volMesh> > dimVectorFields; + readFields(mesh, objects, dimVectorFields); + + PtrList<DimensionedField<sphericalTensor, volMesh> > + dimSphericalTensorFields; + readFields(mesh, objects, dimSphericalTensorFields); + + PtrList<DimensionedField<symmTensor, volMesh> > dimSymmTensorFields; + readFields(mesh, objects, dimSymmTensorFields); + + PtrList<DimensionedField<tensor, volMesh> > dimTensorFields; + readFields(mesh, objects, dimTensorFields); + + // Construct the surface fields // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PtrList<surfaceScalarField> surfaceScalarFields; @@ -727,19 +747,6 @@ int main(int argc, char *argv[]) ); // FV fields - if - ( - volScalarFields.size() - || volVectorFields.size() - || volSphericalTensorFields.size() - || volSymmTensorFields.size() - || volTensorFields.size() - || surfaceScalarFields.size() - || surfaceVectorFields.size() - || surfaceSphericalTensorFields.size() - || surfaceSymmTensorFields.size() - || surfaceTensorFields.size() - ) { fvFieldDecomposer fieldDecomposer ( @@ -763,16 +770,25 @@ int main(int argc, char *argv[]) fieldDecomposer.decomposeFields(surfaceTensorFields); } + // Dimensioned fields + { + dimFieldDecomposer fieldDecomposer + ( + mesh, + procMesh, + faceProcAddressing, + cellProcAddressing + ); + + fieldDecomposer.decomposeFields(dimScalarFields); + fieldDecomposer.decomposeFields(dimVectorFields); + fieldDecomposer.decomposeFields(dimSphericalTensorFields); + fieldDecomposer.decomposeFields(dimSymmTensorFields); + fieldDecomposer.decomposeFields(dimTensorFields); + } + // Point fields - if - ( - pointScalarFields.size() - || pointVectorFields.size() - || pointSphericalTensorFields.size() - || pointSymmTensorFields.size() - || pointTensorFields.size() - ) { labelIOList pointProcAddressing ( @@ -822,21 +838,6 @@ int main(int argc, char *argv[]) ); // Lagrangian fields - if - ( - lagrangianLabelFields[cloudI].size() - || lagrangianLabelFieldFields[cloudI].size() - || lagrangianScalarFields[cloudI].size() - || lagrangianScalarFieldFields[cloudI].size() - || lagrangianVectorFields[cloudI].size() - || lagrangianVectorFieldFields[cloudI].size() - || lagrangianSphericalTensorFields[cloudI].size() - || lagrangianSphericalTensorFieldFields[cloudI].size() - || lagrangianSymmTensorFields[cloudI].size() - || lagrangianSymmTensorFieldFields[cloudI].size() - || lagrangianTensorFields[cloudI].size() - || lagrangianTensorFieldFields[cloudI].size() - ) { fieldDecomposer.decomposeFields ( diff --git a/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposer.C b/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposer.C new file mode 100644 index 0000000000000000000000000000000000000000..8c61e0920c89c44465c584c507cb1775f4eeade8 --- /dev/null +++ b/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposer.C @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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/>. + +\*---------------------------------------------------------------------------*/ + +#include "dimFieldDecomposer.H" + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dimFieldDecomposer::dimFieldDecomposer +( + const fvMesh& completeMesh, + const fvMesh& procMesh, + const labelList& faceAddressing, + const labelList& cellAddressing +) +: + completeMesh_(completeMesh), + procMesh_(procMesh), + faceAddressing_(faceAddressing), + cellAddressing_(cellAddressing) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dimFieldDecomposer::~dimFieldDecomposer() +{} + + +// ************************************************************************* // diff --git a/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposer.H b/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposer.H new file mode 100644 index 0000000000000000000000000000000000000000..ba88e85c8dc32f452145d1283697a44b8067f8f8 --- /dev/null +++ b/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposer.H @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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/>. + +Class + Foam::dimFieldDecomposer + +Description + Dimensioned field decomposer. + +SourceFiles + dimFieldDecomposer.C + dimFieldDecomposerDecomposeFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dimFieldDecomposer_H +#define dimFieldDecomposer_H + +#include "fvMesh.H" +#include "fvPatchFieldMapper.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class IOobjectList; + +/*---------------------------------------------------------------------------*\ + Class fvFieldDecomposer Declaration +\*---------------------------------------------------------------------------*/ + +class dimFieldDecomposer +{ +private: + + // Private data + + //- Reference to complete mesh + const fvMesh& completeMesh_; + + //- Reference to processor mesh + const fvMesh& procMesh_; + + //- Reference to face addressing + const labelList& faceAddressing_; + + //- Reference to cell addressing + const labelList& cellAddressing_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + dimFieldDecomposer(const dimFieldDecomposer&); + + //- Disallow default bitwise assignment + void operator=(const dimFieldDecomposer&); + + +public: + + // Constructors + + //- Construct from components + dimFieldDecomposer + ( + const fvMesh& completeMesh, + const fvMesh& procMesh, + const labelList& faceAddressing, + const labelList& cellAddressing + ); + + + //- Destructor + ~dimFieldDecomposer(); + + + // Member Functions + + //- Decompose field + template<class Type> + tmp<DimensionedField<Type, volMesh> > decomposeField + ( + const DimensionedField<Type, volMesh>& field + ) const; + + + //- Decompose llist of fields + template<class GeoField> + void decomposeFields(const PtrList<GeoField>& fields) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "dimFieldDecomposerDecomposeFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposerDecomposeFields.C b/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposerDecomposeFields.C new file mode 100644 index 0000000000000000000000000000000000000000..2ca8088103e6fe753f4be437abfccd4abd4350d8 --- /dev/null +++ b/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposerDecomposeFields.C @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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/>. + +\*---------------------------------------------------------------------------*/ + +#include "dimFieldDecomposer.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> > +Foam::dimFieldDecomposer::decomposeField +( + const DimensionedField<Type, volMesh>& field +) const +{ + // Create and map the internal field values + Field<Type> mappedField(field, cellAddressing_); + + // Create the field for the processor + return tmp<DimensionedField<Type, volMesh> > + ( + new DimensionedField<Type, volMesh> + ( + IOobject + ( + field.name(), + procMesh_.time().timeName(), + procMesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + procMesh_, + field.dimensions(), + mappedField + ) + ); +} + + +template<class GeoField> +void Foam::dimFieldDecomposer::decomposeFields +( + const PtrList<GeoField>& fields +) const +{ + forAll(fields, fieldI) + { + decomposeField(fields[fieldI])().write(); + } +} + + +// ************************************************************************* //