ENH: code modernization for decompose/reconstruct

- simplify procAddressing read/write

- avoid accessing points in faMeshReconstructor.
  Can rely on the patch meshPoints (labelList), which does not need
  access to a pointField

- report number of points on decomposed mesh.
  Can be useful additional information.
  Additional statistics for finite area decomposition

- provide bundled reconstructAllFields for various reconstructors

- remove reconstructPar checks for very old face addressing
  (from foam2.0 - ie, older than OpenFOAM itself)

- bundle all reading into fieldsDistributor tools,
  where it can be reused by various utilities as required.

- combine decomposition fields as respective fieldsCache
  which eliminates most of the clutter from decomposePar
  and similfies reuse in the future.

STYLE: remove old wordHashSet selection (deprecated in 2018)

BUG: incorrect face flip handling for faMeshReconstructor

- a latent bug which is not yet triggered since the faMesh faces are
  currently only definable on boundary faces (which never flip)
This commit is contained in:
Mark Olesen
2022-04-24 15:06:40 +02:00
committed by Andrew Heather
parent eccc998ed2
commit 3b6761afed
51 changed files with 3270 additions and 2443 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,12 +36,12 @@ Author
SourceFiles
faFieldReconstructor.C
faFieldReconstructorFields.C
faFieldReconstructorTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef faFieldReconstructor_H
#define faFieldReconstructor_H
#ifndef Foam_faFieldReconstructor_H
#define Foam_faFieldReconstructor_H
#include "PtrList.H"
#include "faMesh.H"
@ -59,7 +60,7 @@ namespace Foam
class faFieldReconstructor
{
// Private data
// Private Data
//- Reconstructed mesh reference
faMesh& mesh_;
@ -76,6 +77,9 @@ class faFieldReconstructor
//- List of processor boundary addressing lists
const PtrList<labelIOList>& boundaryProcAddressing_;
//- Number of fields reconstructed
label nReconstructed_;
// Private Member Functions
@ -88,6 +92,8 @@ class faFieldReconstructor
public:
// Public Classes
class faPatchFieldReconstructor
:
public faPatchFieldMapper
@ -111,7 +117,7 @@ public:
{}
// Member functions
// Member Functions
virtual label size() const
{
@ -140,13 +146,19 @@ public:
};
// Static Data
//- Output verbosity when writing
static int verbose_;
// Constructors
//- Construct from components
faFieldReconstructor
(
faMesh& mesh,
const PtrList<faMesh>& procMeshes,
faMesh& mesh, // Target mesh
const PtrList<faMesh>& procMeshes, // Source meshes
const PtrList<labelIOList>& edgeProcAddressing,
const PtrList<labelIOList>& faceProcAddressing,
const PtrList<labelIOList>& boundaryProcAddressing
@ -155,34 +167,80 @@ public:
// Member Functions
//- Return number of fields reconstructed
label nReconstructed() const noexcept
{
return nReconstructed_;
}
//- Reconstruct area field
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh>>
reconstructFaAreaField
reconstructField
(
const IOobject& fieldIoObject
);
const IOobject& fieldObject,
const PtrList<GeometricField<Type, faPatchField, areaMesh>>&
) const;
//- Read and reconstruct area field
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh>>
reconstructAreaField(const IOobject& fieldObject);
//- Reconstruct edge field
template<class Type>
tmp<GeometricField<Type, faePatchField, edgeMesh>>
reconstructFaEdgeField
reconstructField
(
const IOobject& fieldIoObject
const IOobject& fieldObject,
const PtrList<GeometricField<Type, faePatchField, edgeMesh>>&
) const;
//- Read and reconstruct edge field
template<class Type>
tmp<GeometricField<Type, faePatchField, edgeMesh>>
reconstructEdgeField(const IOobject& fieldObject);
//- Read, reconstruct and write specified area fields
template<class Type>
label reconstructAreaFields
(
const UPtrList<const IOobject>& fieldObjects
);
//- Reconstruct and write all area fields
//- Read, reconstruct and write specified edge fields
template<class Type>
void reconstructFaAreaFields
label reconstructEdgeFields
(
const IOobjectList& objects
const UPtrList<const IOobject>& fieldObjects
);
//- Reconstruct and write all area fields
//- Read, reconstruct and write all/selected area fields
// An empty wordRes corresponds to select ALL.
template<class Type>
void reconstructFaEdgeFields
label reconstructAreaFields
(
const IOobjectList& objects
const IOobjectList& objects,
const wordRes& selectedFields = wordRes()
);
//- Read, reconstruct and write all/selected edge fields
// An empty wordRes corresponds to select ALL.
template<class Type>
label reconstructEdgeFields
(
const IOobjectList& objects,
const wordRes& selectedFields = wordRes()
);
//- Reconstruct all supported area/edge field types
label reconstructAllFields
(
const IOobjectList& objects,
const wordRes& selectedFields = wordRes()
);
};
@ -194,7 +252,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "faFieldReconstructorFields.C"
# include "faFieldReconstructorTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //