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

Function OPS_InvokeMaterialObject

SRC/api/elementAPI_TCL.cpp:119–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117//std::map<int, UniaxialMaterial *>theUniaxialMaterials; // map for UniaxialMaterial objects needed by user added ele functions'
118
119static
120void OPS_InvokeMaterialObject(struct matObject* theMat, modelState* theModel, double* strain, double* tang, double* stress, int* isw, int* result)
121{
122 int matType = (int)theMat->theParam[0];
123
124 if (matType == 1) {
125 // UniaxialMaterial *theMaterial = theUniaxialMaterials[matCount];
126 UniaxialMaterial* theMaterial = (UniaxialMaterial*)theMat->matObjectPtr;
127 if (theMaterial == 0) {
128 *result = -1;
129 return;
130 }
131
132 if (*isw == ISW_COMMIT) {
133 *result = theMaterial->commitState();
134 return;
135 }
136 else if (*isw == ISW_REVERT) {
137 *result = theMaterial->revertToLastCommit();
138 return;
139 }
140 else if (*isw == ISW_REVERT_TO_START) {
141 *result = theMaterial->revertToStart();
142 return;
143 }
144 else if (*isw == ISW_FORM_TANG_AND_RESID) {
145 double matStress = 0.0;
146 double matTangent = 0.0;
147 int res = theMaterial->setTrial(strain[0], matStress, matTangent);
148 stress[0] = matStress;
149 tang[0] = matTangent;
150 *result = res;
151 return;
152 }
153 }
154
155 return;
156}
157
158extern "C"
159int OPS_Error(char* errorMessage, int length)

Callers

nothing calls this directly

Calls 4

commitStateMethod · 0.45
revertToLastCommitMethod · 0.45
revertToStartMethod · 0.45
setTrialMethod · 0.45

Tested by

no test coverage detected