/* Copyright (C) Bernard Piette University of Durham (UK) Department of Mathematical Sciences This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. You can modify or use any part of the source code but only under the condition that this Copyright notice is kept in the resulting source file. */ #ifndef PDE_H #define PDE_H #include #include #include #include class pde { public: // constructors and destructors pde(double xmin,double xmax,int nx); virtual ~pde(); // Method to Override for specific equation virtual void Eqn(double &F)=0; // Equations to solve virtual void Init(double x,double &F)=0; // Initial value void init_grf(grf_pde *grfp) { grfp_ = grfp; }; void set_dt(double dt) { dt_ = dt;} double xmin() { return(Xmin_);} double xmax() { return(Xmax_);} double dx() { return(dx_);} int nx() { return(nx_);} virtual void set_neighbour_fcts(double *f,int i); virtual void eval_derivatives(); // integration method overriden by sub-classes virtual void initial_value(); void write_grf(); // Output one graph virtual double integrate_1step() {return(0.0);}; // to override // Calls integrate_1step() several times virtual double integrate_until(double t); virtual double integrate_grf_until(double tmax,double grf_dt); protected: double dt_; double t_; double Xmin_; double Xmax_; double dx_; int nx_; double *f_,*fl_,*fll_,*fr_,*frr_; // fcts pointers double x_; // local value of x = Xmin_+i_*dx_ int i_; // local value of grid index // allocate arrays for the fcts and densities double *Fcts_; // A vector of size nx double Force_; // The evaluated equation double fx_,fxx_,fxxx_,fxxxx_; // Graphic variables grf_pde *grfp_; int grf_index_; }; #endif