本文整理汇总了C++中Patch::getMaterialID方法的典型用法代码示例。如果您正苦于以下问题:C++ Patch::getMaterialID方法的具体用法?C++ Patch::getMaterialID怎么用?C++ Patch::getMaterialID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Patch
的用法示例。
在下文中一共展示了Patch::getMaterialID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OPS_Patch
int OPS_Patch()
{
// num args
if(OPS_GetNumRemainingInputArgs() < 1) {
opserr<<"WARNING insufficient args: patch type ...\n";
return -1;
}
// create patch
Patch *thePatch = 0;
const char* type = OPS_GetString();
if(strcmp(type,"quad")==0 || strcmp(type,"quadr")==0 || strcmp(type,"quadrilateral")==0) {
thePatch = (QuadPatch*) OPS_QuadPatch();
} else if(strcmp(type,"rect")==0 || strcmp(type,"rectangular")==0) {
thePatch = (QuadPatch*) OPS_RectPatch();
} else if(strcmp(type,"circ")==0 || strcmp(type,"circular")==0) {
thePatch = (CircPatch*) OPS_CircPatch();
} else {
opserr<<"ERROR unknow patch type\n";
return -1;
}
if (thePatch == 0) {
opserr<<"WARNING failed to create patch\n";
return -1;
}
// add fibers to the section
int numCells = thePatch->getNumCells();
int matTag = thePatch->getMaterialID();
Cell** cells = thePatch->getCells();
if(cells == 0) {
opserr << "ERROR out of run to create fibers\n";
delete thePatch;
return -1;
}
for(int j=0; j<numCells; j++) {
// get fiber data
double area = cells[j]->getArea();
const Vector& cPos = cells[j]->getCentroidPosition();
// create fibers
Fiber *theFiber = 0;
UniaxialMaterial *material = 0;
NDMaterial *ndmaterial = 0;
if (theActiveFiberSection2d != 0) {
material = OPS_getUniaxialMaterial(matTag);
if (material == 0) {
opserr << "WARNING material "<<matTag<<" cannot be found\n";
delete thePatch;
return -1;
}
theFiber = new UniaxialFiber2d(j,*material,area,cPos(0));
theActiveFiberSection2d->addFiber(*theFiber);
} else if (theActiveFiberSection2dThermal != 0) {
material = OPS_getUniaxialMaterial(matTag);
if (material == 0) {
opserr << "WARNING material "<<matTag<<" cannot be found\n";
delete thePatch;
return -1;
}
theFiber = new UniaxialFiber2d(j,*material,area,cPos(0));
theActiveFiberSection2dThermal->addFiber(*theFiber);
} else if (theActiveFiberSection3d != 0) {
material = OPS_getUniaxialMaterial(matTag);
if (material == 0) {
opserr << "WARNING material "<<matTag<<" cannot be found\n";
delete thePatch;
return -1;
}
theFiber = new UniaxialFiber3d(j,*material,area,cPos);
theActiveFiberSection3d->addFiber(*theFiber);
} else if (theActiveFiberSection3dThermal != 0) {
material = OPS_getUniaxialMaterial(matTag);
if (material == 0) {
opserr << "WARNING material "<<matTag<<" cannot be found\n";
delete thePatch;
return -1;
}
theFiber = new UniaxialFiber3d(j,*material,area,cPos);
theActiveFiberSection3dThermal->addFiber(*theFiber);
} else if (theActiveFiberSectionGJThermal != 0) {
material = OPS_getUniaxialMaterial(matTag);
if (material == 0) {
opserr << "WARNING material "<<matTag<<" cannot be found\n";
delete thePatch;
return -1;
}
theFiber = new UniaxialFiber3d(j,*material,area,cPos);
theActiveFiberSectionGJThermal->addFiber(*theFiber);
//.........这里部分代码省略.........