| 454 | } |
| 455 | |
| 456 | int 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) { |
no test coverage detected