Time evolution with full storage (*** under development ***). More...
#include <evolution.h>
Public Member Functions | |
| Evolution_full (const TyT &initial_value, int initial_j=0, double initial_time=0., int fact_resize_i=2) | |
| Constructor from initial value. | |
| Evolution_full (int fact_resize_i=2) | |
| Constructor without any initial value. | |
| Evolution_full (const Evolution_full< TyT > &t_in) | |
| Copy constructor. | |
| virtual | ~Evolution_full () |
| Destructor. | |
| virtual void | update (const TyT &new_value, int j, double time_j) |
| Sets a new value at a given time step. | |
| virtual void | operator= (const Evolution_full< TyT > &t_in) |
Assignement to another Evolution_full. | |
| virtual void | operator= (const Evolution< TyT > &t_in) |
Assignement to a generic Evolution. | |
| void | downdate (int j) |
| Suppresses a stored value. | |
| const TyT & | operator[] (int j) const |
| Returns the value at time step j. | |
| double | get_time (int j) const |
| Returns the time t at time step j. | |
| TyT | operator() (double t, int order=2) const |
Returns the value at time t, with a scheme of order order. | |
| int | get_size () const |
Returns the member size. | |
| int | j_min () const |
Returns the smaller time step j stored in *this. | |
| int | j_max () const |
Returns the larger time step j stored in *this. | |
| bool | is_known (int j) const |
| Checks whether the value a given time step has been set. | |
| TyT | time_derive (int j, int n=2) const |
Computes the time derivative at time step j by means of a n-th order scheme, from the values at steps j, j-1, . | |
| void | save (const char *filename) const |
Saves *this in a formatted file. | |
Protected Member Functions | |
| int | position (int j) const |
Gives the position in the arrays step, the_time and val corresponding to the time step j. | |
| int | next_position (int i) const |
| Returns the next valid position (returns -1 if none is found). | |
| int | previous_position (int i) const |
| Returns the previous valid position (returns -1 if none is found). | |
Protected Attributes | |
| int | size |
| Maximum number of stored time steps. | |
| int * | step |
Array of time step indices (size = size). | |
| double * | the_time |
Array of values of t at the various time steps (size = size). | |
| TyT ** | val |
Array of pointers onto the values (size = size). | |
| int | pos_jtop |
Position in the arrays step, the_time and val of the most evolved time step. | |
Private Attributes | |
| int | fact_resize |
Factor by which the size size of the arrays val and the_time are to be multiplied when their limits have been reached. | |
Time evolution with full storage (*** under development ***).
()
The template class Evolution_full has been devised to store and manipulate evolving quantities of any type, for instance TyT = double or TyT = Scalar. The quantity is stored at all time steps since the beginning of the time evolution. For large objects, this might result in some memory problem. The class Evolution_std, which stores only a limited number of time steps, is to be prefered then.
Definition at line 266 of file evolution.h.
| Evolution_full< TyT >::Evolution_full | ( | const TyT & | initial_value, | |
| int | initial_j = 0, |
|||
| double | initial_time = 0., |
|||
| int | fact_resize_i = 2 | |||
| ) | [inline] |
Constructor from initial value.
| initial_value | value to be stored at time step initial_j | |
| initial_j | index j of first time step to be stored | |
| initial_time | time t corresponding to time step initial_j | |
| fact_resize_i | factor by which the size size of the arrays val and the_time are to be multiplied when their limits have been reached. |
Definition at line 91 of file evolution_full.C.
| Evolution_full< TyT >::Evolution_full | ( | int | fact_resize_i = 2 |
) | [inline] |
Constructor without any initial value.
| fact_resize_i | factor by which the size size of the arrays val and the_time are to be multiplied when their limits have been reached. |
Definition at line 99 of file evolution_full.C.
| Evolution_full< TyT >::Evolution_full | ( | const Evolution_full< TyT > & | t_in | ) | [inline] |
Copy constructor.
Definition at line 106 of file evolution_full.C.
| Evolution_full< TyT >::~Evolution_full | ( | ) | [inline, virtual] |
Destructor.
Definition at line 119 of file evolution_full.C.
| void Evolution< TyT >::downdate | ( | int | j | ) | [inline, inherited] |
Suppresses a stored value.
Definition at line 240 of file evolution.C.
References Evolution< TyT >::is_known(), Evolution< TyT >::pos_jtop, Evolution< TyT >::position(), Evolution< TyT >::step, Evolution< TyT >::the_time, and Evolution< TyT >::val.
| int Evolution< TyT >::get_size | ( | ) | const [inline, inherited] |
Returns the member size.
Definition at line 201 of file evolution.h.
| double Evolution< TyT >::get_time | ( | int | j | ) | const [inline, inherited] |
Returns the time t at time step j.
Definition at line 195 of file evolution.h.
| bool Evolution< TyT >::is_known | ( | int | j | ) | const [inline, inherited] |
Checks whether the value a given time step has been set.
| j | time step index |
true if the value at time step j is known, false otherwise Definition at line 331 of file evolution.C.
References Evolution< TyT >::pos_jtop, Evolution< TyT >::step, and Evolution< TyT >::val.
| int Evolution< TyT >::j_max | ( | ) | const [inline, inherited] |
Returns the larger time step j stored in *this.
Definition at line 478 of file evolution.C.
References Evolution< TyT >::pos_jtop, and Evolution< TyT >::step.
| int Evolution< TyT >::j_min | ( | ) | const [inline, inherited] |
Returns the smaller time step j stored in *this.
Definition at line 459 of file evolution.C.
References Evolution< TyT >::pos_jtop, and Evolution< TyT >::step.
| int Evolution< TyT >::next_position | ( | int | i | ) | const [inline, protected, inherited] |
Returns the next valid position (returns -1 if none is found).
Definition at line 298 of file evolution.C.
References Evolution< TyT >::pos_jtop, and Evolution< TyT >::step.
| TyT Evolution< TyT >::operator() | ( | double | t, | |
| int | order = 2 | |||
| ) | const [inline, inherited] |
Returns the value at time t, with a scheme of order order.
Definition at line 366 of file evolution.C.
References Evolution< TyT >::j_min(), Evolution< TyT >::next_position(), Evolution< TyT >::pos_jtop, Evolution< TyT >::position(), Evolution< TyT >::previous_position(), Evolution< TyT >::the_time, and Evolution< TyT >::val.
| void Evolution_full< TyT >::operator= | ( | const Evolution< TyT > & | t_in | ) | [inline, virtual] |
Assignement to a generic Evolution.
Definition at line 162 of file evolution_full.C.
| void Evolution_full< TyT >::operator= | ( | const Evolution_full< TyT > & | t_in | ) | [inline, virtual] |
Assignement to another Evolution_full.
Reimplemented from Evolution< TyT >.
Definition at line 128 of file evolution_full.C.
References Evolution_full< TyT >::fact_resize, Evolution< TyT >::pos_jtop, Evolution< TyT >::size, Evolution< TyT >::step, Evolution< TyT >::the_time, and Evolution< TyT >::val.
| const TyT & Evolution< TyT >::operator[] | ( | int | j | ) | const [inline, inherited] |
Returns the value at time step j.
Definition at line 356 of file evolution.C.
References Evolution< TyT >::position(), and Evolution< TyT >::val.
| int Evolution< TyT >::position | ( | int | j | ) | const [inline, protected, inherited] |
Gives the position in the arrays step, the_time and val corresponding to the time step j.
Definition at line 269 of file evolution.C.
References Evolution< TyT >::pos_jtop, and Evolution< TyT >::step.
| int Evolution< TyT >::previous_position | ( | int | i | ) | const [inline, protected, inherited] |
Returns the previous valid position (returns -1 if none is found).
Definition at line 314 of file evolution.C.
References Evolution< TyT >::pos_jtop, and Evolution< TyT >::step.
| void Evolution< TyT >::save | ( | const char * | filename | ) | const [inline, inherited] |
Saves *this in a formatted file.
If TyT = double, this file is readable by 2-D plotting software (e.g. Xmgrace) to produce a curve of the time evolution.
| filename | name of the file: this file will be created in the working directory. |
Definition at line 585 of file evolution.C.
References Evolution< TyT >::pos_jtop, Evolution< TyT >::size, Evolution< TyT >::step, Evolution< TyT >::the_time, and Evolution< TyT >::val.
| TyT Evolution< TyT >::time_derive | ( | int | j, | |
| int | n = 2 | |||
| ) | const [inline, inherited] |
Computes the time derivative at time step j by means of a n-th order scheme, from the values at steps j, j-1, .
.., j-n.
| j | [input] : value of the time step at which the time derivative is required | |
| n | [input] : order of the time scheme (default value=2); if n=0, then the Evolution is considered to be stationary and a null value is returned. |
j Definition at line 500 of file evolution.C.
References Evolution< TyT >::operator[](), Evolution< TyT >::position(), Evolution< TyT >::step, Evolution< TyT >::the_time, and Evolution< TyT >::val.
| void Evolution_full< TyT >::update | ( | const TyT & | new_value, | |
| int | j, | |||
| double | time_j | |||
| ) | [inline, virtual] |
Sets a new value at a given time step.
If the size of the arrays of stored values (members step, the_time, val) is not sufficient, it is increased by multiplication by fact_resize.
Implements Evolution< TyT >.
Definition at line 172 of file evolution_full.C.
References Evolution_full< TyT >::fact_resize, Evolution< TyT >::is_known(), Evolution< TyT >::pos_jtop, Evolution< TyT >::position(), Evolution< TyT >::size, Evolution< TyT >::step, Evolution< TyT >::the_time, and Evolution< TyT >::val.
int Evolution_full< TyT >::fact_resize [private] |
Factor by which the size size of the arrays val and the_time are to be multiplied when their limits have been reached.
Definition at line 290 of file evolution.h.
Position in the arrays step, the_time and val of the most evolved time step.
Definition at line 138 of file evolution.h.
Maximum number of stored time steps.
Definition at line 124 of file evolution.h.
Array of time step indices (size = size).
Definition at line 127 of file evolution.h.
Array of values of t at the various time steps (size = size).
Definition at line 130 of file evolution.h.
Array of pointers onto the values (size = size).
Definition at line 133 of file evolution.h.
1.6.1