| 92 | } |
| 93 | |
| 94 | int |
| 95 | KrylovNewton::solveCurrentStep(void) |
| 96 | { |
| 97 | // set up some pointers and check they are valid |
| 98 | // NOTE this could be taken away if we set Ptrs as protecetd in superclass |
| 99 | AnalysisModel *theAnaModel = this->getAnalysisModelPtr(); |
| 100 | IncrementalIntegrator *theIntegrator = this->getIncrementalIntegratorPtr(); |
| 101 | LinearSOE *theSOE = this->getLinearSOEptr(); |
| 102 | |
| 103 | if ((theAnaModel == 0) || (theIntegrator == 0) || (theSOE == 0) |
| 104 | || (theTest == 0)){ |
| 105 | opserr << "WARNING KrylovNewton::solveCurrentStep() - setLinks() has"; |
| 106 | opserr << " not been called - or no ConvergenceTest has been set\n"; |
| 107 | return -5; |
| 108 | } |
| 109 | |
| 110 | // Get size information from SOE |
| 111 | numEqns = theSOE->getNumEqn(); |
| 112 | if (maxDimension > numEqns) |
| 113 | maxDimension = numEqns; |
| 114 | |
| 115 | if (v == 0) { |
| 116 | // Need to allocate an extra vector for "next" update |
| 117 | v = new Vector*[maxDimension+1]; |
| 118 | for (int i = 0; i < maxDimension+1; i++) |
| 119 | v[i] = new Vector(numEqns); |
| 120 | } |
| 121 | |
| 122 | if (Av == 0) { |
| 123 | Av = new Vector*[maxDimension+1]; |
| 124 | for (int i = 0; i < maxDimension+1; i++) |
| 125 | Av[i] = new Vector(numEqns); |
| 126 | } |
| 127 | |
| 128 | if (AvData == 0) |
| 129 | AvData = new double [maxDimension*numEqns]; |
| 130 | |
| 131 | if (rData == 0) |
| 132 | // The LAPACK least squares subroutine overwrites the RHS vector |
| 133 | // with the solution vector ... these vectors are not the same |
| 134 | // size, so we need to use the max size |
| 135 | rData = new double [(numEqns > maxDimension) ? numEqns : maxDimension]; |
| 136 | |
| 137 | // Length of work vector should be >= 2*min(numEqns,maxDimension) |
| 138 | // See dgels subroutine documentation |
| 139 | lwork = 2 * ((numEqns < maxDimension) ? numEqns : maxDimension); |
| 140 | |
| 141 | if (work == 0) |
| 142 | work = new double [lwork]; |
| 143 | |
| 144 | // Evaluate system residual R(y_0) |
| 145 | if (theIntegrator->formUnbalance() < 0) { |
| 146 | opserr << "WARNING KrylovNewton::solveCurrentStep() -"; |
| 147 | opserr << "the Integrator failed in formUnbalance()\n"; |
| 148 | return -2; |
| 149 | } |
| 150 | |
| 151 |
nothing calls this directly
no test coverage detected