fix deadlock in IOModel

force construction of face-diagonal decomposition (called from all procs!) before call of particle constructor (potentially not on all procs!) to avoid blocking sync operation, when it looks for tet face index and tet point index.
fix #131
This commit is contained in:
Daniel
2022-03-18 13:25:04 +01:00
committed by GitHub
parent d47e4d01a7
commit 6fdda583c2

View File

@ -125,6 +125,14 @@ void IOModel::streamDataToPath(const fileName& path, const double* const* array,
else fileStream << "{}" << "\n"; else fileStream << "{}" << "\n";
return; return;
} }
#if OPENFOAM_VERSION_MAJOR > 4
else if (type == "position")
{
// Force construction of face-diagonal decomposition before construction
// of particle which uses parallel transfers.
(void)particleCloud_.mesh().tetBasePtIs();
}
#endif
fileStream << token::BEGIN_LIST << nl; fileStream << token::BEGIN_LIST << nl;
@ -139,19 +147,24 @@ void IOModel::streamDataToPath(const fileName& path, const double* const* array,
} }
else if (type == "position") else if (type == "position")
{ {
#if OPENFOAM_VERSION_MAJOR < 5 #if OPENFOAM_VERSION_MAJOR > 4
fileStream << "( " << array[index][0] << " " << array[index][1] << " " << array[index][2] << " ) " << cellIDs[index][0] << nl; if (true)
#else {
particle part particle part
( (
particleCloud_.mesh(), particleCloud_.mesh(),
vector(array[index][0],array[index][1],array[index][2]), vector(array[index][0],array[index][1],array[index][2]),
cellIDs[index][0] cellIDs[index][0]
); );
part.writePosition(fileStream); part.writePosition(fileStream);
fileStream << nl; fileStream << nl;
}
else
#endif #endif
{
fileStream << "( " << array[index][0] << " " << array[index][1] << " " << array[index][2] << " ) " << cellIDs[index][0] << nl;
}
} }
else if (type == "vector") else if (type == "vector")
{ {