| 409 | |
| 410 | |
| 411 | int |
| 412 | ElementRecorder::record(int commitTag, double timeStamp) |
| 413 | { |
| 414 | // |
| 415 | // check that initialization has been done |
| 416 | // |
| 417 | |
| 418 | if (initializationDone == false) { |
| 419 | if (this->initialize() != 0) { |
| 420 | opserr << "ElementRecorder::record() - failed to initialize\n"; |
| 421 | return -1; |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | int result = 0; |
| 426 | // where relDeltaTTol is the maximum reliable ratio between analysis time step and deltaT |
| 427 | // and provides tolerance for floating point precision (see floating-point-tolerance-for-recorder-time-step.md) |
| 428 | if (deltaT == 0.0 || timeStamp - nextTimeStampToRecord >= -deltaT * relDeltaTTol) { |
| 429 | |
| 430 | if (deltaT != 0.0) |
| 431 | nextTimeStampToRecord = timeStamp + deltaT; |
| 432 | |
| 433 | int loc = 0; |
| 434 | if (echoTimeFlag == true) |
| 435 | (*data)(loc++) = timeStamp; |
| 436 | |
| 437 | // |
| 438 | // for each element if responses exist, put them in response vector |
| 439 | // |
| 440 | for (int i=0; i< numEle; i++) { |
| 441 | if (theResponses[i] != 0) { |
| 442 | // ask the element for the response |
| 443 | int res; |
| 444 | if (( res = theResponses[i]->getResponse()) < 0) |
| 445 | result += res; |
| 446 | else { |
| 447 | Information &eleInfo = theResponses[i]->getInformation(); |
| 448 | const Vector &eleData = eleInfo.getData(); |
| 449 | if (numDOF == 0) { |
| 450 | for (int j=0; j<eleData.Size(); j++) |
| 451 | (*data)(loc++) = eleData(j); |
| 452 | } else { |
| 453 | int dataSize = data->Size(); |
| 454 | for (int j=0; j<numDOF; j++) { |
| 455 | int index = (*dof)(j); |
| 456 | if (index >= 0 && index < dataSize) |
| 457 | (*data)(loc++) = eleData(index); |
| 458 | else |
| 459 | (*data)(loc++) = 0.0; |
| 460 | } |
| 461 | } |
| 462 | } |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | // |
| 467 | // send the response vector to the output handler for o/p |
| 468 | // |
nothing calls this directly
no test coverage detected