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

Function OPS_functionEvaluator

SRC/interpreter/OpenSeesReliabilityCommands.cpp:2575–2642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2573}
2574
2575int OPS_functionEvaluator() {
2576 if (OPS_GetNumRemainingInputArgs() < 1) {
2577 opserr << "ERROR: wrong number of arguments to functionEvaluator"
2578 << endln;
2579 return -1;
2580 }
2581
2582 if (cmds == 0) {
2583 opserr << "WARNING: Reliability is not initialized\n";
2584 return -1;
2585 }
2586 if (cmds->getStructuralDomain() == 0) {
2587 opserr << "WARNING: Reliability has no structural domain\n";
2588 return -1;
2589 }
2590 if (cmds->getDomain() == 0) {
2591 opserr << "WARNING: Reliability has no domain\n";
2592 return -1;
2593 }
2594
2595 FunctionEvaluator *theEval = 0;
2596
2597 // Get the type of functionEvaluator
2598 const char *type = OPS_GetString();
2599 const char *filename = 0;
2600 if (OPS_GetNumRemainingInputArgs() > 0) {
2601 filename = OPS_GetString();
2602 if (strcmp(filename, "-file") == 0 &&
2603 OPS_GetNumRemainingInputArgs() > 0) {
2604 filename = OPS_GetString();
2605 }
2606 }
2607 if (strcmp(type, "Matlab") == 0) {
2608 opserr << "ERROR: Matlab function evaluator not implemented"
2609 << endln;
2610 return -1;
2611 } else if (strcmp(type, "Tcl") == 0) {
2612 opserr << "ERROR: Tcl function evaluator not implemented" << endln;
2613 return -1;
2614 } else if (strcmp(type, "Python") == 0) {
2615#ifdef _PYTHON3
2616 if (filename == 0) {
2617 theEval = new PythonEvaluator(cmds->getDomain(),
2618 cmds->getStructuralDomain());
2619 } else {
2620 theEval = new PythonEvaluator(
2621 cmds->getDomain(), cmds->getStructuralDomain(), filename);
2622 }
2623#else
2624 opserr << "ERROR: Python function evaluator not implemented"
2625 << endln;
2626 return -1;
2627#endif
2628 } else {
2629 opserr << "ERROR: unrecognized type of function evaluator: "
2630 << type << endln;
2631 return -1;
2632 }

Callers 2

Py_ops_functionEvaluatorFunction · 0.85

Calls 5

getStructuralDomainMethod · 0.80
setFunctionEvaluatorMethod · 0.80
OPS_GetStringFunction · 0.70
getDomainMethod · 0.45

Tested by

no test coverage detected