| 7473 | } |
| 7474 | |
| 7475 | int |
| 7476 | nodeVel(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv) |
| 7477 | { |
| 7478 | // make sure at least one other argument to contain type of system |
| 7479 | if (argc < 2) { |
| 7480 | opserr << "WARNING want - nodeVel nodeTag? <dof?>\n"; |
| 7481 | return TCL_ERROR; |
| 7482 | } |
| 7483 | |
| 7484 | int tag; |
| 7485 | int dof = -1; |
| 7486 | |
| 7487 | if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) { |
| 7488 | opserr << "WARNING nodeVel nodeTag? dof? - could not read nodeTag? \n"; |
| 7489 | return TCL_ERROR; |
| 7490 | } |
| 7491 | if (argc > 2) { |
| 7492 | if (Tcl_GetInt(interp, argv[2], &dof) != TCL_OK) { |
| 7493 | opserr << "WARNING nodeVel nodeTag? dof? - could not read dof? \n"; |
| 7494 | return TCL_ERROR; |
| 7495 | } |
| 7496 | } |
| 7497 | |
| 7498 | dof--; |
| 7499 | |
| 7500 | const Vector *nodalResponse = theDomain.getNodeResponse(tag, Vel); |
| 7501 | |
| 7502 | if (nodalResponse == 0) |
| 7503 | return TCL_ERROR; |
| 7504 | |
| 7505 | int size = nodalResponse->Size(); |
| 7506 | |
| 7507 | if (dof >= 0) { |
| 7508 | if (size < dof) |
| 7509 | return TCL_ERROR; |
| 7510 | |
| 7511 | double value = (*nodalResponse)(dof); |
| 7512 | |
| 7513 | // now we copy the value to the tcl string that is returned |
| 7514 | // sprintf(interp->result,"%35.20f",value); |
| 7515 | char buffer [40]; |
| 7516 | sprintf(buffer,"%35.20f", value); |
| 7517 | Tcl_SetResult(interp, buffer, TCL_VOLATILE); |
| 7518 | |
| 7519 | } else { |
| 7520 | |
| 7521 | char buffer[40]; |
| 7522 | for (int i=0; i<size; i++) { |
| 7523 | sprintf(buffer,"%35.20f",(*nodalResponse)(i)); |
| 7524 | Tcl_AppendResult(interp, buffer, NULL); |
| 7525 | } |
| 7526 | } |
| 7527 | |
| 7528 | return TCL_OK; |
| 7529 | } |
| 7530 | |
| 7531 | int |
| 7532 | setNodeVel(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv) |
nothing calls this directly
no test coverage detected