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

Function ops_addPattern

SRC/interpreter/PythonModelBuilder.cpp:315–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315PyObject *ops_addPattern(PyObject *self, PyObject *args)
316{
317 // check model builder
318 if(pBuilder.isSet() == false) {
319 PyErr_SetString(PyExc_RuntimeError,"ERROR builder has not been set");
320 return NULL;
321 }
322
323 OPS_ResetCommandLine(PyTuple_Size(args), 0, args);
324
325 const char *pType = OPS_GetString();
326 LoadPattern* thePattern = OPS_ParseLoadPatternCommand(pType);
327
328 if(thePattern == 0) {
329 PyErr_SetString(PyExc_RuntimeError, "ERROR could not create LoadPattern.");
330 return NULL;
331 }
332
333 // Now add the pattern
334 Domain& theDomain = *(OPS_GetDomain());
335 if(theDomain.addLoadPattern(thePattern) == false) {
336 PyErr_SetString(PyExc_RuntimeError, "ERROR could not add LoadPattern.");
337 delete thePattern; // invoke the material objects destructor, otherwise mem leak
338 return NULL;
339 }
340
341 // set current pattern
342 std::string type = pType;
343 if(type == "Plain") {
344 pBuilder.setCurrentLoadPattern(thePattern);
345 } else if(type == "MultipleSupport") {
346 pBuilder.setCurrentMultiPattern(dynamic_cast<MultiSupportPattern*>(thePattern));
347 }
348
349 return Py_BuildValue("d", thePattern->getTag());
350
351}
352
353PyObject *ops_addNodalLoad(PyObject *self, PyObject *args)
354{

Callers

nothing calls this directly

Calls 8

OPS_ResetCommandLineFunction · 0.85
isSetMethod · 0.80
setCurrentLoadPatternMethod · 0.80
OPS_GetStringFunction · 0.70
OPS_GetDomainFunction · 0.70
addLoadPatternMethod · 0.45
getTagMethod · 0.45

Tested by

no test coverage detected