00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #ifndef AMROC_INITIALCONDITION_H
00010 #define AMROC_INITIALCONDITION_H
00011 
00019 #include <string>
00020 #include "AMRBase.h"
00021 
00028 template <class VectorType, int dim>
00029 class InitialCondition : public AMRBase<VectorType,dim> {
00030   typedef AMRBase<VectorType,dim> base;
00031   typedef typename VectorType::InternalDataType DataType;
00032 public:
00033   typedef typename base::vec_grid_fct_type vec_grid_fct_type;  
00034   typedef typename base::vec_grid_data_type vec_grid_data_type;
00035   typedef GridFunction<DataType,dim> grid_fct_type;
00036   typedef GridData<DataType,dim> grid_data_type;
00037 
00038   InitialCondition() : base() {}
00039 
00040   virtual ~InitialCondition() {}
00041 
00042   
00043   
00044   
00045   virtual void SetGrid(vec_grid_data_type& gd, const int& level) = 0;   
00046   
00047 
00048   virtual void register_at(ControlDevice& Ctrl, const std::string& prefix) {
00049     base::LocCtrl = Ctrl.getSubDevice(prefix+"InitialCondition");
00050   }
00051   virtual void register_at(ControlDevice& Ctrl) {
00052     register_at(Ctrl, "");
00053   }
00054 
00055   virtual void Set(vec_grid_fct_type& u, grid_fct_type& work, const int Level) { 
00056     SetPhysicalTime(u,0,Level,0.0);
00057     forall (u,0,Level,c)
00058       SetGrid(u(0,Level,c),Level);    
00059     end_forall
00060   }
00061 };
00062 
00063 
00064 #endif