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

Function TclPatternCommand

SRC/domain/pattern/TclPatternCommand.cpp:91–915  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89
90
91int
92TclPatternCommand(ClientData clientData, Tcl_Interp *interp,
93 int argc, TCL_Char **argv, Domain *theDomain)
94{
95 LoadPattern *thePattern = 0;
96
97 // make sure at least one other argument to contain integrator
98 if (argc < 4) {
99 opserr << "WARNING invalid command - want: pattern type ";
100 opserr << " <type args> {list of load and sp constraints commands}\n";
101 opserr << " valid types: Plain, UniformExcitation, MultiSupport\n";
102 return TCL_ERROR;
103 }
104
105
106 TimeSeries *theSeries = 0;
107 int patternID =0;
108
109 if (Tcl_GetInt(interp, argv[2], &patternID) != TCL_OK) {
110 opserr << "WARNING invalid patternID: pattern type " << argv[2]
111 << "<type args>\n";
112 return TCL_ERROR;
113 }
114
115 int commandEndMarker = 0;
116
117 if (strcmp(argv[1],"Plain") == 0) {
118
119 double fact = 1.0;
120 if (argc==7 && ((strcmp(argv[4],"-fact") == 0) ||
121 (strcmp(argv[4],"-factor") == 0))) {
122 if (Tcl_GetDouble(interp, argv[5], &fact) != TCL_OK) {
123 opserr << "WARNING invalid fact: pattern type Plain\n";
124 return TCL_ERROR;
125 }
126 }
127 thePattern = new LoadPattern(patternID,fact);
128 theSeries = TclSeriesCommand(clientData, interp, argv[3]);
129
130 if (thePattern == 0 || theSeries == 0) {
131
132 if (thePattern == 0) {
133 opserr << "WARNING - out of memory creating LoadPattern ";
134 opserr << patternID << endln;
135 } else {
136 opserr << "WARNING - problem creating TimeSeries for LoadPattern ";
137 opserr << patternID << endln;
138 }
139
140 // clean up the memory and return an error
141 if (thePattern != 0)
142 delete thePattern;
143 if (theSeries != 0)
144 delete theSeries;
145 return TCL_ERROR;
146 }
147
148 thePattern->setTimeSeries(theSeries);

Callers 2

TclCommand_addPatternFunction · 0.50

Calls 8

TclSeriesCommandFunction · 0.85
exitFunction · 0.85
setTimeSeriesMethod · 0.80
setFireTimeSeriesMethod · 0.80
setMapsMethod · 0.80
addLoadPatternMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected