Example #1
0
//-----------------------------------------------------------------------------
// Function      : ModelBlock::unpack
// Purpose       : Unpacks ModelBlock from char buffer using MPI_UNPACK
// Special Notes :
// Scope         : public
// Creator       : Rob Hoekstra, SNL, Parallel Computational Sciences
// Creation Date : 5/24/00
//-----------------------------------------------------------------------------
void ModelBlock::unpack(char * pB, int bsize,int & pos, N_PDS_Comm * comm)
{

  int size, length;
  int i;

  //----- unpack name
  comm->unpack( pB, bsize, pos, &length, 1 );
  name_ = std::string( (pB+pos), length);
  pos += length;

  //----- unpack type
  comm->unpack( pB, bsize, pos, &length, 1 );
  type_ = std::string( (pB+pos), length);
  pos += length;

  //----- unpack level
  comm->unpack( pB, bsize, pos, &level_, 1 );

  //----- unpack params
  comm->unpack( pB, bsize, pos, &size, 1 );
  params.clear();
  Param dp;
  for( i = 0; i < size; ++i )
  {
    dp.unpack( pB, bsize, pos, comm );
    params.push_back( dp );
  }

  //----- unpack netlistFileName_
  comm->unpack( pB, bsize, pos, &length, 1 );
  netlistLocation_.setPath(std::string( (pB+pos), length));
  pos += length;

  //----- unpack lineNumber_
  int line_number = 0;
  comm->unpack( pB, bsize, pos, &line_number, 1 );
  netlistLocation_.setLineNumber(line_number);

#ifdef Xyce_DEBUG_TOPOLOGY
  Xyce::dout() << "Unpacked " << pos << " bytes for ModelBlock: " <<
    name_ << std::endl;
#endif

}
Example #2
0
//-----------------------------------------------------------------------------
// Function      : InstanceBlock::unpack
// Purpose       : Unpacks InstanceBlock from char buffer using MPI_UNPACK
// Special Notes :
// Scope         : public
// Creator       : Rob Hoekstra, SNL, Parallel Computational Sciences
// Creation Date : 5/24/00
//-----------------------------------------------------------------------------
void InstanceBlock::unpack(char * pB, int bsize, int & pos, N_PDS_Comm * comm)
{

  int size, length;
  int i;

  //----- unpack name
  comm->unpack( pB, bsize, pos, &length, 1 );
  name_ = InstanceName(std::string( (pB+pos), length));
  pos += length;

  //----- unpack getModelName()
  comm->unpack( pB, bsize, pos, &length, 1 );
  modelName_ = std::string( (pB+pos), length);
  pos += length;

  //----- unpack params
  comm->unpack( pB, bsize, pos, &size, 1 );
  params.clear();
  Param dp;
  for( i = 0; i < size; ++i )
  {
    dp.unpack( pB, bsize, pos, comm );
    params.push_back( dp );
  }

  //----- unpack iNumNodes
  comm->unpack( pB, bsize, pos, &iNumNodes, 1 );

  //----- unpack numIntVars
  comm->unpack( pB, bsize, pos, &numIntVars, 1 );

  //----- unpack numExtVars
  comm->unpack( pB, bsize, pos, &numExtVars, 1 );

  //----- unpack numStateVars
  comm->unpack( pB, bsize, pos, &numStateVars, 1 );

  //----- unpack modelFlag
  comm->unpack( pB, bsize, pos, &i, 1 );
  modelFlag = ( i != 0 );

  //----- unpack sourceFlag
  comm->unpack( pB, bsize, pos, &i, 1 );
  sourceFlag = ( i != 0 );

  //----- unpack bsourceFlag
  comm->unpack( pB, bsize, pos, &i, 1 );
  bsourceFlag = ( i != 0 );

  //----- unpack offFlag
  comm->unpack( pB, bsize, pos, &i, 1 );
  offFlag = ( i != 0 );

  //----- unpack off
  comm->unpack( pB, bsize, pos, &i, 1 );
  off = ( i != 0 );

  //----- unpack netlistFileName_
  comm->unpack( pB, bsize, pos, &length, 1 );
  netlistLocation_.setPath(std::string( (pB+pos), length));
  pos += length;

  //----- unpack lineNumber_
  int line_number = 0;
  comm->unpack( pB, bsize, pos, &line_number, 1 );
  netlistLocation_.setLineNumber(line_number);

#ifdef Xyce_DEBUG_TOPOLOGY
  Xyce::dout() << "Unpacked " << pos << " bytes for InstanceBlock: " <<
    getInstanceName() << std::endl;
#endif

}