-
Notifications
You must be signed in to change notification settings - Fork 13
/
GSimulation.hpp
82 lines (59 loc) · 2.11 KB
/
GSimulation.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
This file is part of the example codes which have been used
for the "Code Optmization Workshop".
Copyright (C) 2016 Fabio Baruffa <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _GSIMULATION_HPP
#define _GSIMULATION_HPP
#include <random>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <stdlib.h>
#include <omp.h>
#include "Particle.hpp"
class GSimulation
{
public:
GSimulation();
~GSimulation();
void init();
void set_number_of_particles(int N);
void set_number_of_steps(int N);
void start();
private:
ParticleSoA *particles;
int _npart; //number of particles
int _nsteps; //number of integration steps
real_type _tstep; //time step of the simulation
int _sfreq; //sample frequency
real_type _kenergy; //kinetic energy
double _totTime; //total time of the simulation
double _totFlops; //total number of flops
void init_pos();
void init_vel();
void init_acc();
void init_mass();
inline void set_npart(const int &N){ _npart = N; }
inline int get_npart() const {return _npart; }
inline void set_tstep(const real_type &dt){ _tstep = dt; }
inline real_type get_tstep() const {return _tstep; }
inline void set_nsteps(const int &n){ _nsteps = n; }
inline int get_nsteps() const {return _nsteps; }
inline void set_sfreq(const int &sf){ _sfreq = sf; }
inline int get_sfreq() const {return _sfreq; }
void print_header();
};
#endif