| 210 | |
| 211 | |
| 212 | int |
| 213 | BFGS::solveCurrentStep(void) |
| 214 | { |
| 215 | |
| 216 | // set up some pointers and check they are valid |
| 217 | // NOTE this could be taken away if we set Ptrs as protecetd in superclass |
| 218 | |
| 219 | AnalysisModel *theAnaModel = this->getAnalysisModelPtr(); |
| 220 | |
| 221 | IncrementalIntegrator *theIntegrator = this->getIncrementalIntegratorPtr(); |
| 222 | |
| 223 | LinearSOE *theSOE = this->getLinearSOEptr(); |
| 224 | |
| 225 | if ((theAnaModel == 0) || (theIntegrator == 0) || (theSOE == 0) |
| 226 | || (theTest == 0)){ |
| 227 | opserr << "WARNING BFGS::solveCurrentStep() - setLinks() has"; |
| 228 | opserr << " not been called - or no ConvergenceTest has been set\n"; |
| 229 | return -5; |
| 230 | } |
| 231 | |
| 232 | // set itself as the ConvergenceTest objects EquiSolnAlgo |
| 233 | theTest->setEquiSolnAlgo(*this); |
| 234 | if (theTest->start() < 0) { |
| 235 | opserr << "BFGS::solveCurrentStep() -"; |
| 236 | opserr << "the ConvergenceTest object failed in start()\n"; |
| 237 | return -3; |
| 238 | } |
| 239 | |
| 240 | localTest->setEquiSolnAlgo(*this); |
| 241 | |
| 242 | if (rdotz == 0) |
| 243 | rdotz = new double[numberLoops+3]; |
| 244 | |
| 245 | if (sdotr == 0) |
| 246 | sdotr = new double[numberLoops+3]; |
| 247 | |
| 248 | |
| 249 | int result = -1; |
| 250 | int count = 0; |
| 251 | do { |
| 252 | |
| 253 | // opserr << " BFGS -- Forming New Tangent" << endln; |
| 254 | |
| 255 | //form the initial tangent |
| 256 | if (theIntegrator->formTangent(tangent) < 0){ |
| 257 | opserr << "WARNING BFGS::solveCurrentStep() -"; |
| 258 | opserr << "the Integrator failed in formTangent()\n"; |
| 259 | return -1; |
| 260 | } |
| 261 | |
| 262 | //form the initial residual |
| 263 | if (theIntegrator->formUnbalance() < 0) { |
| 264 | opserr << "WARNING BFGS::solveCurrentStep() -"; |
| 265 | opserr << "the Integrator failed in formUnbalance()\n"; |
| 266 | } |
| 267 | |
| 268 | //solve |
| 269 | if (theSOE->solve() < 0) { |
no test coverage detected