diff options
author | 2021-10-20 21:02:22 +0200 | |
---|---|---|
committer | 2021-10-20 19:02:22 +0000 | |
commit | 02096d079680a2f7125db230bcde872dde63732c (patch) | |
tree | 14064a6a0b029a16f77ad357772546334e841867 /Source/Initialization/PlasmaInjector.cpp | |
parent | c3f481bca813d834e248d1adeb5b5a02495b9e1a (diff) | |
download | WarpX-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/Initialization/PlasmaInjector.cpp')
-rw-r--r-- | Source/Initialization/PlasmaInjector.cpp | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/Source/Initialization/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp index 1e4b632c0..572267d0e 100644 --- a/Source/Initialization/PlasmaInjector.cpp +++ b/Source/Initialization/PlasmaInjector.cpp @@ -131,9 +131,11 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name) bool mass_is_specified = queryWithParser(pp_species_name, "mass", mass); if ( charge_is_specified && species_is_specified ){ - amrex::Print() << "WARNING: Both '" << species_name << ".charge' and " - << species_name << ".species_type' are specified\n'" - << species_name << ".charge' will take precedence.\n"; + WarpX::GetInstance().RecordWarning("Species", + "Both '" + species_name + ".charge' and " + + species_name + ".species_type' are specified.\n" + + species_name + ".charge' will take precedence.\n"); + } if (!charge_is_specified && !species_is_specified && injection_style != "external_file"){ // external file will throw own assertions below if charge cannot be found @@ -141,9 +143,10 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name) } if ( mass_is_specified && species_is_specified ){ - amrex::Print() << "WARNING: Both '" << species_name << ".mass' and " - << species_name << ".species_type' are specified\n'" - << species_name << ".mass' will take precedence.\n"; + WarpX::GetInstance().RecordWarning("Species", + "Both '" + species_name + ".mass' and " + + species_name + ".species_type' are specified.\n" + + species_name + ".mass' will take precedence.\n"); } if (!mass_is_specified && !species_is_specified && injection_style != "external_file"){ // external file will throw own assertions below if mass cannot be found @@ -343,14 +346,16 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name) "'" + ps_name + ".species_type' in your input file!\n"); if (charge_is_specified) { - amrex::Print() << "WARNING: Both '" << ps_name << ".charge' and '" - << ps_name << ".injection_file' specify a charge.\n'" - << ps_name << ".charge' will take precedence.\n"; + WarpX::GetInstance().RecordWarning("Species", + "Both '" + ps_name + ".charge' and '" + + ps_name + ".injection_file' specify a charge.\n'" + + ps_name + ".charge' will take precedence.\n"); } else if (species_is_specified) { - amrex::Print() << "WARNING: Both '" << ps_name << ".species_type' and '" - << ps_name << ".injection_file' specify a charge.\n'" - << ps_name << ".species_type' will take precedence.\n"; + WarpX::GetInstance().RecordWarning("Species", + "Both '" + ps_name + ".species_type' and '" + + ps_name + ".injection_file' specify a charge.\n'" + + ps_name + ".species_type' will take precedence.\n"); } else { // TODO: Add ASSERT_WITH_MESSAGE to test if charge is a constant record @@ -360,14 +365,16 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name) charge = p_q * charge_unit; } if (mass_is_specified) { - amrex::Print() << "WARNING: Both '" << ps_name << ".mass' and '" - << ps_name << ".injection_file' specify a mass.\n'" - << ps_name << ".mass' will take precedence.\n"; + WarpX::GetInstance().RecordWarning("Species", + "Both '" + ps_name + ".mass' and '" + + ps_name + ".injection_file' specify a charge.\n'" + + ps_name + ".mass' will take precedence.\n"); } else if (species_is_specified) { - amrex::Print() << "WARNING: Both '" << ps_name << ".species_type' and '" - << ps_name << ".injection_file' specify a mass.\n'" - << ps_name << ".species_type' will take precedence.\n"; + WarpX::GetInstance().RecordWarning("Species", + "Both '" + ps_name + ".species_type' and '" + + ps_name + ".injection_file' specify a mass.\n'" + + ps_name + ".species_type' will take precedence.\n"); } else { // TODO: Add ASSERT_WITH_MESSAGE to test if mass is a constant record |