00001 // -*- C++ -*- 00002 00003 // Copyright (C) 2002 Ralf Deiterding 00004 // Brandenburgische Universitaet Cottbus 00005 // 00006 // Copyright (C) 2003-2007 California Institute of Technology 00007 // Ralf Deiterding, ralf@cacr.caltech.edu 00008 00009 #ifndef AMROC_SOLVER_H 00010 #define AMROC_SOLVER_H 00011 00019 #include "IO/control-device.h" 00020 #include <string> 00021 00028 class Solver : public controlable { 00029 public: 00030 Solver() {} 00031 00032 virtual ~Solver() {} 00033 00034 //****************************************************************************** 00035 // Initialize members 00036 //****************************************************************************** 00037 virtual void init() {} 00038 00039 //****************************************************************************** 00040 // Register members at control device 00041 //****************************************************************************** 00042 virtual void register_at(ControlDevice& Ctrl) {} 00043 virtual void register_at(ControlDevice& Ctrl, const std::string& prefix) {} 00044 00045 //****************************************************************************** 00046 // Update members after reading values from control device 00047 //****************************************************************************** 00048 virtual void update() {} 00049 00050 //****************************************************************************** 00051 // Setup communication and data structures based on updated members 00052 // returns true to allow for numerical method, false jumps to finish() 00053 //****************************************************************************** 00054 virtual bool setup() = 0; 00055 00056 //****************************************************************************** 00057 // Functions for an instationary numerical method 00058 //****************************************************************************** 00059 virtual void Initialize(double& t, double& dt) = 0; 00060 virtual void Advance(double& t, double& dt) = 0; 00061 virtual void Output() = 0; 00062 virtual int NSteps() = 0; 00063 00064 virtual void Restart(double& t, double& dt) {} 00065 virtual void Checkpointing() {} 00066 00067 //****************************************************************************** 00068 // Clean-up communication and data structures 00069 //****************************************************************************** 00070 virtual void finish() {} 00071 }; 00072 00073 00074 #endif