1 #ifndef AMREX_ErrorList_H_
2 #define AMREX_ErrorList_H_
3 #include <AMReX_Config.H>
45 const int* tagval,
const int* clearval,
46 amrex::Real* data, AMREX_ARLIM_P(data_lo), AMREX_ARLIM_P(data_hi),
47 const int* lo,
const int * hi,
const int* nvar,
48 const int* domain_lo,
const int* domain_hi,
49 const amrex::Real* dx,
const amrex::Real* xlo,
50 const amrex::Real* prob_lo,
const amrex::Real* time,
54 const int* tagval,
const int* clearval,
55 amrex::Real* data, AMREX_ARLIM_P(data_lo), AMREX_ARLIM_P(data_hi),
56 const int* lo,
const int * hi,
const int* nvar,
57 const int* domain_lo,
const int* domain_hi,
58 const amrex::Real* dx,
const int* level,
const amrex::Real* avg);
85 const int* tagval,
const int* clearval,
86 amrex::Real* data,
const int* data_lo,
const int* data_hi,
87 const int* lo,
const int * hi,
const int* nvar,
88 const int* domain_lo,
const int* domain_hi,
89 const amrex::Real* dx,
const amrex::Real* xlo,
90 const amrex::Real* prob_lo,
const amrex::Real* time,
178 virtual void operator () (
int* tag, AMREX_ARLIM_P(tlo), AMREX_ARLIM_P(thi),
179 const int* tagval,
const int* clearval,
180 Real* data, AMREX_ARLIM_P(data_lo), AMREX_ARLIM_P(data_hi),
181 const int* lo,
const int * hi,
const int* nvar,
182 const int* domain_lo,
const int* domain_hi,
183 const Real* dx,
const Real* xlo,
184 const Real* prob_lo,
const Real* time,
185 const int* level)
const;
209 virtual void operator () (
int* tag,
const int* tlo,
const int* thi,
210 const int* tagval,
const int* clearval,
211 Real* data,
const int* dlo,
const int* dhi,
212 const int* lo,
const int * hi,
const int* nvar,
213 const int* domain_lo,
const int* domain_hi,
214 const Real* dx,
const Real* xlo,
215 const Real* prob_lo,
const Real* time,
216 const int* level)
const;
275 virtual void operator () (
int* tag, AMREX_ARLIM_P(tlo), AMREX_ARLIM_P(thi),
276 const int* tagval,
const int* clearval,
277 Real* data, AMREX_ARLIM_P(data_lo), AMREX_ARLIM_P(data_hi),
278 const int* lo,
const int * hi,
const int* nvar,
279 const int* domain_lo,
const int* domain_hi,
280 const Real* dx,
const int* level,
const Real* avg)
const;
310 [[nodiscard]]
const std::string&
name () const noexcept;
315 [[nodiscard]]
int nGrow () const noexcept;
358 [[nodiscard]]
int size () const noexcept;
368 void add (const std::
string&
name,
373 void add (const std::
string&
name,
379 [[nodiscard]] const
ErrorRec& operator[] (
int k) const noexcept;
381 void clear (
bool rs0 = false) { vec.clear();
if(rs0) { vec.resize(0); } }
392 int m_max_level = 1000;
393 Real m_min_time = std::numeric_limits<Real>::lowest();
395 int m_volume_weighting = 0;
400 m_max_level = max_level;
404 m_min_time = min_time;
408 m_max_time = max_time;
416 m_volume_weighting = volume_weighting;
420 m_derefine = derefine;
429 enum TEST {GRAD=0, RELGRAD, LESS, GREATER, VORT,
BOX, USER};
450 : m_info(info), m_ngrow(SetNGrow()) {}
456 : m_value(info.m_max_level, value), m_test(test), m_field(std::move(field)), m_info(info),
465 : m_test(test), m_field(std::move(field)), m_info(info), m_ngrow(SetNGrow())
468 m_value.resize(info.m_max_level);
469 for (
int i = 0; i < m_value.size() && i < value.
size(); ++i) {
470 m_value[i] = value[i];
474 for (
auto i =
int(value.
size()); i < m_value.size(); ++i) {
475 m_value[i] = value[value.
size()-1];
483 : m_userfunc(userfunc), m_field(std::move(field)), m_info(info), m_ngrow(
ngrow) {}
493 [[nodiscard]]
int NGrow() const noexcept {
return m_ngrow;}
494 [[nodiscard]]
const std::string&
Field () const noexcept {
return m_field;}
501 [[nodiscard]]
int SetNGrow () const noexcept;
#define AMREX_ASSERT(EX)
Definition: AMReX_BLassert.H:38
Definition: AMReX_ErrorList.H:426
AMRErrorTag(AMRErrorTag::UserFunc *userfunc, std::string field, int ngrow, const AMRErrorTagInfo &info=AMRErrorTagInfo()) noexcept
Definition: AMReX_ErrorList.H:479
int NGrow() const noexcept
Definition: AMReX_ErrorList.H:493
AMRErrorTag(amrex::Vector< amrex::Real > value, AMRErrorTag::TEST test, std::string field, const AMRErrorTagInfo &info=AMRErrorTagInfo()) noexcept
Definition: AMReX_ErrorList.H:461
AMRErrorTagInfo const & GetInfo() const noexcept
Definition: AMReX_ErrorList.H:497
AMRErrorTag(amrex::Real value, AMRErrorTag::TEST test, std::string field, const AMRErrorTagInfo &info=AMRErrorTagInfo()) noexcept
Definition: AMReX_ErrorList.H:452
AMRErrorTagInfo m_info
Definition: AMReX_ErrorList.H:507
AMRErrorTag(const AMRErrorTagInfo &info=AMRErrorTagInfo()) noexcept
Definition: AMReX_ErrorList.H:449
const std::string & Field() const noexcept
Definition: AMReX_ErrorList.H:494
std::string m_field
Definition: AMReX_ErrorList.H:506
AMRErrorTagInfo & GetInfo() noexcept
Definition: AMReX_ErrorList.H:496
int m_ngrow
Definition: AMReX_ErrorList.H:508
TEST
Definition: AMReX_ErrorList.H:429
@ BOX
Definition: AMReX_ErrorList.H:429
void SetInfo(AMRErrorTagInfo const &info) noexcept
Definition: AMReX_ErrorList.H:498
A List of ErrorRecs.
Definition: AMReX_ErrorList.H:351
Vector< std::unique_ptr< ErrorRec > > vec
Definition: AMReX_ErrorList.H:385
ErrorList() noexcept=default
Definition: AMReX_ErrorList.H:223
virtual ~ErrorFunc2()=default
Destructor.
ErrorFunc2 & operator=(ErrorFunc2 const &)=default
ErrorFunc2Default m_func
Definition: AMReX_ErrorList.H:283
virtual void operator()(int *tag, AMREX_ARLIM_P(tlo), AMREX_ARLIM_P(thi), const int *tagval, const int *clearval, Real *data, AMREX_ARLIM_P(data_lo), AMREX_ARLIM_P(data_hi), const int *lo, const int *hi, const int *nvar, const int *domain_lo, const int *domain_hi, const Real *dx, const int *level, const Real *avg) const
Tag cells cells using "v2" interface.
Definition: AMReX_ErrorList.cpp:82
ErrorFunc2(ErrorFunc2 &&)=delete
ErrorFunc2(ErrorFunc2 const &)=default
ErrorFunc2()
Bogus constructor.
virtual ErrorFunc2 * clone() const
Return a ptr to a clone of this object. It is the responsibility of the caller to delete the result.
Definition: AMReX_ErrorList.cpp:76
Definition: AMReX_ErrorList.H:116
ErrorFunc(ErrorFunc &&)=delete
virtual ErrorFunc * clone() const
Return a ptr to a clone of this object. It is the responsibility of the caller to delete the result.
Definition: AMReX_ErrorList.cpp:23
ErrorFunc(ErrorFunc const &)=default
ErrorFunc3DDefault m_func3D
Definition: AMReX_ErrorList.H:220
virtual void operator()(int *tag, AMREX_ARLIM_P(tlo), AMREX_ARLIM_P(thi), const int *tagval, const int *clearval, Real *data, AMREX_ARLIM_P(data_lo), AMREX_ARLIM_P(data_hi), const int *lo, const int *hi, const int *nvar, const int *domain_lo, const int *domain_hi, const Real *dx, const Real *xlo, const Real *prob_lo, const Real *time, const int *level) const
Tag cells using "regular" function.
ErrorFuncDefault m_func
Definition: AMReX_ErrorList.H:219
ErrorFunc()
Bogus constructor.
ErrorFunc & operator=(ErrorFunc const &)=default
virtual ~ErrorFunc()=default
Destructor.
Error Record.
Definition: AMReX_ErrorList.H:106
int ngrow
Number of extra zones.
Definition: AMReX_ErrorList.H:334
ErrorRec(ErrorRec &&)=delete
ErrorRec(ErrorRec const &)=delete
int nGrow() const noexcept
The number of extra zones needed for derivation.
Definition: AMReX_ErrorList.cpp:126
virtual const ErrorRec::ErrorFunc2 & errFunc2() const
Definition: AMReX_ErrorList.cpp:144
virtual const ErrorRec::ErrorFunc & errFunc() const
The extern "C" functions to do the error tagging.
Definition: AMReX_ErrorList.cpp:138
ErrorRec(std::string nm, int ng, ErrorType etyp, const ErrorRec::ErrorFunc2 &f2)
The constructors.
Definition: AMReX_ErrorList.cpp:99
const std::string & name() const noexcept
The name of the quantity to derive.
Definition: AMReX_ErrorList.cpp:120
std::string derive_name
Name of quantity to derive.
Definition: AMReX_ErrorList.H:331
virtual ~ErrorRec()
Definition: AMReX_ErrorList.cpp:149
ErrorType err_type
The type of Error.
Definition: AMReX_ErrorList.H:337
ErrorRec & operator=(ErrorRec const &)=delete
ErrorType errType() const noexcept
The type of the error tagging.
Definition: AMReX_ErrorList.cpp:132
ErrorFunc * err_func
Functions to do error estimation.
Definition: AMReX_ErrorList.H:340
ErrorFunc2 * err_func2
Definition: AMReX_ErrorList.H:341
ErrorType
Definition: AMReX_ErrorList.H:111
@ UseAverage
Definition: AMReX_ErrorList.H:111
@ Special
Definition: AMReX_ErrorList.H:111
@ Standard
Definition: AMReX_ErrorList.H:111
Rectangular problem domain geometry.
Definition: AMReX_Geometry.H:73
A collection (stored as an array) of FArrayBox objects.
Definition: AMReX_MultiFab.H:38
A Box with real dimensions. A RealBox is OK iff volume >= 0.
Definition: AMReX_RealBox.H:21
An array of TagBoxes.
Definition: AMReX_TagBox.H:150
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition: AMReX_Vector.H:27
Long size() const noexcept
Definition: AMReX_Vector.H:50
AMREX_GPU_HOST_DEVICE Long size(T const &b) noexcept
integer version
Definition: AMReX_GpuRange.H:26
static int f(amrex::Real t, N_Vector y_data, N_Vector y_rhs, void *user_data)
Definition: AMReX_SundialsIntegrator.H:44
@ max
Definition: AMReX_ParallelReduce.H:17
Definition: AMReX_Amr.cpp:49
void(*)(int *tag, AMREX_ARLIM_P(tlo), AMREX_ARLIM_P(thi), const int *tagval, const int *clearval, amrex::Real *data, AMREX_ARLIM_P(data_lo), AMREX_ARLIM_P(data_hi), const int *lo, const int *hi, const int *nvar, const int *domain_lo, const int *domain_hi, const amrex::Real *dx, const int *level, const amrex::Real *avg) ErrorFunc2Default
Definition: AMReX_ErrorList.H:58
void(*)(int *tag, AMREX_ARLIM_P(tlo), AMREX_ARLIM_P(thi), const int *tagval, const int *clearval, amrex::Real *data, AMREX_ARLIM_P(data_lo), AMREX_ARLIM_P(data_hi), const int *lo, const int *hi, const int *nvar, const int *domain_lo, const int *domain_hi, const amrex::Real *dx, const amrex::Real *xlo, const amrex::Real *prob_lo, const amrex::Real *time, const int *level) ErrorFuncDefault
Type of extern "C" function called by ErrorRec to do tagging of cells for refinement.
Definition: AMReX_ErrorList.H:51
void(*)(int *tag, const int *tlo, const int *thi, const int *tagval, const int *clearval, amrex::Real *data, const int *data_lo, const int *data_hi, const int *lo, const int *hi, const int *nvar, const int *domain_lo, const int *domain_hi, const amrex::Real *dx, const amrex::Real *xlo, const amrex::Real *prob_lo, const amrex::Real *time, const int *level) ErrorFunc3DDefault
Dimension agnostic version that always has three elements. Note that this is only implemented for the...
Definition: AMReX_ErrorList.H:91
std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Definition: AMReX_AmrMesh.cpp:1236
Definition: AMReX_ErrorList.H:391
AMRErrorTagInfo & SetRealBox(const amrex::RealBox &realbox) noexcept
Definition: AMReX_ErrorList.H:411
AMRErrorTagInfo & SetMaxTime(amrex::Real max_time) noexcept
Definition: AMReX_ErrorList.H:407
RealBox m_realbox
Definition: AMReX_ErrorList.H:397
AMRErrorTagInfo & SetDerefine(int derefine) noexcept
Definition: AMReX_ErrorList.H:419
AMRErrorTagInfo & SetVolumeWeighting(int volume_weighting) noexcept
Definition: AMReX_ErrorList.H:415
AMRErrorTagInfo & SetMinTime(amrex::Real min_time) noexcept
Definition: AMReX_ErrorList.H:403
AMRErrorTagInfo & SetMaxLevel(int max_level) noexcept
Definition: AMReX_ErrorList.H:399
Definition: AMReX_ErrorList.H:432
virtual ~UserFunc()=default
UserFunc(UserFunc const &)=default
UserFunc(UserFunc &&)=default
Definition: AMReX_Array4.H:61