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

Method runAnalysis

SRC/reliability/domain/functionEvaluator/PythonEvaluator.cpp:224–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224int PythonEvaluator::runAnalysis() {
225 // Let's just make a direct call since we have
226 // the pointer to OpenSees domain This replaces
227 // above call to Tcl command; however, in the
228 // reset command revertToStart() is also called
229 // on theTransientIntegrator -- MHS needs to
230 // check
231 if (theOpenSeesDomain->revertToStart() != 0) {
232 opserr << "ERROR PythonEvaluator -- error in "
233 "resetting Domain"
234 << endln;
235 return -1;
236 }
237
238 // Source the code file that the user has
239 // provided
240 if (fileName == 0) {
241 // no source file provided, this is akin to
242 // the basic evaluator of days gone by
243
244 } else {
245 // parse the filename
246 std::string parsedFileName(fileName);
247
248 // add imports
249 if (moduleName == "opensees") {
250 PyRun_SimpleString("import opensees");
251 PyRun_SimpleString("import opensees as ops");
252 } else {
253 PyRun_SimpleString("import openseespy.opensees as ops");
254 PyRun_SimpleString("import openseespy.opensees as opensees");
255 }
256 PyRun_SimpleString("from math import *");
257 PyRun_SimpleString("import math");
258 PyRun_SimpleString("par = opensees.OpenSeesParameter");
259
260 // add imports
261
262 if (PyRun_SimpleString(fileName) < 0) {
263 opserr << "WARNING: "
264 "PythonEvaluator::runAnalysis -- "
265 "fileName \""
266 << fileName;
267 opserr << "\" had some errors.\n";
268 opserr << "Note: use par[paramTag] to "
269 "access to parameters\n";
270 opserr << "Note: all math.* functions are "
271 "directly available "
272 "with or "
273 "without prefix math.\n";
274 return -1;
275 }
276
277 // Minjie -- no need to update parameters to previous values
278 // either DDM or FDM
279
280 // make sure the parameter variables in the
281 // namespace update to reflect the results of

Callers

nothing calls this directly

Calls 2

setVariablesMethod · 0.95
revertToStartMethod · 0.45

Tested by

no test coverage detected