-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the helper to write a file for used inputs to ABLASTR.
- Loading branch information
Showing
4 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* Copyright 2022 Axel Huebl | ||
* | ||
* This file is part of WarpX. | ||
* | ||
* License: BSD-3-Clause-LBNL | ||
*/ | ||
|
||
#ifndef ABLASTR_USED_INPUTS_FILE_H | ||
#define ABLASTR_USED_INPUTS_FILE_H | ||
|
||
#include <string> | ||
|
||
|
||
namespace ablastr::utils | ||
{ | ||
/** Write a file that record all inputs: inputs file + command line options | ||
* | ||
* This uses the same syntax as amrex::ParmParse inputs files. | ||
* Only the AMReX IOProcessor writes. | ||
* | ||
* @param filename the name of the text file to write | ||
*/ | ||
void | ||
write_used_inputs_file (std::string const & filename); | ||
} | ||
|
||
#endif // ABLASTR_USED_INPUTS_FILE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* Copyright 2022 Axel Huebl | ||
* | ||
* This file is part of WarpX. | ||
* | ||
* License: BSD-3-Clause-LBNL | ||
*/ | ||
|
||
#include "UsedInputsFile.H" | ||
|
||
#include <AMReX_ParallelDescriptor.H> | ||
#include <AMReX_ParmParse.H> | ||
#include <AMReX_Print.H> | ||
|
||
#include <fstream> | ||
#include <ios> | ||
#include <string> | ||
|
||
|
||
void | ||
ablastr::utils::write_used_inputs_file (std::string const & filename) | ||
{ | ||
amrex::Print() << "For full input parameters, see the file: " << filename << "\n\n"; | ||
|
||
if (amrex::ParallelDescriptor::IOProcessor()) { | ||
std::ofstream jobInfoFile; | ||
jobInfoFile.open(filename.c_str(), std::ios::out); | ||
amrex::ParmParse::dumpTable(jobInfoFile, true); | ||
jobInfoFile.close(); | ||
} | ||
} |