| 351 | } |
| 352 | |
| 353 | PyObject *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 | |
| 405 | PyObject *ops_addSP(PyObject *self, PyObject *args) |
| 406 | { |
nothing calls this directly
no test coverage detected