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

Function TclCommand_addUCFiberSection

SRC/runtime/commands/modeling/section.cpp:1630–1730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1628
1629
1630int
1631TclCommand_addUCFiberSection(ClientData clientData, Tcl_Interp *interp,
1632 int argc, TCL_Char ** const argv)
1633{
1634 assert(clientData != nullptr);
1635 BasicModelBuilder* builder = static_cast<BasicModelBuilder*>(clientData);
1636 G3_Runtime *rt = G3_getRuntime(interp);
1637 int secTag;
1638
1639 if (argc < 4)
1640 return TCL_ERROR;
1641
1642 if (Tcl_GetInt(interp, argv[2], &secTag) != TCL_OK) {
1643 opserr << "could not read section tag\n";
1644 return TCL_ERROR;
1645 }
1646
1647 builder->setCurrentSectionBuilder(secTag);
1648
1649 // first create an empty FiberSection
1650
1651 SectionForceDeformation *section = nullptr;
1652 FiberSection2d *section2d = nullptr;
1653 FiberSection3d *section3d = nullptr;
1654 bool computeCentroid = false;
1655
1656 int NDM = builder->getNDM();
1657 if (NDM == 2) {
1658 section2d = new FiberSection2d(secTag, 30, computeCentroid);
1659 section = section2d;
1660 // SectionForceDeformation *section = new FiberSection(secTag, 0, 0);
1661 } else if (NDM == 3) {
1662 UniaxialMaterial *theGJ = new ElasticMaterial(0, 1e10);
1663 section3d =
1664 new FiberSection3d(secTag, 30, *theGJ, computeCentroid);
1665 section = section3d;
1666 delete theGJ;
1667 }
1668
1669 if (section == nullptr) {
1670 return TCL_ERROR;
1671 }
1672
1673 //
1674 // Now parse the output file containing the fiber data,
1675 // create fibers and add them to the section
1676 //
1677
1678 // open the file
1679 TCL_Char *fileName = argv[3];
1680 std::ifstream theFile;
1681 theFile.open(fileName, std::ios::in);
1682 if (!theFile) {
1683 opserr << "section UCFiber - could not open file named " << fileName;
1684 return TCL_ERROR;
1685 } else {
1686 int foundStart = 0;
1687 static char garbage[100];

Callers 1

TclCommand_addSectionFunction · 0.70

Calls 7

G3_getRuntimeFunction · 0.85
getNDMMethod · 0.45
openMethod · 0.45
closeMethod · 0.45
addFiberMethod · 0.45

Tested by

no test coverage detected