| 300 | } |
| 301 | |
| 302 | void |
| 303 | UniformExcitation::applyLoad(double time) |
| 304 | { |
| 305 | Domain *theDomain = this->getDomain(); |
| 306 | if (theDomain == 0) |
| 307 | return; |
| 308 | |
| 309 | NodeIter &theNodes = theDomain->getNodes(); |
| 310 | Node *theNode; |
| 311 | while ((theNode = theNodes()) != 0) { |
| 312 | theNode->setNumColR(1); |
| 313 | const Vector &crds=theNode->getCrds(); |
| 314 | int ndm = crds.Size(); |
| 315 | |
| 316 | if (ndm == 1) { |
| 317 | if (theDof < 1) { |
| 318 | theNode->setR(theDof, 0, fact); |
| 319 | } |
| 320 | } |
| 321 | else if (ndm == 2) { |
| 322 | if (theDof < 2) { |
| 323 | theNode->setR(theDof, 0, fact); |
| 324 | } |
| 325 | else if (theDof == 2) { |
| 326 | double xCrd = crds(0); |
| 327 | double yCrd = crds(1); |
| 328 | theNode->setR(0, 0, -fact*yCrd); |
| 329 | theNode->setR(1, 0, fact*xCrd); |
| 330 | theNode->setR(2, 0, fact); |
| 331 | } |
| 332 | } |
| 333 | else if (ndm == 3) { |
| 334 | if (theDof < 3) { |
| 335 | theNode->setR(theDof, 0, fact); |
| 336 | } |
| 337 | else if (theDof == 3) { |
| 338 | double yCrd = crds(1); |
| 339 | double zCrd = crds(2); |
| 340 | theNode->setR(1, 0, -fact*zCrd); |
| 341 | theNode->setR(2, 0, fact*yCrd); |
| 342 | theNode->setR(3, 0, fact); |
| 343 | } |
| 344 | else if (theDof == 4) { |
| 345 | double xCrd = crds(0); |
| 346 | double zCrd = crds(2); |
| 347 | theNode->setR(0, 0, fact*zCrd); |
| 348 | theNode->setR(2, 0, -fact*xCrd); |
| 349 | theNode->setR(4, 0, fact); |
| 350 | } |
| 351 | else if (theDof == 5) { |
| 352 | double xCrd = crds(0); |
| 353 | double yCrd = crds(1); |
| 354 | theNode->setR(0, 0, -fact*yCrd); |
| 355 | theNode->setR(1, 0, fact*xCrd); |
| 356 | theNode->setR(5, 0, fact); |
| 357 | } |
| 358 | } |
| 359 | } |