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

Function OPS_eleResponse

SRC/interpreter/OpenSeesOutputCommands.cpp:468–531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

466}
467
468int OPS_eleResponse()
469{
470 Domain* theDomain = OPS_GetDomain();
471 if (theDomain == 0) return -1;
472
473 int numdata = OPS_GetNumRemainingInputArgs();
474 if (numdata < 2) {
475 opserr << "WARNING want - eleResponse eleTag? eleArgs...\n";
476 return -1;
477 }
478
479 int tag;
480 numdata = 1;
481 if (OPS_GetIntInput(&numdata, &tag) < 0) {
482 opserr << "could not read eleTag\n";
483 return -1;
484 }
485
486 numdata = OPS_GetNumRemainingInputArgs();
487 if (numdata > 0) {
488 const char** argv = new const char*[numdata];
489 for (int i=0; i<numdata; i++) {
490 argv[i] = new char[128];
491 // Turn everything in to a string for setResponse
492 OPS_GetStringFromAll((char*)argv[i], 128);
493 }
494 const Vector* data = theDomain->getElementResponse(tag, argv, numdata);
495
496 for (int i=0; i<numdata; i++)
497 delete [] argv[i];
498 delete [] argv;
499
500 if (data != 0) {
501 int size = data->Size();
502 double* newdata = new double[size];
503 for (int i=0; i<size; i++) {
504 newdata[i] = (*data)(i);
505 }
506 if (OPS_SetDoubleOutput(&size, newdata, false) < 0) {
507 opserr << "WARNING failed to et response\n";
508 delete [] newdata;
509 return -1;
510 }
511 delete [] newdata;
512
513 } else {
514 int size = 0;
515 double* newdata = 0;
516 if (OPS_SetDoubleOutput(&size, newdata, false) < 0) {
517 opserr << "WARNING failed to et response\n";
518 return -1;
519 }
520 }
521 } else {
522 int size = 0;
523 double* newdata = 0;
524 if (OPS_SetDoubleOutput(&size, newdata, false) < 0) {
525 opserr << "WARNING failed to et response\n";

Callers 2

Tcl_ops_eleResponseFunction · 0.85
Py_ops_eleResponseFunction · 0.85

Calls 7

OPS_GetDomainFunction · 0.70
OPS_GetIntInputFunction · 0.70
OPS_GetStringFromAllFunction · 0.70
OPS_SetDoubleOutputFunction · 0.70
getElementResponseMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected