00001 #ifndef TIMECONTR_H 00002 #define TIMECONTR_H 00003 00004 #include <stdio.h> 00005 #include "gfunct.h" 00006 #include "iotools.h" 00007 00008 /** 00009 class timecontr controles time in problems with time 00010 00011 JK 00012 */ 00013 00014 class timecontr 00015 { 00016 public: 00017 timecontr (void); 00018 ~timecontr (void); 00019 void read (XFILE *in); 00020 void print (FILE *out); 00021 double newtime (); 00022 double newtime (double &dt); 00023 void oldtime (); 00024 double starttime (); 00025 double endtime (); 00026 double actualtime (); 00027 double actualforwtimeincr (); 00028 double actualbacktimeincr (); 00029 double initialtimeincr (); 00030 void take_values (timecontr &tc); 00031 void seconds_days (); 00032 long isitimptime (); 00033 void initiate (timecontr &tc); 00034 void be_copy_of (timecontr &tc); 00035 void save_txt (FILE *out, int prec); 00036 void save_bin (FILE *out); 00037 void restore_txt (FILE *in); 00038 void restore_bin (FILE *in); 00039 00040 //void reduce_step (double rf); 00041 00042 /// actual time 00043 double time; 00044 /// actual backward time step 00045 double backwarddt; 00046 /// actual forward time step 00047 double forwarddt; 00048 /// backup of forward time step 00049 double bfdt; 00050 /// backup of solver time step 00051 double bsdt; 00052 /// backup of user defined forward time step 00053 double bfdtu; 00054 /// starting time 00055 double start_time; 00056 /// end time 00057 double end_time; 00058 /// function describing time increments 00059 gfunct timefun; 00060 /// array of important times 00061 double *imptime; 00062 /// number of important times 00063 long nit; 00064 /// actual position in imptime array 00065 long apit; 00066 /// is it important time now? 00067 /// iiit=0 - no 00068 /// iiit=1 - yes 00069 long iiit; 00070 00071 double it_step; 00072 00073 /** type of time controller 00074 tct = 0 - fixed - time increments are defined by user due the function timefun, solvers are not able to change these time steps 00075 tct = 1 - adaptive - there are minimum and maximum time steps prescribed by user, the minimum and maximum time steps are constants, 00076 solver prescribes the time steps, the final time step is equal to the time step from solver except the case 00077 where user time step differs for the actual time and the previous one 00078 tct = 2 - adaptivemin - the minimum time step is defined by a constant, smaller value of solver time step and user time is used 00079 in the case of change of user time step, 00080 tct = 3 - adaptivemax 00081 */ 00082 timecontrtype tct; 00083 /// minimum time step 00084 double dtmin; 00085 /// maximum time step 00086 double dtmax; 00087 00088 /// actual minimum time step given by general time function 00089 gfunct *dtminfun; 00090 00091 /// actual maximum time step given by general time function 00092 gfunct *dtmaxfun; 00093 00094 }; 00095 00096 #endif