int 
UniformExcitation::recvSelf(int commitTag, Channel &theChannel, 
			   FEM_ObjectBroker &theBroker)
{
  int dbTag = this->getDbTag();

  static Vector data(6);
  int res = theChannel.recvVector(dbTag, commitTag, data);
  if (res < 0) {
    opserr << "UniformExcitation::recvSelf() - channel failed to recv data\n";
    return res;
  }

  this->setTag(data(0));
  theDof = data(1);
  vel0 = data(2);
  fact = data(5);
  int motionClassTag = data(3);
  int motionDbTag = data(4);

  if (theMotion == 0 || theMotion->getClassTag() != motionClassTag) {
    if (theMotion != 0)
      delete theMotion;
    theMotion = theBroker.getNewGroundMotion(motionClassTag);
    if (theMotion == 0) {
      opserr << "UniformExcitation::recvSelf() - could not create a grond motion\n";
      return -3;
    }

    // have to set the motion in EarthquakePattern base class
    if (numMotions == 0) 
      this->addMotion(*theMotion);
    else
      theMotions[0] = theMotion;
  }

  theMotion->setDbTag(motionDbTag);
  res = theMotion->recvSelf(commitTag, theChannel, theBroker);
  if (res < 0) {
      opserr << "UniformExcitation::recvSelf() - motion could not receive itself \n";
      return res;
  }

  return 0;
}
int 
MultiSupportPattern::recvSelf(int commitTag, Channel &theChannel, 
			 FEM_ObjectBroker &theBroker)
{
  // get my current database tag
  // NOTE - dbTag equals 0 if not sending to a database OR has not yet been sent
  int myDbTag = this->getDbTag();
  
  if (this->LoadPattern::recvSelf(commitTag, theChannel, theBroker) < 0) {
    opserr << "MultiSupportPattern::recvSelf() - LoadPattern class failed in sendSelf()";
    return -1;
  }
  
  // clear out the all the components in the current load pattern
  if (theMotions != 0) {
    for (int i=0; i<numMotions; i++)
      if (theMotions[i] != 0)
	delete theMotions[i];
    delete [] theMotions;
    numMotions = 0;
  }

  // 
  // now we rebuild the motions
  //

  static ID myData(3);
  if (theChannel.recvID(myDbTag, commitTag, myData) < 0) {
    opserr << "MultiSupportPattern::sendSelf - channel failed to send the initial ID\n";
    return -1;
  }    

  int numMotions = myData(0);
  int dbMotions = myData(1);

  if (numMotions != 0) {
    ID motionData(numMotions*2);

    // now send the ID
    if (theChannel.recvID(dbMotions, commitTag, motionData) < 0) {
      opserr << "MultiSupportPattern::sendSelf - channel failed to send the NodalLoads ID\n";
      return -4;
    }

    theMotions = new GroundMotion *[numMotions];
    if (theMotions == 0) {
      opserr << "MultiSupportPattern::recvSelf() - out of memory\n";
      return -1;
    }

    GroundMotion *theMotion;
    for (int i=0; i<numMotions; i++) {
      theMotion = theBroker.getNewGroundMotion(motionData(i*2));
      if (theMotion == 0) {
	return -1;
      }

      theMotion->setDbTag(motionData(i*2+1));

      if (theMotion->recvSelf(commitTag, theChannel, theBroker) < 0) {
	opserr << "MultiSupportPattern::sendSelf - ground motion failed in sendSelf\n";
	return -7;
      }
    }    
  }
  return 0;
}