Skip to content

Commit

Permalink
codeQL
Browse files Browse the repository at this point in the history
  • Loading branch information
mbkuhn committed Jul 25, 2023
1 parent f78e548 commit 72429c0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
3 changes: 0 additions & 3 deletions tools/utilities/CheckpointToCSV/CheckpointFileUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ MultiFab CheckpointFileDataImpl::get(int level) noexcept
MultiFab tmp_mfab(
m_ba[level], m_dmap[level], m_var_ncomp[nf], m_ngrow[level]);

const auto& fab_file = amrex::MultiFabFileFullPrefix(
lev, m_chkptfile_name, level_prefix, m_var_names[nf]);

// Read current field into temporary fab
amrex::VisMF::Read(
tmp_mfab,
Expand Down
12 changes: 6 additions & 6 deletions tools/utilities/CheckpointToCSV/CheckpointToCSV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ void main_main()
Vector<std::string> addl_fnames{};

// CLI handling: Collect parameters and help
for (unsigned char i = 1; i <= nargs; i++) {
for (int i = 1; i <= nargs; i += 2) {
const std::string& arg = amrex::get_command_argument(i);
if (arg == "--format" || arg == "-f") {
// Select format. See enumeration for available options.
const std::string& arg_format = amrex::get_command_argument(++i);
const std::string& arg_format = amrex::get_command_argument(i + 1);
if (arg_format == "csv") {
out_format = csv;
format_str = "csv";
} else if (arg_format == "hdf5") {
// out_format = hdf5;
out_format = hdf5;
amrex::Abort("HDF5 format has not been implemented yet.");
} else {
amrex::Print() << "Invalid format: " << arg_format << std::endl;
Expand All @@ -47,15 +47,15 @@ void main_main()
}
if (arg == "--chk" || arg == "--checkpointfile" || arg == "--file" ||
arg == "-c") {
const std::string& chk_tmp = amrex::get_command_argument(++i);
const std::string& chk_tmp = amrex::get_command_argument(i + 1);
checkpointfile = chk_tmp;
continue;
}
if (arg == "-o" || arg == "--output") {
output_file = amrex::get_command_argument(++i);
output_file = amrex::get_command_argument(i + 1);
}
if (arg == "-af" || arg == "--addfield") {
addl_fname = amrex::get_command_argument(++i);
addl_fname = amrex::get_command_argument(i + 1);
addl_fnames.push_back(addl_fname);
}
}
Expand Down
10 changes: 5 additions & 5 deletions tools/utilities/PlotfileToCSV/PlotfileToCSV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ void main_main()
std::string output_file;

// CLI handling: Collect parameters and help
for (unsigned char i = 1; i <= nargs; i++) {
for (int i = 1; i <= nargs; i += 2) {
const std::string& arg = amrex::get_command_argument(i);
if (arg == "--format" || arg == "-f") {
// Select format. See enumeration for available options.
const std::string& arg_format = amrex::get_command_argument(++i);
const std::string& arg_format = amrex::get_command_argument(i + 1);
if (arg_format == "csv") {
out_format = csv;
format_str = "csv";
} else if (arg_format == "hdf5") {
// out_format = hdf5;
out_format = hdf5;
amrex::Abort("HDF5 format has not been implemented yet.");
} else {
amrex::Print() << "Invalid format: " << arg_format << std::endl;
Expand All @@ -45,12 +45,12 @@ void main_main()
}
if (arg == "--plt" || arg == "--plotfile" || arg == "--file" ||
arg == "-p") {
const std::string& plt_tmp = amrex::get_command_argument(++i);
const std::string& plt_tmp = amrex::get_command_argument(i + 1);
plotfile = plt_tmp;
continue;
}
if (arg == "-o" || arg == "--output") {
output_file = amrex::get_command_argument(++i);
output_file = amrex::get_command_argument(i + 1);
}
}
amrex::Print() << "Converting plotfile " << plotfile << " to format "
Expand Down

0 comments on commit 72429c0

Please sign in to comment.