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

Function ops_addLayer

SRC/interpreter/PythonModelBuilder.cpp:725–831  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

723}
724
725PyObject *ops_addLayer(PyObject *self, PyObject *args)
726{
727 // check model builder
728 if(pBuilder.isSet() == false) {
729 PyErr_SetString(PyExc_RuntimeError,"ERROR builder has not been set");
730 return NULL;
731 }
732
733 OPS_ResetCommandLine(PyTuple_Size(args), 0, args);
734
735 // check if a section is being processed
736 SectionForceDeformation* section = pBuilder.getCurrentSection();
737 if(section == 0) {
738 PyErr_SetString(PyExc_RuntimeError,"ERROR no current section");
739 return NULL;
740 }
741
742 // create fiber
743 ReinfLayer *theLayer =0;
744 std::string type = OPS_GetString();
745 if(type == "straight") {
746 theLayer = (ReinfLayer*) OPS_StraightReinfLayer();
747 } else if(type == "circ" || type == "circular") {
748 theLayer = (ReinfLayer*) OPS_CircReinfLayer();
749 } else {
750 PyErr_SetString(PyExc_RuntimeError,"ERROR unknown layer type");
751 return NULL;
752 }
753
754 if(theLayer == 0) {
755 PyErr_SetString(PyExc_RuntimeError,"ERROR failed to create Layer");
756 return NULL;
757 }
758
759 // add fibers to the section
760 int numReinfBars = theLayer->getNumReinfBars();
761 ReinfBar* reinfBar = theLayer->getReinfBars();
762 int matTag = theLayer->getMaterialID();
763
764 if(reinfBar == 0) {
765 PyErr_SetString(PyExc_RuntimeError,"ERROR out of run to create fibers");
766 delete theLayer;
767 return NULL;
768 }
769
770 for(int j=0; j<numReinfBars; j++) {
771
772 // get fiber data
773 double area = reinfBar[j].getArea();
774 const Vector& cPos = reinfBar[j].getPosition();
775
776 // create fibers
777 Fiber *theFiber = 0;
778 UniaxialMaterial *material = 0;
779 NDMaterial *ndmaterial = 0;
780
781 if(section->getClassTag() == SEC_TAG_FiberSection2d) {
782 material = OPS_getUniaxialMaterial(matTag);

Callers

nothing calls this directly

Calls 15

OPS_ResetCommandLineFunction · 0.85
OPS_StraightReinfLayerFunction · 0.85
OPS_CircReinfLayerFunction · 0.85
ops_addFiberToSectionFunction · 0.85
isSetMethod · 0.80
getCurrentSectionMethod · 0.80
OPS_GetStringFunction · 0.70
OPS_getUniaxialMaterialFunction · 0.50
OPS_getNDMaterialFunction · 0.50
getNumReinfBarsMethod · 0.45
getReinfBarsMethod · 0.45
getMaterialIDMethod · 0.45

Tested by

no test coverage detected