| 688 | } |
| 689 | |
| 690 | int OPS_setNodeAccel() |
| 691 | { |
| 692 | // make sure at least one other argument to contain type of system |
| 693 | if (OPS_GetNumRemainingInputArgs() < 3) { |
| 694 | opserr << "WARNING want - setNodeAccel nodeTag? dof? value? <-commit>\n"; |
| 695 | return -1; |
| 696 | } |
| 697 | |
| 698 | int tag; |
| 699 | int dof = -1; |
| 700 | double value = 0.0; |
| 701 | bool commit = false; |
| 702 | int numdata = 1; |
| 703 | |
| 704 | if (OPS_GetIntInput(&numdata, &tag) < 0) { |
| 705 | opserr << "WARNING setNodeAccel nodeTag? dof? - could not read nodeTag? \n"; |
| 706 | return -1; |
| 707 | } |
| 708 | |
| 709 | Domain* theDomain = OPS_GetDomain(); |
| 710 | if (theDomain == 0) return -1; |
| 711 | |
| 712 | Node *theNode = theDomain->getNode(tag); |
| 713 | if (theNode == 0) { |
| 714 | opserr << "WARNING setNodeAccel -- node with tag " << tag << " not found" << endln; |
| 715 | return -1; |
| 716 | } |
| 717 | |
| 718 | if (OPS_GetIntInput(&numdata, &dof) < 0) { |
| 719 | opserr << "WARNING setNodeAccel nodeTag? dof? value?- could not read dof? \n"; |
| 720 | return -1; |
| 721 | } |
| 722 | |
| 723 | if (OPS_GetDoubleInput(&numdata, &value) < 0) { |
| 724 | opserr << "WARNING setNodeAccel nodeTag? dof? value?- could not read dof? \n"; |
| 725 | return -1; |
| 726 | } |
| 727 | |
| 728 | if (OPS_GetNumRemainingInputArgs() > 0) { |
| 729 | const char* optArg = OPS_GetString(); |
| 730 | if (strcmp(optArg, "-commit") == 0) |
| 731 | commit = true; |
| 732 | } |
| 733 | |
| 734 | dof--; |
| 735 | |
| 736 | int numDOF = theNode->getNumberDOF(); |
| 737 | |
| 738 | if (dof >= 0 && dof < numDOF) { |
| 739 | Vector accel(numDOF); |
| 740 | accel = theNode->getAccel(); |
| 741 | accel(dof) = value; |
| 742 | theNode->setTrialAccel(accel); |
| 743 | } |
| 744 | if (commit) |
| 745 | theNode->commitState(); |
| 746 | |
| 747 | return 0; |
no test coverage detected