aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Particles/MultiParticleContainer.H7
-rw-r--r--Source/Particles/MultiParticleContainer.cpp38
-rw-r--r--Source/QED/BreitWheelerEngineWrapper.H78
-rw-r--r--Source/QED/BreitWheelerEngineWrapper.cpp92
-rw-r--r--Source/QED/QedWrapperCommons.H2
-rw-r--r--Source/QED/QuantumSyncEngineWrapper.H90
-rw-r--r--Source/QED/QuantumSyncEngineWrapper.cpp94
7 files changed, 380 insertions, 21 deletions
diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H
index a09e0eeae..9e44afdd7 100644
--- a/Source/Particles/MultiParticleContainer.H
+++ b/Source/Particles/MultiParticleContainer.H
@@ -19,6 +19,8 @@
#include <map>
#include <string>
#include <algorithm>
+#include <utility>
+#include <tuple>
//
// MultiParticleContainer holds multiple (nspecies or npsecies+1 when
@@ -229,6 +231,11 @@ protected:
void InitQuantumSync ();
void InitBreitWheeler ();
+
+ std::tuple<bool, std::string, WarpXQuantumSynchrotronWrapperCtrl>
+ ParseQuantumSyncParams ();
+ std::tuple<bool, std::string, WarpXBreitWheelerWrapperCtrl>
+ ParseBreitWheelerParams ();
#endif
private:
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp
index 7c7f0bfa1..bca2995e9 100644
--- a/Source/Particles/MultiParticleContainer.cpp
+++ b/Source/Particles/MultiParticleContainer.cpp
@@ -758,16 +758,50 @@ void MultiParticleContainer::InitQED ()
void MultiParticleContainer::InitQuantumSync ()
{
+ bool is_custom;
+ WarpXQuantumSynchrotronWrapperCtrl ctrl;
+ std::string filename;
+ std::tie(is_custom, filename, ctrl) = ParseQuantumSyncParams();
+
if(ParallelDescriptor::IOProcessor()){
- qs_engine.computes_lookup_tables_default();
+ qs_engine.compute_lookup_tables_default();
+ qs_engine.write_lookup_tables("qed_qs_lookup.bin");
}
+ amrex::ParallelDescriptor::Barrier();
+ qs_engine.read_lookup_tables("qed_qs_lookup.bin");
}
void MultiParticleContainer::InitBreitWheeler ()
{
+ bool is_custom;
+ WarpXBreitWheelerWrapperCtrl ctrl;
+ std::string filename;
+ std::tie(is_custom, filename, ctrl) = ParseBreitWheelerParams();
+
if(ParallelDescriptor::IOProcessor()){
- bw_engine.computes_lookup_tables_default();
+ bw_engine.compute_lookup_tables_default();
bw_engine.write_lookup_tables("qed_bw_lookup.bin");
}
+ amrex::ParallelDescriptor::Barrier();
+ bw_engine.read_lookup_tables("qed_bw_lookup.bin");
+
+}
+
+std::tuple<bool,std::string,WarpXQuantumSynchrotronWrapperCtrl>
+MultiParticleContainer::ParseQuantumSyncParams ()
+{
+ WarpXQuantumSynchrotronWrapperCtrl ctrl;
+ bool is_custom{false};
+
+ return std::make_tuple(is_custom, std::string(""), ctrl);
+}
+
+std::tuple<bool,std::string,WarpXBreitWheelerWrapperCtrl>
+MultiParticleContainer::ParseBreitWheelerParams ()
+{
+ WarpXBreitWheelerWrapperCtrl ctrl;
+ bool is_custom{false};
+
+ return std::make_tuple(is_custom, std::string(""), ctrl);
}
#endif
diff --git a/Source/QED/BreitWheelerEngineWrapper.H b/Source/QED/BreitWheelerEngineWrapper.H
index 570d359fc..05e70897d 100644
--- a/Source/QED/BreitWheelerEngineWrapper.H
+++ b/Source/QED/BreitWheelerEngineWrapper.H
@@ -3,6 +3,8 @@
#include "QedWrapperCommons.H"
+#include <AMReX_Array.H>
+
#include<string>
#include<fstream>
@@ -25,6 +27,10 @@ struct BreitWheelerEngineInnards
//Lookup table data
amrex::Gpu::ManagedVector<amrex::Real> TTfunc_coords;
amrex::Gpu::ManagedVector<amrex::Real> TTfunc_data;
+
+ amrex::Gpu::ManagedVector<amrex::Real> cum_distrib_coords_1;
+ amrex::Gpu::ManagedVector<amrex::Real> cum_distrib_coords_2;
+ amrex::Gpu::ManagedVector<amrex::Real> cum_distrib_data;
//______
};
@@ -70,9 +76,9 @@ public:
amrex::Real bx, amrex::Real by, amrex::Real bz,
amrex::Real dt, amrex::Real& opt_depth) const
{
- bool has_event_happend = false;
- amrex::Real dummy_lambda = 1.0;
- amrex::Real unused_event_time = 0.0;
+ bool has_event_happend{false};
+ amrex::Real dummy_lambda{1.0};
+ amrex::Real unused_event_time{0.0};
const auto table = picsar::multi_physics::lookup_1d<amrex::Real>
(innards->TTfunc_data.size(),
@@ -97,6 +103,61 @@ private:
BreitWheelerEngineInnards* innards;
};
+// Generates an electron-positron pair via the Breit-Wheeler process
+// (returns false if errors occur)
+class BreitWheelerGeneratePairs
+{
+public:
+ BreitWheelerGeneratePairs(
+ BreitWheelerEngineInnards* _innards):
+ innards{_innards}{};
+
+ template <size_t sampling>
+ AMREX_GPU_DEVICE
+ AMREX_FORCE_INLINE
+ bool operator()(
+ amrex::Real px, amrex::Real py, amrex::Real pz,
+ amrex::Real ex, amrex::Real ey, amrex::Real ez,
+ amrex::Real bx, amrex::Real by, amrex::Real bz,
+ amrex::Real weight,
+ amrex::Real* e_px, amrex::Real* e_py, amrex::Real* e_pz,
+ amrex::Real* p_px, amrex::Real* p_py, amrex::Real* p_pz,
+ amrex::Real* e_weight, amrex::Real* p_weight) const
+ {
+ amrex::Real dummy_lambda{1.0};
+ picsar::multi_physics::picsar_array<amrex::Real, sampling>
+ rand_zero_one_minus_epsi;
+ for(auto& el : rand_zero_one_minus_epsi)
+ el = amrex::Random();
+
+ const auto table = picsar::multi_physics::lookup_2d<amrex::Real>
+ (innards->cum_distrib_coords_1.size(),
+ innards->cum_distrib_coords_1.data(),
+ innards->cum_distrib_coords_2.size(),
+ innards->cum_distrib_coords_2.data(),
+ innards->cum_distrib_data.data());
+
+ bool stat = WarpXBreitWheelerWrapper::
+ internal_generate_breit_wheeler_pairs(
+ px, py, pz,
+ ex, ey, ez,
+ bx, by, bz,
+ weight, sampling,
+ e_px, e_py, e_pz,
+ p_px, p_py, p_pz,
+ e_weight, p_weight,
+ dummy_lambda,
+ table,
+ innards->ctrl,
+ rand_zero_one_minus_epsi.data());
+
+ return stat;
+ }
+
+private:
+ BreitWheelerEngineInnards* innards;
+};
+
// Factory class =============================
/**
@@ -115,9 +176,15 @@ public:
/* \brief Builds the functor to evolve the optical depth */
BreitWheelerEvolveOpticalDepth build_evolve_functor ();
+ /* \brief Builds the functor to generate the pairs */
+ BreitWheelerGeneratePairs build_pair_functor ();
+
/* \brief Computes the Lookup tables using the default settings
* provided by the PICSAR library */
- void computes_lookup_tables_default ();
+ void compute_lookup_tables_default ();
+
+ /* \brief Computes the Lookup tables using user-defined settings */
+ void compute_custom_lookup_tables (WarpXBreitWheelerWrapperCtrl ctrl);
/* \brief Checks if lookup tables are properly initialized */
bool are_lookup_tables_initialized () const;
@@ -126,6 +193,9 @@ public:
* return false if it fails. */
bool write_lookup_tables (std::string file) const;
+ /* \brief Reads lookup tables from 'file' on disk */
+ void read_lookup_tables (std::string file);
+
private:
bool lookup_tables_initialized = false;
diff --git a/Source/QED/BreitWheelerEngineWrapper.cpp b/Source/QED/BreitWheelerEngineWrapper.cpp
index f5c3acb49..f6925fa9d 100644
--- a/Source/QED/BreitWheelerEngineWrapper.cpp
+++ b/Source/QED/BreitWheelerEngineWrapper.cpp
@@ -20,10 +20,17 @@ BreitWheelerEvolveOpticalDepth BreitWheelerEngine::build_evolve_functor ()
return BreitWheelerEvolveOpticalDepth(&innards);
}
+//Builds the functor to generate the pairs
+BreitWheelerGeneratePairs BreitWheelerEngine::build_pair_functor ()
+{
+ AMREX_ALWAYS_ASSERT(lookup_tables_initialized);
+
+ return BreitWheelerGeneratePairs(&innards);
+}
//Initializes the Lookup tables using the default settings
//provided by the library
-void BreitWheelerEngine::computes_lookup_tables_default ()
+void BreitWheelerEngine::compute_lookup_tables_default ()
{
//A control parameters structure
//with the default values provided by the library
@@ -34,13 +41,20 @@ void BreitWheelerEngine::computes_lookup_tables_default ()
lookup_tables_initialized = true;
}
+// Computes the Lookup tables using user-defined settings
+void BreitWheelerEngine::compute_custom_lookup_tables (
+ WarpXBreitWheelerWrapperCtrl ctrl)
+{
+ computes_lookup_tables(ctrl);
+
+ lookup_tables_initialized = true;
+}
+
bool BreitWheelerEngine::are_lookup_tables_initialized () const
{
return lookup_tables_initialized;
}
-
-
/* \brief Writes lookup tables on disk in 'file'
* return false if it fails. */
bool BreitWheelerEngine::write_lookup_tables (
@@ -49,9 +63,81 @@ bool BreitWheelerEngine::write_lookup_tables (
if(!lookup_tables_initialized)
return false;
+ std::ofstream of(file, std::ios::out | std::ios::binary);
+
+ //Header (control parameters)
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_phot_min),
+ sizeof(innards.ctrl.chi_phot_min));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_phot_tdndt_min),
+ sizeof(innards.ctrl.chi_phot_tdndt_min));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_phot_tdndt_max),
+ sizeof(innards.ctrl.chi_phot_tdndt_max));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_phot_tdndt_how_many),
+ sizeof(innards.ctrl.chi_phot_tdndt_how_many));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_phot_tpair_min),
+ sizeof(innards.ctrl.chi_phot_tpair_min));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_phot_tpair_max),
+ sizeof(innards.ctrl.chi_phot_tpair_max));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_phot_tpair_how_many),
+ sizeof(innards.ctrl.chi_phot_tpair_how_many));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_frac_tpair_how_many),
+ sizeof(innards.ctrl.chi_frac_tpair_how_many));
+ //_______
+
+ //Data
+ of.write(reinterpret_cast<const char*>(innards.TTfunc_coords.dataPtr()),
+ sizeof(amrex::Real)*innards.TTfunc_coords.size());
+ of.write(reinterpret_cast<const char*>(innards.TTfunc_data.dataPtr()),
+ sizeof(amrex::Real)*innards.TTfunc_data.size());
+ // TODO: add other table
+ //_______
+
+ of.close();
+
return true;
}
+/* \brief Reads lookup tables from 'file' on disk */
+void BreitWheelerEngine::read_lookup_tables (std::string file)
+{
+ std::ifstream ifile(file, std::ios::in | std::ios::binary);
+
+ //Header (control parameters)
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_phot_min),
+ sizeof(innards.ctrl.chi_phot_min));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_phot_tdndt_min),
+ sizeof(innards.ctrl.chi_phot_tdndt_min));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_phot_tdndt_max),
+ sizeof(innards.ctrl.chi_phot_tdndt_max));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_phot_tdndt_how_many),
+ sizeof(innards.ctrl.chi_phot_tdndt_how_many));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_phot_tpair_min),
+ sizeof(innards.ctrl.chi_phot_tpair_min));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_phot_tpair_max),
+ sizeof(innards.ctrl.chi_phot_tpair_max));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_phot_tpair_how_many),
+ sizeof(innards.ctrl.chi_phot_tpair_how_many));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_frac_tpair_how_many),
+ sizeof(innards.ctrl.chi_frac_tpair_how_many));
+ //_______
+
+ //Data
+ size_t size_buf = sizeof(amrex::Real)*innards.ctrl.chi_phot_tdndt_how_many;
+ char* data_buf = new char(size_buf);
+ ifile.read(data_buf, size_buf);
+ innards.TTfunc_coords.assign((amrex::Real*)data_buf,
+ (amrex::Real*)data_buf + size_buf);
+ ifile.read(data_buf, size_buf);
+ innards.TTfunc_data.assign((amrex::Real*)data_buf,
+ (amrex::Real*)data_buf + size_buf);
+ delete[] data_buf;
+ //_______
+
+ ifile.close();
+
+ lookup_tables_initialized = true;
+}
+
//Private function which actually computes the lookup tables
void BreitWheelerEngine::computes_lookup_tables (
WarpXBreitWheelerWrapperCtrl ctrl)
diff --git a/Source/QED/QedWrapperCommons.H b/Source/QED/QedWrapperCommons.H
index bfaf992bf..7e7b3df3d 100644
--- a/Source/QED/QedWrapperCommons.H
+++ b/Source/QED/QedWrapperCommons.H
@@ -6,8 +6,6 @@
#include<AMReX_AmrCore.H>
#include<AMReX_Gpu.H>
-#include<utility>
-
//Sets the decorator for GPU
#define PXRMP_GPU AMREX_GPU_DEVICE
//Sets SI units in the library
diff --git a/Source/QED/QuantumSyncEngineWrapper.H b/Source/QED/QuantumSyncEngineWrapper.H
index 2da6d312a..72a652d4d 100644
--- a/Source/QED/QuantumSyncEngineWrapper.H
+++ b/Source/QED/QuantumSyncEngineWrapper.H
@@ -3,6 +3,11 @@
#include "QedWrapperCommons.H"
+#include <AMReX_Array.H>
+
+#include<string>
+#include<fstream>
+
//QS ENGINE from PICSAR
#include "quantum_sync_engine.hpp"
@@ -21,7 +26,11 @@ struct QuantumSynchrotronEngineInnards
//Lookup table data
amrex::Gpu::ManagedDeviceVector<amrex::Real> KKfunc_coords;
- amrex::Gpu::ManagedDeviceVector<amrex::Real> KKfunc_data;
+ amrex::Gpu::ManagedDeviceVector<amrex::Real> KKfunc_data;
+
+ amrex::Gpu::ManagedVector<amrex::Real> cum_distrib_coords_1;
+ amrex::Gpu::ManagedVector<amrex::Real> cum_distrib_coords_2;
+ amrex::Gpu::ManagedVector<amrex::Real> cum_distrib_data;
//______
};
@@ -62,14 +71,14 @@ public:
AMREX_GPU_DEVICE
AMREX_FORCE_INLINE
bool operator()(
- amrex::Real px, amrex::Real py, amrex::Real pz,
+ amrex::Real px, amrex::Real py, amrex::Real pz,
amrex::Real ex, amrex::Real ey, amrex::Real ez,
amrex::Real bx, amrex::Real by, amrex::Real bz,
amrex::Real dt, amrex::Real& opt_depth) const
{
- bool has_event_happend = false;
- amrex::Real dummy_lambda = 1.0;
- amrex::Real unused_event_time = 0.0;
+ bool has_event_happend{false};
+ amrex::Real dummy_lambda{1.0};
+ amrex::Real unused_event_time{0.0};
const auto table = picsar::multi_physics
::lookup_1d<amrex::Real>(
@@ -82,9 +91,9 @@ public:
px, py, pz,
ex, ey, ez,
bx, by, bz,
- dt, opt_depth,
+ dt, opt_depth,
has_event_happend, unused_event_time,
- dummy_lambda,
+ dummy_lambda,
table,
innards->ctrl);
@@ -95,6 +104,59 @@ private:
QuantumSynchrotronEngineInnards* innards;
};
+// Generates a photon via the Quantum Synchrotron process
+// and updates momentum accordingly (returns false if errors occur)
+class QuantumSynchrotronGeneratePhotonAndUpdateMomentum
+{
+public:
+ QuantumSynchrotronGeneratePhotonAndUpdateMomentum(
+ QuantumSynchrotronEngineInnards* _innards):
+ innards{_innards}{};
+
+ template <size_t sampling>
+ AMREX_GPU_DEVICE
+ AMREX_FORCE_INLINE
+ bool operator()(
+ amrex::Real* px, amrex::Real* py, amrex::Real* pz,
+ amrex::Real ex, amrex::Real ey, amrex::Real ez,
+ amrex::Real bx, amrex::Real by, amrex::Real bz,
+ amrex::Real weight,
+ amrex::Real* g_px, amrex::Real* g_py, amrex::Real* g_pz,
+ amrex::Real* g_weight) const
+ {
+ amrex::Real dummy_lambda{1.0};
+ picsar::multi_physics::picsar_array<amrex::Real, sampling>
+ rand_zero_one_minus_epsi;
+ for(auto& el : rand_zero_one_minus_epsi)
+ el = amrex::Random();
+
+ const auto table = picsar::multi_physics::lookup_2d<amrex::Real>
+ (innards->cum_distrib_coords_1.size(),
+ innards->cum_distrib_coords_1.data(),
+ innards->cum_distrib_coords_2.size(),
+ innards->cum_distrib_coords_2.data(),
+ innards->cum_distrib_data.data());
+
+ bool stat = WarpXQuantumSynchrotronWrapper::
+ internal_generate_photons_and_update_momentum(
+ *px, *py, *pz,
+ ex, ey, ez,
+ bx, by, bz,
+ weight, sampling,
+ *g_px, *g_py, *g_pz,
+ *g_weight,
+ dummy_lambda,
+ table,
+ innards->ctrl,
+ rand_zero_one_minus_epsi.data());
+
+ return stat;
+ }
+
+private:
+ QuantumSynchrotronEngineInnards* innards;
+};
+
// Factory class =============================
/**
@@ -113,13 +175,23 @@ public:
/* \brief Builds the functor to evolve the optical depth */
QuantumSynchrotronEvolveOpticalDepth build_evolve_functor ();
- /* \brief Computes the Lookup tables using the default settings
+ /* \brief Computes the Lookup tables using the default settings
* provided by the PICSAR library */
- void computes_lookup_tables_default ();
+ void compute_lookup_tables_default ();
+
+ /* \brief Computes the Lookup tables using user-defined settings */
+ void compute_custom_lookup_tables (WarpXQuantumSynchrotronWrapperCtrl ctrl);
/* \brief Checks if lookup tables are properly initialized */
bool are_lookup_tables_initialized () const;
+ /* \brief Writes lookup tables on disk in 'file'
+ * return false if it fails. */
+ bool write_lookup_tables (std::string file) const;
+
+ /* \brief Reads lookup tables from 'file' on disk */
+ void read_lookup_tables (std::string file);
+
private:
bool lookup_tables_initialized = false;
diff --git a/Source/QED/QuantumSyncEngineWrapper.cpp b/Source/QED/QuantumSyncEngineWrapper.cpp
index 0fd22b53e..322b5cf82 100644
--- a/Source/QED/QuantumSyncEngineWrapper.cpp
+++ b/Source/QED/QuantumSyncEngineWrapper.cpp
@@ -23,7 +23,7 @@ QuantumSynchrotronEvolveOpticalDepth QuantumSynchrotronEngine::build_evolve_func
//Initializes the Lookup tables using the default settings
//provided by the library
-void QuantumSynchrotronEngine::computes_lookup_tables_default ()
+void QuantumSynchrotronEngine::compute_lookup_tables_default ()
{
//A control parameters structure
//with the default values provided by the library
@@ -34,11 +34,103 @@ void QuantumSynchrotronEngine::computes_lookup_tables_default ()
lookup_tables_initialized = true;
}
+// Computes the Lookup tables using user-defined settings
+void QuantumSynchrotronEngine::compute_custom_lookup_tables (
+ WarpXQuantumSynchrotronWrapperCtrl ctrl)
+{
+ computes_lookup_tables(ctrl);
+
+ lookup_tables_initialized = true;
+}
+
bool QuantumSynchrotronEngine::are_lookup_tables_initialized () const
{
return lookup_tables_initialized;
}
+/* \brief Writes lookup tables on disk in 'file'
+ * return false if it fails. */
+bool QuantumSynchrotronEngine::write_lookup_tables (
+ std::string file) const
+{
+ if(!lookup_tables_initialized)
+ return false;
+
+ std::ofstream of(file, std::ios::out | std::ios::binary);
+
+ //Header (control parameters)
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_part_min),
+ sizeof(innards.ctrl.chi_part_min));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_part_tdndt_min),
+ sizeof(innards.ctrl.chi_part_tdndt_min));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_part_tdndt_max),
+ sizeof(innards.ctrl.chi_part_tdndt_max));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_part_tdndt_how_many),
+ sizeof(innards.ctrl.chi_part_tdndt_how_many));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_part_tem_min),
+ sizeof(innards.ctrl.chi_part_tem_max));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_part_tem_max),
+ sizeof(innards.ctrl.chi_part_tem_max));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.chi_part_tem_how_many),
+ sizeof(innards.ctrl.chi_part_tem_how_many));
+ of.write(reinterpret_cast<const char*>(&innards.ctrl.prob_tem_how_many),
+ sizeof(innards.ctrl.prob_tem_how_many));
+ //_______
+
+ //Data
+ of.write(reinterpret_cast<const char*>(innards.KKfunc_coords.dataPtr()),
+ sizeof(amrex::Real)*innards.KKfunc_coords.size());
+ of.write(reinterpret_cast<const char*>(innards.KKfunc_data.dataPtr()),
+ sizeof(amrex::Real)*innards.KKfunc_data.size());
+ // TODO: add other table
+ //_______
+
+ of.close();
+
+ return true;
+}
+
+/* \brief Reads lookup tables from 'file' on disk */
+void QuantumSynchrotronEngine::read_lookup_tables (std::string file)
+{
+ std::ifstream ifile(file, std::ios::in | std::ios::binary);
+
+ //Header (control parameters)
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_part_min),
+ sizeof(innards.ctrl.chi_part_min));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_part_tdndt_min),
+ sizeof(innards.ctrl.chi_part_tdndt_min));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_part_tdndt_max),
+ sizeof(innards.ctrl.chi_part_tdndt_max));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_part_tdndt_how_many),
+ sizeof(innards.ctrl.chi_part_tdndt_how_many));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_part_tem_min),
+ sizeof(innards.ctrl.chi_part_tem_min));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_part_tem_max),
+ sizeof(innards.ctrl.chi_part_tem_max));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.chi_part_tem_how_many),
+ sizeof(innards.ctrl.chi_part_tem_how_many));
+ ifile.read(reinterpret_cast<char*>(&innards.ctrl.prob_tem_how_many),
+ sizeof(innards.ctrl.prob_tem_how_many));
+ //_______
+
+ //Data
+ size_t size_buf = sizeof(amrex::Real)*innards.ctrl.chi_part_tdndt_how_many;
+ char* data_buf = new char(size_buf);
+ ifile.read(data_buf, size_buf);
+ innards.KKfunc_coords.assign((amrex::Real*)data_buf,
+ (amrex::Real*)data_buf + size_buf);
+ ifile.read(data_buf, size_buf);
+ innards.KKfunc_data.assign((amrex::Real*)data_buf,
+ (amrex::Real*)data_buf + size_buf);
+ delete[] data_buf;
+ //_______
+
+ ifile.close();
+
+ lookup_tables_initialized = true;
+}
+
//Private function which actually computes the lookup tables
void QuantumSynchrotronEngine::computes_lookup_tables (
WarpXQuantumSynchrotronWrapperCtrl ctrl)