ENH: distributedTriSurfaceMesh: support distributed running

This commit is contained in:
mattijs
2022-10-26 17:14:38 +01:00
parent 7a67c1e72b
commit 2c7a7b27a3
2 changed files with 29 additions and 7 deletions

View File

@ -450,7 +450,11 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const readAction r)
// Check where surface was found // Check where surface was found
const fileName localFile(io.localFilePath(typeName)); const fileName localFile(io.localFilePath(typeName));
if (r == masterOnly && (actualFile != localFile)) if
(
r == masterOnly
&& ((actualFile.empty() || actualFile != localFile))
)
{ {
// Found undecomposed surface. Load on master only // Found undecomposed surface. Load on master only
if (Pstream::master()) if (Pstream::master())
@ -563,10 +567,18 @@ Foam::triSurfaceMesh::triSurfaceMesh
if (searchGlobal && Pstream::parRun()) if (searchGlobal && Pstream::parRun())
{ {
// Check where surface was found // Check where surface was found. Bit tricky:
// - master will have actualFile (in parent directory)
// different from localFilePath (in processor0/)
// - slave might have actualFile empty and localFile empty
const fileName localFile(io.localFilePath(typeName)); const fileName localFile(io.localFilePath(typeName));
if (r == masterOnly && (actualFile != localFile)) if
(
r == masterOnly
&& ((actualFile.empty() || actualFile != localFile))
)
{ {
// Surface not loaded from processor directories -> undecomposed // Surface not loaded from processor directories -> undecomposed
// surface. Load on master only // surface. Load on master only

View File

@ -2642,11 +2642,16 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io)
bounds().reduce(); bounds().reduce();
const fileName actualFile(triSurfaceMesh::checkFile(io, true)); // Try and find out where the triSurface was loaded from. On slave this
// might give empty filename.
const fileName actualFile(triSurfaceMesh::findFile(io, true));
if if
( (
actualFile != io.localFilePath(triSurfaceMesh::typeName) (
actualFile.empty()
|| actualFile != io.localFilePath(triSurfaceMesh::typeName)
)
&& (distType_ == INDEPENDENT || distType_ == DISTRIBUTED) && (distType_ == INDEPENDENT || distType_ == DISTRIBUTED)
) )
{ {
@ -2779,11 +2784,16 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
bounds().reduce(); bounds().reduce();
const fileName actualFile(triSurfaceMesh::checkFile(io, dict, true)); // Try and find out where the triSurface was loaded from. On slave this
// might give empty filename.
const fileName actualFile(triSurfaceMesh::findFile(io, dict, true));
if if
( (
actualFile != io.localFilePath(triSurfaceMesh::typeName) (
actualFile.empty()
|| actualFile != io.localFilePath(triSurfaceMesh::typeName)
)
&& (distType_ == INDEPENDENT || distType_ == DISTRIBUTED) && (distType_ == INDEPENDENT || distType_ == DISTRIBUTED)
) )
{ {