ENH: non-blocking for all transfers to master.
This commit is contained in:
parent
827d7d7a8f
commit
7cd9f82373
@ -110,30 +110,40 @@ void writeAllData
|
||||
{
|
||||
if (nPrims)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
toMaster<< map(vf, prims, cmpt);
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile << key << nl;
|
||||
|
||||
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
fromSlaves.set(slave, new UIPstream(slave, pBufs));
|
||||
}
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
writeData(map(vf, prims, cmpt), ensightFile);
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField data(fromSlave);
|
||||
scalarField data(fromSlaves[slave]);
|
||||
writeData(data, ensightFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(vf, prims, cmpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,30 +160,40 @@ void writeAllDataBinary
|
||||
{
|
||||
if (nPrims)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
toMaster<< map(vf, prims, cmpt);
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeEnsDataBinary(key,ensightFile);
|
||||
|
||||
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
fromSlaves.set(slave, new UIPstream(slave, pBufs));
|
||||
}
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
writeEnsDataBinary(map(vf, prims, cmpt), ensightFile);
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField data(fromSlave);
|
||||
scalarField data(fromSlaves[slave]);
|
||||
writeEnsDataBinary(data, ensightFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(vf, prims, cmpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,31 +210,40 @@ void writeAllFaceData
|
||||
{
|
||||
if (nPrims)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
toMaster<< map(pf, prims, cmpt);
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile << key << nl;
|
||||
|
||||
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
fromSlaves.set(slave, new UIPstream(slave, pBufs));
|
||||
}
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
writeData(map(pf, prims, cmpt), ensightFile);
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField pf(fromSlave);
|
||||
|
||||
scalarField pf(fromSlaves[slave]);
|
||||
writeData(pf, ensightFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(pf, prims, cmpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,31 +260,40 @@ void writeAllFaceDataBinary
|
||||
{
|
||||
if (nPrims)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
toMaster<< map(pf, prims, cmpt);
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeEnsDataBinary(key,ensightFile);
|
||||
|
||||
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
fromSlaves.set(slave, new UIPstream(slave, pBufs));
|
||||
}
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
writeEnsDataBinary(map(pf, prims, cmpt), ensightFile);
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField pf(fromSlave);
|
||||
|
||||
scalarField pf(fromSlaves[slave]);
|
||||
writeEnsDataBinary(pf, ensightFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(pf, prims, cmpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -554,10 +592,29 @@ void ensightFieldAscii
|
||||
|
||||
if (meshCellSets.nHexesWedges)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
toMaster<< map(vf, hexes, wedges, cmpt);
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile << "hexa8" << nl;
|
||||
|
||||
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
fromSlaves.set(slave, new UIPstream(slave, pBufs));
|
||||
}
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
writeData
|
||||
@ -568,20 +625,11 @@ void ensightFieldAscii
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField data(fromSlave);
|
||||
scalarField data(fromSlaves[slave]);
|
||||
writeData(data, ensightFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(vf, hexes, wedges, cmpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writeAllData("penta6", vf, prisms, meshCellSets.nPrisms, ensightFile);
|
||||
@ -695,10 +743,29 @@ void ensightFieldBinary
|
||||
|
||||
if (meshCellSets.nHexesWedges)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
toMaster<< map(vf, hexes, wedges, cmpt);
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeEnsDataBinary("hexa8",ensightFile);
|
||||
|
||||
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
fromSlaves.set(slave, new UIPstream(slave, pBufs));
|
||||
}
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
writeEnsDataBinary
|
||||
@ -709,20 +776,11 @@ void ensightFieldBinary
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField data(fromSlave);
|
||||
scalarField data(fromSlaves[slave]);
|
||||
writeEnsDataBinary(data, ensightFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(vf, hexes, wedges, cmpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writeAllDataBinary
|
||||
|
@ -467,6 +467,17 @@ void Foam::ensightMesh::writeAllPolys
|
||||
}
|
||||
|
||||
// Number of faces for each poly cell
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< meshCellSets_.polys << cellFaces;
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
@ -479,7 +490,7 @@ void Foam::ensightMesh::writeAllPolys
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
|
||||
@ -491,14 +502,20 @@ void Foam::ensightMesh::writeAllPolys
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces;
|
||||
}
|
||||
|
||||
|
||||
// Number of points for each face of the above list
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
@ -512,7 +529,7 @@ void Foam::ensightMesh::writeAllPolys
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
faceList faces(fromSlave);
|
||||
@ -526,13 +543,21 @@ void Foam::ensightMesh::writeAllPolys
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
|
||||
|
||||
// List of points id for each face of the above list
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
@ -546,7 +571,7 @@ void Foam::ensightMesh::writeAllPolys
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
faceList faces(fromSlave);
|
||||
@ -560,10 +585,6 @@ void Foam::ensightMesh::writeAllPolys
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -659,37 +680,55 @@ void Foam::ensightMesh::writeAllPolysBinary
|
||||
}
|
||||
|
||||
// Number of faces for each poly cell
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
writePolysNFacesBinary
|
||||
(
|
||||
meshCellSets_.polys,
|
||||
cellFaces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
writePolysNFacesBinary
|
||||
(
|
||||
polys,
|
||||
cellFaces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!Pstream::master())
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< meshCellSets_.polys << cellFaces;
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
writePolysNFacesBinary
|
||||
(
|
||||
meshCellSets_.polys,
|
||||
cellFaces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
|
||||
writePolysNFacesBinary
|
||||
(
|
||||
polys,
|
||||
cellFaces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Number of points for each face of the above list
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
@ -703,7 +742,7 @@ void Foam::ensightMesh::writeAllPolysBinary
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
faceList faces(fromSlave);
|
||||
@ -717,13 +756,20 @@ void Foam::ensightMesh::writeAllPolysBinary
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
|
||||
// List of points id for each face of the above list
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master
|
||||
@ -737,7 +783,7 @@ void Foam::ensightMesh::writeAllPolysBinary
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
labelList polys(fromSlave);
|
||||
cellList cellFaces(fromSlave);
|
||||
faceList faces(fromSlave);
|
||||
@ -751,10 +797,6 @@ void Foam::ensightMesh::writeAllPolysBinary
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< meshCellSets_.polys << cellFaces << faces;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -770,6 +812,16 @@ void Foam::ensightMesh::writeAllPrims
|
||||
{
|
||||
if (nPrims)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< cellShapes;
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightGeometryFile << key << nl << setw(10) << nPrims << nl;
|
||||
@ -778,17 +830,12 @@ void Foam::ensightMesh::writeAllPrims
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
cellShapeList cellShapes(fromSlave);
|
||||
|
||||
writePrims(cellShapes, ensightGeometryFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< cellShapes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -803,6 +850,16 @@ void Foam::ensightMesh::writeAllPrimsBinary
|
||||
{
|
||||
if (nPrims)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< cellShapes;
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeEnsDataBinary(key,ensightGeometryFile);
|
||||
@ -812,17 +869,12 @@ void Foam::ensightMesh::writeAllPrimsBinary
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
cellShapeList cellShapes(fromSlave);
|
||||
|
||||
writePrimsBinary(cellShapes, ensightGeometryFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< cellShapes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -832,8 +884,6 @@ void Foam::ensightMesh::writeFacePrims
|
||||
const faceList& patchFaces,
|
||||
OFstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
if (patchFaces.size())
|
||||
{
|
||||
forAll(patchFaces, i)
|
||||
{
|
||||
@ -846,7 +896,6 @@ void Foam::ensightMesh::writeFacePrims
|
||||
ensightGeometryFile << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writeFacePrimsBinary
|
||||
@ -854,8 +903,6 @@ void Foam::ensightMesh::writeFacePrimsBinary
|
||||
const faceList& patchFaces,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const
|
||||
{
|
||||
if (patchFaces.size())
|
||||
{
|
||||
forAll(patchFaces, i)
|
||||
{
|
||||
@ -867,7 +914,6 @@ void Foam::ensightMesh::writeFacePrimsBinary
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightMesh::writeAllFacePrims
|
||||
@ -881,6 +927,16 @@ void Foam::ensightMesh::writeAllFacePrims
|
||||
{
|
||||
if (nPrims)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightGeometryFile << key << nl << setw(10) << nPrims << nl;
|
||||
@ -893,17 +949,12 @@ void Foam::ensightMesh::writeAllFacePrims
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
faceList patchFaces(fromSlave);
|
||||
|
||||
writeFacePrims(patchFaces, ensightGeometryFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -948,6 +999,17 @@ void Foam::ensightMesh::writeAllNSided
|
||||
}
|
||||
|
||||
// Number of points for each face
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeNSidedNPointsPerFace
|
||||
@ -958,7 +1020,7 @@ void Foam::ensightMesh::writeAllNSided
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
faceList patchFaces(fromSlave);
|
||||
|
||||
writeNSidedNPointsPerFace
|
||||
@ -968,13 +1030,20 @@ void Foam::ensightMesh::writeAllNSided
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
|
||||
// List of points id for each face
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeNSidedPoints
|
||||
@ -985,16 +1054,12 @@ void Foam::ensightMesh::writeAllNSided
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
faceList patchFaces(fromSlave);
|
||||
|
||||
writeNSidedPoints(patchFaces, ensightGeometryFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1040,6 +1105,17 @@ void Foam::ensightMesh::writeAllNSidedBinary
|
||||
}
|
||||
|
||||
// Number of points for each face
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeNSidedNPointsPerFaceBinary
|
||||
@ -1050,7 +1126,7 @@ void Foam::ensightMesh::writeAllNSidedBinary
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
faceList patchFaces(fromSlave);
|
||||
|
||||
writeNSidedNPointsPerFaceBinary
|
||||
@ -1060,13 +1136,20 @@ void Foam::ensightMesh::writeAllNSidedBinary
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
|
||||
// List of points id for each face
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeNSidedPointsBinary
|
||||
@ -1077,16 +1160,16 @@ void Foam::ensightMesh::writeAllNSidedBinary
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
faceList patchFaces(fromSlave);
|
||||
|
||||
writeNSidedPointsBinary(patchFaces, ensightGeometryFile);
|
||||
writeNSidedPointsBinary
|
||||
(
|
||||
patchFaces,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1103,6 +1186,16 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
|
||||
{
|
||||
if (nPrims)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeEnsDataBinary(key,ensightGeometryFile);
|
||||
@ -1116,17 +1209,12 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
UIPstream fromSlave(slave, pBufs);
|
||||
faceList patchFaces(fromSlave);
|
||||
|
||||
writeFacePrimsBinary(patchFaces, ensightGeometryFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< UIndirectList<face>(patchFaces, prims);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1245,6 +1333,20 @@ void Foam::ensightMesh::writeAscii
|
||||
{
|
||||
label nPoints = globalPoints.size();
|
||||
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
toMaster<< uniquePoints.component(d);
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightGeometryFile
|
||||
@ -1255,25 +1357,24 @@ void Foam::ensightMesh::writeAscii
|
||||
<< setw(10) << nPoints
|
||||
<< endl;
|
||||
|
||||
|
||||
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
fromSlaves.set(slave, new UIPstream(slave, pBufs));
|
||||
}
|
||||
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
writePoints(uniquePoints.component(d), ensightGeometryFile);
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField pointsComponent(fromSlave);
|
||||
scalarField pointsComponent(fromSlaves[slave]);
|
||||
writePoints(pointsComponent, ensightGeometryFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< uniquePoints.component(d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1352,7 +1453,6 @@ void Foam::ensightMesh::writeAscii
|
||||
uniqueMeshPointLabels
|
||||
);
|
||||
|
||||
|
||||
pointField uniquePoints(mesh_.points(), uniqueMeshPointLabels);
|
||||
// Renumber the patch faces
|
||||
faceList patchFaces(p.localFaces());
|
||||
@ -1362,6 +1462,20 @@ void Foam::ensightMesh::writeAscii
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
toMaster<< uniquePoints.component(d);
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightGeometryFile
|
||||
@ -1372,6 +1486,12 @@ void Foam::ensightMesh::writeAscii
|
||||
<< setw(10) << globalPointsPtr().size()
|
||||
<< endl;
|
||||
|
||||
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
fromSlaves.set(slave, new UIPstream(slave, pBufs));
|
||||
}
|
||||
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
writePoints
|
||||
@ -1382,8 +1502,10 @@ void Foam::ensightMesh::writeAscii
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField patchPointsComponent(fromSlave);
|
||||
scalarField patchPointsComponent
|
||||
(
|
||||
fromSlaves[slave]
|
||||
);
|
||||
|
||||
writePoints
|
||||
(
|
||||
@ -1393,17 +1515,6 @@ void Foam::ensightMesh::writeAscii
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
OPstream toMaster
|
||||
(
|
||||
Pstream::scheduled,
|
||||
Pstream::masterNo()
|
||||
);
|
||||
toMaster<< uniquePoints.component(d);
|
||||
}
|
||||
}
|
||||
|
||||
writeAllFacePrims
|
||||
@ -1497,6 +1608,20 @@ void Foam::ensightMesh::writeBinary
|
||||
{
|
||||
label nPoints = globalPoints.size();
|
||||
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
toMaster<< uniquePoints.component(d);
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeEnsDataBinary("part",ensightGeometryFile);
|
||||
@ -1505,6 +1630,12 @@ void Foam::ensightMesh::writeBinary
|
||||
writeEnsDataBinary("coordinates",ensightGeometryFile);
|
||||
writeEnsDataBinary(nPoints,ensightGeometryFile);
|
||||
|
||||
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
fromSlaves.set(slave, new UIPstream(slave, pBufs));
|
||||
}
|
||||
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
writeEnsDataBinary
|
||||
@ -1515,19 +1646,15 @@ void Foam::ensightMesh::writeBinary
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField pointsComponent(fromSlave);
|
||||
writeEnsDataBinary(pointsComponent, ensightGeometryFile);
|
||||
scalarField pointsComponent(fromSlaves[slave]);
|
||||
writeEnsDataBinary
|
||||
(
|
||||
pointsComponent,
|
||||
ensightGeometryFile
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< uniquePoints.component(d);
|
||||
}
|
||||
}
|
||||
|
||||
writeAllPrimsBinary
|
||||
@ -1605,7 +1732,6 @@ void Foam::ensightMesh::writeBinary
|
||||
pointToGlobal,
|
||||
uniqueMeshPointLabels
|
||||
);
|
||||
|
||||
pointField uniquePoints(mesh_.points(), uniqueMeshPointLabels);
|
||||
// Renumber the patch faces
|
||||
faceList patchFaces(p.localFaces());
|
||||
@ -1615,12 +1741,31 @@ void Foam::ensightMesh::writeBinary
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
UOPstream toMaster(Pstream::masterNo(), pBufs);
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
toMaster<< uniquePoints.component(d);
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeEnsDataBinary("part",ensightGeometryFile);
|
||||
writeEnsDataBinary(ensightPatchI++,ensightGeometryFile);
|
||||
//writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
|
||||
writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
|
||||
//writeEnsDataBinary
|
||||
//(patchName.c_str(),ensightGeometryFile);
|
||||
writeEnsDataBinary
|
||||
(
|
||||
patchName.c_str(),
|
||||
ensightGeometryFile
|
||||
);
|
||||
writeEnsDataBinary("coordinates",ensightGeometryFile);
|
||||
writeEnsDataBinary
|
||||
(
|
||||
@ -1628,6 +1773,12 @@ void Foam::ensightMesh::writeBinary
|
||||
ensightGeometryFile
|
||||
);
|
||||
|
||||
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
fromSlaves.set(slave, new UIPstream(slave, pBufs));
|
||||
}
|
||||
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
//writePointsBinary
|
||||
@ -1639,8 +1790,10 @@ void Foam::ensightMesh::writeBinary
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField patchPointsComponent(fromSlave);
|
||||
scalarField patchPointsComponent
|
||||
(
|
||||
fromSlaves[slave]
|
||||
);
|
||||
|
||||
//writePointsBinary
|
||||
writeEnsDataBinary
|
||||
@ -1651,17 +1804,6 @@ void Foam::ensightMesh::writeBinary
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction d=0; d<vector::nComponents; d++)
|
||||
{
|
||||
OPstream toMaster
|
||||
(
|
||||
Pstream::scheduled,
|
||||
Pstream::masterNo()
|
||||
);
|
||||
toMaster<< uniquePoints.component(d);
|
||||
}
|
||||
}
|
||||
|
||||
writeAllFacePrimsBinary
|
||||
|
Loading…
Reference in New Issue
Block a user