| 403 | } |
| 404 | |
| 405 | PyObject *ops_addSP(PyObject *self, PyObject *args) |
| 406 | { |
| 407 | // check model builder |
| 408 | if(pBuilder.isSet() == false) { |
| 409 | PyErr_SetString(PyExc_RuntimeError,"ERROR builder has not been set"); |
| 410 | return NULL; |
| 411 | } |
| 412 | |
| 413 | OPS_ResetCommandLine(PyTuple_Size(args), 0, args); |
| 414 | |
| 415 | SP_Constraint *theSP = (SP_Constraint*) OPS_SP(); |
| 416 | if(theSP == 0) { |
| 417 | PyErr_SetString(PyExc_RuntimeError, "ERROR could not create SP_Constraint."); |
| 418 | return NULL; |
| 419 | } |
| 420 | |
| 421 | // check user pattern |
| 422 | bool userPattern = false; |
| 423 | int loadPatternTag = 0; |
| 424 | if(OPS_GetNumRemainingInputArgs() > 1) { |
| 425 | std::string type = OPS_GetString(); |
| 426 | if(type == "-pattern") { |
| 427 | int numData = 1; |
| 428 | if(OPS_GetIntInput(&numData, &loadPatternTag) < 0) { |
| 429 | delete theSP; |
| 430 | return NULL; |
| 431 | } |
| 432 | userPattern = true; |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | // get the current pattern tag |
| 437 | if(userPattern == false) { |
| 438 | if(pBuilder.getCurrentLoadPattern() == 0) { |
| 439 | PyErr_SetString(PyExc_RuntimeError, "ERROR no current load pattern."); |
| 440 | delete theSP; |
| 441 | return NULL; |
| 442 | } |
| 443 | loadPatternTag = pBuilder.getCurrentLoadPattern()->getTag(); |
| 444 | } |
| 445 | |
| 446 | // Now add the load |
| 447 | Domain& theDomain = *(OPS_GetDomain()); |
| 448 | if(theDomain.addSP_Constraint(theSP,loadPatternTag) == false) { |
| 449 | PyErr_SetString(PyExc_RuntimeError, "ERROR could not add SP_Constraint."); |
| 450 | delete theSP; // invoke the material objects destructor, otherwise mem leak |
| 451 | return NULL; |
| 452 | } |
| 453 | |
| 454 | return Py_BuildValue("d", theSP->getTag()); |
| 455 | } |
| 456 | |
| 457 | PyObject *ops_addSection(PyObject *self, PyObject *args) |
| 458 | { |
nothing calls this directly
no test coverage detected