| 467 | |
| 468 | |
| 469 | Response * |
| 470 | Truss2D::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 |
nothing calls this directly
no test coverage detected