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

Method setResponse

DEVELOPER/element/cpp/Truss2D.cpp:469–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467
468
469Response *
470Truss2D::setResponse(const char **argv, int argc, OPS_Stream &output)
471{
472 Response *theResponse = 0;
473
474 output.tag("ElementOutput");
475 output.attr("eleType",this->getClassType());
476 output.attr("eleTag",this->getTag());
477 int numNodes = this->getNumExternalNodes();
478 const ID &nodes = this->getExternalNodes();
479 static char nodeData[32];
480
481 for (int i=0; i<numNodes; i++) {
482 sprintf(nodeData,"node%d",i+1);
483 output.attr(nodeData,nodes(i));
484 }
485
486 if (strcmp(argv[0],"force") == 0 || strcmp(argv[0],"forces") == 0 ||
487 strcmp(argv[0],"globalForce") == 0 || strcmp(argv[0],"globalForces") == 0) {
488 const Vector &force = this->getResistingForce();
489 int size = force.Size();
490 for (int i=0; i<size; i++) {
491 sprintf(nodeData,"P%d",i+1);
492 output.tag("ResponseType",nodeData);
493 }
494 theResponse = new ElementResponse(this, 1, this->getResistingForce());
495 }
496
497 else if (strcmp(argv[0],"dampingForce") == 0 || strcmp(argv[0],"dampingForces") == 0) {
498 const Vector &force = this->getResistingForce();
499 int size = force.Size();
500 for (int i=0; i<size; i++) {
501 sprintf(nodeData,"P%d",i+1);
502 output.tag("ResponseType",nodeData);
503 }
504 theResponse = new ElementResponse(this, 2, this->getResistingForce());
505 } else if (strcmp(argv[0],"axialForce") ==0)
506 return new ElementResponse(this, 3, 0.0);
507
508 output.endTag();
509 return theResponse;
510}
511
512
513

Callers

nothing calls this directly

Calls 8

getNumExternalNodesMethod · 0.95
getResistingForceMethod · 0.80
tagMethod · 0.45
attrMethod · 0.45
getClassTypeMethod · 0.45
getTagMethod · 0.45
SizeMethod · 0.45
endTagMethod · 0.45

Tested by

no test coverage detected