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

Function OPS_nodeReaction

SRC/interpreter/OpenSeesOutputCommands.cpp:320–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318
319
320int OPS_nodeReaction()
321{
322 // make sure at least one other argument to contain type of system
323 if (OPS_GetNumRemainingInputArgs() < 1) {
324 opserr << "WARNING want - nodeReaction nodeTag? <dof?>\n";
325 return -1;
326 }
327
328 int data[2] = {0, -1};
329 int numdata = OPS_GetNumRemainingInputArgs();
330 if (numdata > 2) numdata = 2;
331
332 if (OPS_GetIntInput(&numdata, data) < 0) {
333 opserr<<"WARNING nodeReaction - failed to read int inputs\n";
334 return -1;
335 }
336
337 data[1]--;
338
339 // get response
340 Domain* theDomain = OPS_GetDomain();
341 if (theDomain == 0) return -1;
342 const Vector *nodalResponse = theDomain->getNodeResponse(data[0], Reaction);
343
344 if (nodalResponse == 0) {
345 return -1;
346 }
347
348 int size = nodalResponse->Size();
349
350 if (data[1] >= 0) {
351
352 if (data[1] >= size) {
353 opserr << "WARNING nodeReaction nodeTag? dof? - dofTag? too large\n";
354 return -1;
355 }
356
357 double value = (*nodalResponse)(data[1]);
358 numdata = 1;
359
360 // now we copy the value to the tcl string that is returned
361 if (OPS_SetDoubleOutput(&numdata, &value, true) < 0) {
362 opserr<<"WARNING nodeReaction - failed to set double output\n";
363 return -1;
364 }
365
366 } else {
367
368 std::vector<double> values(size);
369 for (int i=0; i<size; i++) {
370 values[i] = (*nodalResponse)(i);
371 }
372 if (OPS_SetDoubleOutput(&size, &values[0], false) < 0) {
373 opserr<<"WARNING nodeReaction - failed to set double output\n";
374 return -1;
375 }
376 }
377

Callers 2

Tcl_ops_nodeReactionFunction · 0.85
Py_ops_nodeReactionFunction · 0.85

Calls 6

OPS_GetIntInputFunction · 0.70
OPS_GetDomainFunction · 0.70
OPS_SetDoubleOutputFunction · 0.70
getNodeResponseMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected