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

Function ops_addSP

SRC/interpreter/PythonModelBuilder.cpp:405–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405PyObject *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
457PyObject *ops_addSection(PyObject *self, PyObject *args)
458{

Callers

nothing calls this directly

Calls 10

OPS_ResetCommandLineFunction · 0.85
OPS_SPFunction · 0.85
isSetMethod · 0.80
getCurrentLoadPatternMethod · 0.80
OPS_GetStringFunction · 0.70
OPS_GetIntInputFunction · 0.70
OPS_GetDomainFunction · 0.70
getTagMethod · 0.45
addSP_ConstraintMethod · 0.45

Tested by

no test coverage detected