diff options
author | 2019-10-23 18:45:42 +0200 | |
---|---|---|
committer | 2019-10-23 18:45:42 +0200 | |
commit | 258d99064786c6582ee6f05ea26ad1d42d99b0fa (patch) | |
tree | 3cfac7e7082837fb6ed1c717fb02e5cb693a559e /Source/Particles/MultiParticleContainer.cpp | |
parent | 388551d117d323840538f5ecf34c39992ba4b7ef (diff) | |
parent | a0337151fd6b715a2f8e3a2a160c8317c1bf27f5 (diff) | |
download | WarpX-258d99064786c6582ee6f05ea26ad1d42d99b0fa.tar.gz WarpX-258d99064786c6582ee6f05ea26ad1d42d99b0fa.tar.zst WarpX-258d99064786c6582ee6f05ea26ad1d42d99b0fa.zip |
Merge remote-tracking branch 'origin/qed_bw_qs_factory_class' into qed_evolve_optical_depth
Diffstat (limited to 'Source/Particles/MultiParticleContainer.cpp')
-rw-r--r-- | Source/Particles/MultiParticleContainer.cpp | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index 1c240bed1..566422a7a 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -772,13 +772,6 @@ void MultiParticleContainer::InitQuantumSync () std::string filename; std::tie(generate_table, filename, ctrl) = ParseQuantumSyncParams(); - if(generate_table && ParallelDescriptor::IOProcessor()){ - qs_engine.compute_lookup_tables(ctrl); - Vector<char> all_data = qs_engine.export_lookup_tables_data(); - WarpXUtilIO::WriteBinaryDataOnFile(filename, all_data); - } - ParallelDescriptor::Barrier(); - //Only temporary for test purposes, will be removed ParmParse pp("qed_qs"); bool ignore_tables = false; @@ -786,10 +779,25 @@ void MultiParticleContainer::InitQuantumSync () if(ignore_tables) return; //_________________________________________________ + + if(generate_table && ParallelDescriptor::IOProcessor()){ + qs_engine.compute_lookup_tables(ctrl); + Vector<char> all_data = qs_engine.export_lookup_tables_data(); + WarpXUtilIO::WriteBinaryDataOnFile(filename, all_data); + } + ParallelDescriptor::Barrier(); + Vector<char> table_data; ParallelDescriptor::ReadAndBcastFile(filename, table_data); ParallelDescriptor::Barrier(); - if(!qs_engine.init_lookup_tables_from_raw_data(table_data)) + + //No need to initialize from raw data for the processor that + //has just generated the table + if(!generate_table || !ParallelDescriptor::IOProcessor()){ + qs_engine.init_lookup_tables_from_raw_data(table_data); + } + + if(!qs_engine.are_lookup_tables_initialized()) amrex::Error("Table initialization has failed!\n"); } @@ -800,13 +808,6 @@ void MultiParticleContainer::InitBreitWheeler () std::string filename; std::tie(generate_table, filename, ctrl) = ParseBreitWheelerParams(); - if(generate_table && ParallelDescriptor::IOProcessor()){ - bw_engine.compute_lookup_tables(ctrl); - Vector<char> all_data = bw_engine.export_lookup_tables_data(); - WarpXUtilIO::WriteBinaryDataOnFile(filename, all_data); - } - ParallelDescriptor::Barrier(); - //Only temporary for test purposes, will be removed ParmParse pp("qed_bw"); bool ignore_tables = false; @@ -814,10 +815,24 @@ void MultiParticleContainer::InitBreitWheeler () if(ignore_tables) return; //_________________________________________________ + if(generate_table && ParallelDescriptor::IOProcessor()){ + bw_engine.compute_lookup_tables(ctrl); + Vector<char> all_data = bw_engine.export_lookup_tables_data(); + WarpXUtilIO::WriteBinaryDataOnFile(filename, all_data); + } + ParallelDescriptor::Barrier(); + Vector<char> table_data; ParallelDescriptor::ReadAndBcastFile(filename, table_data); ParallelDescriptor::Barrier(); - if(!bw_engine.init_lookup_tables_from_raw_data(table_data)) + + //No need to initialize from raw data for the processor that + //has just generated the table + if(!generate_table || !ParallelDescriptor::IOProcessor()){ + bw_engine.init_lookup_tables_from_raw_data(table_data); + } + + if(!bw_engine.are_lookup_tables_initialized()) amrex::Error("Table initialization has failed!\n"); } |