/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation Copyright (C) 2018-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- 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 . Class Foam::parFvFieldDistributor Description Finite volume reconstructor for volume and surface fields. Runs in parallel. Reconstructs/redistributes from procMesh to baseMesh. baseMesh is non-zero cells on processor0 only. SourceFiles parFvFieldDistributor.C parFvFieldDistributorFields.C parFvFieldDistributorTemplates.C \*---------------------------------------------------------------------------*/ #ifndef Foam_parFvFieldDistributor_H #define Foam_parFvFieldDistributor_H #include "PtrList.H" #include "fvMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // Forward Declarations class mapDistributePolyMesh; class mapDistributeBase; class IOobjectList; /*---------------------------------------------------------------------------*\ Class parFvFieldDistributor Declaration \*---------------------------------------------------------------------------*/ class parFvFieldDistributor { // Private Data //- Processor mesh reference (source mesh) const fvMesh& srcMesh_; //- Destination mesh reference (eg, reconstructed mesh) fvMesh& tgtMesh_; //- Distribution map reference const mapDistributePolyMesh& distMap_; //- Patch mappers PtrList patchFaceMaps_; //- Do I need to write (eg, master only for reconstruct) bool isWriteProc_; // Private Member Functions //- Construct per-patch addressing void createPatchFaceMaps(); //- No copy construct parFvFieldDistributor(const parFvFieldDistributor&) = delete; //- No copy assignment void operator=(const parFvFieldDistributor&) = delete; public: //- Output verbosity when writing static int verbose_; // Constructors //- Construct from components // // \param srcMesh The source mesh (eg, processor) // \param tgtMesh The target mesh (eg, reconstructed) // \param distMap The distribution map // \param isWriteProc Tagged for output writing (on this proc) parFvFieldDistributor ( const fvMesh& srcMesh, fvMesh& tgtMesh, const mapDistributePolyMesh& distMap, const bool isWriteProc ); // Member Functions //- Get status of write enabled (on this proc) bool isWriteProc() const noexcept { return isWriteProc_; } //- Change status of write enabled (on this proc) bool isWriteProc(const bool on) noexcept { bool old(isWriteProc_); isWriteProc_ = on; return old; } //- Helper: reconstruct and write mesh points // (note: should be moved to something like processorMeshes class) void reconstructPoints(); //- Distribute all fields for known field types void distributeAllFields ( const IOobjectList& objects, const wordRes& selectedFields ) const; //- Redistribute volume internal field template tmp> distributeField ( const DimensionedField& ) const; //- Read and distribute volume internal field template tmp> distributeInternalField(const IOobject& fieldObject) const; //- Redistribute volume field template tmp> distributeField ( const GeometricField& fld ) const; //- Read and distribute volume field template tmp> distributeVolumeField(const IOobject& fieldObject) const; //- Redistribute surface field template tmp> distributeField ( const GeometricField& ) const; //- Read and distribute surface field template tmp> distributeSurfaceField(const IOobject& fieldObject) const; //- Read, redistribute and write all/selected volume internal fields template label distributeInternalFields ( const IOobjectList& objects, const wordRes& selectedFields = wordRes() ) const; //- Read, redistribute and write all/selected volume fields template label distributeVolumeFields ( const IOobjectList& objects, const wordRes& selectedFields = wordRes() ) const; //- Read, reconstruct and write all/selected surface fields template label distributeSurfaceFields ( const IOobjectList& objects, const wordRes& selectedFields = wordRes() ) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository # include "parFvFieldDistributorTemplates.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* //