diff options
author | 2023-05-01 18:25:01 +0200 | |
---|---|---|
committer | 2023-05-01 09:25:01 -0700 | |
commit | 1c6f1bf24513b4e56f640eea402fa8223ea1c667 (patch) | |
tree | 29967ef551e4632b757f41ac98e10b258692be71 /Source | |
parent | a602c6e60ec8d6b728dfe7fe5e79ec191c906f57 (diff) | |
download | WarpX-1c6f1bf24513b4e56f640eea402fa8223ea1c667.tar.gz WarpX-1c6f1bf24513b4e56f640eea402fa8223ea1c667.tar.zst WarpX-1c6f1bf24513b4e56f640eea402fa8223ea1c667.zip |
Use WARPX_ABORT_WITH_MESSAGE("msg") instead of amrex::Abort(Utils::TextMsg::Err("msg")) (#3879)
* use WARPX_ABORT_WITH_MSG instead of amrex::Abort(Utils::TextMsg::Err(msg)) [WIP]
* use WARPX_ABORT_WITH_MESSAGE
* fix typo
* fix missing parenthesis
* remove spaces to prevent automatic text wrapping
* remove wrong parenthesis
Diffstat (limited to 'Source')
50 files changed, 207 insertions, 180 deletions
diff --git a/Source/Diagnostics/Diagnostics.cpp b/Source/Diagnostics/Diagnostics.cpp index 8d6be27d3..e5b07f359 100644 --- a/Source/Diagnostics/Diagnostics.cpp +++ b/Source/Diagnostics/Diagnostics.cpp @@ -487,19 +487,19 @@ Diagnostics::InitBaseData () dynamic_cast<amrex::AmrMesh*>(const_cast<WarpX*>(&warpx)), m_diag_name); #else - amrex::Abort(Utils::TextMsg::Err( - "To use SENSEI in situ, compile with USE_SENSEI=TRUE")); + WARPX_ABORT_WITH_MESSAGE( + "To use SENSEI in situ, compile with USE_SENSEI=TRUE"); #endif } else if (m_format == "openpmd"){ #ifdef WARPX_USE_OPENPMD m_flush_format = std::make_unique<FlushFormatOpenPMD>(m_diag_name); #else - amrex::Abort(Utils::TextMsg::Err( - "To use openpmd output format, need to compile with USE_OPENPMD=TRUE")); + WARPX_ABORT_WITH_MESSAGE( + "To use openpmd output format, need to compile with USE_OPENPMD=TRUE"); #endif } else { - amrex::Abort(Utils::TextMsg::Err( - "unknown output format")); + WARPX_ABORT_WITH_MESSAGE( + "unknown output format"); } // allocate vector of buffers then allocate vector of levels for each buffer diff --git a/Source/Diagnostics/FieldIO.cpp b/Source/Diagnostics/FieldIO.cpp index 0b7cc9356..006310147 100644 --- a/Source/Diagnostics/FieldIO.cpp +++ b/Source/Diagnostics/FieldIO.cpp @@ -223,6 +223,6 @@ AverageAndPackScalarField (MultiFab& mf_avg, // - Fully nodal ablastr::coarsen::sample::Coarsen(mf_avg, *scalar_total, dcomp, 0, 1, ngrow ); } else { - amrex::Abort(Utils::TextMsg::Err("Unknown staggering.")); + WARPX_ABORT_WITH_MESSAGE("Unknown staggering."); } } diff --git a/Source/Diagnostics/FlushFormats/FlushFormatSensei.cpp b/Source/Diagnostics/FlushFormats/FlushFormatSensei.cpp index b6cb1da97..fb510b6dd 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatSensei.cpp +++ b/Source/Diagnostics/FlushFormats/FlushFormatSensei.cpp @@ -102,9 +102,9 @@ FlushFormatSensei::WriteParticles ( { amrex::ignore_unused(particle_diags); #ifdef AMREX_USE_SENSEI_INSITU - amrex::Abort(Utils::TextMsg::Err( + WARPX_ABORT_WITH_MESSAGE( "FlushFormatSensei::WriteParticles : " "Not yet implemented." - )); + ); #endif } diff --git a/Source/Diagnostics/FullDiagnostics.cpp b/Source/Diagnostics/FullDiagnostics.cpp index e8da1be43..db13e3ead 100644 --- a/Source/Diagnostics/FullDiagnostics.cpp +++ b/Source/Diagnostics/FullDiagnostics.cpp @@ -308,8 +308,8 @@ FullDiagnostics::InitializeFieldFunctorsRZopenPMD (int lev) } } else { - amrex::Abort(Utils::TextMsg::Err( - "Error: " + m_varnames_fields[comp] + " is not a known field output type in RZ geometry")); + WARPX_ABORT_WITH_MESSAGE( + "Error: " + m_varnames_fields[comp] + " is not a known field output type in RZ geometry"); } } // Sum the number of components in input vector m_all_field_functors @@ -639,7 +639,7 @@ FullDiagnostics::InitializeFieldFunctors (int lev) } else if ( m_varnames[comp] == "At" ){ m_all_field_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.get_pointer_vector_potential_fp(lev, 1), lev, m_crse_ratio); } else { - amrex::Abort(Utils::TextMsg::Err(m_varnames[comp] + " is not a known field output type for RZ geometry")); + WARPX_ABORT_WITH_MESSAGE(m_varnames[comp] + " is not a known field output type for RZ geometry"); } #else // Valid transverse fields in Cartesian coordinates @@ -660,7 +660,7 @@ FullDiagnostics::InitializeFieldFunctors (int lev) } else if ( m_varnames[comp] == "Ay" ){ m_all_field_functors[lev][comp] = std::make_unique<CellCenterFunctor>(warpx.get_pointer_vector_potential_fp(lev, 1), lev, m_crse_ratio); } else { - amrex::Abort(Utils::TextMsg::Err(m_varnames[comp] + " is not a known field output type for this geometry")); + WARPX_ABORT_WITH_MESSAGE(m_varnames[comp] + " is not a known field output type for this geometry"); } #endif } diff --git a/Source/Diagnostics/MultiDiagnostics.cpp b/Source/Diagnostics/MultiDiagnostics.cpp index 82ff784ab..caf8de63c 100644 --- a/Source/Diagnostics/MultiDiagnostics.cpp +++ b/Source/Diagnostics/MultiDiagnostics.cpp @@ -28,7 +28,7 @@ MultiDiagnostics::MultiDiagnostics () } else if ( diags_types[i] == DiagTypes::BoundaryScraping ){ alldiags[i] = std::make_unique<BoundaryScrapingDiagnostics>(i, diags_names[i]); } else { - amrex::Abort(Utils::TextMsg::Err("Unknown diagnostic type")); + WARPX_ABORT_WITH_MESSAGE("Unknown diagnostic type"); } } } diff --git a/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp b/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp index 8ae51b0e6..a30655991 100644 --- a/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp +++ b/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp @@ -43,8 +43,8 @@ FieldMomentum::FieldMomentum (std::string rd_name) { // RZ coordinate is not working #if (defined WARPX_DIM_RZ) - amrex::Abort(Utils::TextMsg::Err( - "FieldMomentum reduced diagnostics not implemented in RZ geometry")); + WARPX_ABORT_WITH_MESSAGE( + "FieldMomentum reduced diagnostics not implemented in RZ geometry"); #endif // Read number of levels diff --git a/Source/Diagnostics/ReducedDiags/FieldProbe.cpp b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp index b898d647f..9dfc76e64 100644 --- a/Source/Diagnostics/ReducedDiags/FieldProbe.cpp +++ b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp @@ -115,8 +115,8 @@ FieldProbe::FieldProbe (std::string rd_name) else if (m_probe_geometry_str == "Plane") { #if defined(WARPX_DIM_1D_Z) - amrex::Abort(Utils::TextMsg::Err( - "ERROR: Plane probe should be used in a 2D or 3D simulation only")); + WARPX_ABORT_WITH_MESSAGE( + "Plane probe should be used in a 2D or 3D simulation only"); #endif m_probe_geometry = DetectorGeometry::Plane; #if defined(WARPX_DIM_3D) @@ -135,10 +135,10 @@ FieldProbe::FieldProbe (std::string rd_name) } else { - amrex::Abort(Utils::TextMsg::Err( - "ERROR: Invalid probe geometry '" + m_probe_geometry_str + WARPX_ABORT_WITH_MESSAGE( + "Invalid probe geometry '" + m_probe_geometry_str + "'. Valid geometries are Point, Line or Plane." - )); + ); } pp_rd_name.query("integrate", m_field_probe_integrate); pp_rd_name.query("raw_fields", raw_fields); diff --git a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp index 019ad6d3c..13dee37a8 100644 --- a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp +++ b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp @@ -86,8 +86,8 @@ ParticleHistogram::ParticleHistogram (std::string rd_name) } else if ( norm_string == "area_to_unity" ) { m_norm = NormalizationType::area_to_unity; } else { - Abort(Utils::TextMsg::Err( - "Unknown ParticleHistogram normalization type.")); + WARPX_ABORT_WITH_MESSAGE( + "Unknown ParticleHistogram normalization type."); } // get MultiParticleContainer class object @@ -103,8 +103,8 @@ ParticleHistogram::ParticleHistogram (std::string rd_name) } // if m_selected_species_id is not modified if ( m_selected_species_id == -1 ){ - Abort(Utils::TextMsg::Err( - "Unknown species for ParticleHistogram reduced diagnostic.")); + WARPX_ABORT_WITH_MESSAGE( + "Unknown species for ParticleHistogram reduced diagnostic."); } // Read optional filter diff --git a/Source/Diagnostics/WarpXOpenPMD.cpp b/Source/Diagnostics/WarpXOpenPMD.cpp index 1eebb0765..8ab5c3616 100644 --- a/Source/Diagnostics/WarpXOpenPMD.cpp +++ b/Source/Diagnostics/WarpXOpenPMD.cpp @@ -504,7 +504,7 @@ WarpXOpenPMDPlot::Init (openPMD::Access access, bool isBTD) m_MPISize = amrex::ParallelDescriptor::NProcs(); m_MPIRank = amrex::ParallelDescriptor::MyProc(); #else - amrex::Abort(Utils::TextMsg::Err("openPMD-api not built with MPI support!")); + WARPX_ABORT_WITH_MESSAGE("openPMD-api not built with MPI support!"); #endif } else { m_Series = std::make_unique<openPMD::Series>(filepath, access, m_OpenPMDoptions); diff --git a/Source/EmbeddedBoundary/WarpXFaceExtensions.cpp b/Source/EmbeddedBoundary/WarpXFaceExtensions.cpp index dbfebda66..70c19aed4 100644 --- a/Source/EmbeddedBoundary/WarpXFaceExtensions.cpp +++ b/Source/EmbeddedBoundary/WarpXFaceExtensions.cpp @@ -155,8 +155,8 @@ WarpX::CountExtFaces() { #elif defined(WARPX_DIM_3D) for(int idim = 0; idim < AMREX_SPACEDIM; ++idim) { #else - amrex::Abort(Utils::TextMsg::Err( - "CountExtFaces: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "CountExtFaces: Only implemented in 2D3V and 3D3V"); #endif amrex::ReduceOps<amrex::ReduceOpSum> reduce_ops; amrex::ReduceData<int> reduce_data(reduce_ops); @@ -420,8 +420,8 @@ WarpX::ComputeOneWayExtensions() { #elif defined(WARPX_DIM_3D) for(int idim = 0; idim < AMREX_SPACEDIM; ++idim) { #else - amrex::Abort(Utils::TextMsg::Err( - "ComputeOneWayExtensions: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "ComputeOneWayExtensions: Only implemented in 2D3V and 3D3V"); #endif for (amrex::MFIter mfi(*Bfield_fp[maxLevel()][idim]); mfi.isValid(); ++mfi) { @@ -542,8 +542,8 @@ WarpX::ComputeEightWaysExtensions() { #elif defined(WARPX_DIM_3D) for(int idim = 0; idim < AMREX_SPACEDIM; ++idim) { #else - amrex::Abort(Utils::TextMsg::Err( - "ComputeEightWaysExtensions: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "ComputeEightWaysExtensions: Only implemented in 2D3V and 3D3V"); #endif for (amrex::MFIter mfi(*Bfield_fp[maxLevel()][idim]); mfi.isValid(); ++mfi) { diff --git a/Source/EmbeddedBoundary/WarpXInitEB.cpp b/Source/EmbeddedBoundary/WarpXInitEB.cpp index a3a315ae0..a406886dd 100644 --- a/Source/EmbeddedBoundary/WarpXInitEB.cpp +++ b/Source/EmbeddedBoundary/WarpXInitEB.cpp @@ -129,8 +129,8 @@ WarpX::ComputeEdgeLengths (std::array< std::unique_ptr<amrex::MultiFab>, 3 >& ed #elif defined(WARPX_DIM_3D) for (int idim = 0; idim < AMREX_SPACEDIM; ++idim){ #else - amrex::Abort(Utils::TextMsg::Err( - "ComputeEdgeLengths: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "ComputeEdgeLengths: Only implemented in 2D3V and 3D3V"); #endif amrex::Box box = mfi.tilebox(edge_lengths[idim]->ixType().toIntVect(), edge_lengths[idim]->nGrowVect()); @@ -155,8 +155,8 @@ WarpX::ComputeEdgeLengths (std::array< std::unique_ptr<amrex::MultiFab>, 3 >& ed #elif defined(WARPX_DIM_3D) auto const &edge_cent = edge_centroid[idim]->const_array(mfi); #else - amrex::Abort(Utils::TextMsg::Err( - "ComputeEdgeLengths: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "ComputeEdgeLengths: Only implemented in 2D3V and 3D3V"); #endif amrex::ParallelFor(box, [=] AMREX_GPU_DEVICE (int i, int j, int k) { if (edge_cent(i, j, k) == amrex::Real(-1.0)) { @@ -192,8 +192,8 @@ WarpX::ComputeFaceAreas (std::array< std::unique_ptr<amrex::MultiFab>, 3 >& face #elif defined(WARPX_DIM_3D) auto const &area_frac = eb_fact.getAreaFrac(); #else - amrex::Abort(Utils::TextMsg::Err( - "ComputeFaceAreas: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "ComputeFaceAreas: Only implemented in 2D3V and 3D3V"); #endif #ifdef WARPX_DIM_XZ @@ -207,8 +207,8 @@ WarpX::ComputeFaceAreas (std::array< std::unique_ptr<amrex::MultiFab>, 3 >& face #elif defined(WARPX_DIM_3D) for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { #else - amrex::Abort(Utils::TextMsg::Err( - "ComputeFaceAreas: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "ComputeFaceAreas: Only implemented in 2D3V and 3D3V"); #endif amrex::Box box = mfi.tilebox(face_areas[idim]->ixType().toIntVect(), face_areas[idim]->nGrowVect()); @@ -230,8 +230,8 @@ WarpX::ComputeFaceAreas (std::array< std::unique_ptr<amrex::MultiFab>, 3 >& face #elif defined(WARPX_DIM_3D) auto const &face = area_frac[idim]->const_array(mfi); #else - amrex::Abort(Utils::TextMsg::Err( - "ComputeFaceAreas: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "ComputeFaceAreas: Only implemented in 2D3V and 3D3V"); #endif amrex::ParallelFor(box, [=] AMREX_GPU_DEVICE (int i, int j, int k) { face_areas_dim(i, j, k) = face(i, j, k); @@ -256,8 +256,8 @@ WarpX::ScaleEdges (std::array< std::unique_ptr<amrex::MultiFab>, 3 >& edge_lengt #elif defined(WARPX_DIM_3D) for (int idim = 0; idim < AMREX_SPACEDIM; ++idim){ #else - amrex::Abort(Utils::TextMsg::Err( - "ScaleEdges: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "ScaleEdges: Only implemented in 2D3V and 3D3V"); #endif const amrex::Box& box = mfi.tilebox(edge_lengths[idim]->ixType().toIntVect(), edge_lengths[idim]->nGrowVect() ); @@ -285,8 +285,8 @@ WarpX::ScaleAreas(std::array< std::unique_ptr<amrex::MultiFab>, 3 >& face_areas, #elif defined(WARPX_DIM_3D) for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { #else - amrex::Abort(Utils::TextMsg::Err( - "ScaleAreas: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "ScaleAreas: Only implemented in 2D3V and 3D3V"); #endif const amrex::Box& box = mfi.tilebox(face_areas[idim]->ixType().toIntVect(), face_areas[idim]->nGrowVect() ); @@ -301,8 +301,8 @@ WarpX::ScaleAreas(std::array< std::unique_ptr<amrex::MultiFab>, 3 >& face_areas, full_area = cell_size[0]*cell_size[1]; } #else - amrex::Abort(Utils::TextMsg::Err( - "ScaleAreas: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "ScaleAreas: Only implemented in 2D3V and 3D3V"); #endif auto const &face_areas_dim = face_areas[idim]->array(mfi); @@ -331,8 +331,8 @@ WarpX::MarkCells(){ // In 2D we change the extrema of the for loop so that we only have the case idim=1 for (int idim = 1; idim < AMREX_SPACEDIM; ++idim) { #else - amrex::Abort(Utils::TextMsg::Err( - "MarkCells: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "MarkCells: Only implemented in 2D3V and 3D3V"); #endif for (amrex::MFIter mfi(*Bfield_fp[maxLevel()][idim]); mfi.isValid(); ++mfi) { //amrex::Box const &box = mfi.tilebox(m_face_areas[maxLevel()][idim]->ixType().toIntVect()); @@ -366,8 +366,8 @@ WarpX::MarkCells(){ S_stab = 0.5 * std::max({lx(i, j, k) * dz, lx(i, j, k + 1) * dz, lz(i, j, k) * dx, lz(i + 1, j, k) * dx}); #else - amrex::Abort(Utils::TextMsg::Err( - "MarkCells: Only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "MarkCells: Only implemented in 2D3V and 3D3V"); #endif }else { S_stab = 0.5 * std::max({lx(i, j, k) * dy, lx(i, j + 1, k) * dy, diff --git a/Source/Evolve/WarpXComputeDt.cpp b/Source/Evolve/WarpXComputeDt.cpp index 3c1221e8e..db980a66e 100644 --- a/Source/Evolve/WarpXComputeDt.cpp +++ b/Source/Evolve/WarpXComputeDt.cpp @@ -74,7 +74,7 @@ WarpX::ComputeDt () deltat = cfl * CartesianCKCAlgorithm::ComputeMaxDt(dx); #endif } else { - amrex::Abort(Utils::TextMsg::Err("ComputeDt: Unknown algorithm")); + WARPX_ABORT_WITH_MESSAGE("ComputeDt: Unknown algorithm"); } } diff --git a/Source/Evolve/WarpXEvolve.cpp b/Source/Evolve/WarpXEvolve.cpp index 269270bd9..4cf6db98d 100644 --- a/Source/Evolve/WarpXEvolve.cpp +++ b/Source/Evolve/WarpXEvolve.cpp @@ -202,9 +202,9 @@ WarpX::Evolve (int numsteps) } else { - amrex::Abort(Utils::TextMsg::Err( + WARPX_ABORT_WITH_MESSAGE( "do_subcycling = " + std::to_string(do_subcycling) - + " is an unsupported do_subcycling type.")); + + " is an unsupported do_subcycling type."); } // Resample particles @@ -469,7 +469,7 @@ WarpX::OneStep_nosub (Real cur_time) // macroscopic medium MacroscopicEvolveE(dt[0]); // We now have E^{n+1} } else { - amrex::Abort(Utils::TextMsg::Err("Medium for EM is unknown")); + WARPX_ABORT_WITH_MESSAGE("Medium for EM is unknown"); } FillBoundaryE(guard_cells.ng_FieldSolver, WarpX::sync_nodal_points); @@ -671,8 +671,8 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time) if (WarpX::current_correction) { - amrex::Abort(Utils::TextMsg::Err( - "Current correction not implemented for multi-J algorithm.")); + WARPX_ABORT_WITH_MESSAGE( + "Current correction not implemented for multi-J algorithm."); } // Advance E,B,F,G fields in time and update the average fields @@ -730,8 +730,8 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time) } #else amrex::ignore_unused(cur_time); - amrex::Abort(Utils::TextMsg::Err( - "multi-J algorithm not implemented for FDTD")); + WARPX_ABORT_WITH_MESSAGE( + "multi-J algorithm not implemented for FDTD"); #endif // WARPX_USE_PSATD } diff --git a/Source/FieldSolver/FiniteDifferenceSolver/ComputeDivE.cpp b/Source/FieldSolver/FiniteDifferenceSolver/ComputeDivE.cpp index 2725e4310..7f4016450 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/ComputeDivE.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/ComputeDivE.cpp @@ -65,7 +65,7 @@ void FiniteDifferenceSolver::ComputeDivE ( #endif } else { - amrex::Abort(Utils::TextMsg::Err("ComputeDivE: Unknown algorithm")); + WARPX_ABORT_WITH_MESSAGE("ComputeDivE: Unknown algorithm"); } } diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp index b53f0780c..a439a91f7 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp @@ -93,7 +93,7 @@ void FiniteDifferenceSolver::EvolveB ( #endif #endif } else { - amrex::Abort(Utils::TextMsg::Err("EvolveB: Unknown algorithm")); + WARPX_ABORT_WITH_MESSAGE("EvolveB: Unknown algorithm"); } } @@ -212,8 +212,8 @@ void FiniteDifferenceSolver::EvolveBCartesianECT ( #ifdef AMREX_USE_EB #if !(defined(WARPX_DIM_3D) || defined(WARPX_DIM_XZ)) - amrex::Abort(Utils::TextMsg::Err( - "EvolveBCartesianECT: Embedded Boundaries are only implemented in 2D3V and 3D3V")); + WARPX_ABORT_WITH_MESSAGE( + "EvolveBCartesianECT: Embedded Boundaries are only implemented in 2D3V and 3D3V"); #endif amrex::LayoutData<amrex::Real> *cost = WarpX::getCosts(lev); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp index ba0d7c9ce..9ae67d4f9 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp @@ -50,8 +50,8 @@ void FiniteDifferenceSolver::EvolveBPML ( // but we compile code for each algorithm, using templates) #ifdef WARPX_DIM_RZ amrex::ignore_unused(Bfield, Efield, dt, dive_cleaning); - amrex::Abort(Utils::TextMsg::Err( - "PML are not implemented in cylindrical geometry.")); + WARPX_ABORT_WITH_MESSAGE( + "PML are not implemented in cylindrical geometry."); #else if (m_grid_type == GridType::Collocated) { @@ -66,8 +66,8 @@ void FiniteDifferenceSolver::EvolveBPML ( EvolveBPMLCartesian <CartesianCKCAlgorithm> (Bfield, Efield, dt, dive_cleaning); } else { - amrex::Abort(Utils::TextMsg::Err( - "EvolveBPML: Unknown algorithm")); + WARPX_ABORT_WITH_MESSAGE( + "EvolveBPML: Unknown algorithm"); } #endif } diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp index d37e5f744..3ea6bc8db 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp @@ -84,7 +84,7 @@ void FiniteDifferenceSolver::EvolveE ( #endif } else { - amrex::Abort(Utils::TextMsg::Err("EvolveE: Unknown algorithm")); + WARPX_ABORT_WITH_MESSAGE("EvolveE: Unknown algorithm"); } } diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveECTRho.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveECTRho.cpp index 0ef5571a1..a155b8f71 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveECTRho.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveECTRho.cpp @@ -74,8 +74,8 @@ void FiniteDifferenceSolver::EvolveRhoCartesianECT ( #ifdef AMREX_USE_EB #if !(defined(WARPX_DIM_3D) || defined(WARPX_DIM_XZ)) - amrex::Abort(Utils::TextMsg::Err( - "EvolveRhoCartesianECT: Embedded Boundaries are only implemented in 3D and XZ")); + WARPX_ABORT_WITH_MESSAGE( + "EvolveRhoCartesianECT: Embedded Boundaries are only implemented in 3D and XZ"); #endif amrex::LayoutData<amrex::Real>* cost = WarpX::getCosts(lev); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp index d3475b0c9..2ecc9ee0e 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp @@ -56,8 +56,8 @@ void FiniteDifferenceSolver::EvolveEPML ( // but we compile code for each algorithm, using templates) #ifdef WARPX_DIM_RZ amrex::ignore_unused(Efield, Bfield, Jfield, Ffield, sigba, dt, pml_has_particles, edge_lengths); - amrex::Abort(Utils::TextMsg::Err( - "PML are not implemented in cylindrical geometry.")); + WARPX_ABORT_WITH_MESSAGE( + "PML are not implemented in cylindrical geometry."); #else if (m_grid_type == GridType::Collocated) { @@ -75,7 +75,7 @@ void FiniteDifferenceSolver::EvolveEPML ( Efield, Bfield, Jfield, edge_lengths, Ffield, sigba, dt, pml_has_particles ); } else { - amrex::Abort(Utils::TextMsg::Err("EvolveEPML: Unknown algorithm")); + WARPX_ABORT_WITH_MESSAGE("EvolveEPML: Unknown algorithm"); } #endif } diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveF.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveF.cpp index 171967b81..c43d965b3 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveF.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveF.cpp @@ -72,7 +72,7 @@ void FiniteDifferenceSolver::EvolveF ( #endif } else { - amrex::Abort(Utils::TextMsg::Err("EvolveF: Unknown algorithm")); + WARPX_ABORT_WITH_MESSAGE("EvolveF: Unknown algorithm"); } } diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveFPML.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveFPML.cpp index 1cb5201cd..5b69737c7 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveFPML.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveFPML.cpp @@ -48,8 +48,8 @@ void FiniteDifferenceSolver::EvolveFPML ( // but we compile code for each algorithm, using templates) #ifdef WARPX_DIM_RZ amrex::ignore_unused(Ffield, Efield, dt); - amrex::Abort(Utils::TextMsg::Err( - "PML are not implemented in cylindrical geometry.")); + WARPX_ABORT_WITH_MESSAGE( + "PML are not implemented in cylindrical geometry."); #else if (m_grid_type == GridType::Collocated) { @@ -64,7 +64,7 @@ void FiniteDifferenceSolver::EvolveFPML ( EvolveFPMLCartesian <CartesianCKCAlgorithm> ( Ffield, Efield, dt ); } else { - amrex::Abort(Utils::TextMsg::Err("EvolveFPML: Unknown algorithm")); + WARPX_ABORT_WITH_MESSAGE("EvolveFPML: Unknown algorithm"); } #endif } diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveG.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveG.cpp index c31929258..30d19efe0 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveG.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveG.cpp @@ -61,7 +61,7 @@ void FiniteDifferenceSolver::EvolveG ( } else { - amrex::Abort(Utils::TextMsg::Err("EvolveG: unknown FDTD algorithm")); + WARPX_ABORT_WITH_MESSAGE("EvolveG: unknown FDTD algorithm"); } #endif } diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp index a65d86b8f..26da8352c 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp @@ -58,8 +58,8 @@ FiniteDifferenceSolver::FiniteDifferenceSolver ( m_stencil_coefs_z.begin()); amrex::Gpu::synchronize(); } else { - amrex::Abort(Utils::TextMsg::Err( - "FiniteDifferenceSolver: Unknown algorithm")); + WARPX_ABORT_WITH_MESSAGE( + "FiniteDifferenceSolver: Unknown algorithm"); } #else if (grid_type == GridType::Collocated) { @@ -78,8 +78,8 @@ FiniteDifferenceSolver::FiniteDifferenceSolver ( m_h_stencil_coefs_x, m_h_stencil_coefs_y, m_h_stencil_coefs_z ); } else { - amrex::Abort(Utils::TextMsg::Err( - "FiniteDifferenceSolver: Unknown algorithm")); + WARPX_ABORT_WITH_MESSAGE( + "FiniteDifferenceSolver: Unknown algorithm"); } m_stencil_coefs_x.resize(m_h_stencil_coefs_x.size()); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp index 487ab0652..ffa9fbfc8 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicEvolveE.cpp @@ -47,8 +47,8 @@ void FiniteDifferenceSolver::MacroscopicEvolveE ( // but we compile code for each algorithm, using templates) #ifdef WARPX_DIM_RZ amrex::ignore_unused(Efield, Bfield, Jfield, edge_lengths, dt, macroscopic_properties); - amrex::Abort(Utils::TextMsg::Err( - "currently macro E-push does not work for RZ")); + + WARPX_ABORT_WITH_MESSAGE("currently macro E-push does not work for RZ"); #else WARPX_ALWAYS_ASSERT_WITH_MESSAGE( m_grid_type != GridType::Collocated, "Macroscopic E field solver does not work on collocated grids"); @@ -86,8 +86,8 @@ void FiniteDifferenceSolver::MacroscopicEvolveE ( } } else { - amrex::Abort(Utils::TextMsg::Err( - "MacroscopicEvolveE: Unknown algorithm")); + WARPX_ABORT_WITH_MESSAGE( + "MacroscopicEvolveE: Unknown algorithm"); } #endif diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp index aecc754d4..13eb1bbf3 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp @@ -502,8 +502,8 @@ void PsatdAlgorithmComoving::CurrentCorrection (SpectralFieldData& field_data) void PsatdAlgorithmComoving::VayDeposition (SpectralFieldData& /*field_data*/) { - amrex::Abort(Utils::TextMsg::Err( - "Vay deposition not implemented for comoving PSATD")); + WARPX_ABORT_WITH_MESSAGE( + "Vay deposition not implemented for comoving PSATD"); } #endif // WARPX_USE_PSATD diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp index 3701fb889..290b005e1 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp @@ -357,8 +357,8 @@ void PsatdAlgorithmFirstOrder::CurrentCorrection (SpectralFieldData& field_data) BL_PROFILE("PsatdAlgorithmFirstOrder::CurrentCorrection"); amrex::ignore_unused(field_data); - amrex::Abort(Utils::TextMsg::Err( - "Current correction not implemented for first-order PSATD equations")); + WARPX_ABORT_WITH_MESSAGE( + "Current correction not implemented for first-order PSATD equations"); } void @@ -368,8 +368,8 @@ PsatdAlgorithmFirstOrder::VayDeposition (SpectralFieldData& field_data) BL_PROFILE("PsatdAlgorithmFirstOrder::VayDeposition()"); amrex::ignore_unused(field_data); - amrex::Abort(Utils::TextMsg::Err( - "Vay deposition not implemented for first-order PSATD equations")); + WARPX_ABORT_WITH_MESSAGE( + "Vay deposition not implemented for first-order PSATD equations"); } #endif // WARPX_USE_PSATD diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.cpp index 75f0e49d1..8ab311308 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmGalileanRZ.cpp @@ -364,6 +364,6 @@ PsatdAlgorithmGalileanRZ::CurrentCorrection (SpectralFieldDataRZ& field_data) void PsatdAlgorithmGalileanRZ::VayDeposition (SpectralFieldDataRZ& /*field_data*/) { - amrex::Abort(Utils::TextMsg::Err( - "Vay deposition not implemented in RZ geometry")); + WARPX_ABORT_WITH_MESSAGE( + "Vay deposition not implemented in RZ geometry"); } diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp index ecdd6169c..27db744d7 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp @@ -430,8 +430,8 @@ void PsatdAlgorithmJLinearInTime::CurrentCorrection (SpectralFieldData& field_da BL_PROFILE("PsatdAlgorithmJLinearInTime::CurrentCorrection"); amrex::ignore_unused(field_data); - amrex::Abort(Utils::TextMsg::Err( - "Current correction not implemented for multi-J PSATD algorithm")); + WARPX_ABORT_WITH_MESSAGE( + "Current correction not implemented for multi-J PSATD algorithm"); } void @@ -441,8 +441,8 @@ PsatdAlgorithmJLinearInTime::VayDeposition (SpectralFieldData& field_data) BL_PROFILE("PsatdAlgorithmJLinearInTime::VayDeposition()"); amrex::ignore_unused(field_data); - amrex::Abort(Utils::TextMsg::Err( - "Vay deposition not implemented for multi-J PSATD algorithm")); + WARPX_ABORT_WITH_MESSAGE( + "Vay deposition not implemented for multi-J PSATD algorithm"); } #endif // WARPX_USE_PSATD diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.cpp index 217998d18..b8bdfdbed 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPml.cpp @@ -405,15 +405,15 @@ void PsatdAlgorithmPml::InitializeSpectralCoefficients ( void PsatdAlgorithmPml::CurrentCorrection (SpectralFieldData& /*field_data*/) { - amrex::Abort(Utils::TextMsg::Err( - "Current correction not implemented for PML PSATD")); + WARPX_ABORT_WITH_MESSAGE( + "Current correction not implemented for PML PSATD"); } void PsatdAlgorithmPml::VayDeposition (SpectralFieldData& /*field_data*/) { - amrex::Abort(Utils::TextMsg::Err( - "Vay deposition not implemented for PML PSATD")); + WARPX_ABORT_WITH_MESSAGE( + "Vay deposition not implemented for PML PSATD"); } #endif // WARPX_USE_PSATD diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.cpp index 60f7209de..d2200eb9f 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmPmlRZ.cpp @@ -163,13 +163,13 @@ void PsatdAlgorithmPmlRZ::InitializeSpectralCoefficients (SpectralFieldDataRZ co void PsatdAlgorithmPmlRZ::CurrentCorrection (SpectralFieldDataRZ& /* field_data */) { - amrex::Abort(Utils::TextMsg::Err( - "Current correction not implemented in RZ geometry PML")); + WARPX_ABORT_WITH_MESSAGE( + "Current correction not implemented in RZ geometry PML"); } void PsatdAlgorithmPmlRZ::VayDeposition (SpectralFieldDataRZ& /*field_data*/) { - amrex::Abort(Utils::TextMsg::Err( - "Vay deposition not implemented in RZ geometry PML")); + WARPX_ABORT_WITH_MESSAGE( + "Vay deposition not implemented in RZ geometry PML"); } diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp index 5b024b425..ee83ddce7 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp @@ -58,20 +58,20 @@ PsatdAlgorithmRZ::PsatdAlgorithmRZ (SpectralKSpaceRZ const & spectral_kspace, if (time_averaging && J_in_time != JInTime::Linear) { - amrex::Abort(Utils::TextMsg::Err( - "RZ PSATD: psatd.do_time_averaging=1 implemented only with psatd.J_in_time=linear")); + WARPX_ABORT_WITH_MESSAGE( + "RZ PSATD: psatd.do_time_averaging=1 implemented only with psatd.J_in_time=linear"); } if (dive_cleaning && J_in_time != JInTime::Linear) { - amrex::Abort(Utils::TextMsg::Err( - "RZ PSATD: warpx.do_dive_cleaning=1 implemented only with psatd.J_in_time=linear")); + WARPX_ABORT_WITH_MESSAGE( + "RZ PSATD: warpx.do_dive_cleaning=1 implemented only with psatd.J_in_time=linear"); } if (divb_cleaning && J_in_time != JInTime::Linear) { - amrex::Abort(Utils::TextMsg::Err( - "RZ PSATD: warpx.do_divb_cleaning=1 implemented only with psatd.J_in_time=linear")); + WARPX_ABORT_WITH_MESSAGE( + "RZ PSATD: warpx.do_divb_cleaning=1 implemented only with psatd.J_in_time=linear"); } } @@ -491,6 +491,6 @@ PsatdAlgorithmRZ::CurrentCorrection (SpectralFieldDataRZ& field_data) void PsatdAlgorithmRZ::VayDeposition (SpectralFieldDataRZ& /*field_data*/) { - amrex::Abort(Utils::TextMsg::Err( - "Vay deposition not implemented in RZ geometry")); + WARPX_ABORT_WITH_MESSAGE( + "Vay deposition not implemented in RZ geometry"); } diff --git a/Source/FieldSolver/SpectralSolver/WrapCuFFT.cpp b/Source/FieldSolver/SpectralSolver/WrapCuFFT.cpp index 030efcd4b..59b200a32 100644 --- a/Source/FieldSolver/SpectralSolver/WrapCuFFT.cpp +++ b/Source/FieldSolver/SpectralSolver/WrapCuFFT.cpp @@ -37,7 +37,7 @@ namespace AnyFFT result = cufftPlan2d( &(fft_plan.m_plan), real_size[1], real_size[0], VendorR2C); } else { - amrex::Abort(Utils::TextMsg::Err("only dim=2 and dim=3 have been implemented")); + WARPX_ABORT_WITH_MESSAGE("only dim=2 and dim=3 have been implemented"); } } else { if (dim == 3) { @@ -47,7 +47,7 @@ namespace AnyFFT result = cufftPlan2d( &(fft_plan.m_plan), real_size[1], real_size[0], VendorC2R); } else { - amrex::Abort(Utils::TextMsg::Err("only dim=2 and dim=3 have been implemented")); + WARPX_ABORT_WITH_MESSAGE("only dim=2 and dim=3 have been implemented"); } } @@ -89,11 +89,11 @@ namespace AnyFFT result = cufftExecZ2D(fft_plan.m_plan, fft_plan.m_complex_array, fft_plan.m_real_array); #endif } else { - amrex::Abort(Utils::TextMsg::Err( - "direction must be AnyFFT::direction::R2C or AnyFFT::direction::C2R")); + WARPX_ABORT_WITH_MESSAGE( + "direction must be AnyFFT::direction::R2C or AnyFFT::direction::C2R"); } if ( result != CUFFT_SUCCESS ) { - amrex::Print() << Utils::TextMsg::Err( + WARPX_ABORT_WITH_MESSAGE( "forward transform using cufftExec failed ! Error: " +cufftErrorToString(result)); } diff --git a/Source/FieldSolver/SpectralSolver/WrapFFTW.cpp b/Source/FieldSolver/SpectralSolver/WrapFFTW.cpp index 8159e53c3..df330c4f6 100644 --- a/Source/FieldSolver/SpectralSolver/WrapFFTW.cpp +++ b/Source/FieldSolver/SpectralSolver/WrapFFTW.cpp @@ -54,8 +54,8 @@ namespace AnyFFT fft_plan.m_plan = VendorCreatePlanR2C2D( real_size[1], real_size[0], real_array, complex_array, FFTW_ESTIMATE); } else { - amrex::Abort(Utils::TextMsg::Err( - "only dim=2 and dim=3 have been implemented")); + WARPX_ABORT_WITH_MESSAGE( + "only dim=2 and dim=3 have been implemented"); } } else if (dir == direction::C2R){ if (dim == 3) { @@ -65,8 +65,8 @@ namespace AnyFFT fft_plan.m_plan = VendorCreatePlanC2R2D( real_size[1], real_size[0], complex_array, real_array, FFTW_ESTIMATE); } else { - amrex::Abort(Utils::TextMsg::Err( - "only dim=2 and dim=3 have been implemented. Should be easy to add dim=1.")); + WARPX_ABORT_WITH_MESSAGE( + "only dim=2 and dim=3 have been implemented. Should be easy to add dim=1."); } } diff --git a/Source/FieldSolver/SpectralSolver/WrapRocFFT.cpp b/Source/FieldSolver/SpectralSolver/WrapRocFFT.cpp index 66c9c6c50..0d8246c09 100644 --- a/Source/FieldSolver/SpectralSolver/WrapRocFFT.cpp +++ b/Source/FieldSolver/SpectralSolver/WrapRocFFT.cpp @@ -18,8 +18,8 @@ namespace AnyFFT void assert_rocfft_status (std::string const& name, rocfft_status status) { if (status != rocfft_status_success) { - amrex::Abort(Utils::TextMsg::Err( - name + " failed! Error: " + rocfftErrorToString(status))); + WARPX_ABORT_WITH_MESSAGE( + name + " failed! Error: " + rocfftErrorToString(status)); } } } @@ -91,8 +91,8 @@ namespace AnyFFT (void**)&(fft_plan.m_real_array), // out execinfo); } else { - amrex::Abort(Utils::TextMsg::Err( - "direction must be AnyFFT::direction::R2C or AnyFFT::direction::C2R")); + WARPX_ABORT_WITH_MESSAGE( + "direction must be AnyFFT::direction::R2C or AnyFFT::direction::C2R"); } assert_rocfft_status("rocfft_execute", result); diff --git a/Source/FieldSolver/WarpXPushFieldsEM.cpp b/Source/FieldSolver/WarpXPushFieldsEM.cpp index f633422b2..793a8cd24 100644 --- a/Source/FieldSolver/WarpXPushFieldsEM.cpp +++ b/Source/FieldSolver/WarpXPushFieldsEM.cpp @@ -649,8 +649,8 @@ void WarpX::PushPSATD () { #ifndef WARPX_USE_PSATD - amrex::Abort(Utils::TextMsg::Err( - "PushFieldsEM: PSATD solver selected but not built")); + WARPX_ABORT_WITH_MESSAGE( + "PushFieldsEM: PSATD solver selected but not built"); #else const int rho_old = spectral_solver_fp[0]->m_spectral_index.rho_old; diff --git a/Source/Filter/Filter.cpp b/Source/Filter/Filter.cpp index b0b67648e..f39e797f9 100644 --- a/Source/Filter/Filter.cpp +++ b/Source/Filter/Filter.cpp @@ -183,8 +183,8 @@ void Filter::DoFilter (const Box& tbx, dst(i,j,k,dcomp+n) = d; }); #else - amrex::Abort(Utils::TextMsg::Err( - "Filter not implemented for the current geometry!")); + WARPX_ABORT_WITH_MESSAGE( + "Filter not implemented for the current geometry!"); #endif } @@ -327,8 +327,8 @@ void Filter::DoFilter (const Box& tbx, dst(i,j,k,dcomp+n) += sss*(tmp(i-ix,j,k,scomp+n) +tmp(i+ix,j,k,scomp+n)); #else - amrex::Abort(Utils::TextMsg::Err( - "Filter not implemented for the current geometry!")); + WARPX_ABORT_WITH_MESSAGE( + "Filter not implemented for the current geometry!"); #endif } } diff --git a/Source/Filter/NCIGodfreyFilter.cpp b/Source/Filter/NCIGodfreyFilter.cpp index 8e7c2bbda..ff8663325 100644 --- a/Source/Filter/NCIGodfreyFilter.cpp +++ b/Source/Filter/NCIGodfreyFilter.cpp @@ -38,8 +38,8 @@ NCIGodfreyFilter::NCIGodfreyFilter(godfrey_coeff_set coeff_set, amrex::Real cdto slen = {1,5,1}; #else amrex::ignore_unused(coeff_set, cdtodz, nodal_gather); - amrex::Abort(Utils::TextMsg::Err( - "NCIGodfreyFilter not implemented in 1D!")); + WARPX_ABORT_WITH_MESSAGE( + "NCIGodfreyFilter not implemented in 1D!"); #endif } @@ -78,8 +78,8 @@ void NCIGodfreyFilter::ComputeStencils(){ prestencil[i] = (1_rt-weight_right)*table_nci_godfrey_galerkin_Bx_By_Ez[index ][i] + weight_right *table_nci_godfrey_galerkin_Bx_By_Ez[index+1][i]; } else { - amrex::Abort(Utils::TextMsg::Err( - "m_coeff_set must be godfrey_coeff_set::Ex_Ey_Bz or godfrey_coeff_set::Bx_By_Ez")); + WARPX_ABORT_WITH_MESSAGE( + "m_coeff_set must be godfrey_coeff_set::Ex_Ey_Bz or godfrey_coeff_set::Bx_By_Ez"); } } else @@ -94,8 +94,8 @@ void NCIGodfreyFilter::ComputeStencils(){ prestencil[i] = (1_rt-weight_right)*table_nci_godfrey_momentum_Bx_By_Ez[index ][i] + weight_right *table_nci_godfrey_momentum_Bx_By_Ez[index+1][i]; } else { - amrex::Abort(Utils::TextMsg::Err( - "m_coeff_set must be godfrey_coeff_set::Ex_Ey_Bz or godfrey_coeff_set::Bx_By_Ez")); + WARPX_ABORT_WITH_MESSAGE( + "m_coeff_set must be godfrey_coeff_set::Ex_Ey_Bz or godfrey_coeff_set::Bx_By_Ez"); } } } @@ -138,6 +138,6 @@ void NCIGodfreyFilter::ComputeStencils(){ Gpu::synchronize(); #else - amrex::Abort(Utils::TextMsg::Err("NCIGodfreyFilter not implemented in 1D!")); + WARPX_ABORT_WITH_MESSAGE("NCIGodfreyFilter not implemented in 1D!"); #endif } diff --git a/Source/Initialization/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp index 439e7a8d6..0282636c7 100644 --- a/Source/Initialization/PlasmaInjector.cpp +++ b/Source/Initialization/PlasmaInjector.cpp @@ -50,7 +50,7 @@ namespace { std::string string; stringstream << var << " string '" << name << "' not recognized."; string = stringstream.str(); - amrex::Abort(Utils::TextMsg::Err(string.c_str())); + WARPX_ABORT_WITH_MESSAGE(string.c_str()); } } @@ -388,9 +388,9 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name) parseMomentum(pp_species_name); } else if (injection_style == "external_file") { #ifndef WARPX_USE_OPENPMD - amrex::Abort(Utils::TextMsg::Err( + WARPX_ABORT_WITH_MESSAGE( "WarpX has to be compiled with USE_OPENPMD=TRUE to be able" - " to read the external openPMD file with species data")); + " to read the external openPMD file with species data"); #endif external_file = true; std::string str_injection_file; @@ -475,9 +475,9 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name) amrex::ParallelDescriptor::Bcast(&mass, 1, amrex::ParallelDescriptor::IOProcessorNumber()); #else - amrex::Abort(Utils::TextMsg::Err( + WARPX_ABORT_WITH_MESSAGE( "Plasma injection via external_file requires openPMD support: " - "Add USE_OPENPMD=TRUE when compiling WarpX.")); + "Add USE_OPENPMD=TRUE when compiling WarpX."); #endif // WARPX_USE_OPENPMD } else { diff --git a/Source/Initialization/TemperatureProperties.cpp b/Source/Initialization/TemperatureProperties.cpp index 6414fd118..76ea1ac1b 100644 --- a/Source/Initialization/TemperatureProperties.cpp +++ b/Source/Initialization/TemperatureProperties.cpp @@ -69,6 +69,6 @@ TemperatureProperties::TemperatureProperties (amrex::ParmParse& pp) { std::string string; stringstream << "Temperature distribution type '" << temp_dist_s << "' not recognized."; string = stringstream.str(); - amrex::Abort(Utils::TextMsg::Err(string.c_str())); + WARPX_ABORT_WITH_MESSAGE(string.c_str()); } } diff --git a/Source/Initialization/VelocityProperties.cpp b/Source/Initialization/VelocityProperties.cpp index 95f41d403..e70c1255e 100644 --- a/Source/Initialization/VelocityProperties.cpp +++ b/Source/Initialization/VelocityProperties.cpp @@ -38,10 +38,10 @@ VelocityProperties::VelocityProperties (amrex::ParmParse& pp) { m_dir = 2; } else { - amrex::Abort(Utils::TextMsg::Err( + WARPX_ABORT_WITH_MESSAGE( "Cannot interpret <s_name>.bulk_vel_dir input '" + vel_dir_s + "'. Please enter +/- x, y, or z with no whitespace between the sign and"+ - " other character.")); + " other character."); } pp.query("beta_distribution_type", vel_dist_s); @@ -63,7 +63,7 @@ VelocityProperties::VelocityProperties (amrex::ParmParse& pp) { m_type = VelParserFunction; } else { - amrex::Abort(Utils::TextMsg::Err( - "Velocity distribution type '" + vel_dist_s + "' not recognized.")); + WARPX_ABORT_WITH_MESSAGE( + "Velocity distribution type '" + vel_dist_s + "' not recognized."); } } diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 062f8a83b..d8353a7e5 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -769,8 +769,8 @@ WarpX::InitLevelData (int lev, Real /*time*/) if (B_ext_grid_s == "parse_b_ext_grid_function") { #ifdef WARPX_DIM_RZ - amrex::Abort(Utils::TextMsg::Err( - "E and B parser for external fields does not work with RZ -- TO DO")); + WARPX_ABORT_WITH_MESSAGE( + "E and B parser for external fields does not work with RZ -- TO DO"); #endif utils::parser::Store_parserString(pp_warpx, "Bx_external_grid_function(x,y,z)", str_Bx_ext_grid_function); @@ -827,8 +827,8 @@ WarpX::InitLevelData (int lev, Real /*time*/) if (E_ext_grid_s == "parse_e_ext_grid_function") { #ifdef WARPX_DIM_RZ - amrex::Abort(Utils::TextMsg::Err( - "E and B parser for external fields does not work with RZ -- TO DO")); + WARPX_ABORT_WITH_MESSAGE( + "E and B parser for external fields does not work with RZ -- TO DO"); #endif utils::parser::Store_parserString(pp_warpx, "Ex_external_grid_function(x,y,z)", str_Ex_ext_grid_function); @@ -1336,8 +1336,8 @@ WarpX::ReadExternalFieldFromFile ( WARPX_ALWAYS_ASSERT_WITH_MESSAGE(axisLabels[0] == "x" && axisLabels[1] == "z", "XZ expects axisLabels {x, z}"); #elif defined(WARPX_DIM_1D_Z) - amrex::Abort(Utils::TextMsg::Err( - "Reading from openPMD for external fields is not known to work with 1D3V (see #3830)")); + WARPX_ABORT_WITH_MESSAGE( + "Reading from openPMD for external fields is not known to work with 1D3V (see #3830)"); WARPX_ALWAYS_ASSERT_WITH_MESSAGE(fileGeom == "cartesian", "1D3V can only read from files with cartesian geometry"); WARPX_ALWAYS_ASSERT_WITH_MESSAGE(axisLabels[0] == "z"); #elif defined(WARPX_DIM_RZ) @@ -1485,12 +1485,11 @@ void WarpX::ReadExternalFieldFromFile (std::string , amrex::MultiFab* ,std::string, std::string) { #if defined(WARPX_DIM_1D) - Abort(Utils::TextMsg::Err("Reading fields from openPMD files is not supported in 1D"); + WARPX_ABORT_WITH_MESSAGE("Reading fields from openPMD files is not supported in 1D"); #elif defined(WARPX_DIM_XZ) - Abort(Utils::TextMsg::Err( - "Reading from openPMD for external fields is not known to work with XZ (see #3828)")); + WARPX_ABORT_WITH_MESSAGE("Reading from openPMD for external fields is not known to work with XZ (see #3828)"); #elif !defined(WARPX_USE_OPENPMD) - Abort(Utils::TextMsg::Err("OpenPMD field reading requires OpenPMD support to be enabled")); + WARPX_ABORT_WITH_MESSAGE("OpenPMD field reading requires OpenPMD support to be enabled"); #endif } #endif // WARPX_USE_OPENPMD diff --git a/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp b/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp index 2ebd7fac8..0e0fe0ce0 100644 --- a/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp +++ b/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp @@ -356,8 +356,7 @@ WarpXLaserProfiles::FromTXYEFileLaserProfile::internal_fill_amplitude_uniform( m_params.t_coords.front(); #if (defined WARPX_DIM_1D_Z) - amrex::Abort(Utils::TextMsg::Err( - "WarpXLaserProfiles::FromTXYEFileLaserProfile Not implemented for 1D")); + WARPX_ABORT_WITH_MESSAGE("WarpXLaserProfiles::FromTXYEFileLaserProfile Not implemented for 1D"); #endif // Loop through the macroparticle to calculate the proper amplitude amrex::ParallelFor( @@ -469,8 +468,7 @@ WarpXLaserProfiles::FromTXYEFileLaserProfile::internal_fill_amplitude_nonuniform const auto t_right = m_params.t_coords[idx_t_right]; #if (defined WARPX_DIM_1D_Z) - amrex::Abort(Utils::TextMsg::Err( - "WarpXLaserProfiles::FromTXYEFileLaserProfile Not implemented for 1D")); + WARPX_ABORT_WITH_MESSAGE("WarpXLaserProfiles::FromTXYEFileLaserProfile Not implemented for 1D"); #endif // Loop through the macroparticle to calculate the proper amplitude diff --git a/Source/Utils/Parser/ParserUtils.cpp b/Source/Utils/Parser/ParserUtils.cpp index 48cc9b248..149b9d885 100644 --- a/Source/Utils/Parser/ParserUtils.cpp +++ b/Source/Utils/Parser/ParserUtils.cpp @@ -140,7 +140,7 @@ amrex::Parser utils::parser::makeParser ( ++it; } for (auto const& s : symbols) { - amrex::Abort(Utils::TextMsg::Err("makeParser::Unknown symbol "+s)); + WARPX_ABORT_WITH_MESSAGE("makeParser::Unknown symbol "+s); } return parser; } diff --git a/Source/Utils/TextMsg.H b/Source/Utils/TextMsg.H index d14329850..023bf11c8 100644 --- a/Source/Utils/TextMsg.H +++ b/Source/Utils/TextMsg.H @@ -12,6 +12,8 @@ #define WARPX_ALWAYS_ASSERT_WITH_MESSAGE(EX,MSG) (EX)?((void)0) : ablastr::utils::TextMsg::Assert( # EX , __FILE__, __LINE__ , MSG) +#define WARPX_ABORT_WITH_MESSAGE(MSG) ablastr::utils::TextMsg::Abort( __FILE__, __LINE__ , MSG) + namespace Utils::TextMsg { using namespace ablastr::utils::TextMsg; diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp index 42b2308b9..906269cd8 100644 --- a/Source/Utils/WarpXUtil.cpp +++ b/Source/Utils/WarpXUtil.cpp @@ -128,7 +128,7 @@ void ReadBoostedFrameParameters(Real& gamma_boost, Real& beta_boost, boost_direction[2] = 1; } else { - Abort(Utils::TextMsg::Err("Unknown boost_dir: "+s)); + WARPX_ABORT_WITH_MESSAGE("Unknown boost_dir: "+s); } WARPX_ALWAYS_ASSERT_WITH_MESSAGE( s == "z" || s == "Z" , diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index b0d4adce6..26b3f65eb 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -526,8 +526,8 @@ WarpX::ReadParameters () else if (str_abort_on_warning_threshold == "low") abort_on_warning_threshold = ablastr::warn_manager::WarnPriority::low; else { - Abort(Utils::TextMsg::Err(str_abort_on_warning_threshold - +"is not a valid option for warpx.abort_on_warning_threshold (use: low, medium or high)")); + WARPX_ABORT_WITH_MESSAGE(str_abort_on_warning_threshold + +"is not a valid option for warpx.abort_on_warning_threshold (use: low, medium or high)"); } ablastr::warn_manager::GetWMInstance().SetAbortThreshold(abort_on_warning_threshold); } @@ -618,8 +618,8 @@ WarpX::ReadParameters () unsigned long gpu_seed = (myproc_1 + nprocs) * seed_long; ResetRandomSeed(cpu_seed, gpu_seed); } else { - Abort(Utils::TextMsg::Err( - "warpx.random_seed must be \"default\", \"random\" or an integer > 0.")); + WARPX_ABORT_WITH_MESSAGE( + "warpx.random_seed must be \"default\", \"random\" or an integer > 0."); } } @@ -677,7 +677,7 @@ WarpX::ReadParameters () moving_window_dir = WARPX_ZINDEX; } else { - amrex::Abort(Utils::TextMsg::Err("Unknown moving_window_dir: "+s)); + WARPX_ABORT_WITH_MESSAGE("Unknown moving_window_dir: "+s); } WARPX_ALWAYS_ASSERT_WITH_MESSAGE(Geom(0).isPeriodic(moving_window_dir) == 0, @@ -1200,9 +1200,9 @@ WarpX::ReadParameters () noz = particle_shape; } else{ - amrex::Abort(Utils::TextMsg::Err( + WARPX_ABORT_WITH_MESSAGE( "algo.particle_shape must be set in the input file:" - " please set algo.particle_shape to 1, 2, or 3")); + " please set algo.particle_shape to 1, 2, or 3"); } if ((maxLevel() > 0) && (particle_shape > 1) && (do_pml_j_damping == 1)) @@ -1855,7 +1855,7 @@ void WarpX::MakeNewLevelFromCoarse (int /*lev*/, amrex::Real /*time*/, const amrex::BoxArray& /*ba*/, const amrex::DistributionMapping& /*dm*/) { - amrex::Abort(Utils::TextMsg::Err("MakeNewLevelFromCoarse: To be implemented")); + WARPX_ABORT_WITH_MESSAGE("MakeNewLevelFromCoarse: To be implemented"); } void @@ -2786,8 +2786,8 @@ WarpX::ComputeDivE(amrex::MultiFab& divE, const int lev) #ifdef WARPX_USE_PSATD spectral_solver_fp[lev]->ComputeSpectralDivE( lev, Efield_aux[lev], divE ); #else - amrex::Abort(Utils::TextMsg::Err( - "ComputeDivE: PSATD requested but not compiled")); + WARPX_ABORT_WITH_MESSAGE( + "ComputeDivE: PSATD requested but not compiled"); #endif } else { m_fdtd_solver_fp[lev]->ComputeDivE( Efield_aux[lev], divE ); diff --git a/Source/ablastr/utils/TextMsg.H b/Source/ablastr/utils/TextMsg.H index 9dc55cac6..6fa7b28a9 100644 --- a/Source/ablastr/utils/TextMsg.H +++ b/Source/ablastr/utils/TextMsg.H @@ -49,12 +49,33 @@ namespace ablastr::utils::TextMsg std::string Warn (const std::string &msg, const bool do_text_wrapping = true); + /** \brief This function is a wrapper around amrex::Assert, designed to ensure the uniform + * formatting of the error messages. The function is designed to be used via the + * ABLASTR_ALWAYS_ASSERT_WITH_MESSAGE(EX,MSG) macro. + * + * @param[in] ex the text of the failed assertion + * @param[in] file the file where the assertion failed + * @param[in] line the line where the assertion failed + * @param[in] msg the error message + */ void Assert (const char *ex, const char *file, const int line, const std::string &msg); + /** \brief This function is a wrapper around amrex::Abort, designed to ensure the uniform + * formatting of the error messages. The function is designed to be used via the + * ABLASTR_ABORT_WITH_MESSAGE(MSG) macro. + * + * @param[in] file the file where abort was called + * @param[in] line the line here abort was called + * @param[in] msg the error message + */ + void + Abort (const char *file, const int line, const std::string &msg); + } // namespace ablastr::utils::TextMsg #define ABLASTR_ALWAYS_ASSERT_WITH_MESSAGE(EX,MSG) (EX)?((void)0) : ablastr::utils::TextMsg::Assert( # EX , __FILE__, __LINE__ , MSG) +#define ABLASTR_ABORT_WITH_MESSAGE(MSG) ablastr::utils::TextMsg::Abort( __FILE__, __LINE__ , MSG) #endif // ABLASTR_TEXT_MSG_H_ diff --git a/Source/ablastr/utils/TextMsg.cpp b/Source/ablastr/utils/TextMsg.cpp index 9eea1d8f0..324b07525 100644 --- a/Source/ablastr/utils/TextMsg.cpp +++ b/Source/ablastr/utils/TextMsg.cpp @@ -79,3 +79,10 @@ ablastr::utils::TextMsg::Assert (const char* ex, const char* file, const int lin const auto n_msg = "\n" + Err(msg); amrex::Assert(ex , file, line , n_msg.c_str()); } + +void +ablastr::utils::TextMsg::Abort (const char* file, const int line, const std::string& msg) +{ + const auto n_msg = "\n" + Err(msg + "\n(" + file + ":" + std::to_string(line) + ")"); + amrex::Abort(n_msg); +} diff --git a/Source/ablastr/utils/msg_logger/MsgLogger.cpp b/Source/ablastr/utils/msg_logger/MsgLogger.cpp index c3bca4788..3652ff69d 100644 --- a/Source/ablastr/utils/msg_logger/MsgLogger.cpp +++ b/Source/ablastr/utils/msg_logger/MsgLogger.cpp @@ -118,8 +118,8 @@ Priority abl_msg_logger::StringToPriority(const std::string& priority_string) else if (priority_string == "low") return Priority::low; else - amrex::Abort(abl_utils::TextMsg::Err( - "Priority string '" + priority_string + "' not recognized")); + ABLASTR_ABORT_WITH_MESSAGE( + "Priority string '" + priority_string + "' not recognized"); //this silences a "non-void function does not return a value in all control paths" warning return Priority::low; diff --git a/Source/ablastr/warn_manager/WarnManager.cpp b/Source/ablastr/warn_manager/WarnManager.cpp index 1c4fa477a..2686907b1 100644 --- a/Source/ablastr/warn_manager/WarnManager.cpp +++ b/Source/ablastr/warn_manager/WarnManager.cpp @@ -32,7 +32,7 @@ namespace else if (priority == Priority::high) return WarnPriority::high; else - ablastr::utils::TextMsg::Err( + ABLASTR_ABORT_WITH_MESSAGE( "Parsing Priority to WarnPriority has failed"); return WarnPriority::high; |