diff --git a/README.md b/README.md index 8f64ba684a8039d9a6c46afd8ddb57dcddb13491..598c817a00836fa8fbc6dffb469cc1704af1c78f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ not need to be adapted for a new situation are found in the `lib` folder. They a described in the following. Note that qualifiers, references and the like are discarded where it improves legibility. Consult the source files for more information. -### Template Type `Vec2` (`vec2.hpp`), 2-vector utility class +### Template Type `Vec2` (vec2.hpp), 2-vector utility class 1. Template arguments - `value_t`: type of vector entries 2. Members @@ -46,7 +46,7 @@ where it improves legibility. Consult the source files for more information. - `[]` with `std::size_t` - `<<` with `std::ostream` -### Type `Diagonalizer` (`diagonalizer.hpp`), class to diagonalize symmetric Matrices +### Type `Diagonalizer` (diagonalizer.hpp), class to diagonalize symmetric Matrices 1. Member functions - `std::vector<double> ev(std::vector<double> mat, size_t N)` - returns eigenvalues of the symmetric matrix mat of linear size N @@ -57,7 +57,7 @@ where it improves legibility. Consult the source files for more information. 2. Further developments - Only finding eigenvectors and -values in a certain range may be added later on -### Template Type `Drum` (`drum.hpp`), represents a single drum top resonator +### Template Type `Drum` (drum.hpp), represents a single drum top resonator 1. Template arguments - `value_t`: Scalar type - `params_t`: Drum parameters container type @@ -88,8 +88,11 @@ However, these containers likely need to be adapted to the situation at hand. When time evolving, the stepper will use the container of type `sbuffer_t` to store its intermediate results. Note that the default constructor of this class is `delete`'d. It should be constructed from an object of type `params_t`. +5. Further developments +Abstract interfaces for `params_t` and `vars_t` could be added, but they would +be trivial. -### Interface template type `Force` (`force.hpp`), force functional +### Interface template type `Force` (force.hpp), force functional 1. Template arguments - `value_t`: Scalar type - `params_t`: Drum parameters type @@ -101,13 +104,44 @@ this class is `delete`'d. It should be constructed from an object of type `param 3. Description This interface is a guide to complete implementation of a force functional. Any force functional should derive from this class, but the child type should then be used in -order to avoid the vtable penalty. The type `drum_t` is a `Drum` with the given +order to avoid the vtable penalty. + +The type `drum_t` is a `Drum` with the given template arguments. Typically, this functional would make heavy use of the `Drum` access members `get_parameters()` and `get_variables()`. The `time` argument of the functional exists to fit special cases as well. The file `include/force_simple.hpp` showcases how a real force functional could be written. -### Template Type `Rk4Stepper` (`rk4_stepper.hpp`), performs timesteps using rk4 scheme +### Interface template type `Driver` (driver.hpp), calculate drive of drums +1. Template arguments + - `value_t`: Scalar type + - `drum_t`: Drum type +2. Virtual functions + - `void precompute(value_t t_end, value_t dt, std::vector<drum_t> drum_vec)` + - Called once at begin of `system` lifetime + - `void step(value_t dt)` + - Move in time by `dt` + - `value_t operator()(size_t drum_index)` + - Returns drive of drum `drum_index` at current time +3. Description +This interface is a guide to complete implementation of a drive calculation class. Any drive +class should derive from this class, but the child type should then be used in +order to avoid the vtable penalty. + +The purpose of this class is to set the drive of each drum at specific times. + +In the `precompute` function, this class is passed all information it could need about +the system. Hence it can in principle precompute all values for all drums and all times +of the simulation. + +The member `step` is called to inform the `Driver` that time is advanced by the passed argument. +Note that an rk4 scheme advances time in steps of `dt/2`. + +The functional should return the current drive on the drum with index passed as argument. + +An example implementation of a `Driver` is shown in `include/driver_simple.hpp`. + +### Template Type `Rk4Stepper` (rk4_stepper.hpp), performs timesteps using rk4 scheme 1. Template arguments - `value_t`: Scalar type - `params_t`: Drum parameters container type