| 99 | |
| 100 | |
| 101 | int |
| 102 | responseSpectrumAnalysis(ClientData clientData, |
| 103 | Tcl_Interp* interp, |
| 104 | Tcl_Size argc, |
| 105 | const char** const argv) |
| 106 | { |
| 107 | // responseSpectrum $tsTag $dir <-scale $scale> |
| 108 | // |
| 109 | |
| 110 | // some kudos |
| 111 | static bool first_done = false; |
| 112 | if (!first_done) { |
| 113 | opslog << "Using ResponseSpectrumAnalysis - Developed by: Massimo Petracca, Guido Camata, ASDEA Software Technology\n"; |
| 114 | first_done = true; |
| 115 | } |
| 116 | |
| 117 | if (clientData == nullptr) { |
| 118 | opserr << "ResponseSpectrumAnalysis - eigen and modalProperties have not been called" << "\n"; |
| 119 | return TCL_ERROR; |
| 120 | } |
| 121 | |
| 122 | |
| 123 | // make sure eigenvalue and modal properties have been called before |
| 124 | DomainModalProperties& modal_props = *static_cast<DomainModalProperties*>(clientData); |
| 125 | |
| 126 | int ndf = modal_props.totalMass().Size(); |
| 127 | |
| 128 | |
| 129 | // |
| 130 | // parse |
| 131 | // |
| 132 | // ResponseSpectrumAnalysis $tsTag $dir <-scale $scale> <-damp $damp> |
| 133 | // or |
| 134 | // ResponseSpectrumAnalysis $dir -Tn $TnValues -fn $fnValues -Sa $SaValues <-scale $scale> <-damp $damp> |
| 135 | // |
| 136 | |
| 137 | // init default arguments |
| 138 | TimeSeries* ts = nullptr; |
| 139 | int dir = 1; |
| 140 | double scale = 1.0; |
| 141 | std::vector<double> Tn; |
| 142 | std::vector<double> Sa; |
| 143 | int mode_id = 0; |
| 144 | bool single_mode = false; |
| 145 | |
| 146 | |
| 147 | int nargs = argc - 1; // skip the command name |
| 148 | if (nargs < 2) { |
| 149 | opserr << "ResponseSpectrumAnalysis $tsTag $dir <-scale $scale> <-damp $damp>\n" |
| 150 | << "or\n" |
| 151 | << "ResponseSpectrumAnalysis $dir -Tn $TnValues -fn $fnValues -Sa $SaValues <-scale $scale> <-damp $damp>\n" |
| 152 | "Error: at least 2 arguments should be provided.\n"; |
| 153 | return TCL_ERROR; |
| 154 | } |
| 155 | |
| 156 | // search for -Tn -Sa, if both found we use them as lists |
| 157 | // otherwise we fallback to the old implementation of the timeSeries |
| 158 | bool found_Tn = false; |