Commit 96ad725a authored by Henry Weller's avatar Henry Weller
Browse files

Updated UPstream::commsTypes to use the C++11 enum class

parent 812a9a53
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -184,7 +184,8 @@ public:
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
const Pstream::commsTypes commsType=
Pstream::commsTypes::blocking
);
//- Return face-gradient transform diagonal
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -92,7 +92,11 @@ int main(int argc, char *argv[])
Serr<< "slave sending to master "
<< Pstream::masterNo() << endl;
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
FixedList<label, 2> list3;
list3[0] = 0;
......@@ -109,7 +113,7 @@ int main(int argc, char *argv[])
)
{
Serr << "master receiving from slave " << slave << endl;
IPstream fromSlave(Pstream::blocking, slave);
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
FixedList<label, 2> list3(fromSlave);
Serr<< list3 << endl;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -65,7 +65,7 @@ scalar sumReduce
scalar slaveValue;
UIPstream::read
(
Pstream::blocking,
Pstream::commsTypes::blocking,
slave,
reinterpret_cast<char*>(&slaveValue),
sizeof(scalar),
......@@ -87,7 +87,7 @@ scalar sumReduce
{
UOPstream::write
(
UPstream::blocking,
UPstream::commsTypes::blocking,
slave,
reinterpret_cast<const char*>(&sum),
sizeof(scalar),
......@@ -101,7 +101,7 @@ scalar sumReduce
{
UOPstream::write
(
UPstream::blocking,
UPstream::commsTypes::blocking,
UPstream::masterNo(),
reinterpret_cast<const char*>(&localValue),
sizeof(scalar),
......@@ -113,7 +113,7 @@ scalar sumReduce
{
UIPstream::read
(
UPstream::blocking,
UPstream::commsTypes::blocking,
UPstream::masterNo(),
reinterpret_cast<char*>(&sum),
sizeof(scalar),
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
Pstream::myProcNo()
);
PstreamBuffers pBufs(Pstream::nonBlocking);
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
if (Pstream::myProcNo() != Pstream::masterNo())
{
......@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
// Send allData back
PstreamBuffers pBufs2(Pstream::nonBlocking);
PstreamBuffers pBufs2(Pstream::commsTypes::nonBlocking);
if (Pstream::myProcNo() == Pstream::masterNo())
{
for
......@@ -149,7 +149,7 @@ int main(int argc, char *argv[])
// Do a non-blocking send inbetween
{
PstreamBuffers pBufs(Pstream::nonBlocking);
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
for (label proci = 0; proci < Pstream::nProcs(); proci++)
{
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -147,13 +147,21 @@ int main(int argc, char *argv[])
{
Perr<< "slave sending to master "
<< Pstream::masterNo() << endl;
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
toMaster << data;
}
Perr<< "slave receiving from master "
<< Pstream::masterNo() << endl;
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
IPstream fromMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
fromMaster >> data;
Perr<< data << endl;
......@@ -168,7 +176,7 @@ int main(int argc, char *argv[])
)
{
Perr << "master receiving from slave " << slave << endl;
IPstream fromSlave(Pstream::blocking, slave);
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
fromSlave >> data;
Perr<< data << endl;
......@@ -182,7 +190,7 @@ int main(int argc, char *argv[])
)
{
Perr << "master sending to slave " << slave << endl;
OPstream toSlave(Pstream::blocking, slave);
OPstream toSlave(Pstream::commsTypes::blocking, slave);
toSlave << data;
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -63,7 +63,7 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
slave++, procIndex++
)
{
IPstream fromSlave(Pstream::scheduled, slave);
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
fromSlave >> this->operator[](procIndex);
}
......@@ -75,7 +75,7 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
slave++, procIndex++
)
{
OPstream toSlave(Pstream::scheduled, slave);
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
if (redistribute)
{
......@@ -92,13 +92,21 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
{
// Slave: send my local data to master
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster << localData;
}
// Receive data from master
{
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
IPstream fromMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
if (redistribute)
{
fromMaster >> *this;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -641,7 +641,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
labelList rotation(faces.size(), label(0));
labelList faceMap(faces.size(), label(-1));
PstreamBuffers pBufs(Pstream::nonBlocking);
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
// Send ordering
forAll(sortMesh.boundaryMesh(), patchi)
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -417,7 +417,7 @@ void Foam::mergeAndWrite
// Receive slave ones
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
pointField slavePts(fromSlave);
labelList slaveIDs(fromSlave);
......@@ -433,7 +433,7 @@ void Foam::mergeAndWrite
// be improved.
OPstream toMaster
(
Pstream::scheduled,
Pstream::commsTypes::scheduled,
Pstream::masterNo(),
myPoints.byteSize() + myIDs.byteSize()
);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -348,7 +348,11 @@ void syncPoints
}
}
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
OPstream toNbr
(
Pstream::commsTypes::blocking,
procPatch.neighbProcNo()
);
toNbr << patchInfo;
}
}
......@@ -376,7 +380,7 @@ void syncPoints
// so cannot use Pstream::read.
IPstream fromNbr
(
Pstream::blocking,
Pstream::commsTypes::blocking,
procPatch.neighbProcNo()
);
fromNbr >> nbrPatchInfo;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -394,7 +394,7 @@ void getInterfaceSizes
slave++
)
{
IPstream fromSlave(Pstream::blocking, slave);
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
EdgeMap<Map<label>> slaveSizes(fromSlave);
......@@ -439,7 +439,11 @@ void getInterfaceSizes
{
// Send to master
{
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
toMaster << regionsToSize;
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -97,14 +97,18 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
slave++
)
{
OPstream toSlave(Pstream::scheduled, slave);
OPstream toSlave(Pstream::commsTypes::scheduled, slave);
toSlave << patchEntries;
}
}
else
{
// Receive patches
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
IPstream fromMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
fromMaster >> patchEntries;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -304,7 +304,7 @@ void readFields
{
if (!haveMesh[proci])
{
OPstream toProc(Pstream::blocking, proci);
OPstream toProc(Pstream::commsTypes::blocking, proci);
toProc<< tsubfld();
}
}
......@@ -320,7 +320,11 @@ void readFields
const word& name = masterNames[i];
// Receive field
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
IPstream fromMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
dictionary fieldDict(fromMaster);
fields.set
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -110,7 +110,7 @@ void writeField
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
scalarField slaveData(fromSlave);
ensightFile.write(slaveData);
}
......@@ -120,7 +120,11 @@ void writeField
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster<< vf.component(cmpt);
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -694,7 +694,7 @@ void Foam::ensightMesh::writeAllPolys
// Slaves
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
......@@ -708,7 +708,11 @@ void Foam::ensightMesh::writeAllPolys
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster<< meshCellSets_.polys << cellFaces;
}
......@@ -727,7 +731,7 @@ void Foam::ensightMesh::writeAllPolys
// Slaves
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
faceList faces(fromSlave);
......@@ -743,7 +747,11 @@ void Foam::ensightMesh::writeAllPolys
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster<< meshCellSets_.polys << cellFaces << faces;
}
......@@ -763,7 +771,7 @@ void Foam::ensightMesh::writeAllPolys
// Slaves
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
faceList faces(fromSlave);
......@@ -781,7 +789,11 @@ void Foam::ensightMesh::writeAllPolys
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster<< meshCellSets_.polys << cellFaces << faces << faceOwner;
}
}
......@@ -807,7 +819,7 @@ void Foam::ensightMesh::writeAllPrims
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
cellShapeList cellShapes(fromSlave);
writePrims(cellShapes, ensightGeometryFile);
......@@ -815,7 +827,11 @@ void Foam::ensightMesh::writeAllPrims
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster<< cellShapes;
}
}
......@@ -867,7 +883,7 @@ void Foam::ensightMesh::writeAllFacePrims
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
faceList patchFaces(fromSlave);
writeFacePrims(patchFaces, ensightGeometryFile);
......@@ -875,7 +891,11 @@ void Foam::ensightMesh::writeAllFacePrims
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster<< UIndirectList<face>(patchFaces, prims);
}
}
......@@ -932,7 +952,7 @@ void Foam::ensightMesh::writeAllNSided
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
faceList patchFaces(fromSlave);
writeNSidedNPointsPerFace
......@@ -944,7 +964,11 @@ void Foam::ensightMesh::writeAllNSided
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster<< UIndirectList<face>(patchFaces, prims);
}
......@@ -959,7 +983,7 @@ void Foam::ensightMesh::writeAllNSided
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
faceList patchFaces(fromSlave);
writeNSidedPoints(patchFaces, ensightGeometryFile);
......@@ -967,7 +991,11 @@ void Foam::ensightMesh::writeAllNSided
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster<< UIndirectList<face>(patchFaces, prims);
}
}
......@@ -997,7 +1025,7 @@ void Foam::ensightMesh::writeAllPoints
ensightGeometryFile.write(uniquePoints.component(d));
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
scalarField patchPointsComponent(fromSlave);
ensightGeometryFile.write(patchPointsComponent);
}
......@@ -1007,7 +1035,11 @@ void Foam::ensightMesh::writeAllPoints
{
for (direction d=0; d<vector::nComponents; d++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
<