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

Function ops_addPatch

SRC/interpreter/PythonModelBuilder.cpp:617–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

615}
616
617PyObject *ops_addPatch(PyObject *self, PyObject *args)
618{
619 // check model builder
620 if(pBuilder.isSet() == false) {
621 PyErr_SetString(PyExc_RuntimeError,"ERROR builder has not been set");
622 return NULL;
623 }
624
625 OPS_ResetCommandLine(PyTuple_Size(args), 0, args);
626
627 // check if a section is being processed
628 SectionForceDeformation* section = pBuilder.getCurrentSection();
629 if(section == 0) {
630 PyErr_SetString(PyExc_RuntimeError,"ERROR no current section");
631 return NULL;
632 }
633
634 // create fiber
635 Patch *thePatch =0;
636 std::string type = OPS_GetString();
637 if(type == "quad" || type == "quadrilateral") {
638 thePatch = (Patch*) OPS_QuadPatch();
639 } else if(type == "rect" || type == "rectangular") {
640 thePatch = (Patch*) OPS_RectPatch();
641 } else if(type == "circ" || type == "circular") {
642 thePatch = (Patch*) OPS_CircPatch();
643 } else {
644 PyErr_SetString(PyExc_RuntimeError,"ERROR unknown patch type");
645 return NULL;
646 }
647
648 if(thePatch == 0) {
649 PyErr_SetString(PyExc_RuntimeError,"ERROR failed to create Patch");
650 return NULL;
651 }
652
653 // add fibers to the section
654 int numCells = thePatch->getNumCells();
655 int matTag = thePatch->getMaterialID();
656 Cell** cells = thePatch->getCells();
657 if(cells == 0) {
658 PyErr_SetString(PyExc_RuntimeError,"ERROR out of run to create fibers");
659 delete thePatch;
660 return NULL;
661 }
662 for(int j=0; j<numCells; j++) {
663 // get fiber data
664 double area = cells[j]->getArea();
665 const Vector& cPos = cells[j]->getCentroidPosition();
666
667 // create fibers
668 Fiber *theFiber = 0;
669 UniaxialMaterial *material = 0;
670 NDMaterial *ndmaterial = 0;
671
672 if(section->getClassTag() == SEC_TAG_FiberSection2d) {
673 material = OPS_getUniaxialMaterial(matTag);
674 if(material == 0) {

Callers

nothing calls this directly

Calls 15

OPS_ResetCommandLineFunction · 0.85
OPS_QuadPatchFunction · 0.85
OPS_RectPatchFunction · 0.85
OPS_CircPatchFunction · 0.85
ops_addFiberToSectionFunction · 0.85
isSetMethod · 0.80
getCurrentSectionMethod · 0.80
OPS_GetStringFunction · 0.70
OPS_getUniaxialMaterialFunction · 0.50
OPS_getNDMaterialFunction · 0.50
getNumCellsMethod · 0.45
getMaterialIDMethod · 0.45

Tested by

no test coverage detected