| 71 | } |
| 72 | |
| 73 | int |
| 74 | PlainHandler::handle(const ID *nodesLast) |
| 75 | { |
| 76 | // first check links exist to a Domain and an AnalysisModel object |
| 77 | Domain *theDomain = this->getDomainPtr(); |
| 78 | AnalysisModel *theModel = this->getAnalysisModelPtr(); |
| 79 | Integrator *theIntegrator = this->getIntegratorPtr(); |
| 80 | |
| 81 | if ((theDomain == 0) || (theModel == 0) || (theIntegrator == 0)) { |
| 82 | opserr << "WARNING PlainHandler::handle() - "; |
| 83 | opserr << " setLinks() has not been called\n"; |
| 84 | return -1; |
| 85 | } |
| 86 | |
| 87 | // get all SPs |
| 88 | std::multimap<int,SP_Constraint*> allSPs; |
| 89 | SP_ConstraintIter &theSPs = theDomain->getDomainAndLoadPatternSPs(); |
| 90 | SP_Constraint *theSP; |
| 91 | while ((theSP = theSPs()) != 0) { |
| 92 | if (theSP->isHomogeneous() == false) { |
| 93 | opserr << "WARNING PlainHandler::handle() - "; |
| 94 | opserr << " non-homogeneos constraint"; |
| 95 | opserr << " for node " << theSP->getNodeTag(); |
| 96 | opserr << " homogeneous constraint assumed\n"; |
| 97 | } |
| 98 | allSPs.insert(std::make_pair(theSP->getNodeTag(),theSP)); |
| 99 | } |
| 100 | |
| 101 | // initialise the DOF_Groups and add them to the AnalysisModel. |
| 102 | // : must of course set the initial IDs |
| 103 | NodeIter &theNod = theDomain->getNodes(); |
| 104 | Node *nodPtr; |
| 105 | SP_Constraint *spPtr; |
| 106 | DOF_Group *dofPtr; |
| 107 | |
| 108 | int numDOF = 0; |
| 109 | int count3 = 0; |
| 110 | int countDOF =0; |
| 111 | while ((nodPtr = theNod()) != 0) { |
| 112 | if ((dofPtr = new DOF_Group(numDOF++, nodPtr)) == 0) { |
| 113 | opserr << "WARNING PlainHandler::handle() - ran out of memory"; |
| 114 | opserr << " creating DOF_Group " << numDOF << endln; |
| 115 | return -4; |
| 116 | } |
| 117 | // initially set all the ID value to -2 |
| 118 | const ID &id = dofPtr->getID(); |
| 119 | for (int j=0; j < id.Size(); j++) { |
| 120 | dofPtr->setID(j,-2); |
| 121 | countDOF++; |
| 122 | } |
| 123 | // loop through the SP_Constraints to see if any of the |
| 124 | // DOFs are constrained, if so set initial ID value to -1 |
| 125 | int nodeID = nodPtr->getTag(); |
| 126 | std::multimap<int,SP_Constraint*>::iterator first = allSPs.lower_bound(nodeID); |
| 127 | std::multimap<int,SP_Constraint*>::iterator last = allSPs.upper_bound(nodeID); |
| 128 | for(std::multimap<int,SP_Constraint*>::iterator it=first; it!=last; it++) { |
| 129 | spPtr = it->second; |
| 130 | const ID &id = dofPtr->getID(); |
no test coverage detected