| 324 | |
| 325 | |
| 326 | int |
| 327 | SkylineSPD::addB(const Vector &v, const ID &id, double fact) |
| 328 | { |
| 329 | |
| 330 | // check for a quick return |
| 331 | if (fact == 0.0) return 0; |
| 332 | |
| 333 | // check that m and id are of similar size |
| 334 | int idSize = id.Size(); |
| 335 | if (idSize != v.Size() ) { |
| 336 | opserr << "SkylineSPD::addB() -"; |
| 337 | opserr << " Vector and ID not of similar sizes\n"; |
| 338 | return -1; |
| 339 | } |
| 340 | |
| 341 | if (fact == 1.0) { // do not need to multiply if fact == 1.0 |
| 342 | for (int i=0; i<id.Size(); i++) { |
| 343 | int pos = id(i); |
| 344 | if (pos <size && pos >= 0) |
| 345 | B[pos] += v(i); |
| 346 | } |
| 347 | } else if (fact == -1.0) { // do not need to multiply if fact == -1.0 |
| 348 | for (int i=0; i<id.Size(); i++) { |
| 349 | int pos = id(i); |
| 350 | if (pos <size && pos >= 0) |
| 351 | B[pos] -= v(i); |
| 352 | } |
| 353 | } else { |
| 354 | for (int i=0; i<id.Size(); i++) { |
| 355 | int pos = id(i); |
| 356 | if (pos <size && pos >= 0) |
| 357 | B[pos] += v(i) * fact; |
| 358 | } |
| 359 | } |
| 360 | return 0; |
| 361 | } |
| 362 | |
| 363 | |
| 364 | int |
no test coverage detected