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

Function ops_addNodalLoad

SRC/interpreter/PythonModelBuilder.cpp:353–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353PyObject *ops_addNodalLoad(PyObject *self, PyObject *args)
354{
355 // check model builder
356 if(pBuilder.isSet() == false) {
357 PyErr_SetString(PyExc_RuntimeError,"ERROR builder has not been set");
358 return NULL;
359 }
360
361 OPS_ResetCommandLine(PyTuple_Size(args), 0, args);
362
363 NodalLoad *theLoad = (NodalLoad*) OPS_NodalLoad();
364 if(theLoad == 0) {
365 PyErr_SetString(PyExc_RuntimeError, "ERROR could not create NodalLoad.");
366 return NULL;
367 }
368
369 // check user pattern
370 bool userPattern = false;
371 int loadPatternTag = 0;
372 if(OPS_GetNumRemainingInputArgs() > 1) {
373 std::string type = OPS_GetString();
374 if(type == "-pattern") {
375 int numData = 1;
376 if(OPS_GetIntInput(&numData, &loadPatternTag) < 0) {
377 delete theLoad;
378 return NULL;
379 }
380 userPattern = true;
381 }
382 }
383
384 // get the current pattern tag
385 if(userPattern == false) {
386 if(pBuilder.getCurrentLoadPattern() == 0) {
387 PyErr_SetString(PyExc_RuntimeError, "ERROR no current load pattern.");
388 delete theLoad;
389 return NULL;
390 }
391 loadPatternTag = pBuilder.getCurrentLoadPattern()->getTag();
392 }
393
394 // Now add the load
395 Domain& theDomain = *(OPS_GetDomain());
396 if(theDomain.addNodalLoad(theLoad,loadPatternTag) == false) {
397 PyErr_SetString(PyExc_RuntimeError, "ERROR could not add NodalLoad.");
398 delete theLoad; // invoke the material objects destructor, otherwise mem leak
399 return NULL;
400 }
401
402 return Py_BuildValue("d", loadPatternTag);
403}
404
405PyObject *ops_addSP(PyObject *self, PyObject *args)
406{

Callers

nothing calls this directly

Calls 10

OPS_ResetCommandLineFunction · 0.85
OPS_NodalLoadFunction · 0.85
isSetMethod · 0.80
getCurrentLoadPatternMethod · 0.80
OPS_GetStringFunction · 0.70
OPS_GetIntInputFunction · 0.70
OPS_GetDomainFunction · 0.70
getTagMethod · 0.45
addNodalLoadMethod · 0.45

Tested by

no test coverage detected