MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / OPS_setNodeAccel

Function OPS_setNodeAccel

SRC/interpreter/OpenSeesMiscCommands.cpp:690–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

688}
689
690int 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;

Callers 2

Tcl_ops_setNodeAccelFunction · 0.85
Py_ops_setNodeAccelFunction · 0.85

Calls 10

OPS_GetIntInputFunction · 0.70
OPS_GetDomainFunction · 0.70
OPS_GetDoubleInputFunction · 0.70
OPS_GetStringFunction · 0.70
getNodeMethod · 0.45
getNumberDOFMethod · 0.45
getAccelMethod · 0.45
setTrialAccelMethod · 0.45
commitStateMethod · 0.45

Tested by

no test coverage detected