Commit 5bb620de authored by mattijs's avatar mattijs
Browse files

scheduled or non-blocking polyMesh initialisation

parent de97ff23
......@@ -28,6 +28,9 @@ License
#include "polyBoundaryMesh.H"
#include "facePointPatch.H"
#include "globalPointPatch.H"
#include "PstreamBuffers.H"
#include "lduSchedule.H"
#include "globalMeshData.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......@@ -58,14 +61,46 @@ Foam::pointBoundaryMesh::pointBoundaryMesh
void Foam::pointBoundaryMesh::calcGeometry()
{
forAll(*this, patchi)
PstreamBuffers pBufs(Pstream::defaultCommsType);
if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{
operator[](patchi).initGeometry();
}
forAll(*this, patchi)
{
operator[](patchi).initGeometry(pBufs);
}
forAll(*this, patchi)
pBufs.finishedSends();
forAll(*this, patchi)
{
operator[](patchi).calcGeometry(pBufs);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
{
operator[](patchi).calcGeometry();
const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
// Dummy.
pBufs.finishedSends();
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initGeometry(pBufs);
}
else
{
operator[](patchi).calcGeometry(pBufs);
}
}
}
}
......@@ -97,32 +132,92 @@ Foam::pointBoundaryMesh::globalPatch() const
void Foam::pointBoundaryMesh::movePoints(const pointField& p)
{
pointPatchList& patches = *this;
PstreamBuffers pBufs(Pstream::defaultCommsType);
forAll(patches, patchi)
if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{
patches[patchi].initMovePoints(p);
}
forAll(*this, patchi)
{
operator[](patchi).initMovePoints(pBufs, p);
}
forAll(patches, patchi)
pBufs.finishedSends();
forAll(*this, patchi)
{
operator[](patchi).movePoints(pBufs, p);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
{
patches[patchi].movePoints(p);
const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
// Dummy.
pBufs.finishedSends();
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initMovePoints(pBufs, p);
}
else
{
operator[](patchi).movePoints(pBufs, p);
}
}
}
}
void Foam::pointBoundaryMesh::updateMesh()
{
pointPatchList& patches = *this;
PstreamBuffers pBufs(Pstream::defaultCommsType);
forAll(patches, patchi)
if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{
patches[patchi].initUpdateMesh();
}
forAll(*this, patchi)
{
operator[](patchi).initUpdateMesh(pBufs);
}
pBufs.finishedSends();
forAll(patches, patchi)
forAll(*this, patchi)
{
operator[](patchi).updateMesh(pBufs);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
{
patches[patchi].updateMesh();
const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
// Dummy.
pBufs.finishedSends();
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initUpdateMesh(pBufs);
}
else
{
operator[](patchi).updateMesh(pBufs);
}
}
}
}
......
......@@ -66,22 +66,22 @@ protected:
// Protected Member Functions
//- Initialise the calculation of the patch geometry
virtual void initGeometry() = 0;
virtual void initGeometry(PstreamBuffers&) = 0;
//- Calculate the patch geometry
virtual void calcGeometry() = 0;
virtual void calcGeometry(PstreamBuffers&) = 0;
//- Initialise the patches for moving points
virtual void initMovePoints(const pointField&) = 0;
virtual void initMovePoints(PstreamBuffers&, const pointField&) = 0;
//- Correct patches after moving points
virtual void movePoints(const pointField&) = 0;
virtual void movePoints(PstreamBuffers&, const pointField&) = 0;
//- Initialise the update of the patch topology
virtual void initUpdateMesh() = 0;
virtual void initUpdateMesh(PstreamBuffers&) = 0;
//- Update of the patch topology
virtual void updateMesh() = 0;
virtual void updateMesh(PstreamBuffers&) = 0;
public:
......
......@@ -50,13 +50,13 @@ addToRunTimeSelectionTable
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::cyclicPointPatch::initGeometry()
void Foam::cyclicPointPatch::initGeometry(PstreamBuffers&)
{
transformPairs_.setSize(0);
}
void Foam::cyclicPointPatch::calcGeometry()
void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&)
{
const edgeList& cp = cyclicPolyPatch_.coupledPoints();
const labelList& mp = cyclicPolyPatch_.meshPoints();
......@@ -128,16 +128,20 @@ void Foam::cyclicPointPatch::calcGeometry()
}
else if (pointMap[cp[i][0]] == -1 && pointMap[cp[i][1]] != -1)
{
FatalErrorIn("cyclicPointPatch::calcGeometry() const")
<< "Point " << cp[i][0] << "of point-pair " << i
FatalErrorIn
(
"cyclicPointPatch::calcGeometry(PstreamBuffers&) const"
) << "Point " << cp[i][0] << "of point-pair " << i
<< " is a global point but the other point "
<< cp[i][1] << " is not"
<< exit(FatalError);
}
else if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] == -1)
{
FatalErrorIn("cyclicPointPatch::calcGeometry() const")
<< "Point " << cp[i][1] << "of point-pair " << i
FatalErrorIn
(
"cyclicPointPatch::calcGeometry(PstreamBuffers&) const"
) << "Point " << cp[i][1] << "of point-pair " << i
<< " is a global point but the other point "
<< cp[i][0] << " is not"
<< exit(FatalError);
......@@ -149,25 +153,25 @@ void Foam::cyclicPointPatch::calcGeometry()
}
void cyclicPointPatch::initMovePoints(const pointField&)
void cyclicPointPatch::initMovePoints(PstreamBuffers&, const pointField&)
{}
void cyclicPointPatch::movePoints(const pointField&)
void cyclicPointPatch::movePoints(PstreamBuffers&, const pointField&)
{}
void cyclicPointPatch::initUpdateMesh()
void cyclicPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
facePointPatch::initUpdateMesh();
cyclicPointPatch::initGeometry();
facePointPatch::initUpdateMesh(pBufs);
cyclicPointPatch::initGeometry(pBufs);
}
void cyclicPointPatch::updateMesh()
void cyclicPointPatch::updateMesh(PstreamBuffers& pBufs)
{
facePointPatch::updateMesh();
cyclicPointPatch::calcGeometry();
facePointPatch::updateMesh(pBufs);
cyclicPointPatch::calcGeometry(pBufs);
}
......
......@@ -74,22 +74,22 @@ class cyclicPointPatch
edgeList transformPairs_;
//- Initialise the calculation of the patch geometry
virtual void initGeometry();
virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry
virtual void calcGeometry();
virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points
virtual void initMovePoints(const pointField&);
virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points
virtual void movePoints(const pointField&);
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology
virtual void initUpdateMesh();
virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology
virtual void updateMesh();
virtual void updateMesh(PstreamBuffers&);
public:
......
......@@ -52,7 +52,7 @@ addToRunTimeSelectionTable
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::processorPointPatch::initGeometry()
void Foam::processorPointPatch::initGeometry(PstreamBuffers& pBufs)
{
// Algorithm:
// Depending on whether the patch is a master or a slave, get the primitive
......@@ -84,16 +84,16 @@ void Foam::processorPointPatch::initGeometry()
if (Pstream::parRun())
{
initPatchPatchPoints();
initPatchPatchPoints(pBufs);
}
}
void Foam::processorPointPatch::calcGeometry()
void Foam::processorPointPatch::calcGeometry(PstreamBuffers& pBufs)
{
if (Pstream::parRun())
{
calcPatchPatchPoints();
calcPatchPatchPoints(pBufs);
}
// If it is not runing parallel or there are no global points
......@@ -149,11 +149,11 @@ void Foam::processorPointPatch::calcGeometry()
}
void processorPointPatch::initPatchPatchPoints()
void processorPointPatch::initPatchPatchPoints(PstreamBuffers& pBufs)
{
if (debug)
{
Info<< "processorPointPatch::calcPatchPatchPoints() : "
Info<< "processorPointPatch::initPatchPatchPoints(PstreamBuffers&) : "
<< "constructing patch-patch points"
<< endl;
}
......@@ -229,7 +229,7 @@ void processorPointPatch::initPatchPatchPoints()
// Send the patchPatchPoints to the neighbouring processor
OPstream toNeighbProc(Pstream::blocking, neighbProcNo());
UOPstream toNeighbProc(neighbProcNo(), pBufs);
toNeighbProc
<< ppmp.size() // number of points for checking
......@@ -238,17 +238,17 @@ void processorPointPatch::initPatchPatchPoints()
if (debug)
{
Info<< "processorPointPatch::calcPatchPatchPoints() : "
Info<< "processorPointPatch::initPatchPatchPoints() : "
<< "constructed patch-patch points"
<< endl;
}
}
void Foam::processorPointPatch::calcPatchPatchPoints()
void Foam::processorPointPatch::calcPatchPatchPoints(PstreamBuffers& pBufs)
{
// Get the patchPatchPoints from the neighbouring processor
IPstream fromNeighbProc(Pstream::blocking, neighbProcNo());
UIPstream fromNeighbProc(neighbProcNo(), pBufs);
label nbrNPoints(readLabel(fromNeighbProc));
labelListList patchPatchPoints(fromNeighbProc);
......@@ -265,7 +265,7 @@ void Foam::processorPointPatch::calcPatchPatchPoints()
// separate.
if (nbrNPoints != ppmp.size())
{
WarningIn("processorPointPatch::calcPatchPatchPoints()")
WarningIn("processorPointPatch::calcPatchPatchPoints(PstreamBuffers&)")
<< "Processor patch " << name()
<< " has " << ppmp.size() << " points; coupled patch has "
<< nbrNPoints << " points." << endl
......@@ -352,25 +352,25 @@ void Foam::processorPointPatch::calcPatchPatchPoints()
}
void processorPointPatch::initMovePoints(const pointField&)
void processorPointPatch::initMovePoints(PstreamBuffers&, const pointField&)
{}
void processorPointPatch::movePoints(const pointField&)
void processorPointPatch::movePoints(PstreamBuffers&, const pointField&)
{}
void processorPointPatch::initUpdateMesh()
void processorPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
facePointPatch::initUpdateMesh();
processorPointPatch::initGeometry();
facePointPatch::initUpdateMesh(pBufs);
processorPointPatch::initGeometry(pBufs);
}
void processorPointPatch::updateMesh()
void processorPointPatch::updateMesh(PstreamBuffers& pBufs)
{
facePointPatch::updateMesh();
processorPointPatch::calcGeometry();
facePointPatch::updateMesh(pBufs);
processorPointPatch::calcGeometry(pBufs);
}
......
......@@ -68,30 +68,30 @@ class processorPointPatch
// Private Member Functions
//- Initialise the calculation of the patch geometry
virtual void initGeometry();
virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry
virtual void calcGeometry();
virtual void calcGeometry(PstreamBuffers&);
//- Initialise the points on this patch which are should also be
// on a neighbouring patch but are not part of faces of that patch
void initPatchPatchPoints();
void initPatchPatchPoints(PstreamBuffers&);
//- Calculate the points on this patch which are should also be
// on a neighbouring patch but are not part of faces of that patch
void calcPatchPatchPoints();
void calcPatchPatchPoints(PstreamBuffers&);
//- Initialise the patches for moving points
virtual void initMovePoints(const pointField&);
virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points
virtual void movePoints(const pointField&);
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology
virtual void initUpdateMesh();
virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology
virtual void updateMesh();
virtual void updateMesh(PstreamBuffers&);
//- Disallow default construct as copy
......
......@@ -86,7 +86,7 @@ protected:
// Construction of demand-driven data
//- Calculate mesh points
virtual void calcGeometry() = 0;
virtual void calcGeometry(PstreamBuffers&) = 0;
public:
......
......@@ -67,27 +67,27 @@ class globalPointPatch
// Protected Member Functions
//- Initialise the calculation of the patch geometry
virtual void initGeometry()
virtual void initGeometry(PstreamBuffers&)
{}
//- Calculate the patch geometry
virtual void calcGeometry()
virtual void calcGeometry(PstreamBuffers&)
{}
//- Initialise the patches for moving points
virtual void initMovePoints(const pointField&)
virtual void initMovePoints(PstreamBuffers&, const pointField&)
{}
//- Correct patches after moving points
virtual void movePoints(const pointField&)
virtual void movePoints(PstreamBuffers&, const pointField&)
{}
//- Initialise the update of the patch topology
virtual void initUpdateMesh()
virtual void initUpdateMesh(PstreamBuffers&)
{}
//- Update of the patch topology
virtual void updateMesh()
virtual void updateMesh(PstreamBuffers&)
{}
......
......@@ -51,7 +51,7 @@ addToRunTimeSelectionTable
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void facePointPatch::initGeometry()
void facePointPatch::initGeometry(PstreamBuffers&)
{
meshPoints_.setSize(0);
localPoints_.setSize(0);
......@@ -59,25 +59,25 @@ void facePointPatch::initGeometry()
}
void facePointPatch::calcGeometry()
void facePointPatch::calcGeometry(PstreamBuffers&)
{}
void facePointPatch::initMovePoints(const pointField&)
void facePointPatch::initMovePoints(PstreamBuffers&, const pointField&)
{}
void facePointPatch::movePoints(const pointField&)
void facePointPatch::movePoints(PstreamBuffers&, const pointField&)
{}
void facePointPatch::initUpdateMesh()
void facePointPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
facePointPatch::initGeometry();
facePointPatch::initGeometry(pBufs);
}
void facePointPatch::updateMesh()
void facePointPatch::updateMesh(PstreamBuffers&)
{}
......
......@@ -76,22 +76,22 @@ protected:
// Protected Member Functions
//- Initialise the calculation of the patch geometry
virtual void initGeometry();
virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry
virtual void calcGeometry();
virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points
virtual void initMovePoints(const pointField&);
virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points
virtual void movePoints(const pointField&);
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology
virtual void initUpdateMesh();
virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology
virtual void updateMesh();
virtual void updateMesh(PstreamBuffers&);
private:
......
<
......@@ -49,6 +49,7 @@ namespace Foam
class pointBoundaryMesh;
class pointConstraint;
class PstreamBuffers;
/*---------------------------------------------------------------------------*\
Class pointPatch Declaration
......@@ -79,27 +80,27 @@ protected:
friend class pointBoundaryMesh;
//- Initialise the calculation of the patch geometry
virtual void initGeometry()
virtual void initGeometry(PstreamBuffers&)
{}
//- Calculate the patch geometry