00001
00002
00003
00004
00005
00006 #ifndef SCHEME_INITIAL_CONDITION_H
00007 #define SCHEME_INITIAL_CONDITION_H
00008
00015 #include "InitialCondition.h"
00016
00023 template <class SchemeType, int dim>
00024 class SchemeInitialCondition : public InitialCondition<typename SchemeType::VectorType,dim> {
00025 typedef InitialCondition<typename SchemeType::VectorType,dim> base;
00026 public:
00027 typedef typename SchemeType::VectorType VectorType;
00028 typedef typename VectorType::InternalDataType DataType;
00029 typedef typename base::vec_grid_data_type vec_grid_data_type;
00030 typedef typename base::grid_data_type grid_data_type;
00031
00032 SchemeInitialCondition(SchemeType &scheme) : base(), _scheme(scheme), Type(0), Scaling(0), NAux(0)
00033 { aux = new DataType[Scheme().NEquations()]; }
00034
00035 ~SchemeInitialCondition() { delete [] aux; }
00036
00037 virtual void register_at(ControlDevice& Ctrl, const std::string& prefix) {
00038 base::LocCtrl = Ctrl.getSubDevice(prefix+"InitialCondition");
00039 RegisterAt(base::LocCtrl,"Type",Type);
00040 RegisterAt(base::LocCtrl,"Scaling",Scaling);
00041 RegisterAt(base::LocCtrl,"NAux",NAux);
00042 char VariableName[16];
00043 for (int i=0; i<Scheme().NEquations(); i++) {
00044 aux[i]=DataType(0.);
00045 std::sprintf(VariableName,"Aux(%d)",i+1);
00046 RegisterAt(base::LocCtrl,VariableName,aux[i]);
00047 }
00048 }
00049
00050 virtual void SetGrid(vec_grid_data_type& fvec, grid_data_type& workvec, const int& level)
00051 { Scheme().ICStandard(fvec,Type,aux,NAux,Scaling); }
00052
00053 inline SchemeType& Scheme() { return _scheme; }
00054 inline const SchemeType& Scheme() const { return _scheme; }
00055
00056 protected:
00057 SchemeType &_scheme;
00058 int Type, Scaling, NAux;
00059 DataType *aux;
00060 };
00061
00062
00063 #endif