Skip to content
Snippets Groups Projects
Commit ac1ca8e4 authored by Pascal Engeler's avatar Pascal Engeler
Browse files

Slight update

parent 5e9f22e7
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
2. [ Classes. ](#Classes) 2. [ Classes. ](#Classes)
- [ Vec2. ](#vec2) - [ Vec2. ](#vec2)
- [ Diagonalizer. ](#diagonalizer) - [ Diagonalizer. ](#diagonalizer)
- [ DrumParameters. ](#drumparams)
- [ DrumVariables. ](#drumvars)
- [ Drum. ](#drum) - [ Drum. ](#drum)
- [ Force. ](#force) - [ Force. ](#force)
- [ Driver. ](#driver) - [ Driver. ](#driver)
...@@ -66,7 +68,7 @@ where it improves legibility. Consult the source files for more information. ...@@ -66,7 +68,7 @@ where it improves legibility. Consult the source files for more information.
- `<<` with `std::ostream` - `<<` with `std::ostream`
<a name="diagonalizer"></a> <a name="diagonalizer"></a>
### Type `Diagonalizer` (diagonalizer.hpp), class to diagonalize symmetric Matrices ### `Diagonalizer` (diagonalizer.hpp), class to diagonalize symmetric Matrices
1. Member functions 1. Member functions
- `std::vector<double> ev(std::vector<double> mat, size_t N)` - `std::vector<double> ev(std::vector<double> mat, size_t N)`
- returns eigenvalues of the symmetric matrix mat of linear size 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. ...@@ -77,8 +79,14 @@ where it improves legibility. Consult the source files for more information.
2. Further developments 2. Further developments
- Only finding eigenvectors and -values in a certain range may be added later on - 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> <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 1. Template arguments
- `value_t`: Scalar type - `value_t`: Scalar type
- `params_t`: Drum parameters container type - `params_t`: Drum parameters container type
...@@ -101,7 +109,7 @@ where it improves legibility. Consult the source files for more information. ...@@ -101,7 +109,7 @@ where it improves legibility. Consult the source files for more information.
- `void set_drive(value_t)` - `void set_drive(value_t)`
- Sets central electrode coupling - Sets central electrode coupling
4. Description 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, 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 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`. 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 ...@@ -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 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`. this class is `delete`'d. It should be constructed from an object of type `params_t`.
5. Further developments 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. be trivial.
<a name="force"></a> <a name="force"></a>
### Interface template type `Force` (force.hpp), force functional ### `Force` (force.hpp), force functional
1. Template arguments 1. Template arguments
- `value_t`: Scalar type - `value_t`: Scalar type
- `params_t`: Drum parameters type - `params_t`: Drum parameters type
...@@ -124,78 +132,72 @@ be trivial. ...@@ -124,78 +132,72 @@ be trivial.
- `value_t operator()(drum_t drum, drum_t n1, drum_t n2, drum_t n3, value_t time)` - `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` - Returns force on `drum` at `time`, given its three neighbours `n1`, `n2`, `n3`
3. Description 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 functional should derive from this class, but the child type should then be used in
order to avoid the vtable penalty. 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` template arguments. Typically, this functional would make heavy use of the `Drum`
access members `get_parameters()` and `get_variables()`. The `time` argument of the 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` functional exists to fit special cases as well. The file `include/force_simple.hpp`
showcases how a real force functional could be written. showcases how a real force functional could be written.
<a name="driver"></a> <a name="driver"></a>
### Interface template type `Driver` (driver.hpp), calculate drive of drums ### `Driver` (driver.hpp), calculate drive of drums
1. Template arguments 1. Template arguments
- `value_t`: Scalar type - `value_t`: Scalar type
- `drum_t`: Drum type - `drum_t`: Drum type
2. Virtual functions 2. Virtual functions
- `void precompute(value_t t_end, value_t dt, std::vector<drum_t> drum_vec)` - `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)` - `void step(value_t dt)`
- Move in time by `dt` - Move in time by `dt`
- `value_t operator()(size_t drum_index)` - `value_t operator()(size_t drum_index)`
- Returns drive of drum `drum_index` (wrt `drum_vec`) at current time - Returns drive of drum `drum_index` (wrt `drum_vec`) at current time
3. Description 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 class should derive from this class, but the child type should then be used in
order to avoid the vtable penalty. order to avoid the vtable penalty.
- The purpose of this class is to set the drive of each drum at specific times.
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
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 the system. Hence it can in principle precompute all values for all drums and all times
of the simulation. 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`. 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.
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`.
An example implementation of a `Driver` is shown in `include/driver_simple.hpp`.
<a name="coupler"></a> <a name="coupler"></a>
### Interface template type `Coupler` (coupler.hpp), calculate couplings between drums ### `Coupler` (coupler.hpp), calculate couplings between drums
1. Template arguments 1. Template arguments
- `value_t`: Scalar type - `value_t`: Scalar type
- `drum_t`: Drum type - `drum_t`: Drum type
2. Virtual functions 2. Virtual functions
- `void precompute(value_t t_end, value_t dt, std::vector<drum_t> drum_vec)` - `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)` - `void step(value_t dt)`
- Move in time by `dt` - Move in time by `dt`
- `value_t operator()(size_t drum_index, size_t neighbour_index)` - `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 - Returns coupling between drums `drum_index` and `neighbour_index` (wrt `drum_vec`) at current time
3. Description 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 class should derive from this class, but the child type should then be used in
order to avoid the vtable penalty. 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 the system. Hence it can in principle precompute all values for all drums and all times
of the simulation. 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`. 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> <a name="latticegenerator"></a>
### Interface template type `LatticeGenerator` (lattice_generator.hpp), generates drum lattices ### `LatticeGenerator` (lattice_generator.hpp), generates drum lattices
1. Template arguments 1. Template arguments
- `value_t`: Scalar type - `value_t`: Scalar type
- `params_t`: Drum parameters type - `params_t`: Drum parameters type
...@@ -209,11 +211,9 @@ An example implementation of a `Coupler` is shown in `include/coupler_simple.hpp ...@@ -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 - 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. - All drums have the same `params_t`, except that the `position` members differ.
3. Description 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 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 `std::vector<params_t>` or an additional random number generator to construct the drums
differently. differently.
5. Dependents 5. Dependents
...@@ -221,7 +221,6 @@ differently. ...@@ -221,7 +221,6 @@ differently.
6. Typical dependencies 6. Typical dependencies
- `params_t` - `params_t`
- Existence of `position` member - Existence of `position` member
<a name="noc"></a> <a name="noc"></a>
#### Neighbour ordering convention #### Neighbour ordering convention
An important note is the __convention of neighbour ordering__. Each drum has neighbours 0 thru 3. 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 ...@@ -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, 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 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__. sees j as its i-th neighbour). __Never violate this convention__.
<a name="inc"></a> <a name="inc"></a>
#### Inexistent neighbour convention #### Inexistent neighbour convention
Another __convention__ concerns __inexistent neighbours__. For that purpose, this class should append 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 ...@@ -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. if one uses the couplings of the neighbours instead of the considered drum.
<a name="mec"></a> <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 1. Template arguments
- `value_t`: Scalar type - `value_t`: Scalar type
- `params_t`: Drum parameters type - `params_t`: Drum parameters type
...@@ -267,10 +265,8 @@ if one uses the couplings of the neighbours instead of the considered drum. ...@@ -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)` - `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 - Returns the coupling element (index1, index2), where these are each others neighbour 2
3. Description 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. the individual functions correctly to accomodate the correct neighbours.
4. Dependents 4. Dependents
- `System` - `System`
- Existence of the virtual functions - Existence of the virtual functions
...@@ -284,7 +280,7 @@ the individual functions correctly to accomodate the correct neighbours. ...@@ -284,7 +280,7 @@ the individual functions correctly to accomodate the correct neighbours.
- `get_variables()` - `get_variables()`
<a name="rk4s"></a> <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 1. Template arguments
- `value_t`: Scalar type - `value_t`: Scalar type
- `params_t`: Drum parameters container type - `params_t`: Drum parameters container type
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment