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

Function OPS_Patch

SRC/interpreter/OpenSeesSectionCommands.cpp:456–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454}
455
456int OPS_Patch()
457{
458 // num args
459 if(OPS_GetNumRemainingInputArgs() < 1) {
460 opserr<<"WARNING insufficient args: patch type ...\n";
461 return -1;
462 }
463
464 // create patch
465 Patch *thePatch = 0;
466 const char* type = OPS_GetString();
467 if(strcmp(type,"quad")==0 || strcmp(type,"quadr")==0 || strcmp(type,"quadrilateral")==0) {
468 thePatch = (QuadPatch*) OPS_QuadPatch();
469 } else if(strcmp(type,"rect")==0 || strcmp(type,"rectangular")==0) {
470 thePatch = (QuadPatch*) OPS_RectPatch();
471 } else if(strcmp(type,"circ")==0 || strcmp(type,"circular")==0) {
472 thePatch = (CircPatch*) OPS_CircPatch();
473 } else {
474 opserr<<"ERROR unknown patch type\n";
475 return -1;
476 }
477
478 if (thePatch == 0) {
479 opserr<<"WARNING failed to create patch\n";
480 return -1;
481 }
482
483 // add fibers to the section
484 int numCells = thePatch->getNumCells();
485 int matTag = thePatch->getMaterialID();
486 Cell** cells = thePatch->getCells();
487 if(cells == 0) {
488 opserr << "ERROR out of run to create fibers\n";
489 delete thePatch;
490 return -1;
491 }
492 for(int j=0; j<numCells; j++) {
493 // get fiber data
494 double area = cells[j]->getArea();
495 const Vector& cPos = cells[j]->getCentroidPosition();
496
497 // create fibers
498 Fiber *theFiber = 0;
499 UniaxialMaterial *material = 0;
500 NDMaterial *ndmaterial = 0;
501
502 if (theActiveFiberSection2d != 0) {
503
504 material = OPS_getUniaxialMaterial(matTag);
505 if (material == 0) {
506 opserr << "WARNING material "<<matTag<<" cannot be found\n";
507 delete thePatch;
508 return -1;
509 }
510 theFiber = new UniaxialFiber2d(j,*material,area,cPos(0));
511 theActiveFiberSection2d->addFiber(*theFiber);
512
513 } else if (theActiveFiberSection2dThermal != 0) {

Callers 2

Tcl_ops_patchFunction · 0.85
Py_ops_patchFunction · 0.85

Calls 13

OPS_QuadPatchFunction · 0.85
OPS_RectPatchFunction · 0.85
OPS_CircPatchFunction · 0.85
OPS_GetStringFunction · 0.70
OPS_getUniaxialMaterialFunction · 0.50
OPS_getNDMaterialFunction · 0.50
getNumCellsMethod · 0.45
getMaterialIDMethod · 0.45
getCellsMethod · 0.45
getAreaMethod · 0.45
addFiberMethod · 0.45

Tested by

no test coverage detected