aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Particles/MultiParticleContainer.cpp24
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp14
2 files changed, 29 insertions, 9 deletions
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp
index 12b0a9d61..13390168f 100644
--- a/Source/Particles/MultiParticleContainer.cpp
+++ b/Source/Particles/MultiParticleContainer.cpp
@@ -180,7 +180,11 @@ MultiParticleContainer::ReadParameters ()
pp.queryarr("deposit_on_main_grid", tmp);
for (auto const& name : tmp) {
auto it = std::find(species_names.begin(), species_names.end(), name);
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE(it != species_names.end(), "ERROR: species in particles.deposit_on_main_grid must be part of particles.species_names");
+ WarpXUtilMsg::AlwaysAssert(
+ it != species_names.end(),
+ "ERROR: species '" + name
+ + "' in particles.deposit_on_main_grid must be part of particles.species_names"
+ );
int i = std::distance(species_names.begin(), it);
m_deposit_on_main_grid[i] = true;
}
@@ -190,7 +194,11 @@ MultiParticleContainer::ReadParameters ()
pp.queryarr("gather_from_main_grid", tmp_gather);
for (auto const& name : tmp_gather) {
auto it = std::find(species_names.begin(), species_names.end(), name);
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE(it != species_names.end(), "ERROR: species in particles.gather_from_main_grid must be part of particles.species_names");
+ WarpXUtilMsg::AlwaysAssert(
+ it != species_names.end(),
+ "ERROR: species '" + name
+ + "' in particles.gather_from_main_grid must be part of particles.species_names"
+ );
int i = std::distance(species_names.begin(), it);
m_gather_from_main_grid.at(i) = true;
}
@@ -203,7 +211,11 @@ MultiParticleContainer::ReadParameters ()
if (!rigid_injected_species.empty()) {
for (auto const& name : rigid_injected_species) {
auto it = std::find(species_names.begin(), species_names.end(), name);
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE(it != species_names.end(), "ERROR: species in particles.rigid_injected_species must be part of particles.species_names");
+ WarpXUtilMsg::AlwaysAssert(
+ it != species_names.end(),
+ "ERROR: species '" + name
+ + "' in particles.rigid_injected_species must be part of particles.species_names"
+ );
int i = std::distance(species_names.begin(), it);
species_types[i] = PCTypes::RigidInjected;
}
@@ -214,9 +226,11 @@ MultiParticleContainer::ReadParameters ()
if (!photon_species.empty()) {
for (auto const& name : photon_species) {
auto it = std::find(species_names.begin(), species_names.end(), name);
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
+ WarpXUtilMsg::AlwaysAssert(
it != species_names.end(),
- "ERROR: species in particles.rigid_injected_species must be part of particles.species_names");
+ "ERROR: species '" + name
+ + "' in particles.rigid_injected_species must be part of particles.species_names"
+ );
int i = std::distance(species_names.begin(), it);
species_types[i] = PCTypes::Photon;
}
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index 87b43f661..6f634fc25 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -14,6 +14,7 @@
#include "FortranInterface/WarpX_f.H"
#include "WarpX.H"
#include "Utils/WarpXConst.H"
+#include "Utils/WarpXUtil.H"
#include "Python/WarpXWrappers.h"
#include "Utils/IonizationEnergiesTable.H"
#include "Particles/Gather/FieldGather.H"
@@ -30,6 +31,7 @@
#include <limits>
#include <sstream>
+#include <string>
using namespace amrex;
@@ -69,11 +71,13 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, int isp
pp.query("do_classical_radiation_reaction", do_classical_radiation_reaction);
//if the species is not a lepton, do_classical_radiation_reaction
//should be false
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
+ WarpXUtilMsg::AlwaysAssert(
!(do_classical_radiation_reaction &&
!(AmIA<PhysicalSpecies::electron>() ||
AmIA<PhysicalSpecies::positron>() )),
- "Can't enable classical radiation reaction for non lepton species. ");
+ "ERROR: can't enable classical radiation reaction for non lepton species '"
+ + species_name + "'."
+ );
//Only Boris pusher is compatible with radiation reaction
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
@@ -131,9 +135,11 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, int isp
if (plot_vars[0] != "none"){
for (const auto& var : plot_vars){
// Return error if var not in PIdx.
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
+ WarpXUtilMsg::AlwaysAssert(
ParticleStringNames::to_index.count(var),
- "plot_vars argument not in ParticleStringNames");
+ "ERROR: plot_vars argument '" + var +
+ "' not in ParticleStringNames"
+ );
plot_flags[ParticleStringNames::to_index.at(var)] = 1;
}
}