| 628 | } |
| 629 | |
| 630 | int OPS_setNodeVel() |
| 631 | { |
| 632 | // make sure at least one other argument to contain type of system |
| 633 | if (OPS_GetNumRemainingInputArgs() < 3) { |
| 634 | opserr << "WARNING want - setNodeVel nodeTag? dof? value? <-commit>\n"; |
| 635 | return -1; |
| 636 | } |
| 637 | |
| 638 | int tag; |
| 639 | int dof = -1; |
| 640 | double value = 0.0; |
| 641 | bool commit = false; |
| 642 | int numdata = 1; |
| 643 | |
| 644 | if (OPS_GetIntInput(&numdata, &tag) < 0) { |
| 645 | opserr << "WARNING setNodeVel nodeTag? dof? - could not read nodeTag? \n"; |
| 646 | return -1; |
| 647 | } |
| 648 | |
| 649 | Domain* theDomain = OPS_GetDomain(); |
| 650 | if (theDomain == 0) return -1; |
| 651 | |
| 652 | Node *theNode = theDomain->getNode(tag); |
| 653 | if (theNode == 0) { |
| 654 | opserr << "WARNING setNodeVel -- node with tag " << tag << " not found" << endln; |
| 655 | return -1; |
| 656 | } |
| 657 | |
| 658 | if (OPS_GetIntInput(&numdata, &dof) < 0) { |
| 659 | opserr << "WARNING setNodeVel nodeTag? dof? value?- could not read dof? \n"; |
| 660 | return -1; |
| 661 | } |
| 662 | |
| 663 | if (OPS_GetDoubleInput(&numdata, &value) < 0) { |
| 664 | opserr << "WARNING setNodeVel nodeTag? dof? value?- could not read dof? \n"; |
| 665 | return -1; |
| 666 | } |
| 667 | |
| 668 | if (OPS_GetNumRemainingInputArgs() > 0) { |
| 669 | const char* optArg = OPS_GetString(); |
| 670 | if (strcmp(optArg, "-commit") == 0) |
| 671 | commit = true; |
| 672 | } |
| 673 | |
| 674 | dof--; |
| 675 | |
| 676 | int numDOF = theNode->getNumberDOF(); |
| 677 | |
| 678 | if (dof >= 0 && dof < numDOF) { |
| 679 | Vector vel(numDOF); |
| 680 | vel = theNode->getVel(); |
| 681 | vel(dof) = value; |
| 682 | theNode->setTrialVel(vel); |
| 683 | } |
| 684 | if (commit) |
| 685 | theNode->commitState(); |
| 686 | |
| 687 | return 0; |
no test coverage detected