From 0a64c2b8a42d766e5a893fcab2d4573b33cca74f Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Tue, 8 Mar 2022 18:38:25 +0100 Subject: Make error and info messages visually uniform (#2939) * initial work to add msg formatter * wip * replace AMREX_ALWAYS_ASSERT_WITH_MESSAGE with WarpX equivalent --- Source/Particles/ParticleBoundaryBuffer.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'Source/Particles/ParticleBoundaryBuffer.cpp') diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 2f105de55..6837aef31 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -10,6 +10,7 @@ #include "Particles/ParticleBoundaryBuffer.H" #include "Particles/MultiParticleContainer.H" #include "Particles/Gather/ScalarFieldGather.H" +#include "Utils/TextMsg.H" #include #include @@ -100,9 +101,11 @@ void ParticleBoundaryBuffer::printNumParticles () const { for (int i = 0; i < numSpecies(); ++i) { int np = buffer[i].isDefined() ? buffer[i].TotalNumberOfParticles(false) : 0; - amrex::Print() << "Species " << getSpeciesNames()[i] << " has " - << np << " particles in the boundary buffer " - << "for side " << iside << " of dim " << idim << "\n"; + amrex::Print() << Utils::TextMsg::Info( + "Species " + getSpeciesNames()[i] + " has " + + std::to_string(np) + " particles in the boundary buffer " + + "for side " + std::to_string(iside) + " of dim " + std::to_string(idim) + ); } } } @@ -111,8 +114,10 @@ void ParticleBoundaryBuffer::printNumParticles () const { for (int i = 0; i < numSpecies(); ++i) { int np = buffer[i].isDefined() ? buffer[i].TotalNumberOfParticles(false) : 0; - amrex::Print() << "Species " << getSpeciesNames()[i] << " has " - << np << " particles in the EB boundary buffer \n"; + amrex::Print() << Utils::TextMsg::Info( + "Species " + getSpeciesNames()[i] + " has " + + std::to_string(np) + " particles in the EB boundary buffer" + ); } #endif } @@ -269,10 +274,10 @@ ParticleBoundaryBuffer::getParticleBuffer(const std::string species_name, int bo auto& buffer = m_particle_containers[boundary]; auto index = WarpX::GetInstance().GetPartContainer().getSpeciesID(species_name); - AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_do_boundary_buffer[boundary][index], + WARPX_ALWAYS_ASSERT_WITH_MESSAGE(m_do_boundary_buffer[boundary][index], "Attempted to get particle buffer for boundary " - + boundary + ", which is not used!"); - AMREX_ALWAYS_ASSERT_WITH_MESSAGE(buffer[index].isDefined(), + + std::to_string(boundary) + ", which is not used!"); + WARPX_ALWAYS_ASSERT_WITH_MESSAGE(buffer[index].isDefined(), "Tried to get a buffer that is not defined!"); return buffer[index]; -- cgit v1.2.3