| 533 | } |
| 534 | |
| 535 | Response* |
| 536 | FiberSection::setResponse(const char **argv, int argc, OPS_Stream &output) |
| 537 | { |
| 538 | Response *theResponse = 0; |
| 539 | |
| 540 | output.tag("SectionOutput"); |
| 541 | output.attr("secType", this->getClassType()); |
| 542 | output.attr("secTag", this->getTag()); |
| 543 | |
| 544 | // Check if fiber response is requested |
| 545 | if (strcmp(argv[0],"fiber") == 0) { |
| 546 | int key = 0; |
| 547 | int passarg = 2; |
| 548 | |
| 549 | if (argc <= 2) // not enough data input |
| 550 | return 0; |
| 551 | else if (argc <= 3) // fiber number was input directly |
| 552 | key = atoi(argv[1]); |
| 553 | else { // fiber near-to coordinate specified |
| 554 | double yCoord = atof(argv[1]); |
| 555 | double zCoord = atof(argv[2]); |
| 556 | double ySearch, zSearch; |
| 557 | theFibers[0]->getFiberLocation(ySearch,zSearch); |
| 558 | double closestDist = sqrt( pow(ySearch-yCoord,2) + |
| 559 | pow(zSearch-zCoord,2) ); |
| 560 | double distance; |
| 561 | for (int j = 1; j < numFibers; j++) { |
| 562 | theFibers[j]->getFiberLocation(ySearch,zSearch); |
| 563 | distance = sqrt( pow(ySearch-yCoord,2) + |
| 564 | pow(zSearch-zCoord,2) ); |
| 565 | if (distance < closestDist) { |
| 566 | closestDist = distance; |
| 567 | key = j; |
| 568 | } |
| 569 | } |
| 570 | theFibers[key]->getFiberLocation(ySearch,zSearch); |
| 571 | passarg = 3; |
| 572 | } |
| 573 | |
| 574 | if (key < numFibers && key >= 0) { |
| 575 | output.tag("FiberOutput"); |
| 576 | double yLoc, zLoc; |
| 577 | theFibers[key]->getFiberLocation(yLoc, zLoc); |
| 578 | output.attr("yLoc", yLoc); |
| 579 | output.attr("zLoc",0.0); |
| 580 | output.attr("area", zLoc); |
| 581 | theResponse = theFibers[key]->setResponse(&argv[passarg],argc-passarg, output); |
| 582 | output.endTag(); |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | output.endTag(); |
| 587 | return SectionForceDeformation::setResponse(argv,argc,output); |
| 588 | } |
| 589 | |
| 590 | int |
| 591 | FiberSection::getResponse(int responseID, Information §Info) |
nothing calls this directly
no test coverage detected