From ac1ca8e467157a6f9912df8345297225708cf984 Mon Sep 17 00:00:00 2001 From: Pascal Engeler <engelerp@phys.ethz.ch> Date: Mon, 20 Jan 2020 18:02:31 +0100 Subject: [PATCH] Slight update --- README.md | 78 ++++++++++++++++++++++++++----------------------------- 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 42bfd1b..20e7cf9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ 2. [ Classes. ](#Classes) - [ Vec2. ](#vec2) - [ Diagonalizer. ](#diagonalizer) + - [ DrumParameters. ](#drumparams) + - [ DrumVariables. ](#drumvars) - [ Drum. ](#drum) - [ Force. ](#force) - [ Driver. ](#driver) @@ -66,7 +68,7 @@ where it improves legibility. Consult the source files for more information. - `<<` with `std::ostream` <a name="diagonalizer"></a> -### Type `Diagonalizer` (diagonalizer.hpp), class to diagonalize symmetric Matrices +### `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 @@ -77,8 +79,14 @@ 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 +<a name="drumparams"></a> +### `DrumParameters`(drum_parameters.hpp), contains data members characterizing the static state of a drum + +<a name="drumvars"></a> +### `DrumVariables` (drum_variables.hpp), contains data members characterizing the dynamic state of a drum + <a name="drum"></a> -### Template Type `Drum` (drum.hpp), represents a single drum top resonator +### `Drum` (drum.hpp), represents a single drum top resonator 1. Template arguments - `value_t`: Scalar type - `params_t`: Drum parameters container type @@ -101,7 +109,7 @@ where it improves legibility. Consult the source files for more information. - `void set_drive(value_t)` - Sets central electrode coupling 4. Description -A drum is described by a set of (static) parameters (stiffness, mass, x-y position, etc), + - A drum is described by a set of (static) parameters (stiffness, mass, x-y position, etc), which are to be stored in a container of type `params_t`. The variables (displacement, velocity, electrode charges, etc.) are stored in a container of type `vars_t`. Example classes for these two types are `lib/drum_parameters.hpp` and `lib/drum_variables.hpp`. @@ -110,11 +118,11 @@ 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 + - Abstract interfaces for `params_t` and `vars_t` could be added, but they would be trivial. <a name="force"></a> -### Interface template type `Force` (force.hpp), force functional +### `Force` (force.hpp), force functional 1. Template arguments - `value_t`: Scalar type - `params_t`: Drum parameters type @@ -124,78 +132,72 @@ be trivial. - `value_t operator()(drum_t drum, drum_t n1, drum_t n2, drum_t n3, value_t time)` - Returns force on `drum` at `time`, given its three neighbours `n1`, `n2`, `n3` 3. Description -This interface is a guide to complete implementation of a force functional. Any force + - 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 + - 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. <a name="driver"></a> -### Interface template type `Driver` (driver.hpp), calculate drive of drums +### `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 + - 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` (wrt `drum_vec`) at current time 3. Description -This interface is a guide to complete implementation of a drive calculation class. Any driver + - This interface is a guide to complete implementation of a drive calculation class. Any driver 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 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. + - 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`. + - 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`. <a name="coupler"></a> -### Interface template type `Coupler` (coupler.hpp), calculate couplings between drums +### `Coupler` (coupler.hpp), calculate couplings between 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 + - Called once at begin of `System` lifetime - `void step(value_t dt)` - Move in time by `dt` - `value_t operator()(size_t drum_index, size_t neighbour_index)` - Returns coupling between drums `drum_index` and `neighbour_index` (wrt `drum_vec`) at current time 3. Description -This interface is a guide to complete implementation of a coupling calculation class. Any coupler + - This interface is a guide to complete implementation of a coupling calculation class. Any coupler 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 coupling of each neighbouring pair of drums at specific times. + - The purpose of this class is to set the coupling of each neighbouring pair of drums at specific times. -In the `precompute` function, this class is passed all information it could need about + - 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 `Coupler` that time is advanced by the passed argument. + - The member `step` is called to inform the `Coupler` 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 coupling between the two drums with indices passed as arguments. + - The functional should return the current coupling between the two drums with indices passed as arguments. -An example implementation of a `Coupler` is shown in `include/coupler_simple.hpp`. + - An example implementation of a `Coupler` is shown in `include/coupler_simple.hpp`. <a name="latticegenerator"></a> -### Interface template type `LatticeGenerator` (lattice_generator.hpp), generates drum lattices +### `LatticeGenerator` (lattice_generator.hpp), generates drum lattices 1. Template arguments - `value_t`: Scalar type - `params_t`: Drum parameters type @@ -209,11 +211,9 @@ An example implementation of a `Coupler` is shown in `include/coupler_simple.hpp - an adjacency vector of vectors `adj`, such that `ds[i]` and `ds[adj[i][0]]` are neighbours - All drums have the same `params_t`, except that the `position` members differ. 3. Description - -An example child of the `LatticeGenerator` is shown in the file `include/rbcomb_generator.hpp`. + - An example child of the `LatticeGenerator` is shown in the file `include/rbcomb_generator.hpp`. 4. Further developments - -In the future, there may be another overload for the functional. For example, it could either take an + - In the future, there may be another overload for the functional. For example, it could either take an `std::vector<params_t>` or an additional random number generator to construct the drums differently. 5. Dependents @@ -221,7 +221,6 @@ differently. 6. Typical dependencies - `params_t` - Existence of `position` member - <a name="noc"></a> #### Neighbour ordering convention An important note is the __convention of neighbour ordering__. Each drum has neighbours 0 thru 3. @@ -240,7 +239,6 @@ generally, whenever neighbours of a specific drum are ordered in some fashion, t are assumed to respect the above convention. Note that with this convention, neighbours see each other as the same neighbour index (the i-th neighbour of j sees j as its i-th neighbour). __Never violate this convention__. - <a name="inc"></a> #### Inexistent neighbour convention Another __convention__ concerns __inexistent neighbours__. For that purpose, this class should append @@ -251,7 +249,7 @@ drum are to be kept at 0. This condition can then be applied in force calculatio if one uses the couplings of the neighbours instead of the considered drum. <a name="mec"></a> -### Interface template `MatrixElementCalculator` (matrix_element_calculator.hpp), calculates matrix elements +### `MatrixElementCalculator` (matrix_element_calculator.hpp), calculates matrix elements 1. Template arguments - `value_t`: Scalar type - `params_t`: Drum parameters type @@ -267,10 +265,8 @@ if one uses the couplings of the neighbours instead of the considered drum. - `value_t operator()(size_t index1, size_t index2, std::vector<drum_t>, int, int)` - Returns the coupling element (index1, index2), where these are each others neighbour 2 3. Description - -The overload of the functional is done to avoid branching. When building the matrix, one calls + - The overload of the functional is done to avoid branching. When building the matrix, one calls the individual functions correctly to accomodate the correct neighbours. - 4. Dependents - `System` - Existence of the virtual functions @@ -284,7 +280,7 @@ the individual functions correctly to accomodate the correct neighbours. - `get_variables()` <a name="rk4s"></a> -### Template Type `Rk4Stepper` (rk4_stepper.hpp), performs timesteps using rk4 scheme +### `Rk4Stepper` (rk4_stepper.hpp), performs timesteps using rk4 scheme 1. Template arguments - `value_t`: Scalar type - `params_t`: Drum parameters container type -- GitLab