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

Method getDouble

SRC/interpreter/PythonModule.cpp:159–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159int
160PythonModule::getDouble(double *data, int numArgs) {
161 if ((wrapper.getNumberArgs() - wrapper.getCurrentArg()) < numArgs) {
162 return -1;
163 }
164
165 for (int i = 0; i < numArgs; i++) {
166 PyObject *o = PyTuple_GetItem(wrapper.getCurrentArgv(), wrapper.getCurrentArg());
167 wrapper.incrCurrentArg();
168 if (PyLong_Check(o) || PyFloat_Check(o) || PyBool_Check(o)) {
169 PyErr_Clear();
170 data[i] = PyFloat_AsDouble(o);
171 if (PyErr_Occurred()) {
172 return -1;
173 }
174 } else {
175 return -1;
176 }
177 }
178
179 return 0;
180}
181
182int PythonModule::getDoubleList(int* size, Vector* data)
183{

Callers 1

OPS_GetDoubleInputFunction · 0.45

Calls 4

getNumberArgsMethod · 0.45
getCurrentArgMethod · 0.45
getCurrentArgvMethod · 0.45
incrCurrentArgMethod · 0.45

Tested by

no test coverage detected