Skip to content

Commit

Permalink
add dumping of index list
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienDoerner committed Sep 5, 2024
1 parent bb34f63 commit ee91511
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/crpropa/module/TextOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class TextOutput: public Output {
*/
static void load(const std::string &filename, ParticleCollector *collector);
std::string getDescription() const;

void dumpIndexList(std::vector<int> indicies);
};
/** @}*/

Expand Down
14 changes: 14 additions & 0 deletions src/module/TextOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "kiss/string.h"

#include <sstream>
#include <cstdio>
#include <stdexcept>
#include <iostream>
Expand Down Expand Up @@ -378,4 +379,17 @@ void TextOutput::gzip() {
#endif
}

void TextOutput::dumpIndexList(std::vector<int> indices) {
#pragma omp critical(FileOutput)
{
std::stringstream ss;
ss << "#" << "\t";
for (int i = 0; i < indices.size(); i++)
ss << indices[i] << "\t";

const std::string cstr = ss.str();
out-> write(cstr.c_str(), cstr.length());
}
}

} // namespace crpropa

0 comments on commit ee91511

Please sign in to comment.