Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Source/Diagnostics/ReducedDiags/ParticleHistogram2D.H
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public:
std::string value_string;

/// Parser to read expression for particle quantity from the input file.
/// 7 elements are t, x, y, z, ux, uy, uz, w
/// 8 elements are t, x, y, z, ux, uy, uz, w
static constexpr int m_nvars = 8;
std::unique_ptr<amrex::Parser> m_parser_abs;
std::unique_ptr<amrex::Parser> m_parser_ord;
Expand All @@ -76,11 +76,11 @@ public:
/// Whether the filter is activated
bool m_do_parser_filter = false;

/// Optional parser to filter particles before doing the histogram
/// Optional parser to read particle quantity from input file (comments updated to match documentation)
std::unique_ptr<amrex::Parser> m_parser_value;

/// Whether the filter is activated
bool m_do_parser_value;
/// Whether a custom value function is assigned
bool m_do_parser_value = false; // was uninitialized

/**
* This function computes a histogram of user defined quantity.
Expand Down
8 changes: 6 additions & 2 deletions Source/Diagnostics/ReducedDiags/ParticleHistogram2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,12 @@ ParticleHistogram2D::ParticleHistogram2D (const std::string& rd_name)
if (m_do_parser_value) {
utils::parser::Store_parserString(
pp_rd_name,"value_function(t,x,y,z,ux,uy,uz,w)", value_string);
m_parser_value = std::make_unique<amrex::Parser>(
utils::parser::makeParser(value_string, {"t", "x", "y", "z", "ux", "uy", "uz", "w"}));
} else {
// default value function is particle weight
value_string = "w";
}
m_parser_value = std::make_unique<amrex::Parser>(
utils::parser::makeParser(value_string,{"t","x","y","z","ux","uy","uz","w"}));
}
// end constructor

Expand Down Expand Up @@ -288,6 +291,7 @@ void ParticleHistogram2D::WriteToFile (int step) const
f_mesh.setAttribute("function_abscissa", function_string_abs);
f_mesh.setAttribute("function_ordinate", function_string_ord);
f_mesh.setAttribute("filter", filter_string);
f_mesh.setAttribute("value_function", value_string); // records custom value function

// record components
auto data = f_mesh[io::RecordComponent::SCALAR];
Expand Down
Loading