From 62e52940bce6df27a86fa85e369370828ecbfc16 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Sun, 27 Apr 2025 14:33:46 -0400 Subject: [PATCH] Update all code to use real type --- src/box.hpp | 15 ++++++++------- src/particle.hpp | 11 ++++++----- src/simulation.hpp | 9 +++++---- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/box.hpp b/src/box.hpp index 816b53e..b588c49 100644 --- a/src/box.hpp +++ b/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 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; diff --git a/src/particle.hpp b/src/particle.hpp index 84fd9b8..b9e3464 100644 --- a/src/particle.hpp +++ b/src/particle.hpp @@ -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 struct Particle { - Vec3 pos; - Vec3 vel; - Vec3 force; - T mass; +struct Particle { + Vec3 pos; + Vec3 vel; + Vec3 force; + real mass; }; #endif diff --git a/src/simulation.hpp b/src/simulation.hpp index 5b468b9..0d69d34 100644 --- a/src/simulation.hpp +++ b/src/simulation.hpp @@ -3,15 +3,16 @@ #include "box.hpp" #include "particle.hpp" +#include "precision.hpp" #include -template class Simulation { +class Simulation { // Simulation State variables - T timestep; - Box box; + real timestep; + Box box; // Host Data - std::vector> particles; + std::vector particles; }; #endif