| 32 | |
| 33 | |
| 34 | int |
| 35 | sensNodeDisp(ClientData clientData, Tcl_Interp *interp, int argc, |
| 36 | TCL_Char ** const argv) |
| 37 | { |
| 38 | assert(clientData != nullptr); |
| 39 | Domain *theDomain = (Domain *)clientData; |
| 40 | |
| 41 | // make sure at least one other argument to contain type of system |
| 42 | if (argc < 4) { |
| 43 | opserr << OpenSees::PromptValueError << "want - sensNodeDisp nodeTag? dof? paramTag?\n"; |
| 44 | return TCL_ERROR; |
| 45 | } |
| 46 | |
| 47 | int tag, dof, paramTag; |
| 48 | |
| 49 | if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) { |
| 50 | opserr |
| 51 | << OpenSees::PromptValueError << "nodeDisp nodeTag? dof? paramTag?- could not read nodeTag? "; |
| 52 | return TCL_ERROR; |
| 53 | } |
| 54 | if (Tcl_GetInt(interp, argv[2], &dof) != TCL_OK) { |
| 55 | opserr << OpenSees::PromptValueError << "nodeDisp nodeTag? dof? paramTag?- could not read dof? "; |
| 56 | return TCL_ERROR; |
| 57 | } |
| 58 | if (Tcl_GetInt(interp, argv[3], ¶mTag) != TCL_OK) { |
| 59 | opserr << OpenSees::PromptValueError << "nodeDisp paramTag? dof? paramTag?- could not read " |
| 60 | "paramTag? "; |
| 61 | return TCL_ERROR; |
| 62 | } |
| 63 | |
| 64 | // |
| 65 | // |
| 66 | Node *theNode = theDomain->getNode(tag); |
| 67 | if (theNode == nullptr) { |
| 68 | opserr << "sensNodeDisp: node " << tag << " not found" << "\n"; |
| 69 | return TCL_ERROR; |
| 70 | } |
| 71 | |
| 72 | Parameter *theParam = theDomain->getParameter(paramTag); |
| 73 | if (theParam == nullptr) { |
| 74 | opserr << "sensNodeDisp: parameter " << paramTag << " not found" << "\n"; |
| 75 | return TCL_ERROR; |
| 76 | } |
| 77 | |
| 78 | int gradIndex = theParam->getGradIndex(); |
| 79 | |
| 80 | double value = theNode->getDispSensitivity(dof, gradIndex); |
| 81 | |
| 82 | Tcl_SetObjResult(interp, Tcl_NewDoubleObj(value)); |
| 83 | |
| 84 | return TCL_OK; |
| 85 | } |
| 86 | |
| 87 | int |
| 88 | sensNodeVel(ClientData clientData, Tcl_Interp *interp, int argc, |
nothing calls this directly
no test coverage detected