From df10673fdfbf3fa9a293a8b01911350fd873bc41 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 21 Oct 2019 18:11:20 +0200 Subject: added I) methods --- Source/Utils/WarpXUtil.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'Source/Utils/WarpXUtil.cpp') diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp index 4b11eb69d..0f2c75a15 100644 --- a/Source/Utils/WarpXUtil.cpp +++ b/Source/Utils/WarpXUtil.cpp @@ -1,10 +1,11 @@ -#include - #include #include #include #include +#include +#include + using namespace amrex; void ReadBoostedFrameParameters(Real& gamma_boost, Real& beta_boost, @@ -152,3 +153,15 @@ void NullifyMF(amrex::MultiFab& mf, int lev, amrex::Real zmin, amrex::Real zmax) } } } + + +namespace WarpXUtilIO{ + bool WriteBinaryDataOnFile(std::string filename, const amrex::Vector& data) + { + std::ofstream of{filename, std::ios::binary}; + of.write(data.data(), data.size()); + of.close(); + return of.good(); + } +} + -- cgit v1.2.3 From e9656e0e3c10f36218e1edf15742852229bcf0cf Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Tue, 22 Oct 2019 15:05:08 +0200 Subject: Added comments to WarpXUtil.H and improved existing comments --- Source/QED/BreitWheelerEngineWrapper.H | 4 ++-- Source/QED/QuantumSyncEngineWrapper.H | 4 ++-- Source/Utils/WarpXUtil.H | 6 ++++++ Source/Utils/WarpXUtil.cpp | 1 - 4 files changed, 10 insertions(+), 5 deletions(-) (limited to 'Source/Utils/WarpXUtil.cpp') diff --git a/Source/QED/BreitWheelerEngineWrapper.H b/Source/QED/BreitWheelerEngineWrapper.H index 15592c5ee..976366e84 100644 --- a/Source/QED/BreitWheelerEngineWrapper.H +++ b/Source/QED/BreitWheelerEngineWrapper.H @@ -241,7 +241,7 @@ public: /** * Init lookup tables from raw binary data. - * @param raw_data a Vector of char + * @param[in] raw_data a Vector of char * @return true if it succeeds, false if it cannot parse raw_data */ bool init_lookup_tables_from_raw_data (const amrex::Vector& raw_data); @@ -255,7 +255,7 @@ public: /** * Computes the lookup tables. It does nothing unless WarpX is compiled with QED_TABLE_GEN=TRUE - * @param ctrl control params to generate the tables + * @param[in] ctrl control params to generate the tables */ void compute_lookup_tables (PicsarBreitWheelerCtrl ctrl); diff --git a/Source/QED/QuantumSyncEngineWrapper.H b/Source/QED/QuantumSyncEngineWrapper.H index f968f4182..638f75216 100644 --- a/Source/QED/QuantumSyncEngineWrapper.H +++ b/Source/QED/QuantumSyncEngineWrapper.H @@ -238,7 +238,7 @@ public: /** * Init lookup tables from raw binary data. - * @param raw_data a Vector of char + * @param[in] raw_data a Vector of char * @return true if it succeeds, false if it cannot parse raw_data */ bool init_lookup_tables_from_raw_data (const amrex::Vector& raw_data); @@ -252,7 +252,7 @@ public: /** * Computes the lookup tables. It does nothing unless WarpX is compiled with QED_TABLE_GEN=TRUE - * @param ctrl control params to generate the tables + * @param[in] ctrl control params to generate the tables */ void compute_lookup_tables (PicsarQuantumSynchrotronCtrl ctrl); diff --git a/Source/Utils/WarpXUtil.H b/Source/Utils/WarpXUtil.H index 85e6de911..ab28c5446 100644 --- a/Source/Utils/WarpXUtil.H +++ b/Source/Utils/WarpXUtil.H @@ -13,5 +13,11 @@ void NullifyMF(amrex::MultiFab& mf, int lev, amrex::Real zmin, amrex::Real zmax); namespace WarpXUtilIO{ + /** + * A helper function to write binary data on disk. + * @param[in] filename where to write + * @param[in] data Vector containing binary data to write on disk + * return true if it succeeds, false otherwise + */ bool WriteBinaryDataOnFile(std::string filename, const amrex::Vector& data); } diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp index 0f2c75a15..8764a09c6 100644 --- a/Source/Utils/WarpXUtil.cpp +++ b/Source/Utils/WarpXUtil.cpp @@ -154,7 +154,6 @@ void NullifyMF(amrex::MultiFab& mf, int lev, amrex::Real zmin, amrex::Real zmax) } } - namespace WarpXUtilIO{ bool WriteBinaryDataOnFile(std::string filename, const amrex::Vector& data) { -- cgit v1.2.3