| 82 | } |
| 83 | |
| 84 | int |
| 85 | LagrangeConstraintHandler::handle(const ID *nodesLast) |
| 86 | { |
| 87 | // first check links exist to a Domain and an AnalysisModel object |
| 88 | Domain *theDomain = this->getDomainPtr(); |
| 89 | AnalysisModel *theModel = this->getAnalysisModelPtr(); |
| 90 | Integrator *theIntegrator = this->getIntegratorPtr(); |
| 91 | |
| 92 | if ((theDomain == 0) || (theModel == 0) || (theIntegrator == 0)) { |
| 93 | opserr << "WARNING LagrangeConstraintHandler::handle() - "; |
| 94 | opserr << " setLinks() has not been called\n"; |
| 95 | return -1; |
| 96 | } |
| 97 | |
| 98 | // get number of elements and nodes in the domain |
| 99 | // and init the theFEs and theDOFs arrays |
| 100 | |
| 101 | int numConstraints = 0; |
| 102 | SP_ConstraintIter &theSPss = theDomain->getDomainAndLoadPatternSPs(); |
| 103 | SP_Constraint *spPtr; |
| 104 | while ((spPtr = theSPss()) != 0) |
| 105 | numConstraints++; |
| 106 | |
| 107 | numConstraints += theDomain->getNumMPs(); |
| 108 | numConstraints += theDomain->getNumEQs(); |
| 109 | |
| 110 | //create a DOF_Group for each Node and add it to the AnalysisModel. |
| 111 | // : must of course set the initial IDs |
| 112 | NodeIter &theNod = theDomain->getNodes(); |
| 113 | Node *nodPtr; |
| 114 | MP_Constraint *mpPtr; |
| 115 | EQ_Constraint *eqPtr; |
| 116 | DOF_Group *dofPtr; |
| 117 | |
| 118 | int numDofGrp = 0; |
| 119 | int count3 = 0; |
| 120 | int countDOF =0; |
| 121 | while ((nodPtr = theNod()) != 0) { |
| 122 | if ((dofPtr = new DOF_Group(numDofGrp++, nodPtr)) == 0) { |
| 123 | opserr << "WARNING LagrangeConstraintHandler::handle() "; |
| 124 | opserr << "- ran out of memory"; |
| 125 | opserr << " creating DOF_Group " << numDofGrp++ << endln; |
| 126 | return -4; |
| 127 | } |
| 128 | // initially set all the ID value to -2 |
| 129 | |
| 130 | const ID &id = dofPtr->getID(); |
| 131 | for (int j=0; j < id.Size(); j++) { |
| 132 | dofPtr->setID(j,-2); |
| 133 | countDOF++; |
| 134 | } |
| 135 | |
| 136 | nodPtr->setDOF_GroupPtr(dofPtr); |
| 137 | theModel->addDOF_Group(dofPtr); |
| 138 | } |
| 139 | |
| 140 | // create the FE_Elements for the Elements and add to the AnalysisModel |
| 141 | ElementIter &theEle = theDomain->getElements(); |
nothing calls this directly
no test coverage detected