ENH: improve handling of finiteArea mesh with distributed roots

- in makeFaMesh, the serial fields are now only read on the master
  process and broadcast to the other ranks. The read+distribute is
  almost identical to that used in redistributePar, except that in
  this case entire fields are sent and not a zero-sized subset.

- improved internal faMesh checking for files so that the TryNew
  method works with distributed roots.
This commit is contained in:
Mark Olesen
2022-11-20 15:16:31 +01:00
parent 21e7ce8f42
commit 013f3cccc4
17 changed files with 440 additions and 243 deletions

View File

@ -45,6 +45,7 @@ SourceFiles
#define Foam_faFieldDecomposer_H
#include "faMesh.H"
#include "faMeshSubset.H"
#include "faPatchFieldMapper.H"
#include "edgeFields.H"
@ -446,6 +447,26 @@ public:
const IOobjectList& objects
);
//- Read all fields given mesh and objects.
//- Supports reading/sending fields
void readAllFields
(
const bitSet& haveMeshOnProc,
const faMeshSubset* subsetter,
const faMesh& mesh,
IOobjectList& objects
);
//- Read all fields given mesh and objects.
//- Supports reading/sending fields
void readAllFields
(
const boolList& haveMeshOnProc,
const faMeshSubset* subsetter,
const faMesh& mesh,
IOobjectList& objects
);
//- Decompose and write all fields
void decomposeAllFields
(

View File

@ -77,7 +77,11 @@ public:
bool empty() const noexcept { return !size(); }
void readAll(const faMesh& mesh, const IOobjectList& objects)
void readAll
(
const faMesh& mesh,
const IOobjectList& objects
)
{
#undef doLocalCode
#define doLocalCode(Type) \
@ -113,6 +117,45 @@ public:
#undef doLocalCode
}
template<class BoolListType>
void readAll
(
const BoolListType& haveMeshOnProc,
const faMeshSubset*& subsetter,
const faMesh& mesh,
IOobjectList& objects
)
{
#undef doLocalCode
#define doLocalCode(Type) \
{ \
fieldsDistributor::readFields \
( \
haveMeshOnProc, \
subsetter, \
mesh, \
objects, \
Type##AreaFields_ \
); \
fieldsDistributor::readFields \
( \
haveMeshOnProc, \
subsetter, \
mesh, \
objects, \
Type##EdgeFields_ \
); \
}
doLocalCode(scalar);
doLocalCode(vector);
doLocalCode(sphericalTensor);
doLocalCode(symmTensor);
doLocalCode(tensor);
#undef doLocalCode
}
template<class GeoField>
static void decompose
(
@ -205,6 +248,36 @@ void Foam::faFieldDecomposer::fieldsCache::readAllFields
}
void Foam::faFieldDecomposer::fieldsCache::readAllFields
(
const bitSet& haveMeshOnProc,
const faMeshSubset* subsetter,
const faMesh& mesh,
IOobjectList& objects
)
{
if (cache_)
{
cache_->readAll(haveMeshOnProc, subsetter, mesh, objects);
}
}
void Foam::faFieldDecomposer::fieldsCache::readAllFields
(
const boolList& haveMeshOnProc,
const faMeshSubset* subsetter,
const faMesh& mesh,
IOobjectList& objects
)
{
if (cache_)
{
cache_->readAll(haveMeshOnProc, subsetter, mesh, objects);
}
}
void Foam::faFieldDecomposer::fieldsCache::decomposeAllFields
(
const faFieldDecomposer& decomposer,