diff options
author | 2019-10-23 18:44:26 +0200 | |
---|---|---|
committer | 2019-10-23 18:44:26 +0200 | |
commit | a0337151fd6b715a2f8e3a2a160c8317c1bf27f5 (patch) | |
tree | 2c6ddc4aa0c7b5cdddaed207aa525fe90ba2e960 /Source/Particles/MultiParticleContainer.cpp | |
parent | 666b59ed16d2adfcba94b9b0a908d4ad6b228a16 (diff) | |
download | WarpX-a0337151fd6b715a2f8e3a2a160c8317c1bf27f5.tar.gz WarpX-a0337151fd6b715a2f8e3a2a160c8317c1bf27f5.tar.zst WarpX-a0337151fd6b715a2f8e3a2a160c8317c1bf27f5.zip |
Improved parsing of the inputfile
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"); } |