aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/MultiParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2021-10-20 21:02:22 +0200
committerGravatar GitHub <noreply@github.com> 2021-10-20 19:02:22 +0000
commit02096d079680a2f7125db230bcde872dde63732c (patch)
tree14064a6a0b029a16f77ad357772546334e841867 /Source/Particles/MultiParticleContainer.cpp
parentc3f481bca813d834e248d1adeb5b5a02495b9e1a (diff)
downloadWarpX-02096d079680a2f7125db230bcde872dde63732c.tar.gz
WarpX-02096d079680a2f7125db230bcde872dde63732c.tar.zst
WarpX-02096d079680a2f7125db230bcde872dde63732c.zip
⚠️ Add warning logger (#2113)
* improve error msg * eliminate final dot * initial layout of the main classes * progress * progress with warnings * print local errors * progress with warning logger * improved MsgLogger * added file to test warnings * added method to read debug warnings from inputfile * progress towards collective gather of warnings * add missing blank line in warning message * move misplaced file * refactoring * fixed bugs * progress * fixed bugs * fixed some bugs * it finally works! * add comments in WarpX.H * add missing comment * added comments to WarpX.cpp * add profiler to WarpX.cpp * expose option to enable 'warn immediately' feature in cmake * Add comment to main.cpp * add missing comment in WarpX.cpp * add copyright and include guards to WarnManager_fwd.H * cleaning and added comments to WarnManager.H * updated test * added fwd file for MsgLogger * cleaning * Added copyright in WarnManager.cpp * Cleaning * cleaning * Add missing copyright * cleaning * clean and add comments to MsgLoggerSerialization.H * cleaning MsgLogger_fwd.H * cleaning * continue cleaning MsgLogger * added comments & bugfixing * removed test file * fixed bugs * Update Source/Utils/MsgLogger/MsgLogger.H Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/WarpX.H Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/MsgLogger/MsgLogger.H Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/MsgLogger/MsgLogger.H Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/MsgLogger/MsgLogger.cpp Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/MsgLogger/MsgLoggerSerialization.H Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/MsgLogger/MsgLoggerSerialization.H Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/MsgLogger/MsgLoggerSerialization.H Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/MsgLogger/MsgLoggerSerialization.H Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/MsgLogger/MsgLoggerSerialization.H Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/WarnManager.cpp Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/WarnManager.H Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/WarnManager.H Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Update Source/Utils/WarnManager.cpp Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * fixed bugs * Update Source/Utils/MsgLogger/MsgLogger.cpp Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Added comment to explain rotation * use last value computed by partial_sum * fix bug * now use error stream * using anonymous namespace for helper functions * print on both stderr and stdout * now using runtime parameter to always print warnings * added documentation * using long int for counter * sort affected warnings list * add doc entry * removed doc * added documentation * fixed bug * fixed bug * removing unnecessary text * reformatting * reformatting * fixed bug * fixed bug * correction * add warning_logger.rst to toctree in developers.rst Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com>
Diffstat (limited to 'Source/Particles/MultiParticleContainer.cpp')
-rw-r--r--Source/Particles/MultiParticleContainer.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp
index 6cf890821..b877708f9 100644
--- a/Source/Particles/MultiParticleContainer.cpp
+++ b/Source/Particles/MultiParticleContainer.cpp
@@ -1007,8 +1007,9 @@ void MultiParticleContainer::InitQuantumSync ()
m_quantum_sync_photon_creation_energy_threshold = temp;
}
else{
- amrex::Print() << "Using default value (2*me*c^2)" <<
- " for photon energy creation threshold \n" ;
+ WarpX::GetInstance().RecordWarning("QED",
+ "Using default value (2*me*c^2) for photon energy creation threshold",
+ WarnPriority::low);
}
// qs_minimum_chi_part is the minimum chi parameter to be
@@ -1024,7 +1025,9 @@ void MultiParticleContainer::InitQuantumSync ()
}
if(lookup_table_mode == "generate"){
- amrex::Print() << "Quantum Synchrotron table will be generated. \n" ;
+ WarpX::GetInstance().RecordWarning("QED",
+ "A new Quantum Synchrotron table will be generated.",
+ WarnPriority::low);
#ifndef WARPX_QED_TABLE_GEN
amrex::Error("Error: Compile with QED_TABLE_GEN=TRUE to enable table generation!\n");
#else
@@ -1032,9 +1035,11 @@ void MultiParticleContainer::InitQuantumSync ()
#endif
}
else if(lookup_table_mode == "load"){
- amrex::Print() << "Quantum Synchrotron table will be read from file. \n" ;
std::string load_table_name;
pp_qed_qs.query("load_table_from", load_table_name);
+ WarpX::GetInstance().RecordWarning("QED",
+ "The Quantum Synchrotron table will be read from the file: " + load_table_name,
+ WarnPriority::low);
if(load_table_name.empty()){
amrex::Abort("Quantum Synchrotron table name should be provided");
}
@@ -1045,7 +1050,10 @@ void MultiParticleContainer::InitQuantumSync ()
qs_minimum_chi_part);
}
else if(lookup_table_mode == "builtin"){
- amrex::Print() << "Built-in Quantum Synchrotron table will be used. \n" ;
+ WarpX::GetInstance().RecordWarning("QED",
+ "The built-in Quantum Synchrotron table will be used."
+ "This low resolution table is intended for testing purposes only.",
+ WarnPriority::medium);
m_shr_p_qs_engine->init_builtin_tables(qs_minimum_chi_part);
}
else{
@@ -1075,7 +1083,9 @@ void MultiParticleContainer::InitBreitWheeler ()
}
if(lookup_table_mode == "generate"){
- amrex::Print() << "Breit Wheeler table will be generated. \n" ;
+ WarpX::GetInstance().RecordWarning("QED",
+ "A new Breit Wheeler table will be generated.",
+ WarnPriority::low);
#ifndef WARPX_QED_TABLE_GEN
amrex::Error("Error: Compile with QED_TABLE_GEN=TRUE to enable table generation!\n");
#else
@@ -1083,9 +1093,11 @@ void MultiParticleContainer::InitBreitWheeler ()
#endif
}
else if(lookup_table_mode == "load"){
- amrex::Print() << "Breit Wheeler table will be read from file. \n" ;
std::string load_table_name;
pp_qed_bw.query("load_table_from", load_table_name);
+ WarpX::GetInstance().RecordWarning("QED",
+ "The Breit Wheeler table will be read from the file:" + load_table_name,
+ WarnPriority::low);
if(load_table_name.empty()){
amrex::Abort("Breit Wheeler table name should be provided");
}
@@ -1096,7 +1108,10 @@ void MultiParticleContainer::InitBreitWheeler ()
table_data, bw_minimum_chi_part);
}
else if(lookup_table_mode == "builtin"){
- amrex::Print() << "Built-in Breit Wheeler table will be used. \n" ;
+ WarpX::GetInstance().RecordWarning("QED",
+ "The built-in Breit Wheeler table will be used."
+ "This low resolution table is intended for testing purposes only.",
+ WarnPriority::medium);
m_shr_p_bw_engine->init_builtin_tables(bw_minimum_chi_part);
}
else{