diff --git a/README.md b/README.md index 5a4b1ecc30feb22b817b81a91e5f252f56ec7254..199910a00dc8773dc53209fb0e76163b65d578b7 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,12 @@ where it improves legibility. Consult the source files for more information. #### `Vec2` (vec2.hpp), 2-vector utility class 1. Template arguments - `value_t`: type of vector entries -2. Members +2. Explicit Constructors + - `Vec2(const value_t, const value_t)` + - `Vec2(const Vec2&)` + - `Vec2()` + - `Vec2& operator=(const Vec2&)` +3. Members - Access - `value_t x()` - returns x entry @@ -118,14 +123,16 @@ where it improves legibility. Consult the source files for more information. <a name="diagonalizer"></a> #### `Diagonalizer` (diagonalizer.hpp), class to diagonalize symmetric Matrices -1. Member functions +1. Explicit Constructors + - `Diagonalizer()` +2. Member functions - `std::vector<double> ev(std::vector<double> mat, size_t N)` - returns eigenvalues of the symmetric matrix mat of linear size N - throws upon diagonalization failure - `std::pair<std::vector<double>, std::vector<double> > evv(std::vector<double> mat, size_t N)` - returns pair of (eigenvalues, eigenvectors) of the symmetric matrix mat of size N - throws upon diagonalization failure -2. Further developments +3. Further developments - Only finding eigenvectors and -values in a certain range may be added later on <a name="drumparams"></a> @@ -142,23 +149,32 @@ where it improves legibility. Consult the source files for more information. - `params_t`: Drum parameters container type - `vars_t`: Drum variables container type - `sbuffer_t`: Stepper buffer container type -2. Access +2. Explicit Constructors + - `Drum(const params_t&)` + - `Drum() = delete` + - `Drum(const Drum&)` + - `Drum& operator=(const Drum&)` +3. Access - `params_t get_parameters()` - returns the parameters, const and reference versions implemented - `vars_t get_variables()` - returns the variables, const and reference versions implemented - `sbuffer_t get_sbuffer()` - returns the stepper buffer, const and reference versions implemented -3. Modifiers +4. Modifiers - `void set_coupling_0(value_t)` - Sets coupling 0 + - [deprecated](https://gitlab.phys.ethz.ch/engelerp/rbcomb-simulation/issues/4) - `void set_coupling_1(value_t)` - Sets coupling 1 + - [deprecated](https://gitlab.phys.ethz.ch/engelerp/rbcomb-simulation/issues/4) - `void set_coupling_2(value_t)` - Sets coupling 2 + - [deprecated](https://gitlab.phys.ethz.ch/engelerp/rbcomb-simulation/issues/4) - `void set_drive(value_t)` - Sets central electrode coupling -4. Description + - [deprecated](https://gitlab.phys.ethz.ch/engelerp/rbcomb-simulation/issues/4) +5. Description - 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 @@ -178,10 +194,12 @@ be trivial. - `params_t`: Drum parameters type - `vars_t`: Drum variables type - `buffer_t`: Stepper buffer type -2. Virtual functions +2. Explicit Constructors + - `Force()` +3. Virtual functions - `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 +4. 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. @@ -196,14 +214,16 @@ showcases how a real force functional could be written. 1. Template arguments - `value_t`: Scalar type - `drum_t`: Drum type -2. Virtual functions +2. Explicit Constructors + - `Driver()` +3. 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` (wrt `drum_vec`) at current time -3. Description +4. Description - 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. @@ -221,29 +241,26 @@ Note that an rk4 scheme advances time in steps of `dt/2`. 1. Template arguments - `value_t`: Scalar type - `drum_t`: Drum type -2. Virtual functions +2. Explicit Constructors + - `Coupler()` +3. 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, size_t neighbour_index)` - Returns coupling between drums `drum_index` and `neighbour_index` (wrt `drum_vec`) at current time -3. Description +4. Description - 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. - - 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. 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. - - An example implementation of a `Coupler` is shown in `include/coupler_simple.hpp`. <a name="latticegenerator"></a> @@ -253,22 +270,24 @@ Note that an rk4 scheme advances time in steps of `dt/2`. - `params_t`: Drum parameters type - `vars_t`: Drum variables type - `sbuffer_t`: Stepper buffer type -2. Virtual functions +2. Explicit Constructors + - `LatticeGenerator()` +3. Virtual functions - `std::pair<std::vector<drum_t>, std::vector<int> > operator()(params_t)` - Takes a `params_t` - Returns a pair that characterizes the generated lattice - a vector of drums `ds` - 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 +4. Description - An example child of the `LatticeGenerator` is shown in the file `include/rbcomb_generator.hpp`. -4. Further developments +5. Further developments - 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 +6. Dependents - None -6. Typical dependencies +7. Typical dependencies - `params_t` - Existence of `position` member <a name="noc"></a> @@ -305,7 +324,9 @@ if one uses the couplings of the neighbours instead of the considered drum. - `params_t`: Drum parameters type - `vars_t`: Drum variables type - `drum_t`: Drum type -2. Virtual functions +2. Explicit Constructors + - `MatrixElementCalculator()` +3. Virtual functions - `value_t operator()(size_t index, std::vector<drum_t>)` - Returns the diagonal element (index, index). - `value_t operator()(size_t index1, size_t index2, std::vector<drum_t>)` @@ -314,13 +335,13 @@ if one uses the couplings of the neighbours instead of the considered drum. - Returns the coupling element (index1, index2), where these are each others neighbour 1 - `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 +4. Description - 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 +5. Dependents - `System` - Existence of the virtual functions -5. Typical dependencies +6. Typical dependencies - `params_t` - Class semantics - `vars_t` @@ -340,7 +361,9 @@ the individual functions correctly to accomodate the correct neighbours. - `vars_t`: Drum variables container type - `buffer_t`: Stepper buffer container type - `force_t`: Force functional type -2. Member functions +2. Explicit Constructors + - `Rk4Stepper()` +3. Member functions - `void step_1(force_t, std::vector<drum_t>, std::vector<std::vector<int> >, value_t dt, value_t time)` - `void step_2(force_t, std::vector<drum_t>, std::vector<std::vector<int> >, value_t dt, value_t time)` - `void step_3(force_t, std::vector<drum_t>, std::vector<std::vector<int> >, value_t dt, value_t time)` @@ -353,7 +376,9 @@ the individual functions correctly to accomodate the correct neighbours. 1. Template arguments - `coupler_t`: Coupler type - `driver_t`: Driver type -2. Public data members +2. Explicit Constructors + - `SystemParameters(coupler_t, driver_t, std::vector<std::vector<int> >)` +3. Public data members - `coupler`: The coupler_t object of the system - `driver`: The driver_t object of the system - `adjacency_vector`: A `std::vector<std::vector<int> >` representing the adjacency vector @@ -363,7 +388,15 @@ the individual functions correctly to accomodate the correct neighbours. 1. Template arguments - `value_t`: Scalar type - `drum_t`: Drum type -2. Member functions +2. Explicit Constructors + - `Grabber(const size_t grab_every, const std::string params_file, const std::string adjacency_file, const std::string dynamic_file)` + - `grab_every`: stride between data grabs + - `params_file`: file for parameters saving + - `adjacency_file`: file for lattice adjacency saving + - `dynamic_file:` file for dynamics saving + - `Grabber() = delete` + - `Grabber(const Grabber&)` +3. Member functions - `void init(value_t t_end, value_t dt, std::vector<drum_t>, std::vector<std::vector<int> >)` - Called upon `System` lifetime start. - `bool grab(std::vector<drum_t>, value_t time)` @@ -374,7 +407,7 @@ the individual functions correctly to accomodate the correct neighbours. - Saves data to the specified files. - Is called by `System`. - Returns `true` on success. -3. Description +4. Description - This class needs to be re-implemented whenever either `DrumParameters` or `DrumVariables` changes. - One should also implement a helper struct, as seen in `include/grabber.hpp` @@ -391,6 +424,15 @@ the individual functions correctly to accomodate the correct neighbours. - `driver_t`: Driver type - `stepper_t`: Stepper type - `matelecalc_t`: Matrix element calculator type +2. Explicit constructors + - `System(const value_t t_end, const value_t dt, const std::vector<drum_t>& ds, const stepper_t s, const force_t f, const sysparams_t sp, const grabber_t g)` + - `t_end`: Temporal simulation length + - `dt`: Simulation time step + - `ds`: Vector of drums + - `s`: Time stepper + - `f`: Force functional + - `sp`: System parameters + - `g`: Grabber 2. Member functions - `void simulate()` - Runs a simulation with the set parameters. diff --git a/projects/braidingTightBinding/bin/main_braiding_zerostate b/projects/braidingTightBinding/bin/main_braiding_zerostate new file mode 100755 index 0000000000000000000000000000000000000000..7a77e79848dd7d421fbbabef92482967b5dc509c Binary files /dev/null and b/projects/braidingTightBinding/bin/main_braiding_zerostate differ