diff options
author | 2019-03-06 16:09:35 -0800 | |
---|---|---|
committer | 2019-03-06 16:09:35 -0800 | |
commit | 1e44150d0cc7d2b295f8f3e1b6968b97df4efab3 (patch) | |
tree | 28303c8c0c318421b9cda3d504993fb2caeb0815 /Source/Diagnostics/ParticleIO.cpp | |
parent | 028011d44564f0745f3036b10bbd2ddadd0a0cf6 (diff) | |
parent | f0bea186a253a97d82a78dcd227d07879a0eea1d (diff) | |
download | WarpX-1e44150d0cc7d2b295f8f3e1b6968b97df4efab3.tar.gz WarpX-1e44150d0cc7d2b295f8f3e1b6968b97df4efab3.tar.zst WarpX-1e44150d0cc7d2b295f8f3e1b6968b97df4efab3.zip |
Merge branch 'dev' into RZgeometry
Diffstat (limited to 'Source/Diagnostics/ParticleIO.cpp')
-rw-r--r-- | Source/Diagnostics/ParticleIO.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Source/Diagnostics/ParticleIO.cpp b/Source/Diagnostics/ParticleIO.cpp new file mode 100644 index 000000000..be9809bac --- /dev/null +++ b/Source/Diagnostics/ParticleIO.cpp @@ -0,0 +1,54 @@ + +#include <MultiParticleContainer.H> +#include <WarpX.H> + +using namespace amrex; + +void +WarpXParticleContainer::ReadHeader (std::istream& is) +{ + is >> charge >> mass; + WarpX::GotoNextLine(is); +} + +void +WarpXParticleContainer::WriteHeader (std::ostream& os) const +{ + // no need to write species_id + os << charge << " " << mass << "\n"; +} + +void +MultiParticleContainer::Checkpoint (const std::string& dir, + bool is_checkpoint, + const Vector<std::string>& varnames) const +{ + for (unsigned i = 0, n = species_names.size(); i < n; ++i) { + allcontainers[i]->Checkpoint(dir, species_names[i], is_checkpoint, varnames); + } +} + +void +MultiParticleContainer::Restart (const std::string& dir) +{ + for (unsigned i = 0, n = species_names.size(); i < n; ++i) { + allcontainers[i]->Restart(dir, species_names[i]); + } +} + +void +MultiParticleContainer::ReadHeader (std::istream& is) +{ + for (auto& pc : allcontainers) { + pc->ReadHeader(is); + } +} + +void +MultiParticleContainer::WriteHeader (std::ostream& os) const +{ + for (const auto& pc : allcontainers) { + pc->WriteHeader(os); + } +} + |