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

Function ops_addElement

SRC/interpreter/PythonModelBuilder.cpp:258–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256}
257
258PyObject *ops_addElement(PyObject *self, PyObject *args)
259{
260 // check model builder
261 if(pBuilder.isSet() == false) {
262 PyErr_SetString(PyExc_RuntimeError,"ERROR builder has not been set");
263 return NULL;
264 }
265
266 OPS_ResetCommandLine(PyTuple_Size(args), 0, args);
267
268 const char *eleType = OPS_GetString();
269 Element* theEle = OPS_ParseElementCommand(eleType);
270
271 if(theEle == 0) {
272 PyErr_SetString(PyExc_RuntimeError, "ERROR could not create element.");
273 return NULL;
274 }
275
276 // Now add the element to the modelBuilder
277 Domain* theDomain = OPS_GetDomain();
278 if(theDomain->addElement(theEle) == false) {
279 PyErr_SetString(PyExc_RuntimeError, "ERROR could not add element to domain.");
280 delete theEle; // invoke the material objects destructor, otherwise mem leak
281 return NULL;
282 }
283
284 return Py_BuildValue("d", theEle->getTag());
285}
286
287PyObject *ops_addTimeSeries(PyObject *self, PyObject *args)
288{

Callers

nothing calls this directly

Calls 6

OPS_ResetCommandLineFunction · 0.85
isSetMethod · 0.80
OPS_GetStringFunction · 0.70
OPS_GetDomainFunction · 0.70
addElementMethod · 0.45
getTagMethod · 0.45

Tested by

no test coverage detected