| 78 | |
| 79 | |
| 80 | int |
| 81 | TclPatternCommand(ClientData clientData, Tcl_Interp *interp, |
| 82 | int argc, TCL_Char **argv, Domain *theDomain) |
| 83 | { |
| 84 | LoadPattern *thePattern = 0; |
| 85 | |
| 86 | // make sure at least one other argument to contain integrator |
| 87 | if (argc < 4) { |
| 88 | opserr << "WARNING invalid command - want: pattern type "; |
| 89 | opserr << " <type args> {list of load and sp constraints commands}\n"; |
| 90 | opserr << " valid types: Plain, UniformExcitation, MultiSupport\n"; |
| 91 | return TCL_ERROR; |
| 92 | } |
| 93 | |
| 94 | TimeSeries *theSeries = 0; |
| 95 | int patternID =0; |
| 96 | |
| 97 | if (Tcl_GetInt(interp, argv[2], &patternID) != TCL_OK) { |
| 98 | opserr << "WARNING invalid patternID: pattern type " << argv[2] |
| 99 | << "<type args>\n"; |
| 100 | return TCL_ERROR; |
| 101 | } |
| 102 | |
| 103 | int commandEndMarker = 0; |
| 104 | |
| 105 | if (strcmp(argv[1],"Plain") == 0) { |
| 106 | |
| 107 | thePattern = new LoadPattern(patternID); |
| 108 | theSeries = TclSeriesCommand(clientData, interp, argv[3]); |
| 109 | |
| 110 | |
| 111 | if (thePattern == 0 || theSeries == 0) { |
| 112 | |
| 113 | if (thePattern == 0) { |
| 114 | opserr << "WARNING - out of memory creating LoadPattern "; |
| 115 | opserr << patternID << endln; |
| 116 | } else { |
| 117 | opserr << "WARNING - problem creating TimeSeries for LoadPattern "; |
| 118 | opserr << patternID << endln; |
| 119 | } |
| 120 | |
| 121 | // clean up the memory and return an error |
| 122 | if (thePattern != 0) |
| 123 | delete thePattern; |
| 124 | if (theSeries != 0) |
| 125 | delete theSeries; |
| 126 | return TCL_ERROR; |
| 127 | } |
| 128 | |
| 129 | thePattern->setTimeSeries(theSeries); |
| 130 | |
| 131 | } |
| 132 | |
| 133 | else if (strcmp(argv[1],"UniformExcitation") == 0) { |
| 134 | |
| 135 | int dir; |
| 136 | |
| 137 | if (Tcl_GetInt(interp, argv[3], &dir) != TCL_OK) { |
nothing calls this directly
no test coverage detected