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

Function ops_addHomogeneousBC

SRC/interpreter/PythonModelBuilder.cpp:205–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205PyObject *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
258PyObject *ops_addElement(PyObject *self, PyObject *args)
259{

Callers

nothing calls this directly

Calls 8

OPS_ResetCommandLineFunction · 0.85
isSetMethod · 0.80
OPS_GetIntInputFunction · 0.70
OPS_GetDomainFunction · 0.70
getNodeMethod · 0.45
getNumberDOFMethod · 0.45
addSP_ConstraintMethod · 0.45

Tested by

no test coverage detected