| 203 | } |
| 204 | |
| 205 | PyObject *ops_addHomogeneousBC(PyObject *self, PyObject *args) |
| 206 | { |
| 207 | // check model builder |
| 208 | if(pBuilder.isSet() == false) { |
| 209 | PyErr_SetString(PyExc_RuntimeError,"ERROR builder has not been set"); |
| 210 | return NULL; |
| 211 | } |
| 212 | |
| 213 | OPS_ResetCommandLine(PyTuple_Size(args), 0, args); |
| 214 | int numberArgs = OPS_GetNumRemainingInputArgs(); |
| 215 | |
| 216 | // get data |
| 217 | ID data(numberArgs); |
| 218 | if(OPS_GetIntInput(&numberArgs, &data[0]) < 0) { |
| 219 | return NULL; |
| 220 | } |
| 221 | |
| 222 | // get node |
| 223 | Domain* theDomain = OPS_GetDomain(); |
| 224 | Node* theNode = theDomain->getNode(data[0]); |
| 225 | if(theNode == 0) { |
| 226 | opserr<<"ERROR node "<<data[0]<<"does not exist\n"; |
| 227 | return NULL; |
| 228 | } |
| 229 | int ndf = theNode->getNumberDOF(); |
| 230 | |
| 231 | // check inputs |
| 232 | if(numberArgs < ndf+1) { |
| 233 | PyErr_SetString(PyExc_RuntimeError,"ERROR incorrect number of nodal fix terms"); |
| 234 | return NULL; |
| 235 | } |
| 236 | |
| 237 | // create homogeneous constraint |
| 238 | for(int i=0; i<ndf; i++) { |
| 239 | if(data[i+1] != 0) { |
| 240 | SP_Constraint *theSP = new SP_Constraint(data[0], i, 0.0, true); |
| 241 | if(theSP == 0) { |
| 242 | PyErr_SetString(PyExc_RuntimeError,"ERROR ran out of memory for SP_Constraint"); |
| 243 | return NULL; |
| 244 | } |
| 245 | if(theDomain->addSP_Constraint(theSP) == false) { |
| 246 | PyErr_SetString(PyExc_RuntimeError,"ERROR failed to add SP_Constraint to domain"); |
| 247 | delete theSP; |
| 248 | return NULL; |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | // return |
| 254 | Py_INCREF(Py_None); |
| 255 | return Py_None; |
| 256 | } |
| 257 | |
| 258 | PyObject *ops_addElement(PyObject *self, PyObject *args) |
| 259 | { |
nothing calls this directly
no test coverage detected