133 if (candidate.nx != reference.nx || candidate.ny != reference.ny) {
134 return candidate_description +
" dimensions (" + std::to_string(candidate.nx) +
135 " x " + std::to_string(candidate.ny) +
") do not match " +
136 reference_description +
" dimensions (" + std::to_string(reference.nx) +
137 " x " + std::to_string(reference.ny) +
")";
140 struct MetadataValue {
145 const MetadataValue values[] = {
146 {
"x spacing", reference.dx, candidate.dx},
147 {
"y spacing", reference.dy, candidate.dy},
148 {
"x origin", reference.xmin, candidate.xmin},
149 {
"y origin", reference.ymin, candidate.ymin}
151 for (
const auto& value : values) {
152 if (!
nearly_equal(value.reference_value, value.candidate_value)) {
153 std::ostringstream message;
154 message << candidate_description <<
" " << value.name <<
" ("
155 << value.candidate_value <<
") does not match "
156 << reference_description <<
" (" << value.reference_value <<
")";
157 return message.str();
std::string name
Definition: ERF_Plotfile2DCatalog.cpp:101
bool nearly_equal(amrex::Real lhs, amrex::Real rhs)
Definition: ERF_GridUtils.H:50