| 85 | } |
| 86 | |
| 87 | int |
| 88 | sensNodeVel(ClientData clientData, Tcl_Interp *interp, int argc, |
| 89 | TCL_Char ** const argv) |
| 90 | { |
| 91 | assert(clientData != nullptr); |
| 92 | Domain *theDomain = (Domain *)clientData; |
| 93 | |
| 94 | // make sure at least one other argument to contain type of system |
| 95 | if (argc < 4) { |
| 96 | opserr << OpenSees::PromptValueError << "want - sensNodeVel nodeTag? dof? paramTag?\n"; |
| 97 | return TCL_ERROR; |
| 98 | } |
| 99 | |
| 100 | int tag, dof, paramTag; |
| 101 | |
| 102 | if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) { |
| 103 | opserr << OpenSees::PromptValueError << "sensNodeVel nodeTag? dof? paramTag? - could not read " |
| 104 | "nodeTag? \n"; |
| 105 | return TCL_ERROR; |
| 106 | } |
| 107 | if (Tcl_GetInt(interp, argv[2], &dof) != TCL_OK) { |
| 108 | opserr << OpenSees::PromptValueError << "sensNodeVel nodeTag? dof? paramTag? - could not read " |
| 109 | "dof? \n"; |
| 110 | return TCL_ERROR; |
| 111 | } |
| 112 | if (Tcl_GetInt(interp, argv[3], ¶mTag) != TCL_OK) { |
| 113 | opserr << OpenSees::PromptValueError << "sensNodeVel nodeTag? dof? paramTag? - could not read " |
| 114 | "paramTag? \n"; |
| 115 | return TCL_ERROR; |
| 116 | } |
| 117 | |
| 118 | Node *theNode = theDomain->getNode(tag); |
| 119 | if (theNode == nullptr) { |
| 120 | opserr << "sensNodeVel: node " << tag << " not found" << "\n"; |
| 121 | return TCL_ERROR; |
| 122 | } |
| 123 | |
| 124 | Parameter *theParam = theDomain->getParameter(paramTag); |
| 125 | if (theParam == nullptr) { |
| 126 | opserr << "sensNodeVel: parameter " << paramTag << " not found" << "\n"; |
| 127 | return TCL_ERROR; |
| 128 | } |
| 129 | |
| 130 | int gradIndex = theParam->getGradIndex(); |
| 131 | |
| 132 | double value = theNode->getVelSensitivity(dof, gradIndex); |
| 133 | |
| 134 | Tcl_SetObjResult(interp, Tcl_NewDoubleObj(value)); |
| 135 | |
| 136 | return TCL_OK; |
| 137 | } |
| 138 | |
| 139 | int |
| 140 | sensNodeAccel(ClientData clientData, Tcl_Interp *interp, int argc, |
nothing calls this directly
no test coverage detected