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

Function TclCommand_specifyModel

SRC/runtime/commands/modeling/model.cpp:49–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47
48//
49int
50TclCommand_specifyModel(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char *argv[])
51{
52 G3_Runtime *rt = G3_getRuntime(interp);
53 Domain *theNewDomain = (Domain*)clientData;
54
55 BasicModelBuilder *theNewBuilder = nullptr;
56
57 //
58 //
59 //
60 if (clientData == nullptr) {
61 theNewDomain = new Domain();
62
63 // TODO: remove ops_TheActiveDomain
64 ops_TheActiveDomain = theNewDomain;
65
66 Tcl_CreateCommand(interp, "model", &TclCommand_specifyModel, theNewDomain, nullptr);
67
68 G3_AddTclDomainCommands(interp, theNewDomain);
69 }
70
71
72 // make sure at least one other argument to contain model builder type given
73 if (argc < 2) {
74 opserr << OpenSees::PromptValueError << "need to specify a model type, valid types:\n";
75 opserr << "\tBasicBuilder\n";
76 return TCL_ERROR;
77 }
78
79 // check argv[1] for type of ModelBuilder and create the object
80 if ((strcmp(argv[1], "basic") == 0) ||
81 (strcmp(argv[1], "Basic") == 0) ||
82 (strcmp(argv[1], "-ndm") == 0) ||
83 (strcmp(argv[1], "BasicBuilder") == 0) ||
84 (strcmp(argv[1], "basicBuilder") == 0)) {
85
86 if (argc < 3) {
87 opserr << OpenSees::PromptValueError
88 << "incorrect number of arguments\n";
89 return TCL_ERROR;
90 }
91 int ndm = 0;
92 int ndf = 0;
93
94 int posArg = 1; // track positional argument
95 int argPos = 2;
96 while (argPos < argc) {
97 if (strcmp(argv[argPos], "-ndm") == 0 ||
98 strcmp(argv[argPos], "-NDM") == 0) {
99 argPos++;
100 if (argPos < argc) {
101 if (Tcl_GetInt(interp, argv[argPos], &ndm) != TCL_OK) {
102 opserr << OpenSees::PromptValueError
103 << "error reading ndm, got '" << argv[argPos] << "'\n";
104 return TCL_ERROR;
105 }
106 }

Callers

nothing calls this directly

Calls 5

G3_getRuntimeFunction · 0.85
G3_AddTclDomainCommandsFunction · 0.85
G3_setDomainFunction · 0.85
G3_setModelBuilderFunction · 0.85
G3_AddTclAnalysisAPIFunction · 0.85

Tested by

no test coverage detected