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

Function nodeAccel

SRC/tcl/commands.cpp:7687–7740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7685}
7686
7687int
7688nodeAccel(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
7689{
7690 // make sure at least one other argument to contain type of system
7691 if (argc < 2) {
7692 opserr << "WARNING want - nodeAccel nodeTag? dof?\n";
7693 return TCL_ERROR;
7694 }
7695
7696 int tag;
7697 int dof = -1;
7698
7699 if (Tcl_GetInt(interp, argv[1], &tag) != TCL_OK) {
7700 opserr << "WARNING nodeAccel nodeTag? dof? - could not read nodeTag? \n";
7701 return TCL_ERROR;
7702 }
7703 if (argc > 2) {
7704 if (Tcl_GetInt(interp, argv[2], &dof) != TCL_OK) {
7705 opserr << "WARNING nodeAccel nodeTag? dof? - could not read dof? \n";
7706 return TCL_ERROR;
7707 }
7708 }
7709
7710 dof--;
7711
7712 const Vector *nodalResponse = theDomain.getNodeResponse(tag, Accel);
7713 if (nodalResponse == 0)
7714 return TCL_ERROR;
7715
7716
7717 int size = nodalResponse->Size();
7718
7719 if (dof >= 0) {
7720 if (size < dof)
7721 return TCL_ERROR;
7722
7723 double value = (*nodalResponse)(dof);
7724
7725 // now we copy the value to the tcl string that is returned
7726 //sprintf(interp->result,"%35.20f",value);
7727 char buffer [40];
7728 sprintf(buffer,"%35.20f", value);
7729 Tcl_SetResult(interp, buffer, TCL_VOLATILE);
7730
7731 } else {
7732 char buffer[40];
7733 for (int i=0; i<size; i++) {
7734 sprintf(buffer,"%35.20f",(*nodalResponse)(i));
7735 Tcl_AppendResult(interp, buffer, NULL);
7736 }
7737 }
7738
7739 return TCL_OK;
7740}
7741
7742
7743int

Callers

nothing calls this directly

Calls 2

getNodeResponseMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected