コード例 #1
0
ファイル: LoadPattern.cpp プロジェクト: aceskpark/osfeo
int
LoadPattern::sendSelf(int cTag, Channel &theChannel)
{
  // 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();

  // into an ID we place all info needed to determine state of LoadPattern
  int numNodLd, numEleLd, numSPs;
  ID lpData(11);

  numNodLd = theNodalLoads->getNumComponents();
  numEleLd = theElementalLoads->getNumComponents();
  numSPs = theSPs->getNumComponents();

  lpData(10) = this->getTag();
  lpData(0) = currentGeoTag;
  lpData(1) = numNodLd;
  lpData(2) = numEleLd;
  lpData(3) = numSPs;

  if (dbNod == 0) {
    dbNod = theChannel.getDbTag();
    dbEle = theChannel.getDbTag();
    dbSPs = theChannel.getDbTag();
  } 

  lpData(4) = dbNod;
  lpData(5) = dbEle;
  lpData(6) = dbSPs;

  lpData(7) = isConstant;

  if (theSeries != 0) {
    int dbtag = theSeries->getDbTag();
    int classtag = theSeries->getClassTag();
    if (dbtag == 0) {
      dbtag = theChannel.getDbTag();
      theSeries->setDbTag(dbtag);
    }
    lpData(8) = classtag;
    lpData(9) = dbtag;
  } else
    lpData(8) = -1;


  // see if we can save sending the vector containing just the load factor
  // will happen in parallel if sending the loadPattern .. not in database

  if (theChannel.sendID(myDbTag, cTag, lpData) < 0) {
    opserr << "LoadPattern::sendSelf - channel failed to send the initial ID\n";
    return -1;
  }    
  
  if (isConstant == 0) {
    Vector data(2);
    data(0) = loadFactor;
    data(1) = scaleFactor;
    if (theChannel.sendVector(myDbTag, cTag, data) < 0) {
      opserr << "LoadPattern::sendSelf - channel failed to send the Vector\n";
      return -2;
    }

  }

  if (theSeries != 0)
    if (theSeries->sendSelf(cTag, theChannel) < 0) {
      opserr << "LoadPattern::sendSelf - the TimeSeries failed to send\n";
      return -3;
    }

  // now check if data defining the objects in the LoadPAttern needs to be sent 
  // NOTE THIS APPROACH MAY NEED TO CHANGE FOR VERY LARGE PROBLEMS IF CHANNEL CANNOT
  // HANDLE VERY LARGE ID OBJECTS.

  /*
  if (theChannel.isDatastore() == 1) {
    static ID theLastSendTag(1);
    if (theChannel.recvID(myDbTag,0,theLastSendTag) == 0)
      lastGeoSendTag = theLastSendTag(0);
    else
      lastGeoSendTag = -1;
  }
  */

  if (lastChannel != theChannel.getTag() || lastGeoSendTag != currentGeoTag || theChannel.isDatastore() == 0) {

    lastChannel = theChannel.getTag();

    //
    // into an ID we are gonna place the class and db tags for each node so can rebuild
    // this ID we then send to the channel
    //

    // create the ID and get the node iter
    if (numNodLd != 0) {
      ID nodeData(numNodLd*2);
      NodalLoad *theNode;
      NodalLoadIter &theNodes = this->getNodalLoads();
      int loc =0;

      // loop over nodes in domain adding their classTag and dbTag to the ID
      while ((theNode = theNodes()) != 0) {
	nodeData(loc) = theNode->getClassTag();
	int dbTag = theNode->getDbTag();
	
	// if dbTag still 0 get one from Channel; 
	// if this tag != 0 set the dbTag in node
	if (dbTag == 0 && myDbTag != 0) {// go get a new tag and setDbTag in ele if this not 0 
	  dbTag = theChannel.getDbTag();
	  if (dbTag != 0)
	    theNode->setDbTag(dbTag);
	}
	
	nodeData(loc+1) = dbTag;
	loc+=2;
      }    

      // now send the ID
      if (theChannel.sendID(dbNod, currentGeoTag, nodeData) < 0) {
	opserr << "LoadPattern::sendSelf - channel failed to send the NodalLoads ID\n";
	return -4;
      }
    }

    // we do the same for elemental loads as we did for nodal loads above .. see comments above!

    if (numEleLd != 0) {
      ID elementData(numEleLd*2);
      ElementalLoad *theEle;
      ElementalLoadIter &theElements = this->getElementalLoads();
      int loc = 0;
    
      while ((theEle = theElements()) != 0) {
	elementData(loc) = theEle->getClassTag();
	int dbTag = theEle->getDbTag();

	if (dbTag == 0 && myDbTag != 0) {// go get a new tag and setDbTag in ele if this not 0 
	  dbTag = theChannel.getDbTag();
	  if (dbTag != 0)
	    theEle->setDbTag(dbTag);
	}
      
	elementData(loc+1) = dbTag;
	loc+=2;
      }

      // now send the ID
      if (theChannel.sendID(dbEle, currentGeoTag, elementData) < 0) {
	opserr << "Domain::send - channel failed to send the element ID\n";
	return -5;
      }
    }

    // we do the same for SP_Constraints as for NodalLoads above .. see comments above!
    
    if (numSPs != 0) {
      ID spData(numSPs*2);
      SP_Constraint *theSP;
      SP_ConstraintIter &theSPs = this->getSPs();
      int loc = 0;
    
      while ((theSP = theSPs()) != 0) {
	spData(loc) = theSP->getClassTag();
	int dbTag = theSP->getDbTag();

	if (dbTag == 0 && myDbTag != 0) {// go get a new tag and setDbTag in ele if this not 0 
	  dbTag = theChannel.getDbTag();
	  if (dbTag != 0)
	    theSP->setDbTag(dbTag);
	}
	
	spData(loc+1) = dbTag;
	loc+=2;
      }    

      if (theChannel.sendID(dbSPs, currentGeoTag, spData) < 0) {
	opserr << "LoadPAttern::sendSelf - channel failed sending SP_Constraint ID\n";
	return -6;
      }
    }

    // set the lst send db tag so we don't have to do all that again
    lastGeoSendTag = currentGeoTag;
    if (theChannel.isDatastore() == 1) {
      static ID theLastSendTag(1);
      theLastSendTag(0) = lastGeoSendTag;
      theChannel.sendID(myDbTag,0, theLastSendTag);
    }
  }

  // now we invoke sendSelf on all the NodalLoads, ElementalLoads and SP_Constraints
  // which have been added to the LoadCase
  NodalLoad *theNode;
  NodalLoadIter &theNodes = this->getNodalLoads();
  while ((theNode = theNodes()) != 0) {
    if (theNode->sendSelf(cTag, theChannel) < 0) {
      opserr << "LoadPattern::sendSelf - node with tag " << theNode->getTag() << " failed in sendSelf\n";
      return -7;
    }
  }

  ElementalLoad *theEle;
  ElementalLoadIter &theElements = this->getElementalLoads();
  while ((theEle = theElements()) != 0) {
    if (theEle->sendSelf(cTag, theChannel) < 0) {
      opserr << "LoadPattern::sendSelf - element with tag " << theEle->getTag() << " failed in sendSelf\n";
      return -8;
    }
  }

  SP_Constraint *theSP;
  SP_ConstraintIter &theSPs = this->getSPs();
  while ((theSP = theSPs()) != 0) {
    if (theSP->sendSelf(cTag, theChannel) < 0) {
      
      opserr << "LoadPattern::sendSelf - SP_Constraint: " << *theSP << " failed sendSelf\n";
      return -9;
    }
  }    

  // if we get here we are successfull
  return 0;
}
コード例 #2
0
ファイル: LoadPattern.cpp プロジェクト: aceskpark/osfeo
int
LoadPattern::recvSelf(int cTag, 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();

  // into an ID we place all info needed to determine state of LoadPattern
  int numNod, numEle, numSPs;
  ID lpData(11);

  if (theChannel.recvID(myDbTag, cTag, lpData) < 0) {
    opserr << "LoadPattern::recvSelf - channel failed to recv the initial ID\n";
    return -1;
  }

  isConstant = lpData(7);

  this->setTag(lpData(10));

  if (isConstant == 0) { // we must recv the load factor in a Vector
    Vector data(2);
    if (theChannel.recvVector(myDbTag, cTag, data) < 0) {
      opserr << "LoadPattern::recvSelf - channel failed to recv the Vector\n";
      return -2;
    }
    loadFactor = data(0);
    scaleFactor = data(1);
  }
  
  // read data about the time series
  if (lpData(8) != -1) {
    if (theSeries == 0) {
      theSeries = theBroker.getNewTimeSeries(lpData(8));
    } else if (theSeries->getClassTag() != lpData(8)) {
      delete theSeries;    
      theSeries = theBroker.getNewTimeSeries(lpData(8));
    }
    if (theSeries == 0) {
      opserr << "LoadPattern::recvSelf - failed to create TimeSeries\n";
      return -3;
    }
  
    theSeries->setDbTag(lpData(9));

    if (theSeries->recvSelf(cTag, theChannel, theBroker) < 0) {
      opserr << "LoadPattern::recvSelf - the TimeSeries failed to recv\n";
      return -3;
    }
  }

  /*
  if (theChannel.isDatastore() == 1) {
    static ID theLastSendTag(1);
    if (theChannel.recvID(myDbTag,0,theLastSendTag) == 0)
      lastGeoSendTag = theLastSendTag(0);
  }
  */

  if (lastChannel != theChannel.getTag() || currentGeoTag != lpData(0) || theChannel.isDatastore() == 0) {

    // clear out the all the components in the current load pattern
    this->clearAll();
    lastChannel = theChannel.getTag();
    currentGeoTag = lpData(0);

    numNod = lpData(1);
    numEle = lpData(2);
    numSPs = lpData(3);
    dbNod = lpData(4);
    dbEle = lpData(5);
    dbSPs = lpData(6);    

    // 
    // now we rebuild the nodal loads
    //
    
    // first get the information from the domainData about the nodes
    if (numNod != 0) {
      ID nodeData(2*numNod);

      // now receive the ID about the nodes, class tag and dbTags
      if (theChannel.recvID(dbNod, currentGeoTag, nodeData) < 0) {
	opserr << "LoadPAttern::recvSelf - channel failed to recv the NodalLoad ID\n";
	return -2;
      }

      // now for each NodalLoad we 1) get a new node of the correct type from the ObjectBroker
      // 2) ensure the node exists and set it's dbTag, 3) we invoke recvSelf on this new 
      // blank node and 4) add this node to the domain

      int loc = 0;

      for (int i=0; i<numNod; i++) {
	int classTag = nodeData(loc);
	int dbTag = nodeData(loc+1);
	
	NodalLoad *theNode = theBroker.getNewNodalLoad(classTag);

	if (theNode == 0) {
	  opserr << "LoadPattern::recv - cannot create NodalLoad with classTag " << classTag << endln;
	  return -2;
	}			
	
	theNode->setDbTag(dbTag);
	
	if (theNode->recvSelf(cTag, theChannel, theBroker) < 0) {
	  opserr << "LoadPattern::recvSelf - NodalLoad with dbTag " << dbTag << " failed in recvSelf\n";
	  return -2;
	}			

	if (this->addNodalLoad(theNode) == false) {
	  opserr << "LoadPattern::recvSelf - failed adding NodalLoad tagged " << theNode->getTag() << " into LP!\n";
	  return -3;
	}			
	  
	loc+=2;
      }   
    }

    // 
    // now we rebuild the ElementalLoads .. same as NodalLoads above .. see comments above
    //
    
    if (numEle != 0) {
      ID eleData(2*numEle);
      
      if (theChannel.recvID(dbEle, currentGeoTag, eleData) < 0) {
	opserr << "LoadPattern::recvSelf - channel failed to recv the EleLoad ID\n";
	return -2;
      }

      int loc = 0;
      for (int i=0; i<numEle; i++) {
	int classTag = eleData(loc);
	int dbTag = eleData(loc+1);
      
	ElementalLoad *theEle = theBroker.getNewElementalLoad(classTag);
	if (theEle == 0) {
	  opserr << "LoadPattern::recv - cannot create ElementalLoad with classTag " << classTag << endln;
	  return -2;
	}			

	theEle->setDbTag(dbTag);
	
	if (theEle->recvSelf(cTag, theChannel, theBroker) < 0) {
	  opserr << "LoadPattern::recvSelf - Ele with dbTag " << dbTag << " failed in recvSelf\n";
	  return -2;
	}			
	
	if (this->addElementalLoad(theEle) == false) {
	  opserr << "LoadPattern::recvSelf - could not add Ele with tag " << theEle->getTag() << " into LP!\n";
	  return -3;
	}			
	
	loc+=2;
      }
    }

    // 
    // now we rebuild the SP_Constraints .. same as nodes above .. see above if can't understand!!
    //
    
    if (numSPs != 0) {
      ID spData(2*numSPs);

      if (theChannel.recvID(dbSPs, currentGeoTag, spData) < 0) {
	opserr << "LoadPattern::recvSelf - channel failed to recv the SP_Constraints ID\n";
	return -2;
      }

      int loc = 0;
      for (int i=0; i<numSPs; i++) {
	int classTag = spData(loc);
	int dbTag = spData(loc+1);
      
	SP_Constraint *theSP = theBroker.getNewSP(classTag);
	if (theSP == 0) {
	  opserr << "LoadPattern::recv - cannot create SP_Constraint with classTag " << classTag << endln;
	  return -2;
	}			
	theSP->setDbTag(dbTag);
      
	if (theSP->recvSelf(cTag, theChannel, theBroker) < 0) {
	  opserr << "LoadPattern::recvSelf - SP_Constraint with dbTag " << dbTag << " failed in recvSelf\n";
	  return -2;
	}			
	
	if (this->addSP_Constraint(theSP) == false) {
	  opserr << "LoadPattern::recvSelf - could not add SP_Constraint with tag " << theSP->getTag()
		 << " into LP!\n";
				  
	  return -3;
	}			
	
	loc+=2;
      }
    }

    // now set the load pattern db count
    currentGeoTag = lpData(0);
    lastGeoSendTag  = currentGeoTag;

  } else {
    if (theSeries != 0)
      if (theSeries->recvSelf(cTag, theChannel, theBroker) < 0) {
	opserr << "LoadPattern::recvSelf - the TimeSeries failed to recv\n";
	return -3;
      }

    
    NodalLoad *theNode;
    NodalLoadIter &theNodes = this->getNodalLoads();
    while ((theNode = theNodes()) != 0) {
      if (theNode->recvSelf(cTag, theChannel, theBroker) < 0) {
	opserr << "LoadPattern::recvSelf - node with tag " << theNode->getTag() << " failed in recvSelf\n";
	return -7;
      }
    }

    ElementalLoad *theEle;
    ElementalLoadIter &theElements = this->getElementalLoads();
    while ((theEle = theElements()) != 0) {
      if (theEle->recvSelf(cTag, theChannel, theBroker) < 0) {
	opserr << "LoadPattern::recvSelf - element with tag " << theEle->getTag() << " failed in recvSelf\n";
	return -8;
      }
    }

    SP_Constraint *theSP;
    SP_ConstraintIter &theSPs = this->getSPs();
    while ((theSP = theSPs()) != 0) {
      if (theSP->recvSelf(cTag, theChannel, theBroker) < 0) {
	opserr << "LoadPattern::recvSelf - SP_Constraint tagged " << theSP->getTag() << "  failed recvSelf\n";
	return -9;
      }
    }    
  }

  // if we get here we are successfull
  return 0;
}
コード例 #3
0
ファイル: ActorSubdomain.cpp プロジェクト: DBorello/OpenSees
int
ActorSubdomain::run(void)
{
    static Vector theVect(4);
	static Vector theVect1(1);
    bool exitYet = false;
    int res = 0;

    while (exitYet == false) {
      int action;
      res = this->recvID(msgData);
      if (res != 0) {
	opserr << "ActorSubdomain::run - error receiving msgData\n";
	exitYet = true;
        action = ShadowActorSubdomain_DIE;
      } else {
	action = msgData(0);
      }

      bool change;
      int theType, theOtherType, tag, dbTag, loadPatternTag;
      int startTag, endTag, axisDirn, numSP, i, numMode, dof;
      Element *theEle;
      Node *theNod;
      SP_Constraint *theSP;
      MP_Constraint *theMP;
      LoadPattern *theLoadPattern;
      NodalLoad *theNodalLoad;
      ElementalLoad *theElementalLoad;
      DomainDecompositionAnalysis *theDDAnalysis;
      const Matrix *theMatrix;
      const Vector *theVector;
      Matrix *theM;
      Vector *theV;
      ID     *theI, *theNodeTags, *theEleTags;
      PartitionedModelBuilder *theBuilder;
      IncrementalIntegrator *theIntegrator;
      EquiSolnAlgo *theAlgorithm;
      LinearSOE *theSOE;
      EigenSOE *theEigenSOE;
      ConvergenceTest *theTest;
      Recorder *theRecorder;
      bool res, generalized, findSmallest;
      double doubleRes;
      int intRes;
      NodeResponseType nodeResponseType;
      Parameter *theParameter;
      int argc;
      char **argv;
      char *allResponseArgs;
      char *currentLoc;
      int argLength, msgLength;
      Message theMessage;

      const ID *theID;
      
      //     opserr << "ActorSubdomain ACTION: " << action << endln;

      switch (action) {
	  case ShadowActorSubdomain_setTag:
	    tag = msgData(1); // subdomain tag
	    this->setTag(tag);
	    this->Actor::setCommitTag(tag);
	    break;

	  case ShadowActorSubdomain_analysisStep:
	    this->recvVector(theVect);
	    this->analysisStep(theVect(0));
	    break;

	  case ShadowActorSubdomain_eigenAnalysis:
	    numMode = msgData(1);
	    if (msgData(2) == 0)
	      generalized = true;
	    else
	      generalized = false;
	    if (msgData(3) == 0)
	      findSmallest = true;
	    else
	      findSmallest = false;
		
	    this->eigenAnalysis(numMode, generalized, findSmallest);
	    break;
	    /*
	  case ShadowActorSubdomain_buildSubdomain:
	    theType = msgData(1);
	    tag = msgData(3); // subdomain tag
	    this->setTag(tag);
	    tag = msgData(2); // numSubdomains
	    theBuilder = theBroker->getPtrNewPartitionedModelBuilder(*this, 
								     theType);
	    this->recvObject(*theBuilder);
	    this->buildSubdomain(tag, *theBuilder);

	    break;
	    */
	case ShadowActorSubdomain_getRemoteData:
	    theID = &(this->getExternalNodes());
	    msgData(0) = theID->Size();
	    msgData(1) = this->getNumDOF();

	    this->sendID(msgData);
	    if (theID->Size() != 0)
	      this->sendID(*theID);
	    break;

	  case ShadowActorSubdomain_getCost:
       	    theVect(0) = this->getCost(); // have to use [] for Sun's CC!
	    this->sendVector(theVect);
	    break;	    

 	  case ShadowActorSubdomain_addElement:
	    theType = msgData(1);
	    dbTag = msgData(2);

	    theEle = theBroker->getNewElement(theType);

	    if (theEle != 0) {
		theEle->setDbTag(dbTag);		
		this->recvObject(*theEle);
		bool result = this->addElement(theEle);
		if (result == true)
		    msgData(0) = 0;
		else
		    msgData(0) = -1;
	    } else
		msgData(0) = -1;

	    /*
	    this->recvID(msgData);	    
	    opserr << "ActorSubdomain::addElement() : " << msgData;
	    
	    msgData(0) = 1;
	    msgData(1) = 2;
	    msgData(2) = 3;
	    msgData(3) = 4;
	    this->sendID(msgData);	    
	    */

	    break;

	    
	  case ShadowActorSubdomain_hasNode:
	    theType = msgData(1);
	    res = this->hasNode(theType);
	    if (res == true)
	      msgData(0) = 0;
	    else
	      msgData(0) = -1;
	    this->sendID(msgData);

	    break;

	  case ShadowActorSubdomain_hasElement:
	    theType = msgData(1);
	    res = this->hasElement(theType);
	    if (res == true)
	      msgData(0) = 0;
	    else
	      msgData(0) = -1;
	    this->sendID(msgData);
	   
             break;


	  case ShadowActorSubdomain_addNode:
	    theType = msgData(1);
	    dbTag = msgData(2);
	    theNod = theBroker->getNewNode(theType);

	    if (theNod != 0) {
		theNod->setDbTag(dbTag);		
		this->recvObject(*theNod); 
		bool result = this->addNode(theNod);
		if (result == true)
		  msgData(0) = 0;
		else
		  msgData(0) = -1;
	    } else
		msgData(0) = -1;
	    //	    opserr << "ActorSubdomain::add node: " << *theNod;
	    break;


	  case ShadowActorSubdomain_addExternalNode:
	    theType = msgData(1);
	    dbTag = msgData(2);
	    theNod = theBroker->getNewNode(theType);

	    if (theNod != 0) {
		theNod->setDbTag(dbTag);
		this->recvObject(*theNod);
		bool result = this->Subdomain::addExternalNode(theNod);
		delete theNod;
		/*
		Node *dummy = new Node(*theNod);
		delete theNod;
		opserr << *dummy;
		opserr << dummy->getMass();
		*/

		if (result == true)
		    msgData(0) = 0;
		else
		    msgData(0) = -1;
	    } else
		msgData(0) = -1;

	    break;	    

	    
	  case ShadowActorSubdomain_addSP_Constraint:
	    theType = msgData(1);
	    dbTag = msgData(2);

	    theSP = theBroker->getNewSP(theType);
	    
	    if (theSP != 0) {
		theSP->setDbTag(dbTag);
		this->recvObject(*theSP);
		bool result = this->addSP_Constraint(theSP);
		if (result == true)
		    msgData(0) = 0;
		else
		    msgData(0) = -1;
	    } else
		msgData(0) = -1;

	    break;	    


	  case ShadowActorSubdomain_addSP_ConstraintAXIS:

	    axisDirn = msgData(1);
	    theI = new ID(msgData(2));
	    theV = new Vector(2);
	    SP_Constraint_SetNextTag(msgData(3));

	    endTag = 0;
		
	    this->recvID(*theI);
	    this->recvVector(*theV);

	    msgData(0) = 0;				 
	    numSP = this->addSP_Constraint(axisDirn, (*theV)(0), *theI, (*theV)(1));
	    endTag = SP_Constraint_GetNextTag();

	    msgData(1) = numSP;
	    msgData(2) = endTag;

	    this->domainChange();
	    this->sendID(msgData);
		
	    delete theV;
	    delete theI;
		
	    /* DONT BOTHER SENDING
	    if (numSP > 0) {
	      theI = new ID(numSP);
	      for (i = 0; i<numSP; i++) {
		theSP = this->getSP_Constraint(i+startTag);
		(*theI)(i) = theSP->getClassTag();
	      }
	      this->sendID(*theI);	
		  opserr << "Actor: sent: " << *theI;
	      for (i = 0; i<numSP; i++) {
		theSP = this->getSP_Constraint(i+startTag);
		if (theSP != 0)
		this->sendObject(*theSP);	
		else
			opserr << "ActorSubdomain::addSP_AXIS :: PROBLEMS\n";
	      }
	      delete theI;
	    }
opserr << "ActorSubdomain::addSP_AXIS :: DONE\n";
        */

	    break;	    
	    
	  case ShadowActorSubdomain_addMP_Constraint:
	    theType = msgData(1);
	    dbTag = msgData(2);
	    theMP = theBroker->getNewMP(theType);

	    if (theMP != 0) {
		theMP->setDbTag(dbTag);
		this->recvObject(*theMP);
		bool result = this->addMP_Constraint(theMP);
		if (result == true)
		    msgData(0) = 0;
		else
		    msgData(0) = -1;
	    } else
		msgData(0) = -1;
		
	    break;	    
	    
	    
	  case ShadowActorSubdomain_addLoadPattern:
	    theType = msgData(1);
	    dbTag = msgData(2);
	    
	    theLoadPattern = theBroker->getNewLoadPattern(theType);

	    if (theLoadPattern != 0) {
		theLoadPattern->setDbTag(dbTag);
		this->recvObject(*theLoadPattern);
		bool result = this->addLoadPattern(theLoadPattern);
		if (result == true)
		    msgData(0) = 0;
		else
		    msgData(0) = -1;
	    } else
		msgData(0) = -1;

	    break;	    	    

	  case ShadowActorSubdomain_addNodalLoadToPattern:
 	    theType = msgData(1);
	    dbTag = msgData(2);
	    loadPatternTag = msgData(3);
	    
	    theNodalLoad = theBroker->getNewNodalLoad(theType);

	    if (theNodalLoad != 0) {
		theNodalLoad->setDbTag(dbTag);
		this->recvObject(*theNodalLoad);
		bool result = this->addNodalLoad(theNodalLoad, loadPatternTag);
		if (result == true)
		    msgData(0) = 0;
		else
		    msgData(0) = -1;
	    } else
		msgData(0) = -1;

	    break;	    
	    
	    
	  case ShadowActorSubdomain_addElementalLoadToPattern:
	    theType = msgData(1);
	    dbTag = msgData(2);
	    loadPatternTag = msgData(3);
	    
	    theElementalLoad = theBroker->getNewElementalLoad(theType);

	    if (theElementalLoad != 0) {
		theElementalLoad->setDbTag(dbTag);
		this->recvObject(*theElementalLoad);
		bool result = this->addElementalLoad(theElementalLoad, 
						     loadPatternTag);
		if (result == true)
		    msgData(0) = 0;
		else
		    msgData(0) = -1;
	    } else
		msgData(0) = -1;

	    break;	    	    
	    
	  case ShadowActorSubdomain_addSP_ConstraintToPattern:
	    theType = msgData(1);
	    dbTag = msgData(2);
	    loadPatternTag = msgData(3);
	    
	    theSP = theBroker->getNewSP(theType);

	    if (theSP != 0) {
		theSP->setDbTag(dbTag);
		this->recvObject(*theSP);
		bool result = this->addSP_Constraint(theSP, loadPatternTag);

		if (result == true)
		    msgData(0) = 0;
		else
		    msgData(0) = -1;
	    } else
		msgData(0) = -1;

	    break;	    	    	    

	  case ShadowActorSubdomain_removeElement:
	    tag = msgData(1);

	    theEle = this->removeElement(tag);

	    if (theEle != 0) 
		msgData(0) = theEle->getClassTag();
	    else
		msgData(0) = -1;

	    this->sendID(msgData);
	    if (theEle != 0) {
		this->sendObject(*theEle);
		delete theEle;
	    }

	    msgData(0) = 0;

	    break;	    	    	    


	  case ShadowActorSubdomain_removeNode:
	    tag = msgData(1);

	    theNod = this->removeNode(tag);

	    if (theNod != 0) 
		msgData(0) = theNod->getClassTag();
	    else
		msgData(0) = -1;

	    this->sendID(msgData);
	    if (theNod != 0) {
		this->sendObject(*theNod);
		delete theNod;
	    }

	    msgData(0) = 0;

	    break;

	  case ShadowActorSubdomain_removeSP_Constraint:
	    tag = msgData(1);

	    theSP = this->removeSP_Constraint(tag);

	    break;	    

	  case ShadowActorSubdomain_removeSP_ConstraintNoTag:
	    tag = msgData(1);
	    dof = msgData(2);
	    loadPatternTag = msgData(3);
	    msgData(0) = this->removeSP_Constraint(tag, dof, loadPatternTag);
	    this->sendID(msgData);

	    break;	    
	    
	  case ShadowActorSubdomain_removeMP_Constraint:
	    tag = msgData(1);

	    theMP = this->removeMP_Constraint(tag);

	    break;	    	    

	  case ShadowActorSubdomain_removeLoadPattern:
	    tag = msgData(1);

	    theLoadPattern = this->removeLoadPattern(tag);

	    break;	    	    
	    
	  case ShadowActorSubdomain_removeNodalLoadFromPattern:
	    tag = msgData(1);
	    theType = msgData(2);

	    theNodalLoad = this->removeNodalLoad(tag, theType);

	    break;	    	    	    

	  case ShadowActorSubdomain_removeElementalLoadFromPattern:
	    tag = msgData(1);
	    theType = msgData(2);

	    theElementalLoad = this->removeElementalLoad(tag, theType);

	    break;	    	    	    

	  case ShadowActorSubdomain_removeSP_ConstraintFromPattern:
	    tag = msgData(1);
	    theType = msgData(2);

	    theSP = this->removeSP_Constraint(tag, theType);

	    break;	    	    	    
	    
	    
	    
	  case ShadowActorSubdomain_getElement:
	    tag = msgData(1);

	    theEle = this->getElement(tag);

	    if (theEle != 0) 
		msgData(0) = theEle->getClassTag();
	    else
		msgData(0) = -1;

	    this->sendID(msgData);
	    if (theEle != 0) {
		this->sendObject(*theEle);
	    }

	    msgData(0) = 0;

	    break;	    	    	    	    


	  case ShadowActorSubdomain_getNode:
	    tag = msgData(1);

	    theNod = this->getNode(tag);

	    if (theNod != 0) 
		msgData(0) = theNod->getClassTag();
	    else
		msgData(0) = -1;

	    this->sendID(msgData);

	    if (theNod != 0) {
		this->sendObject(*theNod);
	    }

	    msgData(0) = 0;

	    break;	    	    	    	    


	  case ShadowActorSubdomain_Print:
	    this->Print(opserr, msgData(3));
	    this->sendID(msgData);

	    break;	    	    	    	    

	  case ShadowActorSubdomain_PrintNodeAndEle:
	    
	    theNodeTags = 0;
	    theEleTags = 0;

	    if (msgData(1) != 0) {
	      theNodeTags = new ID(msgData(1));
	      this->recvID(*theNodeTags);
	    }
	    if (msgData(2) != 0) {
	      theEleTags = new ID(msgData(2));
	      this->recvID(*theEleTags);
	    }
	      
	    this->Print(opserr, theNodeTags, theEleTags, msgData(3));
	    
	    if (theNodeTags != 0)
	      delete theNodeTags;
	    if (theEleTags != 0)
	      delete theEleTags;

	    this->sendID(msgData);

	    break;	    	    	    	    

	  case ShadowActorSubdomain_applyLoad:
	    this->recvVector(theVect);	    
	    this->applyLoad(theVect(0));
	    break;

	  case ShadowActorSubdomain_setCommittedTime:
	    this->recvVector(theVect);	    
	    this->setCurrentTime(theVect(0));
	    this->setCommittedTime(theVect(0));
	    break;	    
	    
	  case ShadowActorSubdomain_setLoadConstant:
	    this->setLoadConstant();
	    break;	    

	  case ShadowActorSubdomain_update:
	    this->update();
	    break;

	  case ShadowActorSubdomain_updateTimeDt:
	    this->updateTimeDt();
	    break;

	  case ShadowActorSubdomain_computeNodalResponse:
	    tag = msgData(1);
	    if (lastResponse == 0)
		lastResponse = new Vector(tag);
	    else if (lastResponse->Size() != tag) {
		delete lastResponse;
		lastResponse = new Vector(tag);
	    }
	    this->recvVector(*lastResponse);
	    this->computeNodalResponse();
            break;

	  case ShadowActorSubdomain_record:
	    this->record();
	    break;
	    
	  case ShadowActorSubdomain_commit:
	    this->commit();
	    break;
	    
	  case ShadowActorSubdomain_revertToLastCommit:
	    this->revertToLastCommit();
	    break;	    
	    
	  case ShadowActorSubdomain_revertToStart:
	    this->revertToStart();
	    this->sendID(msgData);

	    break;	    	    

	  case ShadowActorSubdomain_addRecorder:
	    theType = msgData(1);
	    theRecorder = theBroker->getPtrNewRecorder(theType);
	    if (theRecorder != 0) {
	      this->recvObject(*theRecorder);	      
	      this->addRecorder(*theRecorder);
	    }
	    break;	    	    

	  case ShadowActorSubdomain_removeRecorders:
	    this->removeRecorders();
	    this->barrierCheck(1);
	    break;	    	    

	  case ShadowActorSubdomain_removeRecorder:
	    theType = msgData(1);
	    this->removeRecorder(theType);
	    break;	    	    
	    

	case ShadowActorSubdomain_wipeAnalysis:
	  this->wipeAnalysis();	    
	  break;

	  case ShadowActorSubdomain_setDomainDecompAnalysis:
	    theType = msgData(1);
	    theDDAnalysis = 
		theBroker->getNewDomainDecompAnalysis(theType, *this);

	    if (theDDAnalysis != 0) {
		this->recvObject(*theDDAnalysis);
		this->setDomainDecompAnalysis(*theDDAnalysis);
		msgData(0) = 0;
	    } else
		msgData(0) = -1;
	    
	    break;

	case ShadowActorSubdomain_setAnalysisAlgorithm:
	  theType = msgData(1);
	  theAlgorithm = theBroker->getNewEquiSolnAlgo(theType);

	  if (theAlgorithm != 0) {
	    this->recvObject(*theAlgorithm);
	    this->setAnalysisAlgorithm(*theAlgorithm);
	    msgData(0) = 0;
	  } else
	    msgData(0) = -1;
	    
	  break;
	  
	case ShadowActorSubdomain_setAnalysisIntegrator:
	  theType = msgData(1);
	  theIntegrator = theBroker->getNewIncrementalIntegrator(theType);
	  if (theIntegrator != 0) {
	    this->recvObject(*theIntegrator);
	    this->setAnalysisIntegrator(*theIntegrator);
	    msgData(0) = 0;
	  } else
	    msgData(0) = -1;
	  this->sendID(msgData);
	  break;

	case ShadowActorSubdomain_setAnalysisLinearSOE:
	  theType = msgData(1);
	  theSOE = theBroker->getNewLinearSOE(theType);

	  if (theSOE != 0) {
	    this->recvObject(*theSOE);
	    this->setAnalysisLinearSOE(*theSOE);
	    msgData(0) = 0;
	  } else
	    msgData(0) = -1;
	    
	  break;

	case ShadowActorSubdomain_setAnalysisEigenSOE:
	  theType = msgData(1);
	  theEigenSOE = theBroker->getNewEigenSOE(theType);

	  if (theEigenSOE != 0) {
	    this->recvObject(*theEigenSOE);
	    this->setAnalysisEigenSOE(*theEigenSOE);
	    msgData(0) = 0;
	  } else
	    msgData(0) = -1;
	    
	  break;

	case ShadowActorSubdomain_setAnalysisConvergenceTest:
	  theType = msgData(1);
	  theTest = theBroker->getNewConvergenceTest(theType);
	  
	  if (theTest != 0) {
	    this->recvObject(*theTest);
	    this->setAnalysisConvergenceTest(*theTest);
	    msgData(0) = 0;
	  } else
	    msgData(0) = -1;

	  break;
	    
	  case ShadowActorSubdomain_domainChange:
	    this->domainChange();

	    tag = this->getNumDOF();
	    if (tag != 0) {
	      if (lastResponse == 0)
		lastResponse = new Vector(tag);
	      else if (lastResponse->Size() != tag) {
		delete lastResponse;
		lastResponse = new Vector(tag);
	      }
	    }
	    break;

	  case ShadowActorSubdomain_getDomainChangeFlag:
	    change = this->getDomainChangeFlag();
	    if (change == true)
	      msgData(0) = 0;
	    else
	      msgData(0) = 1;
	    this->sendID(msgData);
	    
	    break;

	  case ShadowActorSubdomain_clearAnalysis:
//	    this->clearAnalysis();
	    break;
	  /*
	  case 50:
	    const Matrix *theMatrix1 = &(this->getStiff());
	    this->sendMatrix(*theMatrix1);
	    break;

	  case 51:
	    const Matrix *theMatrix2 = &(this->getDamp());
	    this->sendMatrix(*theMatrix2);
	    break;
	    
	  case 52:
	    const Matrix *theMatrix3 = &(this->getMass());
	    this->sendMatrix(*theMatrix3);
	    break;	    
	    */
	  case  ShadowActorSubdomain_getTang:
	    theMatrix = &(this->getTang());
	    this->sendMatrix(*theMatrix);
	    break;	    
	    
	  case ShadowActorSubdomain_getResistingForce:
	    theVector = &(this->getResistingForce());
	    this->sendVector(*theVector);
	    break;	    	    

	  case ShadowActorSubdomain_computeTang:
	    tag = msgData(1);
	    this->setTag(tag);
	    this->computeTang();
	    break;


	  case ShadowActorSubdomain_computeResidual:
	    this->computeResidual();
	    break;

	  case ShadowActorSubdomain_clearAll:
	    this->clearAll();
	    this->sendID(msgData);
	    break;

	  case ShadowActorSubdomain_getNodeDisp:
	    tag = msgData(1);  // nodeTag
	    dbTag = msgData(2); // dof
	    doubleRes = this->getNodeDisp(tag, dbTag, intRes);
	    msgData(0) = intRes;
	    this->sendID(msgData);
	    if (intRes == 0) {
	      theV = new Vector(1);
	      (*theV)(0) = doubleRes;
	      this->sendVector(*theV);
	      delete theV;
	    }
	    break;

	  case ShadowActorSubdomain_setMass:
	    tag = msgData(1);  // nodeTag
	    dbTag = msgData(2); // noRows
	    theOtherType = msgData(3); // noRows
	    theM = new Matrix(dbTag, theOtherType);
	    this->recvMatrix(*theM);
	    intRes = this->setMass(*theM, tag);
	    
	    delete theM;
	    msgData(0) = intRes;
	    this->sendID(msgData);
	    break;


	  case ShadowActorSubdomain_getNodeResponse:
	    tag = msgData(1);  // nodeTag
	    nodeResponseType = (NodeResponseType)msgData(2); 
	    theVector = this->getNodeResponse(tag, nodeResponseType);

	    if (theVector == 0)
	      msgData(0) = 0;
	    else {
	      msgData(0) = 1;
	      msgData(1) = theVector->Size();
	    }
	    this->sendID(msgData);

	    if (theVector != 0)
	      this->sendVector(*theVector);

	    break;

	  case ShadowActorSubdomain_getElementResponse:
	    tag = msgData(1);  // eleTag
	    argc = msgData(2);
	    msgLength = msgData(3);

	    if (msgLength == 0) {
	      opserr << "ElementRecorder::recvSelf() - 0 sized string for responses\n";
	      return -1;
	    }

	    allResponseArgs = new char[msgLength];
	    if (allResponseArgs == 0) {
	      opserr << "ElementRecorder::recvSelf() - out of memory\n";
	      return -1;
	    }

	    theMessage.setData(allResponseArgs, msgLength);
	    if (this->recvMessage(theMessage) < 0) {
	      opserr << "ElementRecorder::recvSelf() - failed to recv message\n";
	      return -1;
	    }

	    //
	    // now break this single array into many
	    // 
	    
	    argv = new char *[argc];
	    if (argv == 0) {
	      opserr << "ElementRecorder::recvSelf() - out of memory\n";
	      return -1;
	    }
	    
	    currentLoc = allResponseArgs;
	    for (int j=0; j<argc; j++) {
	      argv[j] = currentLoc;	      
	      argLength = strlen(currentLoc)+1;
	      currentLoc += argLength;
	    }

	    theVector = this->getElementResponse(tag, (const char**)argv, argc);

	    delete [] argv;
	    delete [] allResponseArgs;

	    if (theVector == 0) 
	      msgData(0) = 0;
	    else {
	      msgData(0) = 1;
	      msgData(1) = theVector->Size();
	    }
	    this->sendID(msgData);

	    if (theVector != 0)
	      this->sendVector(*theVector);
      
	    break;

	  case ShadowActorSubdomain_calculateNodalReactions:
	    if (msgData(0) == 0)
	      this->calculateNodalReactions(true);
	    else
	      this->calculateNodalReactions(false);
	    break;

         case ShadowActorSubdomain_setRayleighDampingFactors:
	   theV = new Vector(4);
	   this->recvVector(*theV);
	   intRes = this->Subdomain::setRayleighDampingFactors((*theV)(0), (*theV)(1), (*theV)(2), (*theV)
(3));
	   delete theV;
	   break;


         case ShadowActorSubdomain_addParameter:
	    theType = msgData(1);
	    dbTag = msgData(2);

	    theParameter = theBroker->getParameter(theType);

	    if (theParameter != 0) {
		theParameter->setDbTag(dbTag);		
		this->recvObject(*theParameter);
		//bool result = true;
		bool result = this->addParameter(theParameter);
		if (result == true)
		    msgData(0) = 0;
		else {
		  opserr << "Actor::addParameter - FAILED\n";
		  msgData(0) = -1;
		}
	    } else
		msgData(0) = -1;

	   break;

       case ShadowActorSubdomain_removeParameter:
	   theType = msgData(1);
	  
	   this->removeParameter(theType);
	 
	    this->sendID(msgData);
	   break;

         case ShadowActorSubdomain_updateParameterINT:
	   theType = msgData(1);  // tag
	   dbTag = msgData(2);    // value

	   msgData(0) = this->Domain::updateParameter(theType, dbTag);
	   this->sendID(msgData);
	   break;

       case ShadowActorSubdomain_updateParameterDOUBLE:
	   theType = msgData(1);  // tag
	 
	   this->recvVector(theVect1);
	
	   msgData(0) = this->Domain::updateParameter(theType, theVect1(0));
	  
	   this->sendID(msgData);
	   break;


	  case ShadowActorSubdomain_DIE:
	    exitYet = true;
	    break;

	  default:
	    opserr << "ActorSubdomain::invalid action " << action << "received\n";
	    msgData(0) = -1;
	    
      }
      //      opserr << "DONE ACTION: " << action << endln;
    }

    //    this->sendID(msgData);
    return 0;
}