mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: consistent use of resize_nocopy for processor transfers
STYLE: rename some internal buffers with the data types low-level : byteSendBuf_, byteRecvBuf_ field level: sendBuf_, recvBuf_ solve level: scalarSendBuf_, scalarRecvBuf_
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,8 +41,7 @@ Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(p, iF),
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(p)),
|
||||
receiveBuf_(0)
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(p))
|
||||
{}
|
||||
|
||||
|
||||
@ -55,8 +54,7 @@ Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(p, iF, dict),
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(p, dict)),
|
||||
receiveBuf_(0)
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(p, dict))
|
||||
{}
|
||||
|
||||
|
||||
@ -70,8 +68,7 @@ Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(ptf, p, iF, mapper),
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(ptf.patch())),
|
||||
receiveBuf_(0)
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(ptf.patch()))
|
||||
{}
|
||||
|
||||
|
||||
@ -83,15 +80,7 @@ Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(ptf, iF),
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(ptf.patch())),
|
||||
receiveBuf_(0)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::processorCyclicPointPatchField<Type>::~processorCyclicPointPatchField()
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(ptf.patch()))
|
||||
{}
|
||||
|
||||
|
||||
@ -118,13 +107,13 @@ void Foam::processorCyclicPointPatchField<Type>::initSwapAddSeparated
|
||||
|
||||
if (commsType == Pstream::commsTypes::nonBlocking)
|
||||
{
|
||||
receiveBuf_.setSize(pf.size());
|
||||
recvBuf_.resize_nocopy(pf.size());
|
||||
UIPstream::read
|
||||
(
|
||||
commsType,
|
||||
procPatch_.neighbProcNo(),
|
||||
receiveBuf_.data_bytes(),
|
||||
receiveBuf_.size_bytes(),
|
||||
recvBuf_.data_bytes(),
|
||||
recvBuf_.size_bytes(),
|
||||
procPatch_.tag(),
|
||||
procPatch_.comm()
|
||||
);
|
||||
@ -151,16 +140,17 @@ void Foam::processorCyclicPointPatchField<Type>::swapAddSeparated
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// If nonblocking data has already been received into receiveBuf_
|
||||
// If nonblocking, data is already in receive buffer
|
||||
|
||||
if (commsType != Pstream::commsTypes::nonBlocking)
|
||||
{
|
||||
receiveBuf_.setSize(this->size());
|
||||
recvBuf_.resize_nocopy(this->size());
|
||||
UIPstream::read
|
||||
(
|
||||
commsType,
|
||||
procPatch_.neighbProcNo(),
|
||||
receiveBuf_.data_bytes(),
|
||||
receiveBuf_.size_bytes(),
|
||||
recvBuf_.data_bytes(),
|
||||
recvBuf_.size_bytes(),
|
||||
procPatch_.tag(),
|
||||
procPatch_.comm()
|
||||
);
|
||||
@ -172,11 +162,11 @@ void Foam::processorCyclicPointPatchField<Type>::swapAddSeparated
|
||||
procPatch_.procCyclicPolyPatch();
|
||||
const tensor& forwardT = ppp.forwardT()[0];
|
||||
|
||||
transform(receiveBuf_, forwardT, receiveBuf_);
|
||||
transform(recvBuf_, forwardT, recvBuf_);
|
||||
}
|
||||
|
||||
// All points are separated
|
||||
this->addToInternalField(pField, receiveBuf_);
|
||||
this->addToInternalField(pField, recvBuf_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -54,13 +55,13 @@ class processorCyclicPointPatchField
|
||||
:
|
||||
public coupledPointPatchField<Type>
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- Local reference to processor patch
|
||||
const processorCyclicPointPatch& procPatch_;
|
||||
|
||||
//- Receive buffer for non-blocking communication
|
||||
mutable Field<Type> receiveBuf_;
|
||||
mutable Field<Type> recvBuf_;
|
||||
|
||||
|
||||
public:
|
||||
@ -132,7 +133,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~processorCyclicPointPatchField();
|
||||
virtual ~processorCyclicPointPatchField() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
@ -93,21 +93,21 @@ void Foam::lduCalculatedProcessorField<Type>::initInterfaceMatrixUpdate
|
||||
// Bypass patchInternalField since uses fvPatch addressing
|
||||
const labelList& fc = lduAddr.patchAddr(patchId);
|
||||
|
||||
scalarSendBuf_.setSize(fc.size());
|
||||
scalarSendBuf_.resize_nocopy(fc.size());
|
||||
forAll(fc, i)
|
||||
{
|
||||
scalarSendBuf_[i] = psiInternal[fc[i]];
|
||||
}
|
||||
|
||||
scalarReceiveBuf_.setSize(scalarSendBuf_.size());
|
||||
scalarRecvBuf_.resize_nocopy(scalarSendBuf_.size());
|
||||
|
||||
recvRequest_ = UPstream::nRequests();
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
procInterface_.neighbProcNo(),
|
||||
scalarReceiveBuf_.data_bytes(),
|
||||
scalarReceiveBuf_.size_bytes(),
|
||||
scalarRecvBuf_.data_bytes(),
|
||||
scalarRecvBuf_.size_bytes(),
|
||||
procInterface_.tag(),
|
||||
procInterface_.comm()
|
||||
);
|
||||
@ -180,7 +180,7 @@ void Foam::lduCalculatedProcessorField<Type>::updateInterfaceMatrix
|
||||
|
||||
// Consume straight from receive buffer. Note use of our own
|
||||
// helper to avoid using fvPatch addressing
|
||||
addToInternalField(result, !add, coeffs, scalarReceiveBuf_);
|
||||
addToInternalField(result, !add, coeffs, scalarRecvBuf_);
|
||||
|
||||
this->updatedMatrix(true);
|
||||
}
|
||||
|
||||
@ -84,13 +84,13 @@ protected:
|
||||
mutable Field<Type> sendBuf_;
|
||||
|
||||
//- Receive buffer
|
||||
mutable Field<Type> receiveBuf_;
|
||||
mutable Field<Type> recvBuf_;
|
||||
|
||||
//- Scalar send buffer
|
||||
mutable solveScalarField scalarSendBuf_;
|
||||
|
||||
//- Scalar receive buffer
|
||||
mutable solveScalarField scalarReceiveBuf_;
|
||||
//- Scalar recv buffer
|
||||
mutable solveScalarField scalarRecvBuf_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -57,11 +57,11 @@ class processorLduInterface
|
||||
|
||||
//- Send buffer.
|
||||
// Only sized and used when compressed or non-blocking comms used.
|
||||
mutable List<char> sendBuf_;
|
||||
mutable List<char> byteSendBuf_;
|
||||
|
||||
//- Receive buffer.
|
||||
// Only sized and used when compressed or non-blocking comms used.
|
||||
mutable List<char> receiveBuf_;
|
||||
mutable List<char> byteRecvBuf_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -76,6 +76,7 @@ class processorLduInterface
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -118,7 +119,7 @@ public:
|
||||
template<class Type>
|
||||
void send
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
const UList<Type>& f
|
||||
) const;
|
||||
|
||||
@ -126,7 +127,7 @@ public:
|
||||
template<class Type>
|
||||
void receive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
UList<Type>& f
|
||||
) const;
|
||||
|
||||
@ -134,7 +135,7 @@ public:
|
||||
template<class Type>
|
||||
tmp<Field<Type>> receive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
const label size
|
||||
) const;
|
||||
|
||||
@ -143,7 +144,7 @@ public:
|
||||
template<class Type>
|
||||
void compressedSend
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
const UList<Type>& f
|
||||
) const;
|
||||
|
||||
@ -151,7 +152,7 @@ public:
|
||||
template<class Type>
|
||||
void compressedReceive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
UList<Type>& f
|
||||
) const;
|
||||
|
||||
@ -159,7 +160,7 @@ public:
|
||||
template<class Type>
|
||||
tmp<Field<Type>> compressedReceive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
const label size
|
||||
) const;
|
||||
};
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,7 +35,7 @@ License
|
||||
template<class Type>
|
||||
void Foam::processorLduInterface::send
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
const UList<Type>& f
|
||||
) const
|
||||
{
|
||||
@ -43,8 +43,8 @@ void Foam::processorLduInterface::send
|
||||
|
||||
if
|
||||
(
|
||||
commsType == Pstream::commsTypes::blocking
|
||||
|| commsType == Pstream::commsTypes::scheduled
|
||||
commsType == UPstream::commsTypes::blocking
|
||||
|| commsType == UPstream::commsTypes::scheduled
|
||||
)
|
||||
{
|
||||
UOPstream::write
|
||||
@ -57,31 +57,31 @@ void Foam::processorLduInterface::send
|
||||
comm()
|
||||
);
|
||||
}
|
||||
else if (commsType == Pstream::commsTypes::nonBlocking)
|
||||
else if (commsType == UPstream::commsTypes::nonBlocking)
|
||||
{
|
||||
resizeBuf(receiveBuf_, nBytes);
|
||||
resizeBuf(byteSendBuf_, nBytes);
|
||||
std::memcpy
|
||||
(
|
||||
static_cast<void*>(byteSendBuf_.data()), f.cdata(), nBytes
|
||||
);
|
||||
|
||||
resizeBuf(byteRecvBuf_, nBytes);
|
||||
|
||||
UIPstream::read
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
receiveBuf_.data(),
|
||||
byteRecvBuf_.data(),
|
||||
nBytes,
|
||||
tag(),
|
||||
comm()
|
||||
);
|
||||
|
||||
resizeBuf(sendBuf_, nBytes);
|
||||
std::memcpy
|
||||
(
|
||||
static_cast<void*>(sendBuf_.data()), f.cdata(), nBytes
|
||||
);
|
||||
|
||||
UOPstream::write
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
sendBuf_.cdata(),
|
||||
byteSendBuf_.cdata(),
|
||||
nBytes,
|
||||
tag(),
|
||||
comm()
|
||||
@ -99,14 +99,16 @@ void Foam::processorLduInterface::send
|
||||
template<class Type>
|
||||
void Foam::processorLduInterface::receive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
UList<Type>& f
|
||||
) const
|
||||
{
|
||||
const label nBytes = f.byteSize();
|
||||
|
||||
if
|
||||
(
|
||||
commsType == Pstream::commsTypes::blocking
|
||||
|| commsType == Pstream::commsTypes::scheduled
|
||||
commsType == UPstream::commsTypes::blocking
|
||||
|| commsType == UPstream::commsTypes::scheduled
|
||||
)
|
||||
{
|
||||
UIPstream::read
|
||||
@ -114,16 +116,16 @@ void Foam::processorLduInterface::receive
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
f.data_bytes(),
|
||||
f.byteSize(),
|
||||
nBytes,
|
||||
tag(),
|
||||
comm()
|
||||
);
|
||||
}
|
||||
else if (commsType == Pstream::commsTypes::nonBlocking)
|
||||
else if (commsType == UPstream::commsTypes::nonBlocking)
|
||||
{
|
||||
std::memcpy
|
||||
(
|
||||
static_cast<void*>(f.data()), receiveBuf_.cdata(), f.byteSize()
|
||||
static_cast<void*>(f.data()), byteRecvBuf_.cdata(), nBytes
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -138,7 +140,7 @@ void Foam::processorLduInterface::receive
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::processorLduInterface::receive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
const label size
|
||||
) const
|
||||
{
|
||||
@ -151,7 +153,7 @@ Foam::tmp<Foam::Field<Type>> Foam::processorLduInterface::receive
|
||||
template<class Type>
|
||||
void Foam::processorLduInterface::compressedSend
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
const UList<Type>& f
|
||||
) const
|
||||
{
|
||||
@ -170,8 +172,8 @@ void Foam::processorLduInterface::compressedSend
|
||||
|
||||
const scalar *sArray = reinterpret_cast<const scalar*>(f.cdata());
|
||||
const scalar *slast = &sArray[nm1];
|
||||
resizeBuf(sendBuf_, nBytes);
|
||||
float *fArray = reinterpret_cast<float*>(sendBuf_.data());
|
||||
resizeBuf(byteSendBuf_, nBytes);
|
||||
float *fArray = reinterpret_cast<float*>(byteSendBuf_.data());
|
||||
|
||||
for (label i=0; i<nm1; i++)
|
||||
{
|
||||
@ -182,29 +184,29 @@ void Foam::processorLduInterface::compressedSend
|
||||
|
||||
if
|
||||
(
|
||||
commsType == Pstream::commsTypes::blocking
|
||||
|| commsType == Pstream::commsTypes::scheduled
|
||||
commsType == UPstream::commsTypes::blocking
|
||||
|| commsType == UPstream::commsTypes::scheduled
|
||||
)
|
||||
{
|
||||
UOPstream::write
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
sendBuf_.cdata(),
|
||||
byteSendBuf_.cdata(),
|
||||
nBytes,
|
||||
tag(),
|
||||
comm()
|
||||
);
|
||||
}
|
||||
else if (commsType == Pstream::commsTypes::nonBlocking)
|
||||
else if (commsType == UPstream::commsTypes::nonBlocking)
|
||||
{
|
||||
resizeBuf(receiveBuf_, nBytes);
|
||||
resizeBuf(byteRecvBuf_, nBytes);
|
||||
|
||||
UIPstream::read
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
receiveBuf_.data(),
|
||||
byteRecvBuf_.data(),
|
||||
nBytes,
|
||||
tag(),
|
||||
comm()
|
||||
@ -214,7 +216,7 @@ void Foam::processorLduInterface::compressedSend
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
sendBuf_.cdata(),
|
||||
byteSendBuf_.cdata(),
|
||||
nBytes,
|
||||
tag(),
|
||||
comm()
|
||||
@ -237,7 +239,7 @@ void Foam::processorLduInterface::compressedSend
|
||||
template<class Type>
|
||||
void Foam::processorLduInterface::compressedReceive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
UList<Type>& f
|
||||
) const
|
||||
{
|
||||
@ -256,23 +258,23 @@ void Foam::processorLduInterface::compressedReceive
|
||||
|
||||
if
|
||||
(
|
||||
commsType == Pstream::commsTypes::blocking
|
||||
|| commsType == Pstream::commsTypes::scheduled
|
||||
commsType == UPstream::commsTypes::blocking
|
||||
|| commsType == UPstream::commsTypes::scheduled
|
||||
)
|
||||
{
|
||||
resizeBuf(receiveBuf_, nBytes);
|
||||
resizeBuf(byteRecvBuf_, nBytes);
|
||||
|
||||
UIPstream::read
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
receiveBuf_.data(),
|
||||
byteRecvBuf_.data(),
|
||||
nBytes,
|
||||
tag(),
|
||||
comm()
|
||||
);
|
||||
}
|
||||
else if (commsType != Pstream::commsTypes::nonBlocking)
|
||||
else if (commsType != UPstream::commsTypes::nonBlocking)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unsupported communications type " << int(commsType)
|
||||
@ -280,7 +282,7 @@ void Foam::processorLduInterface::compressedReceive
|
||||
}
|
||||
|
||||
const float *fArray =
|
||||
reinterpret_cast<const float*>(receiveBuf_.cdata());
|
||||
reinterpret_cast<const float*>(byteRecvBuf_.cdata());
|
||||
f.last() = reinterpret_cast<const Type&>(fArray[nm1]);
|
||||
scalar *sArray = reinterpret_cast<scalar*>(f.data());
|
||||
const scalar *slast = &sArray[nm1];
|
||||
@ -300,7 +302,7 @@ void Foam::processorLduInterface::compressedReceive
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::processorLduInterface::compressedReceive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UPstream::commsTypes commsType,
|
||||
const label size
|
||||
) const
|
||||
{
|
||||
|
||||
@ -111,15 +111,15 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
|
||||
)
|
||||
{
|
||||
// Fast path.
|
||||
scalarReceiveBuf_.setSize(scalarSendBuf_.size());
|
||||
scalarRecvBuf_.resize_nocopy(scalarSendBuf_.size());
|
||||
|
||||
recvRequest_ = UPstream::nRequests();
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
procInterface_.neighbProcNo(),
|
||||
scalarReceiveBuf_.data_bytes(),
|
||||
scalarReceiveBuf_.size_bytes(),
|
||||
scalarRecvBuf_.data_bytes(),
|
||||
scalarRecvBuf_.size_bytes(),
|
||||
procInterface_.tag(),
|
||||
comm()
|
||||
);
|
||||
@ -175,28 +175,20 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
|
||||
UPstream::waitRequest(recvRequest_);
|
||||
recvRequest_ = -1;
|
||||
sendRequest_ = -1;
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
transformCoupleField(scalarReceiveBuf_, cmpt);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
addToInternalField(result, !add, faceCells, coeffs, scalarReceiveBuf_);
|
||||
}
|
||||
else
|
||||
{
|
||||
solveScalarField pnf
|
||||
(
|
||||
procInterface_.compressedReceive<solveScalar>
|
||||
(
|
||||
commsType,
|
||||
coeffs.size()
|
||||
)
|
||||
);
|
||||
transformCoupleField(pnf, cmpt);
|
||||
|
||||
addToInternalField(result, !add, faceCells, coeffs, pnf);
|
||||
scalarRecvBuf_.resize_nocopy(coeffs.size());
|
||||
procInterface_.compressedReceive(commsType, scalarRecvBuf_);
|
||||
}
|
||||
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
transformCoupleField(scalarRecvBuf_, cmpt);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
addToInternalField(result, !add, faceCells, coeffs, scalarRecvBuf_);
|
||||
|
||||
this->updatedMatrix(true);
|
||||
}
|
||||
|
||||
|
||||
@ -79,8 +79,8 @@ class processorGAMGInterfaceField
|
||||
//- Scalar send buffer
|
||||
mutable solveScalarField scalarSendBuf_;
|
||||
|
||||
//- Scalar receive buffer
|
||||
mutable solveScalarField scalarReceiveBuf_;
|
||||
//- Scalar recv buffer
|
||||
mutable solveScalarField scalarRecvBuf_;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1590,7 +1590,7 @@ void Foam::faMesh::calcPointAreaNormals(vectorField& result) const
|
||||
}
|
||||
|
||||
// Receive neighbour values
|
||||
patchPointNormals.resize(nbrPatchPoints.size());
|
||||
patchPointNormals.resize_nocopy(nbrPatchPoints.size());
|
||||
|
||||
{
|
||||
UIPstream::read
|
||||
|
||||
@ -123,7 +123,7 @@ void Foam::calculatedProcessorFvPatchField<Type>::initEvaluate
|
||||
{
|
||||
const Field<Type>& iF = this->internalField();
|
||||
const labelList& fc = procInterface_.faceCells();
|
||||
sendBuf_.setSize(fc.size());
|
||||
sendBuf_.resize_nocopy(fc.size());
|
||||
forAll(fc, i)
|
||||
{
|
||||
sendBuf_[i] = iF[fc[i]];
|
||||
@ -131,7 +131,7 @@ void Foam::calculatedProcessorFvPatchField<Type>::initEvaluate
|
||||
}
|
||||
|
||||
// Receive straight into *this
|
||||
this->setSize(sendBuf_.size());
|
||||
this->resize_nocopy(sendBuf_.size());
|
||||
|
||||
recvRequest_ = UPstream::nRequests();
|
||||
UIPstream::read
|
||||
@ -198,21 +198,21 @@ void Foam::calculatedProcessorFvPatchField<Type>::initInterfaceMatrixUpdate
|
||||
// Bypass patchInternalField since uses fvPatch addressing
|
||||
const labelList& fc = lduAddr.patchAddr(patchId);
|
||||
|
||||
scalarSendBuf_.setSize(fc.size());
|
||||
scalarSendBuf_.resize_nocopy(fc.size());
|
||||
forAll(fc, i)
|
||||
{
|
||||
scalarSendBuf_[i] = psiInternal[fc[i]];
|
||||
}
|
||||
|
||||
scalarReceiveBuf_.setSize(scalarSendBuf_.size());
|
||||
scalarRecvBuf_.resize_nocopy(scalarSendBuf_.size());
|
||||
|
||||
recvRequest_ = UPstream::nRequests();
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
procInterface_.neighbProcNo(),
|
||||
scalarReceiveBuf_.data_bytes(),
|
||||
scalarReceiveBuf_.size_bytes(),
|
||||
scalarRecvBuf_.data_bytes(),
|
||||
scalarRecvBuf_.size_bytes(),
|
||||
procInterface_.tag(),
|
||||
procInterface_.comm()
|
||||
);
|
||||
@ -288,7 +288,7 @@ void Foam::calculatedProcessorFvPatchField<Type>::updateInterfaceMatrix
|
||||
|
||||
// Consume straight from receive buffer. Note use of our own
|
||||
// helper to avoid using fvPatch addressing
|
||||
addToInternalField(result, !add, coeffs, scalarReceiveBuf_);
|
||||
addToInternalField(result, !add, coeffs, scalarRecvBuf_);
|
||||
|
||||
this->updatedMatrix(true);
|
||||
}
|
||||
|
||||
@ -86,13 +86,13 @@ protected:
|
||||
mutable Field<Type> sendBuf_;
|
||||
|
||||
//- Receive buffer
|
||||
mutable Field<Type> receiveBuf_;
|
||||
mutable Field<Type> recvBuf_;
|
||||
|
||||
//- Scalar send buffer
|
||||
mutable solveScalarField scalarSendBuf_;
|
||||
|
||||
//- Scalar receive buffer
|
||||
mutable solveScalarField scalarReceiveBuf_;
|
||||
//- Scalar recv buffer
|
||||
mutable solveScalarField scalarRecvBuf_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
@ -138,9 +138,9 @@ Foam::processorFvPatchField<Type>::processorFvPatchField
|
||||
sendRequest_(-1),
|
||||
recvRequest_(-1),
|
||||
sendBuf_(std::move(ptf.sendBuf_)),
|
||||
receiveBuf_(std::move(ptf.receiveBuf_)),
|
||||
recvBuf_(std::move(ptf.recvBuf_)),
|
||||
scalarSendBuf_(std::move(ptf.scalarSendBuf_)),
|
||||
scalarReceiveBuf_(std::move(ptf.scalarReceiveBuf_))
|
||||
scalarRecvBuf_(std::move(ptf.scalarRecvBuf_))
|
||||
{
|
||||
if (debug && !ptf.ready())
|
||||
{
|
||||
@ -226,7 +226,7 @@ void Foam::processorFvPatchField<Type>::initEvaluate
|
||||
}
|
||||
|
||||
// Receive straight into *this
|
||||
this->setSize(sendBuf_.size());
|
||||
this->resize_nocopy(sendBuf_.size());
|
||||
|
||||
recvRequest_ = UPstream::nRequests();
|
||||
UIPstream::read
|
||||
@ -320,7 +320,7 @@ void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
|
||||
|
||||
const labelUList& faceCells = lduAddr.patchAddr(patchId);
|
||||
|
||||
scalarSendBuf_.setSize(this->patch().size());
|
||||
scalarSendBuf_.resize_nocopy(this->patch().size());
|
||||
forAll(scalarSendBuf_, facei)
|
||||
{
|
||||
scalarSendBuf_[facei] = psiInternal[faceCells[facei]];
|
||||
@ -341,16 +341,15 @@ void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
scalarReceiveBuf_.setSize(scalarSendBuf_.size());
|
||||
scalarRecvBuf_.resize_nocopy(scalarSendBuf_.size());
|
||||
|
||||
recvRequest_ = UPstream::nRequests();
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
procPatch_.neighbProcNo(),
|
||||
scalarReceiveBuf_.data_bytes(),
|
||||
scalarReceiveBuf_.size_bytes(),
|
||||
scalarRecvBuf_.data_bytes(),
|
||||
scalarRecvBuf_.size_bytes(),
|
||||
procPatch_.tag(),
|
||||
procPatch_.comm()
|
||||
);
|
||||
@ -407,44 +406,23 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix
|
||||
UPstream::waitRequest(recvRequest_);
|
||||
recvRequest_ = -1;
|
||||
sendRequest_ = -1;
|
||||
|
||||
if (!std::is_arithmetic<Type>::value)
|
||||
{
|
||||
// Transform non-scalar data according to the transformation tensor
|
||||
transformCoupleField(scalarReceiveBuf_, cmpt);
|
||||
}
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
this->addToInternalField
|
||||
(
|
||||
result,
|
||||
!add,
|
||||
faceCells,
|
||||
coeffs,
|
||||
scalarReceiveBuf_
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
solveScalarField pnf
|
||||
(
|
||||
procPatch_.compressedReceive<solveScalar>
|
||||
(
|
||||
commsType,
|
||||
this->size()
|
||||
)()
|
||||
);
|
||||
|
||||
if (!std::is_arithmetic<Type>::value)
|
||||
{
|
||||
// Transform non-scalar data according to the transformation tensor
|
||||
transformCoupleField(pnf, cmpt);
|
||||
}
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
|
||||
scalarRecvBuf_.resize_nocopy(this->size());
|
||||
procPatch_.compressedReceive(commsType, scalarRecvBuf_);
|
||||
}
|
||||
|
||||
|
||||
if (!std::is_arithmetic<Type>::value)
|
||||
{
|
||||
// Transform non-scalar data according to the transformation tensor
|
||||
transformCoupleField(scalarRecvBuf_, cmpt);
|
||||
}
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
this->addToInternalField(result, !add, faceCells, coeffs, scalarRecvBuf_);
|
||||
|
||||
this->updatedMatrix(true);
|
||||
}
|
||||
|
||||
@ -461,7 +439,7 @@ void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
|
||||
const Pstream::commsTypes commsType
|
||||
) const
|
||||
{
|
||||
sendBuf_.setSize(this->patch().size());
|
||||
sendBuf_.resize_nocopy(this->patch().size());
|
||||
|
||||
const labelUList& faceCells = lduAddr.patchAddr(patchId);
|
||||
|
||||
@ -485,16 +463,15 @@ void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
receiveBuf_.setSize(sendBuf_.size());
|
||||
recvBuf_.resize_nocopy(sendBuf_.size());
|
||||
|
||||
recvRequest_ = UPstream::nRequests();
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
procPatch_.neighbProcNo(),
|
||||
receiveBuf_.data_bytes(),
|
||||
receiveBuf_.size_bytes(),
|
||||
recvBuf_.data_bytes(),
|
||||
recvBuf_.size_bytes(),
|
||||
procPatch_.tag(),
|
||||
procPatch_.comm()
|
||||
);
|
||||
@ -550,27 +527,20 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix
|
||||
UPstream::waitRequest(recvRequest_);
|
||||
recvRequest_ = -1;
|
||||
sendRequest_ = -1;
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
transformCoupleField(receiveBuf_);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
this->addToInternalField(result, !add, faceCells, coeffs, receiveBuf_);
|
||||
}
|
||||
else
|
||||
{
|
||||
Field<Type> pnf
|
||||
(
|
||||
procPatch_.compressedReceive<Type>(commsType, this->size())()
|
||||
);
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
transformCoupleField(pnf);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
|
||||
recvBuf_.resize_nocopy(this->size());
|
||||
procPatch_.compressedReceive(commsType, recvBuf_);
|
||||
}
|
||||
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
transformCoupleField(recvBuf_);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
this->addToInternalField(result, !add, faceCells, coeffs, recvBuf_);
|
||||
|
||||
this->updatedMatrix(true);
|
||||
}
|
||||
|
||||
|
||||
@ -87,13 +87,13 @@ class processorFvPatchField
|
||||
mutable Field<Type> sendBuf_;
|
||||
|
||||
//- Receive buffer.
|
||||
mutable Field<Type> receiveBuf_;
|
||||
mutable Field<Type> recvBuf_;
|
||||
|
||||
//- Scalar send buffer
|
||||
mutable solveScalarField scalarSendBuf_;
|
||||
|
||||
//- Scalar receive buffer
|
||||
mutable solveScalarField scalarReceiveBuf_;
|
||||
//- Scalar recv buffer
|
||||
mutable solveScalarField scalarRecvBuf_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -112,15 +112,15 @@ void Foam::calculatedProcessorGAMGInterfaceField::initInterfaceMatrixUpdate
|
||||
)
|
||||
{
|
||||
// Fast path.
|
||||
scalarReceiveBuf_.setSize(scalarSendBuf_.size());
|
||||
scalarRecvBuf_.resize_nocopy(scalarSendBuf_.size());
|
||||
|
||||
recvRequest_ = UPstream::nRequests();
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
procInterface_.neighbProcNo(),
|
||||
scalarReceiveBuf_.data_bytes(),
|
||||
scalarReceiveBuf_.size_bytes(),
|
||||
scalarRecvBuf_.data_bytes(),
|
||||
scalarRecvBuf_.size_bytes(),
|
||||
procInterface_.tag(),
|
||||
comm()
|
||||
);
|
||||
@ -176,28 +176,20 @@ void Foam::calculatedProcessorGAMGInterfaceField::updateInterfaceMatrix
|
||||
UPstream::waitRequest(recvRequest_);
|
||||
recvRequest_ = -1;
|
||||
sendRequest_ = -1;
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
transformCoupleField(scalarReceiveBuf_, cmpt);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
addToInternalField(result, !add, faceCells, coeffs, scalarReceiveBuf_);
|
||||
}
|
||||
else
|
||||
{
|
||||
solveScalarField pnf
|
||||
(
|
||||
procInterface_.compressedReceive<solveScalar>
|
||||
(
|
||||
commsType,
|
||||
this->size()
|
||||
)()
|
||||
);
|
||||
transformCoupleField(pnf, cmpt);
|
||||
|
||||
addToInternalField(result, !add, faceCells, coeffs, pnf);
|
||||
scalarRecvBuf_.resize_nocopy(this->size());
|
||||
procInterface_.compressedReceive(commsType, scalarRecvBuf_);
|
||||
}
|
||||
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
transformCoupleField(scalarRecvBuf_, cmpt);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
addToInternalField(result, !add, faceCells, coeffs, scalarRecvBuf_);
|
||||
|
||||
this->updatedMatrix(true);
|
||||
}
|
||||
|
||||
|
||||
@ -78,8 +78,8 @@ class calculatedProcessorGAMGInterfaceField
|
||||
//- Scalar send buffer
|
||||
mutable solveScalarField scalarSendBuf_;
|
||||
|
||||
//- Scalar receive buffer
|
||||
mutable solveScalarField scalarReceiveBuf_;
|
||||
//- Scalar recv buffer
|
||||
mutable solveScalarField scalarRecvBuf_;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user