From 64de88802f52d58f386e1658ba98810ec2bfe0cb Mon Sep 17 00:00:00 2001 From: Ilian Kara-Mostefa <95044023+IlianCS@users.noreply.github.com> Date: Fri, 19 May 2023 06:21:30 -0700 Subject: Implement legacy mode for external laser file reading (#3923) * Implement legacy mode * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix file_name initialization for RZ test * Clear commented-out code * Change permission * import sys in analysis_2d_binary.py & add checksum test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add explanations in class file and update the docs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ignore y_min and y_max allocation in 2D * fix syntax * Implement warnings, improving docs, fix indentation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Remi Lehe --- Source/Particles/LaserParticleContainer.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'Source/Particles/LaserParticleContainer.cpp') diff --git a/Source/Particles/LaserParticleContainer.cpp b/Source/Particles/LaserParticleContainer.cpp index a0cafadcd..fbf61d579 100644 --- a/Source/Particles/LaserParticleContainer.cpp +++ b/Source/Particles/LaserParticleContainer.cpp @@ -135,7 +135,29 @@ LaserParticleContainer::LaserParticleContainer (AmrCore* amr_core, int ispecies, } //Select laser profile - if(laser_profiles_dictionary.count(laser_type_s) == 0){ + + //Check if someone uses the obsolete syntax + std::vector backward_laser_names; + ParmParse pp_lasers("lasers"); + pp_lasers.queryarr("names", backward_laser_names); + for(std::string lasersiter : backward_laser_names){ + ParmParse pp_name(lasersiter); + std::string backward_profile; + std::stringstream lasers; + pp_name.query("profile", backward_profile); + if (backward_profile == "from_txye_file") { + lasers << "'" << lasersiter << ".profile = " + backward_profile + "'"; + lasers << " is not supported anymore. "; + lasers << "Please use instead: "; + lasers << "'" << lasersiter << ".profile = from_file'"; + WARPX_ALWAYS_ASSERT_WITH_MESSAGE( + !pp_name.query("profile", backward_profile), + lasers.str()); + } + } + + //Check if profile exists + if(laser_profiles_dictionary.count(laser_type_s) == 0 ){ amrex::Abort(std::string("Unknown laser type: ").append(laser_type_s)); } m_up_laser_profile = laser_profiles_dictionary.at(laser_type_s)(); -- cgit v1.2.3