Skip to content
Merged
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
32 changes: 29 additions & 3 deletions Src/AmrCore/AMReX_ErrorList.H
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ std::ostream& operator << (std::ostream& os, const ErrorList& elst);

struct AMRErrorTagInfo
{
int m_max_level = 100000;
int m_max_level = 1000;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I changed this just because we're now storing a vector of length m_max_level and I wanted to avoid it being gigantic, and no one will realistically have more than 1000 levels.

Real m_min_time = std::numeric_limits<Real>::lowest();
Real m_max_time = std::numeric_limits<Real>::max();
RealBox m_realbox;
Expand Down Expand Up @@ -425,7 +425,33 @@ std::ostream& operator << (std::ostream& os, const ErrorList& elst);
AMRErrorTag::TEST test,
const std::string& field,
const AMRErrorTagInfo& info = AMRErrorTagInfo()) noexcept
: m_value(value), m_test(test), m_field(field), m_info(info) {m_ngrow = SetNGrow();}
: m_test(test), m_field(field), m_info(info)
{
m_value.resize(info.m_max_level);
for (int i = 0; i < info.m_max_level; ++i) {
m_value[i] = value;
}
m_ngrow = SetNGrow();
}

AMRErrorTag (amrex::Vector<amrex::Real> value,
AMRErrorTag::TEST test,
const std::string& field,
const AMRErrorTagInfo& info = AMRErrorTagInfo()) noexcept
: m_test(test), m_field(field), m_info(info)
{
AMREX_ASSERT(value.size() > 0);
m_value.resize(info.m_max_level);
for (int i = 0; i < value.size(); ++i) {
m_value[i] = value[i];
}
// If the user didn't provided a value for every level,
// assume the last value holds for all higher levels.
for (int i = value.size(); i < m_value.size(); ++i) {
m_value[i] = value[value.size()-1];
}
m_ngrow = SetNGrow();
}

AMRErrorTag (AMRErrorTag::UserFunc* userfunc,
const std::string& field,
Expand All @@ -447,7 +473,7 @@ std::ostream& operator << (std::ostream& os, const ErrorList& elst);
protected:
int SetNGrow () const noexcept;

Real m_value;
Vector<Real> m_value;
TEST m_test;
UserFunc* m_userfunc = nullptr;
std::string m_field;
Expand Down
8 changes: 4 additions & 4 deletions Src/AmrCore/AMReX_ErrorList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,19 +395,19 @@ operator << (std::ostream& os,

if (m_test == GRAD)
{
AMRErrorTag_GRAD(bx, dat, tag, m_value, tagval);
AMRErrorTag_GRAD(bx, dat, tag, m_value[level], tagval);
}
else if (m_test == LESS)
{
AMRErrorTag_LESS(bx, dat, tag, m_value, tagval);
AMRErrorTag_LESS(bx, dat, tag, m_value[level], tagval);
}
else if (m_test == GREATER)
{
AMRErrorTag_GREATER(bx, dat, tag, m_value, tagval);
AMRErrorTag_GREATER(bx, dat, tag, m_value[level], tagval);
}
else if (m_test == VORT)
{
AMRErrorTag_VORT(bx, dat, tag, level, m_value, tagval);
AMRErrorTag_VORT(bx, dat, tag, level, m_value[level], tagval);
}
else
{
Expand Down