From 343ea2e1b7a3fbaa5ecdcc0fce85e29d4f188d39 Mon Sep 17 00:00:00 2001 From: Weiqun Zhang Date: Mon, 3 Jun 2019 14:45:56 -0700 Subject: compare C strings with strcmp --- Source/Utils/WarpXAlgorithmSelection.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Source/Utils/WarpXAlgorithmSelection.cpp') diff --git a/Source/Utils/WarpXAlgorithmSelection.cpp b/Source/Utils/WarpXAlgorithmSelection.cpp index 89802e064..2c8038ccd 100644 --- a/Source/Utils/WarpXAlgorithmSelection.cpp +++ b/Source/Utils/WarpXAlgorithmSelection.cpp @@ -1,6 +1,7 @@ #include #include #include +#include // Define dictionary with correspondance between user-input strings, // and corresponding integer for use inside the code (e.g. in PICSAR). @@ -60,15 +61,15 @@ GetAlgorithmInteger( amrex::ParmParse& pp, const char* pp_search_key ){ // Pick the right dictionary std::map algo_to_int; - if (pp_search_key == "maxwell_fdtd_solver") { + if (0 == std::strcmp(pp_search_key, "maxwell_fdtd_solver")) { algo_to_int = maxwell_solver_algo_to_int; - } else if (pp_search_key == "particle_pusher") { + } else if (0 == std::strcmp(pp_search_key, "particle_pusher")) { algo_to_int = particle_pusher_algo_to_int; - } else if (pp_search_key == "current_deposition") { + } else if (0 == std::strcmp(pp_search_key, "current_deposition")) { algo_to_int = current_deposition_algo_to_int; - } else if (pp_search_key == "charge_deposition") { + } else if (0 == std::strcmp(pp_search_key, "charge_deposition")) { algo_to_int = charge_deposition_algo_to_int; - } else if (pp_search_key == "field_gathering") { + } else if (0 == std::strcmp(pp_search_key, "field_gathering")) { algo_to_int = gathering_algo_to_int; } else { std::string pp_search_string = pp_search_key; -- cgit v1.2.3