00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef AMROC_CRITERION_H
00010 #define AMROC_CRITERION_H
00011
00019 #include <string>
00020 #include "AMRBase.h"
00021
00022 #define MAXCOMPONENTS 100
00023
00030 template <class VectorType, class FlagType, int dim>
00031 class Criterion : public AMRBase<VectorType,dim> {
00032 typedef AMRBase<VectorType,dim> base;
00033 typedef typename VectorType::InternalDataType DataType;
00034 public:
00035 typedef typename base::vec_grid_fct_type vec_grid_fct_type;
00036 typedef typename base::vec_grid_data_type vec_grid_data_type;
00037 typedef GridFunction<DataType,dim> grid_fct_type;
00038 typedef GridData<DataType,dim> grid_data_type;
00039 typedef GridFunction<FlagType,dim> flag_fct_type;
00040 typedef GridData<FlagType,dim> flag_data_type;
00041 typedef Vector<DataType,MAXCOMPONENTS> max_vector_type;
00042
00043 Criterion() : _IsUsed(false), _ShadowCriterion(false), _UpdateShadow(false), _Output(0) {
00044 _Ncnt = base::NEquations();
00045 for (register int i=0; i<MAXCOMPONENTS; i++)
00046 _MaxLevel[i] = -1;
00047 }
00048
00049 virtual ~Criterion() {}
00050
00051
00052
00053
00054 virtual bool SetFlags(vec_grid_fct_type& u, grid_fct_type& work, flag_fct_type& flags,
00055 const int& cnt, const int& Time, const int& Level, const double& t,
00056 const FlagType& FlagValue) = 0;
00057 virtual void OutputName(char* name, int cnt) = 0;
00058
00059
00060 inline void SetIsUsed(const bool sh) { _IsUsed = sh; }
00061 inline const bool& IsUsed() const { return _IsUsed; }
00062 inline void SetShadowCriterion(const bool sh) { _ShadowCriterion = sh; }
00063 inline const bool& ShadowCriterion() const { return _ShadowCriterion; }
00064 inline void SetUpdateShadow(const bool sh) { _UpdateShadow = sh; }
00065 inline const bool& UpdateShadow() const { return _UpdateShadow; }
00066 inline void SetNcnt(const int& cnt) { _Ncnt = cnt; }
00067 inline const int& Ncnt() const { return _Ncnt; }
00068 inline bool OutputFlags() const { return (_Output != 0); }
00069 inline const int& MaxLevel(const int& i) const
00070 { assert (i>=0 && i<MAXCOMPONENTS); return _MaxLevel[i]; }
00071
00072 protected:
00073 bool _IsUsed, _ShadowCriterion, _UpdateShadow;
00074 int _Ncnt, _Output;
00075 int _MaxLevel[MAXCOMPONENTS];
00076 };
00077
00078
00079 #endif