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

Function ops_Model

SRC/interpreter/PythonModelBuilder.cpp:124–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124PyObject* ops_Model(PyObject* self, PyObject* args)
125{
126 OPS_ResetCommandLine(PyTuple_Size(args), 0, args);
127 int ndm = 0, ndf = 0;
128
129 // model builder type
130 if(OPS_GetNumRemainingInputArgs() == 0) {
131 PyErr_SetString(PyExc_RuntimeError,"model type must be set");
132 return NULL;
133 }
134 std::string model = OPS_GetString();
135
136 // ndm ndf
137 while(OPS_GetNumRemainingInputArgs() > 0) {
138 std::string type = OPS_GetString();
139 int numData = 1;
140 if(OPS_GetNumRemainingInputArgs() == 0) break;
141 if(type=="-ndm" || type=="-NDM") {
142 OPS_GetIntInput(&numData, &ndm);
143 } else if(type=="-ndf" || type=="-NDF") {
144 OPS_GetIntInput(&numData, &ndf);
145 }
146 }
147
148 if(ndm == 0) {
149 PyErr_SetString(PyExc_RuntimeError,"ERROR ndm must be set to positive value");
150 return NULL;
151 }
152
153 if(ndf == 0) {
154 if (ndm == 1)
155 ndf = 1;
156 else if (ndm == 2)
157 ndf = 3;
158 else if (ndm == 3)
159 ndf = 6;
160 else {
161 PyErr_SetString(PyExc_RuntimeError,"ERROR ndm has wrong value");
162 return NULL;
163 }
164 }
165
166 // basic model
167 if(model=="basic" || model=="Basic" || model=="BasicBuilder" || model=="basicBuilder") {
168 PythonModelBuilder& pBuilder = OPS_GetPythonModelBuilder();
169 pBuilder.set(ndm,ndf);
170 }
171
172 Py_INCREF(Py_None);
173 return Py_None;
174}
175
176
177PyObject *ops_addNode(PyObject *self, PyObject *args)

Callers

nothing calls this directly

Calls 5

OPS_ResetCommandLineFunction · 0.85
OPS_GetStringFunction · 0.70
OPS_GetIntInputFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected