From 0555226e4a20b8ae5349e14f830e270c4577f558 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Wed, 18 Mar 2020 00:42:16 +0100 Subject: Add some WarpXUtilMsg::AlwaysAssert in particle containers (#811) * replaced AMREX_ALWAYS_ASSERT_WITH_MESSAGE with WarpXUtilMsg::AlwaysAssert where needed * reverted horrible mistake --- Source/Particles/MultiParticleContainer.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'Source/Particles/MultiParticleContainer.cpp') 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; } -- cgit v1.2.3