当前位置: 首页>>代码示例>>C++>>正文


C++ Patch::getCells方法代码示例

本文整理汇总了C++中Patch::getCells方法的典型用法代码示例。如果您正苦于以下问题:C++ Patch::getCells方法的具体用法?C++ Patch::getCells怎么用?C++ Patch::getCells使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Patch的用法示例。


在下文中一共展示了Patch::getCells方法的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);
//.........这里部分代码省略.........
开发者ID:fmckenna,项目名称:OpenSees,代码行数:101,代码来源:OpenSeesSectionCommands.cpp


注:本文中的Patch::getCells方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。