BUGFIX: Enable point interpolation with global non-blocking comms
This commit is contained in:
parent
71983fec41
commit
aaf0bf5037
2 changed files with 76 additions and 38 deletions
|
@ -84,7 +84,7 @@ sendField
|
|||
|
||||
//HJ: This needs complete rewrite:
|
||||
// - move communications into a patch
|
||||
// - allow for various types of communication
|
||||
// - allow for various types of communication - done HR, 12/6/2017
|
||||
// HJ, 15/Apr/2009
|
||||
|
||||
if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
|
||||
|
@ -101,6 +101,7 @@ sendField
|
|||
{
|
||||
resizeBuf(receiveBuf_, f.size()*sizeof(Type));
|
||||
|
||||
outstandingRecvRequest_ = Pstream::nRequests();
|
||||
IPstream::read
|
||||
(
|
||||
commsType,
|
||||
|
@ -112,6 +113,7 @@ sendField
|
|||
resizeBuf(sendBuf_, f.byteSize());
|
||||
memcpy(sendBuf_.begin(), f.begin(), f.byteSize());
|
||||
|
||||
outstandingSendRequest_ = Pstream::nRequests();
|
||||
OPstream::write
|
||||
(
|
||||
commsType,
|
||||
|
@ -127,22 +129,6 @@ sendField
|
|||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Not using non-blocking comms
|
||||
// if (commsType == Pstream::nonBlocking)
|
||||
// {
|
||||
// FatalErrorIn("void ProcessorPointPatchField::sendField")
|
||||
// << "Non-blocking comms not implemented"
|
||||
// << abort(FatalError);
|
||||
// }
|
||||
|
||||
// OPstream::write
|
||||
// (
|
||||
// commsType,
|
||||
// procPatch_.neighbProcNo(),
|
||||
// reinterpret_cast<const char*>(f.begin()),
|
||||
// f.byteSize()
|
||||
// );
|
||||
|
||||
tf.clear();
|
||||
}
|
||||
|
||||
|
@ -167,13 +153,36 @@ receivePointField
|
|||
{
|
||||
tmp<Field<Type2> > tf(new Field<Type2>(this->size()));
|
||||
|
||||
IPstream::read
|
||||
(
|
||||
commsType,
|
||||
procPatch_.neighbProcNo(),
|
||||
reinterpret_cast<char*>(tf().begin()),
|
||||
tf().byteSize()
|
||||
);
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (commsType == Pstream::nonBlocking)
|
||||
{
|
||||
// Receive into tf
|
||||
|
||||
if
|
||||
(
|
||||
outstandingRecvRequest_ >= 0
|
||||
&& outstandingRecvRequest_ < Pstream::nRequests()
|
||||
)
|
||||
{
|
||||
Pstream::waitRequest(outstandingRecvRequest_);
|
||||
}
|
||||
outstandingSendRequest_ = -1;
|
||||
outstandingRecvRequest_ = -1;
|
||||
|
||||
memcpy(tf().begin(), receiveBuf_.begin(), tf().byteSize());
|
||||
}
|
||||
else
|
||||
{
|
||||
IPstream::read
|
||||
(
|
||||
commsType,
|
||||
procPatch_.neighbProcNo(),
|
||||
reinterpret_cast<char*>(tf().begin()),
|
||||
tf().byteSize()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return tf;
|
||||
}
|
||||
|
@ -202,13 +211,36 @@ receiveEdgeField
|
|||
new Field<Type2>(procPatch_.localEdgeIndices().size())
|
||||
);
|
||||
|
||||
IPstream::read
|
||||
(
|
||||
commsType,
|
||||
procPatch_.neighbProcNo(),
|
||||
reinterpret_cast<char*>(tf().begin()),
|
||||
tf().byteSize()
|
||||
);
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (commsType == Pstream::nonBlocking)
|
||||
{
|
||||
// Receive into tf
|
||||
|
||||
if
|
||||
(
|
||||
outstandingRecvRequest_ >= 0
|
||||
&& outstandingRecvRequest_ < Pstream::nRequests()
|
||||
)
|
||||
{
|
||||
Pstream::waitRequest(outstandingRecvRequest_);
|
||||
}
|
||||
outstandingSendRequest_ = -1;
|
||||
outstandingRecvRequest_ = -1;
|
||||
|
||||
memcpy(tf().begin(), receiveBuf_.begin(), tf().byteSize());
|
||||
}
|
||||
else
|
||||
{
|
||||
IPstream::read
|
||||
(
|
||||
commsType,
|
||||
procPatch_.neighbProcNo(),
|
||||
reinterpret_cast<char*>(tf().begin()),
|
||||
tf().byteSize()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return tf;
|
||||
}
|
||||
|
@ -470,7 +502,7 @@ initEvaluate
|
|||
{
|
||||
if (this->isPointField())
|
||||
{
|
||||
initAddFieldTempl(Pstream::blocking, this->internalField());
|
||||
initAddFieldTempl(commsType, this->internalField());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -551,7 +583,7 @@ ProcessorPointPatchField
|
|||
<PatchField, Mesh, PointPatch, ProcessorPointPatch, MatrixType, Type>::
|
||||
initAddField() const
|
||||
{
|
||||
initAddFieldTempl(Pstream::blocking, this->internalField());
|
||||
initAddFieldTempl(Pstream::defaultComms(), this->internalField());
|
||||
}
|
||||
|
||||
|
||||
|
@ -570,7 +602,7 @@ ProcessorPointPatchField
|
|||
<PatchField, Mesh, PointPatch, ProcessorPointPatch, MatrixType, Type>::
|
||||
addField(Field<Type>& f) const
|
||||
{
|
||||
addFieldTempl(Pstream::blocking, f);
|
||||
addFieldTempl(Pstream::defaultComms(), f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -636,7 +668,7 @@ ProcessorPointPatchField
|
|||
<PatchField, Mesh, PointPatch, ProcessorPointPatch, MatrixType, Type>::
|
||||
initAddDiag(const scalarField& d) const
|
||||
{
|
||||
initAddFieldTempl(Pstream::blocking, d);
|
||||
initAddFieldTempl(Pstream::defaultComms(), d);
|
||||
}
|
||||
|
||||
|
||||
|
@ -655,7 +687,7 @@ ProcessorPointPatchField
|
|||
<PatchField, Mesh, PointPatch, ProcessorPointPatch, MatrixType, Type>::
|
||||
initAddSource(const scalarField& s) const
|
||||
{
|
||||
initAddFieldTempl(Pstream::blocking, s);
|
||||
initAddFieldTempl(Pstream::defaultComms(), s);
|
||||
}
|
||||
|
||||
|
||||
|
@ -674,7 +706,7 @@ ProcessorPointPatchField
|
|||
<PatchField, Mesh, PointPatch, ProcessorPointPatch, MatrixType, Type>::
|
||||
addDiag(scalarField& d) const
|
||||
{
|
||||
addFieldTempl(Pstream::blocking, d);
|
||||
addFieldTempl(Pstream::defaultComms(), d);
|
||||
}
|
||||
|
||||
|
||||
|
@ -693,7 +725,7 @@ ProcessorPointPatchField
|
|||
<PatchField, Mesh, PointPatch, ProcessorPointPatch, MatrixType, Type>::
|
||||
addSource(scalarField& s) const
|
||||
{
|
||||
addFieldTempl(Pstream::blocking, s);
|
||||
addFieldTempl(Pstream::defaultComms(), s);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -75,6 +75,12 @@ class ProcessorPointPatchField
|
|||
// Non-blocking parallel communications
|
||||
// Temporary: move to patch. HJ, 15/Apr/2008
|
||||
|
||||
//- Outstanding request
|
||||
mutable label outstandingSendRequest_;
|
||||
|
||||
//- Outstanding request
|
||||
mutable label outstandingRecvRequest_;
|
||||
|
||||
//- Send buffer.
|
||||
// Only sized and used when compressed or non-blocking comms used.
|
||||
mutable List<char> sendBuf_;
|
||||
|
|
Reference in a new issue