本文整理汇总了C++中UniaxialMaterial::commitState方法的典型用法代码示例。如果您正苦于以下问题:C++ UniaxialMaterial::commitState方法的具体用法?C++ UniaxialMaterial::commitState怎么用?C++ UniaxialMaterial::commitState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniaxialMaterial
的用法示例。
在下文中一共展示了UniaxialMaterial::commitState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OPS_InvokeMaterialObject
static
void OPS_InvokeMaterialObject(struct matObject *theMat, modelState *theModel,double *strain, double *tang, double *stress, int *isw, int *result)
{
int matType = theMat->theParam[0];
if (matType == 1) {
// UniaxialMaterial *theMaterial = theUniaxialMaterials[matCount];
UniaxialMaterial *theMaterial = (UniaxialMaterial *)theMat->matObjectPtr;
if (theMaterial == 0) {
*result = -1;
return;
}
if (*isw == ISW_COMMIT) {
*result = theMaterial->commitState();
return;
} else if (*isw == ISW_REVERT) {
*result = theMaterial->revertToLastCommit();
return;
} else if (*isw == ISW_REVERT_TO_START) {
*result = theMaterial->revertToStart();
return;
} else if (*isw == ISW_FORM_TANG_AND_RESID) {
double matStress = 0.0;
double matTangent = 0.0;
int res = theMaterial->setTrial(strain[0], matStress, matTangent);
stress[0] = matStress;
tang[0] = matTangent;
*result = res;
return;
}
}
return;
}
示例2: OPS_setStrain
int OPS_setStrain()
{
if (OPS_GetNumRemainingInputArgs() != 1) {
opserr<<"testUniaxialMaterial - You must provide a strain value.\n";
return -1;
}
UniaxialMaterial* material = theTestingUniaxialMaterial;
if (material == 0) {
opserr<<"setStrain WARNING no active UniaxialMaterial - use testUniaxialMaterial command.\n";
return -1;
}
double strain;
int numData = 1;
if (OPS_GetDoubleInput(&numData, &strain) < 0) {
opserr<<"invalid double value\n";
return -1;
}
material->setTrialStrain(strain);
material->commitState();
return 0;
}