Update all code to use real type
This commit is contained in:
parent
4269333aa2
commit
62e52940bc
3 changed files with 19 additions and 16 deletions
15
src/box.hpp
15
src/box.hpp
|
@ -1,19 +1,20 @@
|
|||
#ifndef BOX_H
|
||||
#define BOX_H
|
||||
|
||||
#include "precision.hpp"
|
||||
/**
|
||||
* Struct representing the simulation box.
|
||||
* Currently the simulation box is always assumed to be perfectly rectangular.
|
||||
* This code does not support shearing the box. This functionality may be added
|
||||
* in later.
|
||||
*/
|
||||
template <typename T> struct Box {
|
||||
T xlo;
|
||||
T xhi;
|
||||
T ylo;
|
||||
T yhi;
|
||||
T zlo;
|
||||
T zhi;
|
||||
struct Box {
|
||||
real xlo;
|
||||
real xhi;
|
||||
real ylo;
|
||||
real yhi;
|
||||
real zlo;
|
||||
real zhi;
|
||||
bool x_is_periodic;
|
||||
bool y_is_periodic;
|
||||
bool z_is_periodic;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef PARTICLE_H
|
||||
#define PARTICLE_H
|
||||
|
||||
#include "precision.hpp"
|
||||
#include "vec3.h"
|
||||
|
||||
/**
|
||||
|
@ -8,11 +9,11 @@
|
|||
* This class is only used on the host side of the code and is converted
|
||||
* to the device arrays.
|
||||
*/
|
||||
template <typename T = float> struct Particle {
|
||||
Vec3<T> pos;
|
||||
Vec3<T> vel;
|
||||
Vec3<T> force;
|
||||
T mass;
|
||||
struct Particle {
|
||||
Vec3<real> pos;
|
||||
Vec3<real> vel;
|
||||
Vec3<real> force;
|
||||
real mass;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,15 +3,16 @@
|
|||
|
||||
#include "box.hpp"
|
||||
#include "particle.hpp"
|
||||
#include "precision.hpp"
|
||||
#include <vector>
|
||||
|
||||
template <typename T> class Simulation {
|
||||
class Simulation {
|
||||
// Simulation State variables
|
||||
T timestep;
|
||||
Box<T> box;
|
||||
real timestep;
|
||||
Box box;
|
||||
|
||||
// Host Data
|
||||
std::vector<Particle<T>> particles;
|
||||
std::vector<Particle> particles;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue