| 489 | } |
| 490 | |
| 491 | int OPS_setNodeDisp() |
| 492 | { |
| 493 | // make sure at least one other argument to contain type of system |
| 494 | if (OPS_GetNumRemainingInputArgs() < 3) { |
| 495 | opserr << "WARNING want - setNodeDisp nodeTag? dof? value? <-commit>\n"; |
| 496 | return -1; |
| 497 | } |
| 498 | |
| 499 | int tag; |
| 500 | int dof = -1; |
| 501 | double value = 0.0; |
| 502 | bool commit = false; |
| 503 | int numdata = 1; |
| 504 | |
| 505 | if (OPS_GetIntInput(&numdata, &tag) < 0) { |
| 506 | opserr << "WARNING setNodeDisp nodeTag? dof? - could not read nodeTag? \n"; |
| 507 | return -1; |
| 508 | } |
| 509 | |
| 510 | Domain* theDomain = OPS_GetDomain(); |
| 511 | if (theDomain == 0) return -1; |
| 512 | |
| 513 | Node *theNode = theDomain->getNode(tag); |
| 514 | if (theNode == 0) { |
| 515 | opserr << "WARNING setNodeDisp -- node with tag " << tag << " not found" << endln; |
| 516 | return -1; |
| 517 | } |
| 518 | |
| 519 | if (OPS_GetIntInput(&numdata, &dof) < 0) { |
| 520 | opserr << "WARNING setNodeDisp nodeTag? dof? value?- could not read dof? \n"; |
| 521 | return -1; |
| 522 | } |
| 523 | |
| 524 | if (OPS_GetDoubleInput(&numdata, &value) < 0) { |
| 525 | opserr << "WARNING setNodeDisp nodeTag? dof? value?- could not read dof? \n"; |
| 526 | return -1; |
| 527 | } |
| 528 | |
| 529 | if (OPS_GetNumRemainingInputArgs() > 0) { |
| 530 | const char* optArg = OPS_GetString(); |
| 531 | if (strcmp(optArg, "-commit") == 0) |
| 532 | commit = true; |
| 533 | } |
| 534 | |
| 535 | dof--; |
| 536 | |
| 537 | int numDOF = theNode->getNumberDOF(); |
| 538 | |
| 539 | if (dof >= 0 && dof < numDOF) { |
| 540 | Vector disp(numDOF); |
| 541 | disp = theNode->getDisp(); |
| 542 | disp(dof) = value; |
| 543 | theNode->setTrialDisp(disp); |
| 544 | } |
| 545 | if (commit) |
| 546 | theNode->commitState(); |
| 547 | |
| 548 | return 0; |
no test coverage detected