本文整理汇总了C++中CommunicationBuffer类的典型用法代码示例。如果您正苦于以下问题:C++ CommunicationBuffer类的具体用法?C++ CommunicationBuffer怎么用?C++ CommunicationBuffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CommunicationBuffer类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: packToCommBuffer
int
FloatArray :: packToCommBuffer(CommunicationBuffer &buff) const
{
int result = 1;
// pack size
result &= buff.packInt(size);
// pack data
result &= buff.packArray(this->values, size);
return result;
}
示例2: unpackFromCommBuffer
int
FloatArray :: unpackFromCommBuffer(CommunicationBuffer &buff)
{
int newSize, result = 1;
// unpack size
result &= buff.unpackInt(newSize);
// resize yourself
this->resize(newSize);
result &= buff.unpackArray(this->values, newSize);
return result;
}
示例3: estimatePackSize
int
MisesMatNl :: estimatePackSize(CommunicationBuffer &buff, GaussPoint *ip)
{
// Note: nlStatus localStrainVectorForAverage memeber must be properly sized!
// IDNLMaterialStatus *nlStatus = (IDNLMaterialStatus*) this -> giveStatus (ip);
return buff.givePackSize(MPI_DOUBLE, 1);
}
示例4: packUnknowns
int
MisesMatNl :: packUnknowns(CommunicationBuffer &buff, TimeStep *tStep, GaussPoint *ip)
{
MisesMatNlStatus *nlStatus = static_cast< MisesMatNlStatus * >( this->giveStatus(ip) );
this->buildNonlocalPointTable(ip);
this->updateDomainBeforeNonlocAverage(tStep);
return buff.packDouble( nlStatus->giveLocalCumPlasticStrainForAverage() );
}
示例5: packUnknowns
int
RankineMatNl :: packUnknowns(CommunicationBuffer &buff, TimeStep *stepN, GaussPoint *ip)
{
RankineMatNlStatus *nlStatus = ( RankineMatNlStatus * ) this->giveStatus(ip);
this->buildNonlocalPointTable(ip);
this->updateDomainBeforeNonlocAverage(stepN);
return buff.packDouble( nlStatus->giveLocalCumPlasticStrainForAverage() );
}
示例6: packUnknowns
int
MazarsNLMaterial :: packUnknowns(CommunicationBuffer &buff, TimeStep *stepN, GaussPoint *ip)
{
MazarsNLMaterialStatus *status = ( MazarsNLMaterialStatus * ) this->giveStatus(ip);
this->buildNonlocalPointTable(ip);
this->updateDomainBeforeNonlocAverage(stepN);
return buff.packDouble( status->giveLocalEquivalentStrainForAverage() );
}
示例7: unpackAndUpdateUnknowns
int
MisesMatNl :: unpackAndUpdateUnknowns(CommunicationBuffer &buff, TimeStep *tStep, GaussPoint *ip)
{
int result;
MisesMatNlStatus *nlStatus = static_cast< MisesMatNlStatus * >( this->giveStatus(ip) );
double localCumPlasticStrainForAverage;
result = buff.unpackDouble(localCumPlasticStrainForAverage);
nlStatus->setLocalCumPlasticStrainForAverage(localCumPlasticStrainForAverage);
return result;
}
示例8: unpackAndUpdateUnknowns
int
RankineMatNl :: unpackAndUpdateUnknowns(CommunicationBuffer &buff, TimeStep *stepN, GaussPoint *ip)
{
int result;
RankineMatNlStatus *nlStatus = ( RankineMatNlStatus * ) this->giveStatus(ip);
double localCumPlasticStrainForAverage;
result = buff.unpackDouble(localCumPlasticStrainForAverage);
nlStatus->setLocalCumPlasticStrainForAverage(localCumPlasticStrainForAverage);
return result;
}
示例9: unpackAndUpdateUnknowns
int
MazarsNLMaterial :: unpackAndUpdateUnknowns(CommunicationBuffer &buff, TimeStep *stepN, GaussPoint *ip)
{
int result;
MazarsNLMaterialStatus *status = ( MazarsNLMaterialStatus * ) this->giveStatus(ip);
double localEquivalentStrainForAverage;
result = buff.unpackDouble(localEquivalentStrainForAverage);
status->setLocalEquivalentStrainForAverage(localEquivalentStrainForAverage);
return result;
}
示例10: estimateMaxPackSize
int
NonLinearDynamic :: estimateMaxPackSize(IntArray &commMap, CommunicationBuffer &buff, int packUnpackType)
{
int mapSize = commMap.giveSize();
int i, j, ndofs, count = 0, pcount = 0;
IntArray locationArray;
Domain *domain = this->giveDomain(1);
DofManager *dman;
Dof *jdof;
if ( packUnpackType == ProblemCommMode__ELEMENT_CUT ) {
for ( i = 1; i <= mapSize; i++ ) {
count += domain->giveDofManager( commMap.at(i) )->giveNumberOfDofs();
}
return ( buff.givePackSize(MPI_DOUBLE, 1) * count );
} else if ( packUnpackType == ProblemCommMode__NODE_CUT ) {
for ( i = 1; i <= mapSize; i++ ) {
ndofs = ( dman = domain->giveDofManager( commMap.at(i) ) )->giveNumberOfDofs();
for ( j = 1; j <= ndofs; j++ ) {
jdof = dman->giveDof(j);
if ( jdof->isPrimaryDof() && ( jdof->__giveEquationNumber() ) ) {
count++;
} else {
pcount++;
}
}
}
//printf ("\nestimated count is %d\n",count);
return ( buff.givePackSize(MPI_DOUBLE, 1) * max(count, pcount) );
} else if ( packUnpackType == ProblemCommMode__REMOTE_ELEMENT_MODE ) {
for ( i = 1; i <= mapSize; i++ ) {
count += domain->giveElement( commMap.at(i) )->estimatePackSize(buff);
}
return count;
}
return 0;
}
示例11: estimateMaxPackSize
int
FreeWarping :: estimateMaxPackSize(IntArray &commMap, CommunicationBuffer &buff, int packUnpackType)
{
int count = 0, pcount = 0;
IntArray locationArray;
Domain *domain = this->giveDomain(1);
if ( packUnpackType == ProblemCommMode__ELEMENT_CUT ) {
for ( int map: commMap ) {
count += domain->giveDofManager( map )->giveNumberOfDofs();
}
return ( buff.givePackSize(MPI_DOUBLE, 1) * count );
} else if ( packUnpackType == ProblemCommMode__NODE_CUT ) {
for ( int map: commMap ) {
for ( Dof *jdof: *domain->giveDofManager( map ) ) {
if ( jdof->isPrimaryDof() && ( jdof->__giveEquationNumber() ) ) {
count++;
} else {
pcount++;
}
}
}
// --------------------------------------------------------------------------------
// only pcount is relevant here, since only prescribed components are exchanged !!!!
// --------------------------------------------------------------------------------
return ( buff.givePackSize(MPI_DOUBLE, 1) * pcount );
} else if ( packUnpackType == ProblemCommMode__REMOTE_ELEMENT_MODE ) {
for ( int map: commMap ) {
count += domain->giveElement( map )->estimatePackSize(buff);
}
return count;
}
return 0;
}
示例12: estimateMaxPackSize
int
NonLinearDynamic :: estimateMaxPackSize(IntArray &commMap, CommunicationBuffer &buff, int packUnpackType)
{
int count = 0, pcount = 0;
IntArray locationArray;
Domain *domain = this->giveDomain(1);
if ( packUnpackType == ProblemCommMode__ELEMENT_CUT ) {
for ( int map: commMap ) {
count += domain->giveDofManager( map )->giveNumberOfDofs();
}
return ( buff.givePackSize(MPI_DOUBLE, 1) * count );
} else if ( packUnpackType == ProblemCommMode__NODE_CUT ) {
for ( int map: commMap ) {
DofManager *dman = domain->giveDofManager( map );
for ( Dof *dof: *dman ) {
if ( dof->isPrimaryDof() && ( dof->__giveEquationNumber() ) ) {
count++;
} else {
pcount++;
}
}
}
//printf ("\nestimated count is %d\n",count);
return ( buff.givePackSize(MPI_DOUBLE, 1) * max(count, pcount) );
} else if ( packUnpackType == ProblemCommMode__REMOTE_ELEMENT_MODE ) {
for ( int map: commMap ) {
count += domain->giveElement( map )->estimatePackSize(buff);
}
return count;
}
return 0;
}
示例13: givePackSize
int
FloatArray :: givePackSize(CommunicationBuffer &buff) const
{
return buff.givePackSize(MPI_INT, 1) + buff.givePackSize(MPI_DOUBLE, this->size);
}