Blockstructured Adaptive Mesh Refinement in object-oriented C++
00001 #ifndef AMROC_INITIALCONDITION_H 00002 #define AMROC_INITIALCONDITION_H 00003 00011 #include "InitialConditionInterface.h" 00012 00013 #ifndef InitialConditionName 00014 #define InitialCondition(dim) name2(InitialCondition,dim) 00015 #define InitialConditionName 00016 #endif 00017 00024 template <class VectorType> 00025 class InitialCondition(DIM) : public InitialConditionInterface(DIM)<VectorType> { 00026 00027 typedef GridFunction(DIM)<VectorType> vec_grid_fct_type; 00028 typedef GridData(DIM)<VectorType> vec_grid_data_type; 00029 00030 public: 00031 InitialCondition(DIM)(const int gh) : 00032 _Equations(VectorType::Length()), _Ghosts(gh) { 00033 _Hierarchy = (GridHierarchy*) 0; 00034 } 00035 00036 virtual void register_at(ControlDevice& Ctrl) {} 00037 virtual void register_at(ControlDevice& Ctrl,const string& prefix) {} 00038 virtual void init() {} 00039 virtual void update() {} 00040 virtual void finish() {} 00041 00042 void Set(vec_grid_fct_type& u, const int Level) { 00043 SetCurrentTime(GH(), 0, Level); 00044 SetPhysicalTime(u,0,Level,0.0); 00045 00046 forall (u,0,Level,c) 00047 DCoords dx(DIM); 00048 for (int d=0; d<DIM; d++) 00049 dx(d) = DeltaX(u,d,Level); 00050 SetGrid(u(0,Level,c),dx); 00051 end_forall 00052 00053 BoundaryUpdate(u,0,Level); 00054 } 00055 00056 inline void SetGridHierarchy(GridHierarchy* gh) { _Hierarchy = gh; } 00057 inline GridHierarchy& GH() { return *_Hierarchy; } 00058 inline const GridHierarchy& GH() const { return *_Hierarchy; } 00059 00060 inline const int& NEquations() const { return _Equations; } 00061 inline const int& NGhosts() const { return _Ghosts; } 00062 00063 protected: 00064 int _Equations; 00065 int _Ghosts; 00066 GridHierarchy* _Hierarchy; 00067 }; 00068 00069 00070 #endif
Quickstart Users Guide Programmers Reference Installation Examples Download
AMROC Main Home Contactlast update: 06/01/04