ShadowSubdomain.cpp

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.5 $
00022 // $Date: 2005/11/30 23:47:00 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/domain/subdomain/ShadowSubdomain.cpp,v $
00024                                                                         
00025 // Written: fmk 
00026 // Revision: A
00027 //
00028 // Description: This file contains the class definition for ShadowSubdomain.
00029 // ShadowSubdomain is a container class. The class is responsible for holding
00030 // and providing access to the Elements, Nodes, LoadCases, SP_Constraints 
00031 // and MP_Constraints that have been added to the ShadowSubdomain.
00032 //
00033 // What: "@(#) ShadowSubdomain.C, revA"
00034 
00035 
00036 #include <ShadowSubdomain.h>
00037 #include <stdlib.h>
00038 
00039 #include <Node.h>
00040 #include <Element.h>
00041 #include <SP_Constraint.h>
00042 #include <MP_Constraint.h>
00043 #include <DomainDecompositionAnalysis.h>
00044 #include <NodalLoad.h>
00045 #include <ElementalLoad.h>
00046 #include <FEM_ObjectBroker.h>
00047 #include <Timer.h>
00048 #include <LoadPattern.h>
00049 
00050 #include <ArrayOfTaggedObjects.h>
00051 #include <SingleDomNodIter.h>
00052 #include <SingleDomEleIter.h>
00053 #include <Graph.h>
00054 #include <FE_Element.h>
00055 #include <PartitionedModelBuilder.h>
00056 
00057 #include <EquiSolnAlgo.h>
00058 #include <IncrementalIntegrator.h>
00059 #include <LinearSOE.h>
00060 #include <LinearSOESolver.h>
00061 #include <ConvergenceTest.h>
00062 #include <Recorder.h>
00063 
00064 #include <FE_Element.h>
00065 
00066 #include <ShadowActorSubdomain.h>
00067 
00068 int ShadowSubdomain::count = 0; // MHS
00069 int ShadowSubdomain::numShadowSubdomains = 0;
00070 ShadowSubdomain **ShadowSubdomain::theShadowSubdomains = 0;
00071 
00072 ShadowSubdomain::ShadowSubdomain(int tag, 
00073                                  MachineBroker &theMachineBroker,
00074                                  FEM_ObjectBroker &theObjectBroker)
00075   :Shadow(ACTOR_TAGS_SUBDOMAIN, theObjectBroker, theMachineBroker, 0),
00076           
00077    Subdomain(tag),
00078    msgData(4),
00079    theElements(0,128),
00080    theNodes(0,128),
00081    theExternalNodes(0,128), 
00082    theLoadCases(0,128),
00083    theShadowSPs(0), theShadowMPs(0), theShadowLPs(0),
00084    numDOF(0),numElements(0),numNodes(0),numExternalNodes(0),
00085    numSPs(0),numMPs(0), buildRemote(false), gotRemoteData(false), 
00086    theFEele(0),
00087    theVector(0), theMatrix(0)
00088 {
00089   
00090   numShadowSubdomains++;
00091 
00092   ShadowSubdomain **theCopy = new ShadowSubdomain *[numShadowSubdomains];
00093 
00094   for (int i = 0; i < numShadowSubdomains-1; i++)
00095     theCopy[i] = theShadowSubdomains[i];
00096 
00097   if (theShadowSubdomains != 0)
00098     delete [] theShadowSubdomains;
00099 
00100   theCopy[numShadowSubdomains-1] = this;
00101 
00102   theShadowSubdomains = theCopy;
00103 
00104 
00105   theShadowSPs      = new ArrayOfTaggedObjects(256);
00106   theShadowMPs      = new ArrayOfTaggedObjects(256);    
00107   theShadowLPs = new ArrayOfTaggedObjects(32);
00108 
00109   // does nothing
00110   numLoadPatterns = 0;
00111 
00112   msgData(0) = ShadowActorSubdomain_setTag;
00113   msgData(1) = tag;
00114   this->sendID(msgData);
00115 
00116   this->setCommitTag(tag);
00117 }
00118 
00119 
00120 ShadowSubdomain::ShadowSubdomain(int tag, 
00121                                  Channel &the_Channel,
00122                                  FEM_ObjectBroker &theObjectBroker)
00123   :Shadow(the_Channel, theObjectBroker),
00124    Subdomain(tag),
00125    msgData(4),
00126    theElements(0,128),
00127    theNodes(0,128),
00128    theExternalNodes(0,128), 
00129    theLoadCases(0,128),
00130    theShadowSPs(0), theShadowMPs(0), theShadowLPs(0),
00131    numDOF(0),numElements(0),numNodes(0),numExternalNodes(0),
00132    numSPs(0),numMPs(0), buildRemote(false), gotRemoteData(false), 
00133    theFEele(0),
00134    theVector(0), theMatrix(0)
00135 {
00136 
00137   numShadowSubdomains++;
00138 
00139   ShadowSubdomain **theCopy = new ShadowSubdomain *[numShadowSubdomains];
00140 
00141   for (int i = 0; i < numShadowSubdomains-1; i++)
00142     theCopy[i] = theShadowSubdomains[i];
00143 
00144   if (theShadowSubdomains != 0)
00145     delete [] theShadowSubdomains;
00146 
00147   theCopy[numShadowSubdomains-1] = this;
00148 
00149   theShadowSubdomains = theCopy;
00150 
00151   theShadowSPs      = new ArrayOfTaggedObjects(256);
00152   theShadowMPs      = new ArrayOfTaggedObjects(256);    
00153   theShadowLPs = new ArrayOfTaggedObjects(32);
00154 
00155   // does nothing
00156   numLoadPatterns = 0;
00157 }
00158 
00159 ShadowSubdomain::~ShadowSubdomain()    
00160 {
00161   // send a message to the remote actor telling it to shut sown
00162   msgData(0) = ShadowActorSubdomain_DIE;
00163   this->sendID(msgData);
00164   this->recvID(msgData);
00165 
00166   delete theShadowSPs;
00167   delete theShadowMPs;
00168   delete theShadowLPs;
00169 
00170   opserr << "ShadowSubdomain::~ShadowSubdomain()\n";
00171 }
00172 
00173 
00174 int
00175 ShadowSubdomain::buildSubdomain(int numSubdomains, PartitionedModelBuilder &theBuilder)
00176 {
00177   // send a message identify setting ModelBuilder and it's class tag
00178   buildRemote = true;
00179   gotRemoteData = false;
00180 
00181   msgData(0) = ShadowActorSubdomain_buildSubdomain;
00182   msgData(1) = theBuilder.getClassTag();
00183   msgData(2) = numSubdomains;
00184   msgData(3) = this->getTag();
00185   this->sendID(msgData);
00186 
00187   // send the builder
00188   this->sendObject(theBuilder);
00189 
00190   // mark the domain as having been modified
00191   this->domainChange();
00192   return 0;  
00193 }
00194 
00195 
00196 int
00197 ShadowSubdomain::getRemoteData(void)
00198 {
00199   if (buildRemote == true && gotRemoteData == false){
00200     msgData(0) = ShadowActorSubdomain_getRemoteData;
00201     this->sendID(msgData);
00202 
00203     this->recvID(msgData);
00204     numExternalNodes = msgData(0);
00205     numDOF = msgData(1);
00206 
00207 opserr << "ShadowSubdomain::getRemoteData numExtNodes " << numExternalNodes << endln;    
00208     if (theExternalNodes.Size() != numExternalNodes)
00209       theExternalNodes[numExternalNodes-1] = 0; // this will resize
00210     if (theExternalNodes.Size() != numExternalNodes) {
00211       opserr << "ShadowSubdomain::getRemoteData(void) - need to resize the ID\n";
00212       return -1;
00213     }
00214     if (numExternalNodes != 0)
00215       this->recvID(theExternalNodes);
00216 opserr << "ShadowSubdomain::getREmoteData " << theExternalNodes;    
00217   }
00218 
00219   gotRemoteData = true;
00220   return 0;
00221 }
00222 
00223 bool 
00224 ShadowSubdomain::addElement(Element *theEle)
00225 {
00226     int tag = theEle->getTag();
00227 
00228 #ifdef _G3DEBUG    
00229         // do all the checking stuff
00230 #endif
00231 
00232     msgData(0) = ShadowActorSubdomain_addElement;
00233     msgData(1) = theEle->getClassTag();
00234     msgData(2) = theEle->getDbTag();
00235     this->sendID(msgData);
00236     this->sendObject(*theEle);
00237     theElements[numElements] = tag;
00238     numElements++;
00239     //    this->domainChange();
00240 
00241     /*
00242     msgData(0) = 5;
00243     msgData(1) = 6;
00244     msgData(2) = 7;
00245     msgData(3) = 8;
00246     this->sendID(msgData);  
00247     this->recvID(msgData);  
00248     opserr << "ShadowSubdomain::addElement() : " << msgData;
00249     */
00250 
00251     delete theEle;
00252     
00253     return true;
00254 }
00255 
00256 bool 
00257 ShadowSubdomain::addNode(Node *theNode)
00258 {
00259     int tag = theNode->getTag();
00260 #ifdef _G3DEBUG
00261         // do all the checking stuff
00262 #endif
00263     msgData(0) = ShadowActorSubdomain_addNode;
00264     msgData(1) = theNode->getClassTag();
00265     msgData(2) = theNode->getDbTag();
00266     this->sendID(msgData);
00267     this->sendObject(*theNode);
00268     theNodes[numNodes] = tag;
00269     numNodes++;    
00270     // this->domainChange();
00271 
00272     delete theNode;
00273     
00274     return true;
00275 }
00276 
00277 bool 
00278 ShadowSubdomain::addExternalNode(Node *theNode)
00279 {
00280     int tag = theNode->getTag();
00281 #ifdef _G3DEBUG
00282         // do all the checking stuff
00283 #endif
00284 
00285     msgData(0) = ShadowActorSubdomain_addExternalNode;
00286     msgData(1) = theNode->getClassTag();
00287     msgData(2) = theNode->getDbTag();
00288     this->sendID(msgData);
00289     this->sendObject(*theNode);
00290     theNodes[numNodes] = tag;
00291     theExternalNodes[numExternalNodes] = tag;    
00292     numNodes++;    
00293     numExternalNodes++;        
00294     numDOF += theNode->getNumberDOF();
00295 
00296     //    this->domainChange();
00297 
00298     return true;    
00299 }
00300 
00301 bool 
00302 ShadowSubdomain::addSP_Constraint(SP_Constraint *theSP)
00303 {
00304 
00305 #ifdef _G3DEBUG
00306         // do all the checking stuff
00307 #endif
00308     msgData(0) = ShadowActorSubdomain_addSP_Constraint;
00309     msgData(1) = theSP->getClassTag();
00310     msgData(2) = theSP->getDbTag();
00311     this->sendID(msgData);
00312     this->sendObject(*theSP);
00313     numSPs++;    
00314     // this->domainChange();
00315     
00316     theShadowSPs->addComponent(theSP);
00317 
00318     return true;    
00319 }
00320 
00321 bool 
00322 ShadowSubdomain::addMP_Constraint(MP_Constraint *theMP)    
00323 {
00324 #ifdef _G3DEBUG
00325         // do all the checking stuff
00326 #endif
00327     msgData(0) = ShadowActorSubdomain_addMP_Constraint;
00328     msgData(1) = theMP->getClassTag();
00329     msgData(2) = theMP->getDbTag();
00330     this->sendID(msgData);
00331     this->sendObject(*theMP);
00332     numMPs++;    
00333     // // this->domainChange();
00334 
00335     theShadowMPs->addComponent(theMP);    
00336     return true;    
00337 }
00338 
00339 
00340 bool 
00341 ShadowSubdomain::addLoadPattern(LoadPattern *thePattern)    
00342 {
00343 #ifdef _G3DEBUG
00344         // do all the checking stuff
00345 #endif
00346     msgData(0) = ShadowActorSubdomain_addLoadPattern;
00347     msgData(1) = thePattern->getClassTag();
00348     msgData(2) = thePattern->getDbTag();
00349     this->sendID(msgData);
00350     this->sendObject(*thePattern);
00351     //    this->domainChange();
00352 
00353 
00354     theShadowLPs->addComponent(thePattern);    
00355     numLoadPatterns++;
00356 
00357     return true;    
00358 }
00359 
00360 
00361 
00362 bool 
00363 ShadowSubdomain::addSP_Constraint(SP_Constraint *theSP, int loadPattern)
00364 {
00365 #ifdef _G3DEBUG
00366         // do all the checking stuff
00367 #endif
00368 
00369   /*
00370   LoadPattern *thePattern = this->Subdomain::getLoadPattern(loadPattern);
00371   if ((thePattern == 0) || (thePattern->addSP_Constraint(theSP) == false)) {
00372     opserr << "ShadowSubdomain::addSP_Constraint() - could not add SP_Constraint: " << *theSP;
00373     return false;
00374   }
00375   */
00376 
00377   msgData(0) = ShadowActorSubdomain_addSP_ConstraintToPattern;
00378   msgData(1) = theSP->getClassTag();
00379   msgData(2) = theSP->getDbTag();
00380   msgData(3) = loadPattern;
00381   this->sendID(msgData);
00382   this->sendObject(*theSP);
00383   numSPs++;    
00384   // this->domainChange();
00385   
00386   return true;    
00387 }
00388 
00389 bool 
00390 ShadowSubdomain::addNodalLoad(NodalLoad *theLoad, int loadPattern)
00391 {
00392 #ifdef _G3DEBUG
00393   // do all the checking stuff
00394 #endif
00395 
00396   /*
00397   LoadPattern *thePattern = this->Subdomain::getLoadPattern(loadPattern);
00398   if ((thePattern == 0) || (thePattern->addNodalLoad(theLoad) == false)) {
00399     opserr << "ShadowSubdomain::addNodalLoad() - could not add the load: " << *theLoad;
00400     return false;
00401   }
00402   opserr << "ShadowSubdomain::addNodalLoad : " << this->getTag() << " " << theLoad->getNodeTag() << endln;
00403   */
00404 
00405   msgData(0) = ShadowActorSubdomain_addNodalLoadToPattern;
00406   msgData(1) = theLoad->getClassTag();
00407   msgData(2) = theLoad->getDbTag();
00408   msgData(3) = loadPattern;
00409   this->sendID(msgData);
00410   this->sendObject(*theLoad);
00411   
00412   return true;    
00413 }
00414 
00415 bool 
00416 ShadowSubdomain::addElementalLoad(ElementalLoad *theLoad, int loadPattern)
00417 {
00418 #ifdef _G3DEBUG
00419         // do all the checking stuff
00420 #endif
00421   LoadPattern *thePattern = this->Subdomain::getLoadPattern(loadPattern);
00422   if ((thePattern == 0) || (thePattern->addElementalLoad(theLoad) == false)) {
00423     opserr << "ShadowSubdomain::addElementalLoad() - could not add the load: " << *theLoad;
00424     return false;
00425   }
00426   msgData(0) = ShadowActorSubdomain_addElementalLoadToPattern;
00427   msgData(1) = theLoad->getClassTag();
00428   msgData(2) = theLoad->getDbTag();
00429   msgData(3) = loadPattern;
00430   this->sendID(msgData);
00431   this->sendObject(*theLoad);
00432 
00433   return true;    
00434 }
00435 
00436 
00437 bool 
00438 ShadowSubdomain::hasNode(int tag)
00439 {
00440     msgData(0) = ShadowActorSubdomain_hasNode;
00441     msgData(1) = tag;
00442     this->sendID(msgData);
00443     this->recvID(msgData);
00444     if (msgData(0) == 0)
00445       return true;
00446     else
00447       return false;
00448 }
00449 
00450 bool 
00451 ShadowSubdomain::hasElement(int tag)
00452 {
00453     msgData(0) = ShadowActorSubdomain_hasElement;
00454     msgData(1) = tag;
00455     this->sendID(msgData);
00456     this->recvID(msgData);
00457     if (msgData(0) == 0)
00458       return true;
00459     else
00460       return false;
00461 }
00462 
00463     
00464 Element  *
00465 ShadowSubdomain::removeElement(int tag)
00466 {
00467     int loc = theElements.removeValue(tag);
00468     if (loc < 0)
00469         return 0;
00470     else { // the element is there go get it
00471         // send a message to remove the object from the actor
00472         msgData(0) = ShadowActorSubdomain_removeElement;
00473         msgData(1) = tag;
00474         this->sendID(msgData);
00475 
00476         numElements--;
00477         // this->domainChange();        
00478 
00479         // get the element from the actor
00480         this->recvID(msgData);
00481         int theType = msgData(0);
00482         
00483         if (theType == -1) // the ele was not there!
00484             return 0;    
00485     
00486         Element *theEle = theBroker->getNewElement(theType);
00487         if (theEle != 0) 
00488             this->recvObject(*theEle);
00489     
00490         return theEle;
00491     }
00492 }
00493 
00494 Node     *
00495 ShadowSubdomain::removeNode(int tag)    
00496 {
00497     int loc = theNodes.removeValue(tag);
00498     if (loc < 0)
00499         return 0;
00500     else { // the node is there, go get it
00501         // send a message to actor requesting node
00502         msgData(0) = ShadowActorSubdomain_removeNode;
00503         msgData(1) = tag;
00504         this->sendID(msgData);
00505 
00506 
00507         numNodes--;
00508         // this->domainChange();        
00509         // remove from external as well
00510         loc = theExternalNodes.removeValue(tag);
00511         if (loc >= 0)
00512             numExternalNodes--;
00513         
00514         // receive the node from the actor
00515         this->recvID(msgData);
00516         int theType = msgData(0);
00517 
00518         if (theType == -1)
00519             return 0;
00520     
00521         Node *theNode = theBroker->getNewNode(theType);
00522         if (theNode != 0) {
00523             this->recvObject(*theNode);
00524             if (loc >= 0)
00525                 numDOF -= theNode->getNumberDOF();
00526         }
00527         return theNode;    
00528     }
00529 }
00530 
00531 SP_Constraint *
00532 ShadowSubdomain::removeSP_Constraint(int tag)
00533 {
00534   TaggedObject *mc = theShadowSPs->removeComponent(tag);
00535   if (mc == 0)
00536     return 0;
00537   
00538   msgData(0) = ShadowActorSubdomain_removeSP_Constraint;
00539   msgData(1) = tag;
00540   
00541   this->sendID(msgData);
00542   numSPs--;
00543   
00544   SP_Constraint *result = (SP_Constraint *)mc;    
00545   return result;
00546 }
00547 
00548 MP_Constraint *
00549 ShadowSubdomain::removeMP_Constraint(int tag)    
00550 {
00551   TaggedObject *mc = theShadowMPs->removeComponent(tag);
00552   if (mc == 0)
00553     return 0;
00554     
00555   msgData(0) = ShadowActorSubdomain_removeMP_Constraint;
00556   msgData(1) = tag;
00557     
00558   this->sendID(msgData);
00559 
00560   numMPs--;
00561 
00562   MP_Constraint *result = (MP_Constraint *)mc;    
00563   return result;
00564 }
00565 
00566 LoadPattern *
00567 ShadowSubdomain::removeLoadPattern(int loadTag)
00568 {
00569   TaggedObject *mc = theShadowLPs->removeComponent(loadTag);
00570   if (mc == 0)
00571     return 0;
00572   
00573   msgData(0) = ShadowActorSubdomain_removeLoadPattern;
00574   msgData(1) = loadTag;
00575 
00576   this->sendID(msgData);  
00577 
00578   LoadPattern *result = (LoadPattern *)mc;    
00579   return result;
00580 }
00581 
00582 NodalLoad *
00583 ShadowSubdomain::removeNodalLoad(int loadTag, int loadPattern)
00584 {
00585   // remove the object from the container            
00586   TaggedObject *mc = theShadowLPs->getComponentPtr(loadPattern);
00587   if (mc == 0)
00588     return 0;
00589 
00590   LoadPattern *theLoadPattern = (LoadPattern *)mc;    
00591   NodalLoad *res = theLoadPattern->removeNodalLoad(loadTag);
00592   if (res == 0)
00593     return 0;
00594   
00595   msgData(0) = ShadowActorSubdomain_removeNodalLoadFromPattern;
00596   msgData(1) = loadTag;
00597   msgData(2) = loadPattern;
00598   
00599   this->sendID(msgData);
00600   return res;
00601 }
00602 
00603 
00604 
00605 ElementalLoad *
00606 ShadowSubdomain::removeElementalLoad(int loadTag, int loadPattern)
00607 {
00608   // remove the object from the container            
00609   TaggedObject *mc = theShadowLPs->getComponentPtr(loadPattern);
00610   if (mc == 0)
00611     return 0;
00612 
00613   LoadPattern *theLoadPattern = (LoadPattern *)mc;    
00614   ElementalLoad *res = theLoadPattern->removeElementalLoad(loadTag);
00615   if (res == 0)
00616     return 0;
00617     
00618   msgData(0) = ShadowActorSubdomain_removeElementalLoadFromPattern;
00619   msgData(1) = loadTag;
00620   msgData(2) = loadPattern;
00621   
00622   this->sendID(msgData);
00623   return res;
00624 }
00625 
00626 SP_Constraint *
00627 ShadowSubdomain::removeSP_Constraint(int loadTag, int loadPattern)
00628 {
00629   // remove the object from the container            
00630   TaggedObject *mc = theShadowLPs->getComponentPtr(loadPattern);
00631   if (mc == 0)
00632     return 0;
00633 
00634   LoadPattern *theLoadPattern = (LoadPattern *)mc;    
00635   SP_Constraint *res = theLoadPattern->removeSP_Constraint(loadTag);
00636   if (res == 0)
00637     return 0;
00638   
00639   msgData(0) = ShadowActorSubdomain_removeSP_ConstraintFromPattern;
00640   msgData(1) = loadTag;
00641   msgData(2) = loadPattern;
00642   
00643   this->sendID(msgData);
00644   return res;
00645 }
00646 
00647 
00648 ElementIter       &
00649 ShadowSubdomain::getElements()
00650 {
00651   opserr << "ShadowSubdomain::getElements() ";
00652   opserr << " - SHOULD NEVER BE CALLED - EXITING\n";
00653   exit(-1);
00654   
00655   // this will never be called - just for a strict compiler    
00656   ArrayOfTaggedObjects *theEror = new ArrayOfTaggedObjects(1);
00657   ElementIter *theIter = new SingleDomEleIter(theEror);
00658   return *theIter;
00659 }
00660 
00661 NodeIter          &
00662 ShadowSubdomain::getNodes()
00663 {
00664     opserr << "ShadowSubdomain::getNodes() ";
00665     opserr << " - SHOULD NEVER BE CALLED - EXITING\n";
00666     exit(-1);
00667 
00668     // this will never be called - just for a strict compiler
00669     ArrayOfTaggedObjects *theEror = new ArrayOfTaggedObjects(1);
00670     NodeIter *theIter = new SingleDomNodIter(theEror);
00671     return *theIter;
00672 }
00673 
00674 NodeIter &
00675 ShadowSubdomain::getInternalNodeIter(void)
00676 {
00677     opserr << "ShadowSubdomain::getInternalNodeIter() ";
00678     opserr << " - SHOULD NEVER BE CALLED - EXITING\n";
00679     exit(-1);
00680 
00681     // this will never be called - just for a strict compiler
00682     ArrayOfTaggedObjects *theEror = new ArrayOfTaggedObjects(1);
00683     NodeIter *theIter = new SingleDomNodIter(theEror);
00684     return *theIter;
00685 }
00686 
00687 NodeIter          &
00688 ShadowSubdomain::getExternalNodeIter(void)
00689 {
00690     opserr << "ShadowSubdomain::getExternalNodeIter() ";
00691     opserr << " - SHOULD NEVER BE CALLED - EXITING\n";
00692     exit(-1);
00693 
00694     // this will never be called - just for a strict compiler
00695     ArrayOfTaggedObjects *theEror = new ArrayOfTaggedObjects(1);
00696     NodeIter *theIter = new SingleDomNodIter(theEror);
00697     return *theIter;
00698 }
00699 
00700     
00701 Element *
00702 ShadowSubdomain::getElementPtr(int tag) 
00703 {
00704     if (theElements.getLocation(tag) < 0)
00705         return 0;
00706     
00707     msgData(0) = ShadowActorSubdomain_getElementPtr;
00708     msgData(1) = tag;
00709     this->sendID(msgData);
00710     this->recvID(msgData);
00711     int theType = msgData(0);
00712     
00713     Element *theEle = theBroker->getNewElement(theType);
00714     if (theEle != 0) {
00715         this->recvObject(*theEle);
00716     }
00717     opserr << "ShadowSubdomain::getElementPtr() ";
00718     opserr << " - SHOULD BE AVOIDED IF POSSIBLE \n";
00719     
00720     return theEle;
00721 }
00722 
00723 Node  *
00724 ShadowSubdomain::getNodePtr(int tag)
00725 {
00726     if (theNodes.getLocation(tag) < 0)
00727         return 0;
00728     
00729     msgData(0) = ShadowActorSubdomain_getNodePtr;
00730     msgData(1) = tag;
00731     this->sendID(msgData);
00732     this->recvID(msgData);
00733     int theType = msgData(0);
00734     
00735     Node *theNod = theBroker->getNewNode(theType);
00736     if (theNod != 0) {
00737         this->recvObject(*theNod);
00738     }
00739     opserr << "ShadowSubdomain::getNodPtr() ";
00740     opserr << " - SHOULD BE AVOIDED IF POSSIBLE \n";
00741     
00742     return theNod;
00743 }
00744 
00745 int 
00746 ShadowSubdomain::getNumElements(void) const
00747 {
00748     return numElements;
00749 }
00750 
00751 int 
00752 ShadowSubdomain::getNumLoadPatterns(void) const
00753 {
00754     return numLoadPatterns;
00755 }
00756 
00757 int 
00758 ShadowSubdomain::getNumNodes(void) const
00759 {
00760     return numNodes;
00761 }
00762 
00763 int 
00764 ShadowSubdomain::getNumSPs(void) const
00765 {
00766     return numSPs;
00767 }
00768 
00769 int 
00770 ShadowSubdomain::getNumMPs(void) const
00771 {
00772     return numMPs;
00773 }
00774 
00775     
00776 Graph &
00777 ShadowSubdomain::getElementGraph(void)
00778 {
00779     opserr << "ShadowSubdomain::getElementGraph() ";
00780     opserr << " - NOT YET IMPLEMENTED - EXITING\n";
00781     exit(-1);
00782 
00783     // this will never be called, needed for a strict compiler
00784     Graph *theGraph = new Graph;
00785     return *theGraph;
00786 }
00787 
00788 Graph             &
00789 ShadowSubdomain::getNodeGraph(void)
00790 {
00791     opserr << "ShadowSubdomain::getNodeGraph() ";
00792     opserr << " - NOT YET IMPLEMENTED - EXITING\n";
00793     exit(-1);
00794 
00795     // this will never be called, needed for a strict compiler
00796     Graph *theGraph = new Graph;
00797     return *theGraph;
00798 }
00799 
00800     
00801 void 
00802 ShadowSubdomain::applyLoad(double time)
00803 {
00804   DomainDecompositionAnalysis *theDDA = this->getDDAnalysis();
00805   if (theDDA != 0 && theDDA->doesIndependentAnalysis() != true) {
00806     msgData(0) = ShadowActorSubdomain_applyLoad;
00807     Vector data(4);
00808     data(0) = time;
00809   
00810     this->sendID(msgData);
00811     this->sendVector(data);    
00812   }
00813 }
00814 
00815 
00816 void 
00817 ShadowSubdomain::setCommitTag(int newTag)
00818 {
00819     msgData(0) = ShadowActorSubdomain_setCommitTag;
00820     msgData(1) = newTag;
00821 
00822     //    this->sendID(msgData);
00823 }
00824 
00825 void 
00826 ShadowSubdomain::setCurrentTime(double time)
00827 {
00828   DomainDecompositionAnalysis *theDDA = this->getDDAnalysis();
00829   if (theDDA != 0 && theDDA->doesIndependentAnalysis() != true) {
00830     msgData(0) = ShadowActorSubdomain_setCurrentTime;
00831     Vector data(4);
00832     data(0) = time;
00833 
00834     this->sendID(msgData);
00835     this->sendVector(data);    
00836   }
00837 }
00838 
00839 void 
00840 ShadowSubdomain::setCommittedTime(double time)
00841 {
00842     msgData(0) = ShadowActorSubdomain_setCommittedTime;
00843     Vector data(4);
00844     data(0) = time;
00845     
00846     this->sendID(msgData);
00847     this->sendVector(data);    
00848 }
00849 
00850 void 
00851 ShadowSubdomain::setLoadConstant(void)
00852 {
00853     msgData(0) = ShadowActorSubdomain_setLoadConstant;
00854     
00855     this->sendID(msgData);
00856 }
00857 
00858 
00859 int
00860 ShadowSubdomain::update(void)
00861 {
00862   DomainDecompositionAnalysis *theDDA = this->getDDAnalysis();
00863   if (theDDA != 0 && theDDA->doesIndependentAnalysis() != true) {
00864     msgData(0) =  ShadowActorSubdomain_update;
00865     this->sendID(msgData);
00866   }
00867   return 0;
00868 }
00869 
00870 int
00871 ShadowSubdomain::update(double newTime, double dT)
00872 {
00873   static Vector data(2);
00874   DomainDecompositionAnalysis *theDDA = this->getDDAnalysis();
00875   if (theDDA != 0 && theDDA->doesIndependentAnalysis() != true) {
00876     msgData(0) =  ShadowActorSubdomain_updateTimeDt;
00877     this->sendID(msgData);
00878     data(0) = newTime;
00879     data(1) = dT;
00880     this->sendVector(data);
00881   }
00882 
00883   return 0;
00884 }
00885 
00886 
00887 int
00888 ShadowSubdomain::barrierCheckIN(void)
00889 {
00890   static ID data(1);
00891   this->recvID(data);
00892   return data(0);
00893 }
00894 
00895 int
00896 ShadowSubdomain::barrierCheckOUT(int result)
00897 {
00898   static ID data(1);
00899   data(0) = result;
00900   this->sendID(data);
00901 
00902   return 0;
00903 }
00904 
00905 
00906 
00907 int
00908 ShadowSubdomain::setRayleighDampingFactors(double alphaM, double betaK, double betaK0, double betaKc)
00909 {
00910   msgData(0) = ShadowActorSubdomain_setRayleighDampingFactors;
00911   this->sendID(msgData);
00912   static Vector data(4);
00913   data(0) = alphaM;
00914   data(1) = betaK;
00915   data(2) = betaK0;
00916   data(3) = betaKc;
00917   this->sendVector(data);
00918 
00919   return 0;
00920 }
00921 
00922 
00923 
00924 
00925 void
00926 ShadowSubdomain::clearAll(void)
00927 {
00928   msgData(0) = ShadowActorSubdomain_clearAll;
00929   this->sendID(msgData);
00930   this->recvID(msgData);
00931 }
00932 
00933 
00934 int  
00935 ShadowSubdomain::addRecorder(Recorder &theRecorder)
00936 {
00937   msgData(0) = ShadowActorSubdomain_addRecorder;
00938   msgData(1) = theRecorder.getClassTag();
00939   this->sendID(msgData);
00940   this->sendObject(theRecorder);  
00941   return 0;
00942 }
00943 
00944 int  
00945 ShadowSubdomain::removeRecorders(void)
00946 {
00947   msgData(0) = ShadowActorSubdomain_removeRecorders;
00948   this->sendID(msgData);
00949   return 0;
00950 }
00951 
00952 int
00953 ShadowSubdomain::commit(void)
00954 {
00955   DomainDecompositionAnalysis *theDDA = this->getDDAnalysis();
00956   if (theDDA != 0 && theDDA->doesIndependentAnalysis() != true) {
00957     msgData(0) = ShadowActorSubdomain_commit;
00958     this->sendID(msgData);
00959     return 0;
00960   }
00961   return 0;
00962 }
00963 
00964 int
00965 ShadowSubdomain::revertToLastCommit(void)
00966 {
00967   DomainDecompositionAnalysis *theDDA = this->getDDAnalysis();
00968   if (theDDA != 0 && theDDA->doesIndependentAnalysis() != true) {
00969     msgData(0) = ShadowActorSubdomain_revertToLastCommit;
00970     this->sendID(msgData);
00971     return 0;
00972   }
00973   return 0;
00974 }
00975 
00976 int
00977 ShadowSubdomain::revertToStart(void)
00978 {
00979   msgData(0) = ShadowActorSubdomain_revertToStart;
00980   this->sendID(msgData);
00981   return 0;
00982 }
00983 
00984 
00985 void 
00986 ShadowSubdomain::wipeAnalysis(void)
00987 {
00988   msgData(0) = ShadowActorSubdomain_wipeAnalysis;
00989     
00990   this->sendID(msgData);
00991 }
00992 
00993 void 
00994 ShadowSubdomain::setDomainDecompAnalysis(DomainDecompositionAnalysis &theDDAnalysis)
00995 {
00996     msgData(0) = ShadowActorSubdomain_setDomainDecompAnalysis;
00997     msgData(1) = theDDAnalysis.getClassTag();
00998     
00999     this->sendID(msgData);
01000     this->sendObject(theDDAnalysis);
01001 
01002     this->Subdomain::setDomainDecompAnalysis(theDDAnalysis);
01003 }
01004 
01005 int 
01006 ShadowSubdomain::setAnalysisAlgorithm(EquiSolnAlgo &theAlgorithm)
01007 {
01008     msgData(0) = ShadowActorSubdomain_setAnalysisAlgorithm;
01009     msgData(1) = theAlgorithm.getClassTag();
01010     
01011     this->sendID(msgData);
01012     this->sendObject(theAlgorithm);
01013     return 0;
01014 }
01015 
01016 int 
01017 ShadowSubdomain::setAnalysisIntegrator(IncrementalIntegrator &theIntegrator)
01018 {
01019     msgData(0) = ShadowActorSubdomain_setAnalysisIntegrator;
01020     msgData(1) = theIntegrator.getClassTag();
01021     
01022     this->sendID(msgData);
01023     this->sendObject(theIntegrator);
01024     return 0;
01025 }
01026 
01027 int 
01028 ShadowSubdomain::setAnalysisLinearSOE(LinearSOE &theSOE)
01029 {
01030     msgData(0) = ShadowActorSubdomain_setAnalysisLinearSOE;
01031     msgData(1) = theSOE.getClassTag();
01032 
01033     LinearSOESolver *theSolver = theSOE.getSolver();
01034     msgData(2) = theSolver->getClassTag();    
01035 
01036     this->sendID(msgData);
01037     this->sendObject(theSOE);
01038     this->sendObject(*theSolver);
01039 
01040     return 0;
01041 }
01042 
01043 int 
01044 ShadowSubdomain::setAnalysisConvergenceTest(ConvergenceTest &theTest)
01045 {
01046     msgData(0) = ShadowActorSubdomain_setAnalysisConvergenceTest;
01047     msgData(1) = theTest.getClassTag();
01048 
01049     this->sendID(msgData);
01050     this->sendObject(theTest);
01051 
01052     opserr << "ShadowSubdomain::setAnalysisConvergenceTest(ConvergenceTest &theTest)\n";
01053     return 0;
01054 }
01055 
01056 
01057 
01058 void
01059 ShadowSubdomain::domainChange(void)
01060 {
01061     msgData(0) = ShadowActorSubdomain_domainChange;
01062     this->sendID(msgData);
01063     
01064     if (theVector == 0)
01065         theVector = new Vector(numDOF);
01066     else if (theVector->Size() != numDOF) {
01067         delete theVector;
01068         theVector = new Vector(numDOF);
01069     }
01070     
01071     if (theMatrix == 0)
01072         theMatrix = new Matrix(numDOF,numDOF);
01073     else if (theMatrix->noRows() != numDOF) {
01074         delete theMatrix;
01075         theMatrix = new Matrix(numDOF,numDOF);
01076     }    
01077 }
01078 
01079 void 
01080 ShadowSubdomain::clearAnalysis(void)
01081 {
01082     msgData(0) = ShadowActorSubdomain_clearAnalysis;
01083     this->sendID(msgData);
01084 }
01085 
01086 int     
01087 ShadowSubdomain::getNumExternalNodes(void) const    
01088 {
01089   if (gotRemoteData == false && buildRemote == true) {    
01090     opserr << "WARNING: ShadowSubdomain::getNumExternalNodes()";
01091     opserr << " - not yet received the data\n";
01092   }
01093   
01094   return numExternalNodes;
01095 }
01096 
01097 const ID   &
01098 ShadowSubdomain::getExternalNodes(void)
01099 {
01100   // if the subdoamin was built remotly need to get it's data
01101   if (gotRemoteData == false && buildRemote == true)
01102     this->getRemoteData();
01103 
01104     return theExternalNodes;
01105 }
01106 
01107 int     
01108 ShadowSubdomain::getNumDOF(void)
01109 {
01110   // if the subdoamin was built remotly need to get it's data
01111   if (gotRemoteData == false && buildRemote == true)
01112     this->getRemoteData();
01113 
01114     return numDOF;
01115 }
01116 
01117 
01118 const Matrix &
01119 ShadowSubdomain::getTang(void)    
01120 {
01121   // if the subdoamin was built remotly need to get it's data
01122   if (gotRemoteData == false && buildRemote == true)
01123     this->getRemoteData();
01124 
01125     msgData(0) =  ShadowActorSubdomain_getTang;
01126     this->sendID(msgData);
01127     
01128     if (theMatrix == 0)
01129         theMatrix = new Matrix(numDOF,numDOF);
01130     else if (theMatrix->noRows() != numDOF) {
01131         delete theMatrix;
01132         theMatrix = new Matrix(numDOF,numDOF);
01133     }    
01134     
01135     this->recvMatrix(*theMatrix);
01136     return *theMatrix;
01137 }
01138 
01139 
01140 
01141 const Vector &
01142 ShadowSubdomain::getResistingForce(void)    
01143 {
01144   // if the subdoamin was built remotly need to get it's data
01145   if (gotRemoteData == false && buildRemote == true)
01146     this->getRemoteData();
01147 
01148     msgData(0) = ShadowActorSubdomain_getResistingForce;
01149     this->sendID(msgData);
01150     
01151     if (theVector == 0)
01152         theVector = new Vector(numDOF);
01153     else if (theVector->Size() != numDOF) {
01154         delete theVector;
01155         theVector = new Vector(numDOF);
01156     }    
01157     
01158     this->recvVector(*theVector);
01159     return *theVector;
01160 }
01161 
01162 
01163 int       
01164 ShadowSubdomain::computeTang(void)
01165 {
01166     count++;
01167 
01168     if (count == 1) {
01169       msgData(0) = ShadowActorSubdomain_computeTang;
01170       msgData(1) = this->getTag();
01171       this->sendID(msgData);
01172 
01173       for (int i = 0; i < numShadowSubdomains; i++) {
01174         ShadowSubdomain *theShadow = theShadowSubdomains[i];
01175         if (theShadow != this)
01176           theShadow->computeTang();
01177       }
01178     }
01179     else if (count <= numShadowSubdomains) {
01180       msgData(0) = ShadowActorSubdomain_computeTang;
01181       msgData(1) = this->getTag();
01182       this->sendID(msgData);
01183     }
01184     else if (count == 2*numShadowSubdomains - 1)
01185       count = 0;
01186     
01187     return 0;
01188 }
01189 
01190 int  
01191 ShadowSubdomain::computeResidual(void)
01192 {
01193     count++;
01194 
01195     if (count == 1) {
01196       msgData(0) = ShadowActorSubdomain_computeResidual;
01197       this->sendID(msgData);
01198 
01199       for (int i = 0; i < numShadowSubdomains; i++) {
01200         ShadowSubdomain *theShadow = theShadowSubdomains[i];
01201         if (theShadow != this)
01202           theShadow->computeResidual();
01203       }
01204     }
01205     else if (count <= numShadowSubdomains) {
01206       msgData(0) = ShadowActorSubdomain_computeResidual;
01207       this->sendID(msgData);
01208     }
01209     else if (count == 2*numShadowSubdomains - 1)
01210       count = 0;
01211 
01212     return 0;
01213 }
01214 
01215 
01216 
01217 const Vector &
01218 ShadowSubdomain::getLastExternalSysResponse(void)
01219 {
01220     opserr << "ShadowSubdomain::getLastExternalSysResponse() ";
01221     opserr << " SHOULD NEVER BE CALLED\n";
01222     exit(0);
01223 
01224     // this should never be called, provided for a strict compiler
01225     Vector *theVect = new Vector(0);
01226     return *theVect;
01227 }
01228 
01229 int 
01230 ShadowSubdomain::computeNodalResponse(void)    
01231 {
01232 
01233   DomainDecompositionAnalysis *theDDA = this->getDDAnalysis();
01234   if (theDDA != 0 && theDDA->doesIndependentAnalysis() != true) {
01235     FE_Element *theFePtr = this->getFE_ElementPtr();
01236 
01237     if (theFePtr != 0) {
01238 
01239       const Vector &lastChange = theFePtr->getLastResponse();
01240       msgData(0) =  ShadowActorSubdomain_computeNodalResponse;
01241       msgData(1) = lastChange.Size();
01242       if (numDOF != msgData(1)) {
01243         opserr << "ShadowSubdomain::update(void)";
01244         opserr << " - numDOF " << numDOF << " and size of Vector ";
01245         opserr << msgData(1) << "do not agree?\n";
01246         numDOF = msgData(1);
01247       }
01248       this->sendID(msgData);
01249       Vector theChange(lastChange);
01250       this->sendVector(theChange);
01251     }
01252   }
01253   
01254   return 0;
01255 }
01256 
01257 
01258 int 
01259 ShadowSubdomain::newStep(double dT)    
01260 {
01261     msgData(0) =  ShadowActorSubdomain_newStep;
01262     this->sendID(msgData);
01263     static Vector timeStep(4);
01264     timeStep(0) = dT;
01265     this->sendVector(timeStep);
01266     return 0;
01267 }
01268 
01269 
01270 double
01271 ShadowSubdomain::getCost(void)    
01272 {
01273   /*
01274     msgData(0) = ShadowActorSubdomain_getCost;
01275     
01276     this->sendID(msgData);
01277     Vector cost(2);
01278     this->recvVector(cost);
01279     return cost(0);
01280   */
01281   return 0.0;
01282 }
01283 
01284 
01285 int 
01286 ShadowSubdomain::sendSelf(int cTag, Channel &the_Channel)
01287 {
01288     opserr << "ShadowSubdomain::sendSelf() ";
01289     opserr << " - NOT YET IMPLEMENTED\n";
01290     return -1;
01291 }
01292 
01293 int 
01294 ShadowSubdomain::recvSelf(int cTag, Channel &the_Channel, 
01295                           FEM_ObjectBroker &the_Broker)    
01296 {
01297     opserr << "ShadowSubdomain::recvSelf() ";
01298     opserr << " - NOT YET IMPLEMENTED\n";
01299     return -1;
01300 }
01301 
01302 
01303 void 
01304 ShadowSubdomain::Print(OPS_Stream &s, int flag)
01305 {
01306     msgData(0) = ShadowActorSubdomain_Print;
01307     
01308     this->sendID(msgData);
01309     this->recvID(msgData);
01310 }
01311 
01312 
01313 int 
01314 ShadowSubdomain::buildEleGraph(Graph *theEleGraph)
01315 {
01316     opserr << "ShadowSubdomain::buildEleGraph() ";
01317     opserr << " - NOT YET IMPLEMENTED\n";
01318     return -1;
01319 }
01320 
01321 int 
01322 ShadowSubdomain::buildNodeGraph(Graph *theNodeGraph)
01323 {
01324     opserr << "ShadowSubdomain::buildNodeGraph() ";
01325     opserr << " - NOT YET IMPLEMENTED\n";
01326     return -1;
01327 }
01328 
01329 int
01330 ShadowSubdomain::buildMap(void)
01331 {
01332   mapBuilt = true;
01333   return 0;
01334 }
01335 
01336 
01337 
01338 double
01339 ShadowSubdomain::getNodeDisp(int nodeTag, int dof, int &errorFlag)
01340 {
01341   static Vector data(1); 
01342   data(0) = 0.0;
01343   
01344   msgData(0) = ShadowActorSubdomain_getNodeDisp;
01345   msgData(1) = nodeTag;
01346   msgData(2) = dof;
01347   this->sendID(msgData);
01348   this->recvID(msgData);
01349   errorFlag = msgData(0);
01350   if (errorFlag == 0) {
01351     this->recvVector(data);
01352   }
01353 
01354   return data(0);
01355 }
01356 
01357 int 
01358 ShadowSubdomain::setMass(const Matrix &mass, int nodeTag)
01359 {
01360   msgData(0) = ShadowActorSubdomain_setMass;
01361   msgData(1) = nodeTag;
01362   msgData(2) = mass.noRows();
01363   msgData(3) = mass.noCols();
01364   this->sendID(msgData);
01365   this->sendMatrix(mass);
01366   this->recvID(msgData);
01367   return msgData(0);
01368 }
01369 
01370 
01371 
01372 
01373 
01374 

Generated on Mon Oct 23 15:05:03 2006 for OpenSees by doxygen 1.5.0