| 147 | |
| 148 | |
| 149 | int |
| 150 | NormElementRecorder::record(int commitTag, double timeStamp) |
| 151 | { |
| 152 | // |
| 153 | // check that initialization has been done |
| 154 | // |
| 155 | |
| 156 | if (initializationDone == false) { |
| 157 | if (this->initialize() != 0) { |
| 158 | opserr << "NormElementRecorder::record() - failed to initialize\n"; |
| 159 | return -1; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | int result = 0; |
| 164 | // where relDeltaTTol is the maximum reliable ratio between analysis time step and deltaT |
| 165 | // and provides tolerance for floating point precision (see floating-point-tolerance-for-recorder-time-step.md) |
| 166 | if (deltaT == 0.0 || timeStamp - nextTimeStampToRecord >= -deltaT * relDeltaTTol) { |
| 167 | |
| 168 | if (deltaT != 0.0) |
| 169 | nextTimeStampToRecord = timeStamp + deltaT; |
| 170 | |
| 171 | int loc = 0; |
| 172 | if (echoTimeFlag == true) |
| 173 | (*data)(loc++) = timeStamp; |
| 174 | |
| 175 | // |
| 176 | // for each element if responses exist, put them in response vector |
| 177 | // |
| 178 | for (int i=0; i< numEle; i++) { |
| 179 | if (theResponses[i] != 0) { |
| 180 | // ask the element for the response |
| 181 | int res; |
| 182 | if (( res = theResponses[i]->getResponse()) < 0) |
| 183 | result += res; |
| 184 | else { |
| 185 | Information &eleInfo = theResponses[i]->getInformation(); |
| 186 | const Vector &eleData = eleInfo.getData(); |
| 187 | double normV = 0.0; |
| 188 | if (numDOF == 0) { |
| 189 | for (int j=0; j<eleData.Size(); j++) |
| 190 | normV += eleData(j)*eleData(j); |
| 191 | } else { |
| 192 | int dataSize = data->Size(); |
| 193 | for (int j=0; j<numDOF; j++) { |
| 194 | int index = (*dof)(j); |
| 195 | if (index >= 0 && index < dataSize) |
| 196 | normV += eleData(index) * eleData(index); |
| 197 | } |
| 198 | } |
| 199 | (*data)(loc++) = sqrt(normV); |
| 200 | } |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | // |
| 205 | // send the response vector to the output handler for o/p |
| 206 | // |
nothing calls this directly
no test coverage detected