| 155 | } |
| 156 | |
| 157 | void ReceiverWriter::syncPoint(double /*currentTime*/) { |
| 158 | if (m_receiverClusters.empty()) { |
| 159 | return; |
| 160 | } |
| 161 | |
| 162 | m_stopwatch.start(); |
| 163 | |
| 164 | for (auto& [layer, clusters] : m_receiverClusters) { |
| 165 | for (auto& cluster : clusters) { |
| 166 | auto ncols = cluster.ncols(); |
| 167 | for (auto& receiver : cluster) { |
| 168 | assert(receiver.output.size() % ncols == 0); |
| 169 | const size_t nSamples = receiver.output.size() / ncols; |
| 170 | |
| 171 | std::ofstream file; |
| 172 | file.open(fileName(receiver.pointId), std::ios::app); |
| 173 | file << std::scientific << std::setprecision(15); |
| 174 | for (size_t i = 0; i < nSamples; ++i) { |
| 175 | for (size_t q = 0; q < ncols; ++q) { |
| 176 | file << " " << receiver.output[q + i * ncols]; |
| 177 | } |
| 178 | file << std::endl; |
| 179 | } |
| 180 | file.close(); |
| 181 | receiver.output.clear(); |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | auto time = m_stopwatch.stop(); |
| 187 | const int rank = seissol::MPI::mpi.rank(); |
| 188 | logInfo(rank) << "Wrote receivers in" << time << "seconds."; |
| 189 | } |
| 190 | void ReceiverWriter::init( |
| 191 | const std::string& fileNamePrefix, |
| 192 | double endTime, |