| 196 | |
| 197 | |
| 198 | int |
| 199 | Broyden::solveCurrentStep(void) |
| 200 | { |
| 201 | |
| 202 | // set up some pointers and check they are valid |
| 203 | // NOTE this could be taken away if we set Ptrs as protecetd in superclass |
| 204 | AnalysisModel *theAnaModel = this->getAnalysisModelPtr(); |
| 205 | |
| 206 | IncrementalIntegrator *theIntegrator = this->getIncrementalIntegratorPtr(); |
| 207 | |
| 208 | LinearSOE *theSOE = this->getLinearSOEptr(); |
| 209 | |
| 210 | |
| 211 | if ((theAnaModel == 0) || (theIntegrator == 0) || (theSOE == 0) |
| 212 | || (theTest == 0)){ |
| 213 | opserr << "WARNING Broyden::solveCurrentStep() - setLinks() has"; |
| 214 | opserr << " not been called - or no ConvergenceTest has been set\n"; |
| 215 | return -5; |
| 216 | } |
| 217 | |
| 218 | // set itself as the ConvergenceTest objects EquiSolnAlgo |
| 219 | theTest->setEquiSolnAlgo(*this); |
| 220 | if (theTest->start() < 0) { |
| 221 | opserr << "Broyden::solveCurrentStep() -"; |
| 222 | opserr << "the ConvergenceTest object failed in start()\n"; |
| 223 | return -3; |
| 224 | } |
| 225 | |
| 226 | localTest->setEquiSolnAlgo(*this); |
| 227 | |
| 228 | int result = -1 ; |
| 229 | int count = 0 ; |
| 230 | do { |
| 231 | |
| 232 | // opserr << " Broyden -- Forming New Tangent" << endln ; |
| 233 | |
| 234 | //form the initial tangent |
| 235 | if (theIntegrator->formTangent(tangent) < 0){ |
| 236 | opserr << "WARNING Broyden::solveCurrentStep() -"; |
| 237 | opserr << "the Integrator failed in formTangent()\n"; |
| 238 | return -1; |
| 239 | } |
| 240 | |
| 241 | //form the initial residual |
| 242 | if (theIntegrator->formUnbalance() < 0) { |
| 243 | opserr << "WARNING Broyden::solveCurrentStep() -"; |
| 244 | opserr << "the Integrator failed in formUnbalance()\n"; |
| 245 | } |
| 246 | |
| 247 | //solve |
| 248 | if (theSOE->solve() < 0) { |
| 249 | opserr << "WARNING Broyden::solveCurrentStep() -"; |
| 250 | opserr << "the LinearSysOfEqn failed in solve()\n"; |
| 251 | return -3; |
| 252 | } |
| 253 | |
| 254 | //update |
| 255 | if ( theIntegrator->update(theSOE->getX() ) < 0) { |
nothing calls this directly
no test coverage detected