vtf-logo

clawpack/applications/euler/2d/Shockbubble/src/Problem.h

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