aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/LaserParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Ilian Kara-Mostefa <95044023+IlianCS@users.noreply.github.com> 2023-05-19 06:21:30 -0700
committerGravatar GitHub <noreply@github.com> 2023-05-19 06:21:30 -0700
commit64de88802f52d58f386e1658ba98810ec2bfe0cb (patch)
tree8d2de9f7ec0a8e2f7d12e62db20f419e10797d6b /Source/Particles/LaserParticleContainer.cpp
parent617b286c58b4d55f004aa453aa46662e588acc0e (diff)
downloadWarpX-64de88802f52d58f386e1658ba98810ec2bfe0cb.tar.gz
WarpX-64de88802f52d58f386e1658ba98810ec2bfe0cb.tar.zst
WarpX-64de88802f52d58f386e1658ba98810ec2bfe0cb.zip
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 <remi.lehe@normalesup.org>
Diffstat (limited to 'Source/Particles/LaserParticleContainer.cpp')
-rw-r--r--Source/Particles/LaserParticleContainer.cpp24
1 files changed, 23 insertions, 1 deletions
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<std::string> 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)();