Permalink
Newer
Older
100644 71 lines (63 sloc) 3.2 KB
Apr 24, 2014 @miscco Code cleanups.
1 /*
Feb 1, 2016 @miscco Updated the naming convention and switched to the Random_stream header
2 * Copyright (c) 2015 University of Lübeck
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 *
22 * AUTHORS: Michael Schellenberger Costa: mschellenbergercosta@gmail.com
23 *
24 * Based on: A thalamocortical neural mass model of the EEG during NREM sleep and its response
25 * to auditory stimulation.
26 * M Schellenberger Costa, A Weigenand, H-VV Ngo, L Marshall, J Born, T Martinetz,
27 * JC Claussen.
Sep 13, 2016 @miscco Major cleanup and code modernization
28 * PLoS Computational Biology http://dx.doi.org/10.1371/journal.pcbi.1005022
Feb 1, 2016 @miscco Updated the naming convention and switched to the Random_stream header
29 */
Apr 24, 2014 @miscco Code cleanups.
30
Sep 13, 2016 @miscco Major cleanup and code modernization
31 /******************************************************************************/
32 /* Main file for compilation and runtime tests */
33 /******************************************************************************/
Dec 29, 2015 @miscco General code cleanup.
34 #include <iostream>
35 #include <chrono>
Sep 13, 2016 @miscco Major cleanup and code modernization
36
Apr 18, 2013 @miscco renamed some files, fixed some typos and some descriptions.
37 #include "Thalamic_Column.h"
Jan 24, 2013 @miscco Updated version of Steyn-Ross model with correct noise. Added a file…
38
Sep 13, 2016 @miscco Major cleanup and code modernization
39 /******************************************************************************/
40 /* Fixed simulation settings */
41 /******************************************************************************/
Dec 29, 2015 @miscco General code cleanup.
42 typedef std::chrono::high_resolution_clock::time_point timer;
Sep 13, 2016 @miscco Major cleanup and code modernization
43 extern const int T = 30; /* Time until data is stored in s */
44 extern const int res = 1E4; /* Number of iteration steps per s */
45 extern const double dt = 1E3/res; /* Duration of a time step in ms */
46 extern const double h = sqrt(dt); /* Square root of dt for SRK iteration */
Jan 24, 2013 @miscco Updated version of Steyn-Ross model with correct noise. Added a file…
47
Sep 13, 2016 @miscco Major cleanup and code modernization
48 /******************************************************************************/
49 /* Main simulation routine */
50 /******************************************************************************/
Dec 29, 2015 @miscco General code cleanup.
51 int main(void) {
Sep 13, 2016 @miscco Major cleanup and code modernization
52 std::vector<double> param = {0.2, 0.06};
53 Thalamic_Column Thalamus (param.data());
Jan 24, 2013 @miscco Updated version of Steyn-Ross model with correct noise. Added a file…
54
Sep 13, 2016 @miscco Major cleanup and code modernization
55 /* Take the time of the simulation */
56 timer start,end;
Jan 24, 2013 @miscco Updated version of Steyn-Ross model with correct noise. Added a file…
57
Sep 13, 2016 @miscco Major cleanup and code modernization
58 /* Simulation */
59 start = std::chrono::high_resolution_clock::now();
60 for (unsigned t=0; t< T*res; ++t) {
61 Thalamus.iterate_ODE();
62 }
63 end = std::chrono::high_resolution_clock::now();
Jan 24, 2013 @miscco Updated version of Steyn-Ross model with correct noise. Added a file…
64
Sep 13, 2016 @miscco Major cleanup and code modernization
65 /* Time consumed by the simulation */
66 double dif = 1E-3*std::chrono::duration_cast<std::chrono::milliseconds>( end - start ).count();
67 std::cout << "simulation done!\n";
68 std::cout << "took " << dif << " seconds" << "\n";
69 std::cout << "end\n";
Jan 24, 2013 @miscco Updated version of Steyn-Ross model with correct noise. Added a file…
70 }