Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pgrete/user-output' into pgrete/…
Browse files Browse the repository at this point in the history
…next-opmd-ncycle
  • Loading branch information
pgrete committed Nov 29, 2024
2 parents 6bec73e + bdb997a commit 8100980
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/outputs/outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Outputs::Outputs(Mesh *pm, ParameterInput *pin, SimTime *tm) {

// set output variable and optional data format string used in formatted writes
if ((op.file_type != "hst") && (op.file_type != "rst") &&
(op.file_type != "ascent") && (op.file_type != "histogram")) {
(op.file_type != "ascent") && (op.file_type != "histogram") && (op.file_type != "user")) {
// differentiating here whether a block exists or not to not add an empty
// parameter to the input file (which might interfere with restarts)
if (pin->DoesParameterExist(pib->block_name, "variables")) {
Expand Down Expand Up @@ -303,6 +303,8 @@ Outputs::Outputs(Mesh *pm, ParameterInput *pin, SimTime *tm) {
<< std::endl;
PARTHENON_FAIL(msg);
#endif // ifdef ENABLE_HDF5
} else if (op.file_type == "user") {
pnew_type = new UserOutput(op);
} else if (is_hdf5_output) {
const bool restart = (op.file_type == "rst");
if (restart) {
Expand Down
15 changes: 15 additions & 0 deletions src/outputs/outputs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,21 @@ class HistogramOutput : public OutputType {
};
#endif // ifdef ENABLE_HDF5

//----------------------------------------------------------------------------------------
//! \class UserOutput
// \brief derived OutputType class for User enrolled outputs

class UserOutput : public OutputType {
public:
explicit UserOutput(const OutputParameters &oparams) : OutputType(oparams) {}
void WriteOutputFile(Mesh *pm, ParameterInput *pin, SimTime *tm,
const SignalHandler::OutputSignal signal) override;

private:
std::string GenerateFilename_(ParameterInput *pin, SimTime *tm,
const SignalHandler::OutputSignal signal);
};

//----------------------------------------------------------------------------------------
//! \class Outputs

Expand Down

0 comments on commit 8100980

Please sign in to comment.