00001
00002
00003
00004
00005
00006 #ifndef AMROC_PROBLEM_H
00007 #define AMROC_PROBLEM_H
00008
00009 #include "euler2.h"
00010 #include "ClpProblem.h"
00011
00012 #define OWN_FLAGGING
00013
00014 class ScaledGradientSpecific : public ScaledGradient<VectorType,FlagType,DIM> {
00015 typedef ScaledGradient<VectorType,FlagType,DIM> base;
00016 typedef VectorType::InternalDataType DataType;
00017 public:
00018 typedef base::grid_fct_type grid_fct_type;
00019 typedef base::flag_fct_type flag_fct_type;
00020
00021 virtual bool FlagByScaledGradient(grid_fct_type& work, flag_fct_type& flags,
00022 const int& Time, const int& Level,
00023 const DataType& TolVal, const FlagType& FlagValue) {
00024 if (TolVal <= 0.0) return false;
00025 int TStep = TimeStep(work,Level);
00026 forall(work,Time,Level,c)
00027 work(Time+TStep,Level,c) = 0.0;
00028 end_forall
00029 int East[2] = { 1, 0 }; int West[2] = { -1, 0 };
00030 int North[2] = { 0, 1 }; int South[2] = { 0, -1 };
00031 base::Difference(work, Time, Level, East, West);
00032 base::Difference(work, Time, Level, North, South);
00033 base::FlagByValue(work, flags, Time, Level, TolVal, FlagValue);
00034 return true;
00035 }
00036 };
00037
00038 class FlaggingSpecific :
00039 public AMRFlagging<VectorType,FixupType,FlagType,DIM> {
00040 typedef AMRFlagging<VectorType,FixupType,FlagType,DIM> base;
00041 typedef base::solver_type solver_type;
00042 public:
00043 FlaggingSpecific(solver_type& solver) : base(solver) {
00044 base::AddCriterion(new ScaledGradientSpecific());
00045 base::AddCriterion(new AbsoluteError<VectorType,FixupType,FlagType,DIM>(solver));
00046 }
00047 ~FlaggingSpecific() { DeleteAllCriterions(); }
00048 };
00049
00050 #include "ClpStdProblem.h"
00051