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

Function ops_setStrain

SRC/interpreter/OpenSeesCommandsPython.cpp:90–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88
89
90static PyObject *ops_setStrain(PyObject *self, PyObject *args)
91{
92 int argc = PyTuple_Size(args);
93 if (argc == 0) {
94 return NULL;
95 PyErr_SetString(PyExc_RuntimeError, "You must provide a strain value.");
96 }
97
98 PyObject *o = PyTuple_GetItem(args,0);
99 if (!PyFloat_Check(o)) {
100 PyErr_SetString(PyExc_ValueError,"setStrain expected a floating point value");
101 return NULL;
102 }
103
104 double opsStrain = PyFloat_AS_DOUBLE(o);
105 if (theTestingUniaxialMaterial !=0 ) {
106 theTestingUniaxialMaterial->setTrialStrain(opsStrain);
107 theTestingUniaxialMaterial->commitState();
108 } else {
109 PyErr_SetString(PyExc_ValueError,"setStrain WARNING no active UniaxialMaterial - use testUniaxialMaterial command");
110 return NULL;
111 }
112 PyObject *ret = Py_BuildValue("d", opsStrain);
113 return ret;
114}
115
116
117static PyObject *ops_getStrain(PyObject *self, PyObject *args)

Callers

nothing calls this directly

Calls 2

setTrialStrainMethod · 0.45
commitStateMethod · 0.45

Tested by

no test coverage detected