本文整理汇总了C++中UList::last方法的典型用法代码示例。如果您正苦于以下问题:C++ UList::last方法的具体用法?C++ UList::last怎么用?C++ UList::last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UList
的用法示例。
在下文中一共展示了UList::last方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void Foam::processorLduInterface::compressedReceive
(
const Pstream::commsTypes commsType,
UList<Type>& f
) const
{
if (sizeof(scalar) != sizeof(float) && Pstream::floatTransfer && f.size())
{
static const label nCmpts = sizeof(Type)/sizeof(scalar);
label nm1 = (f.size() - 1)*nCmpts;
label nlast = sizeof(Type)/sizeof(float);
label nFloats = nm1 + nlast;
label nBytes = nFloats*sizeof(float);
if
(
commsType == Pstream::commsTypes::blocking
|| commsType == Pstream::commsTypes::scheduled
)
{
resizeBuf(receiveBuf_, nBytes);
IPstream::read
(
commsType,
neighbProcNo(),
receiveBuf_.begin(),
nBytes,
tag(),
comm()
);
}
else if (commsType != Pstream::commsTypes::nonBlocking)
{
FatalErrorInFunction
<< "Unsupported communications type " << int(commsType)
<< exit(FatalError);
}
const float *fArray =
reinterpret_cast<const float*>(receiveBuf_.begin());
f.last() = reinterpret_cast<const Type&>(fArray[nm1]);
scalar *sArray = reinterpret_cast<scalar*>(f.begin());
const scalar *slast = &sArray[nm1];
for (label i=0; i<nm1; i++)
{
sArray[i] = fArray[i] + slast[i%nCmpts];
}
}
else
{
this->receive<Type>(commsType, f);
}
}
示例2: if
void Foam::processorLduInterface::compressedSend
(
const Pstream::commsTypes commsType,
const UList<Type>& f
) const
{
if (sizeof(scalar) != sizeof(float) && Pstream::floatTransfer && f.size())
{
static const label nCmpts = sizeof(Type)/sizeof(scalar);
label nm1 = (f.size() - 1)*nCmpts;
label nlast = sizeof(Type)/sizeof(float);
label nFloats = nm1 + nlast;
label nBytes = nFloats*sizeof(float);
const scalar *sArray = reinterpret_cast<const scalar*>(f.begin());
const scalar *slast = &sArray[nm1];
resizeBuf(sendBuf_, nBytes);
float *fArray = reinterpret_cast<float*>(sendBuf_.begin());
for (register label i=0; i<nm1; i++)
{
fArray[i] = sArray[i] - slast[i%nCmpts];
}
reinterpret_cast<Type&>(fArray[nm1]) = f.last();
if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
{
OPstream::write
(
commsType,
neighbProcNo(),
sendBuf_.begin(),
nBytes,
tag()
);
}
else if (commsType == Pstream::nonBlocking)
{
resizeBuf(receiveBuf_, nBytes);
IPstream::read
(
commsType,
neighbProcNo(),
receiveBuf_.begin(),
receiveBuf_.size(),
tag()
);
OPstream::write
(
commsType,
neighbProcNo(),
sendBuf_.begin(),
nBytes,
tag()
);
}
else
{
FatalErrorIn("processorLduInterface::compressedSend")
<< "Unsupported communications type " << commsType
<< exit(FatalError);
}
}
else
{
this->send(commsType, f);
}
}