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

Function nodeReaction

SRC/tcl/commands.cpp:6307–6364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6305}
6306
6307int
6308nodeReaction(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
6309{
6310 // make sure at least one other argument to contain type of system
6311 if (argc < 2) {
6312 opserr << "WARNING want - nodeReaction nodeTag? <dof?>\n";
6313 return TCL_ERROR;
6314 }
6315
6316 int tag;
6317 int dof = -1;
6318
6319 if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) {
6320 opserr << "WARNING nodeReaction nodeTag? dof? - could not read nodeTag? \n";
6321 return TCL_ERROR;
6322 }
6323
6324 if (argc > 2) {
6325 if (Tcl_GetInt(interp, argv[2], &dof) != TCL_OK) {
6326 opserr << "WARNING nodeReaction nodeTag? dof? - could not read dof? \n";
6327 return TCL_ERROR;
6328 }
6329 }
6330
6331 dof--;
6332
6333 const Vector *nodalResponse = theDomain.getNodeResponse(tag, Reaction);
6334
6335 if (nodalResponse == 0)
6336 return TCL_ERROR;
6337
6338 int size = nodalResponse->Size();
6339
6340 if (dof >= 0) {
6341
6342 if (dof >= size) {
6343 opserr << "WARNING nodeReaction nodeTag? dof? - dofTag? too large\n";
6344 return TCL_ERROR;
6345 }
6346
6347 double value = (*nodalResponse)(dof);
6348
6349 // now we copy the value to the tcl string that is returned
6350
6351 char buffer [40];
6352 sprintf(buffer,"%35.20f", value);
6353 Tcl_SetResult(interp, buffer, TCL_VOLATILE);
6354 // sprintf(interp->result,"%35.20f ",value);
6355 } else {
6356 char buffer [40];
6357 for (int i=0; i<size; i++) {
6358 sprintf(buffer,"%35.20f",(*nodalResponse)(i));
6359 Tcl_AppendResult(interp, buffer, NULL);
6360 }
6361 }
6362
6363 return TCL_OK;
6364}

Callers

nothing calls this directly

Calls 2

getNodeResponseMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected