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

Function ops_UniaxialMaterialCommand

SRC/interpreter/OpenSeesCommandsPython.cpp:33–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31extern "C" void OPS_ResetCommandLine(int nArgs, int cArg, PyObject *args);
32
33static PyObject *ops_UniaxialMaterialCommand(PyObject *self, PyObject *args)
34{
35 OPS_ResetCommandLine(PyTuple_Size(args), 0, args);
36 int numberArgs = OPS_GetNumRemainingInputArgs();
37
38 if (numberArgs < 2) {
39 PyErr_SetString(PyExc_RuntimeError, "ERROR too few arguments: uniaxialMaterial type? tag? args.");
40 return NULL;
41 }
42
43 const char *matType = OPS_GetString();
44 UniaxialMaterial *theMaterial = OPS_ParseUniaxialMaterialCommand(matType);
45
46 if (theMaterial == 0) {
47 PyErr_SetString(PyExc_RuntimeError, "ERROR could not create uniaxialMaterial.");
48 return NULL;
49 }
50
51 // Now add the material to the modelBuilder
52 if (OPS_addUniaxialMaterial(theMaterial) == false) {
53 PyErr_SetString(PyExc_RuntimeError, "ERROR could not add uniaxialMaterial.");
54 delete theMaterial; // invoke the material objects destructor, otherwise mem leak
55 return NULL;
56 }
57
58 PyObject *ret = Py_BuildValue("d", 0.0);
59 return ret;
60}
61
62static PyObject *ops_testUniaxialMaterial(PyObject *self, PyObject *args)
63{

Callers

nothing calls this directly

Calls 4

OPS_ResetCommandLineFunction · 0.85
OPS_GetStringFunction · 0.70
OPS_addUniaxialMaterialFunction · 0.50

Tested by

no test coverage detected