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

Function ops_printModel

SRC/interpreter/PythonAnalysisBuilder.cpp:528–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526static int ops_printInteg(OPS_Stream &output, PyObject *args);
527
528PyObject *ops_printModel(PyObject *self, PyObject *args)
529{
530 OPS_ResetCommandLine(PyTuple_Size(args), 0, args);
531
532 // file stream
533 FileStream outputFile;
534 OPS_Stream *output = &opserr;
535
536 // domain
537 Domain& theDomain = *(OPS_GetDomain());
538
539 // just printModel()
540 int numData = OPS_GetNumRemainingInputArgs();
541 if(numData == 0) {
542 opserr << theDomain;
543 Py_INCREF(Py_None);
544 return Py_None;
545 }
546
547 // printModel()
548 int res = 0;
549 while(numData > 0) {
550 std::string type = OPS_GetString();
551 if(type=="-ele" || type=="ele") {
552 res = ops_printEle(*output,args);
553 break;
554 } else if(type=="-node" || type=="node") {
555 res = ops_printNode(*output,args);
556 break;
557 } else if(type=="-integrator" || type=="integrator") {
558 res = ops_printInteg(*output,args);
559 break;
560 } else if(type=="-algorithm" || type=="algorithm") {
561 res = ops_printAlgo(*output,args);
562 break;
563 } else {
564 // open file
565 if(type=="-file" || type=="file") {
566 type = OPS_GetString();
567 numData = OPS_GetNumRemainingInputArgs();
568 }
569 if(outputFile.setFile(type.c_str(), APPEND) != 0) {
570 PyErr_SetString(PyExc_RuntimeError,"failed to open file ");
571 return NULL;
572 }
573
574 // just print(filename)
575 if(numData == 0) {
576 outputFile << theDomain;
577 Py_INCREF(Py_None);
578 return Py_None;
579 }
580 output = &outputFile;
581 }
582 }
583
584 if(res < 0) {
585 PyErr_SetString(PyExc_RuntimeError,"failed to print ");

Callers

nothing calls this directly

Calls 10

OPS_ResetCommandLineFunction · 0.85
ops_printEleFunction · 0.85
ops_printNodeFunction · 0.85
ops_printIntegFunction · 0.85
ops_printAlgoFunction · 0.85
OPS_GetDomainFunction · 0.70
OPS_GetStringFunction · 0.70
setFileMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected