From 196edac46d807eaf48079053c025af14d258964e Mon Sep 17 00:00:00 2001 From: jpekkila Date: Wed, 24 Jun 2020 17:03:54 +0300 Subject: [PATCH] Added proper casts to modelsolver.c --- src/core/kernels/integration.cuh | 11 +++++------ src/utils/modelsolver.c | 9 ++++++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/core/kernels/integration.cuh b/src/core/kernels/integration.cuh index 4c01148..0d88ac3 100644 --- a/src/core/kernels/integration.cuh +++ b/src/core/kernels/integration.cuh @@ -41,12 +41,11 @@ static __device__ __forceinline__ AcReal3 rk3_integrate(const AcReal3 state_previous, const AcReal3 state_current, const AcReal3 rate_of_change, const AcReal dt) { - return (AcReal3){rk3_integrate(state_previous.x, state_current.x, rate_of_change.x, - dt), - rk3_integrate(state_previous.y, state_current.y, rate_of_change.y, - dt), - rk3_integrate(state_previous.z, state_current.z, rate_of_change.z, - dt)}; + return (AcReal3){ + rk3_integrate(state_previous.x, state_current.x, rate_of_change.x, dt), + rk3_integrate(state_previous.y, state_current.y, rate_of_change.y, dt), + rk3_integrate(state_previous.z, state_current.z, rate_of_change.z, dt), + }; } #define rk3(state_previous, state_current, rate_of_change, dt) \ diff --git a/src/utils/modelsolver.c b/src/utils/modelsolver.c index 4c2edcf..3937e5e 100644 --- a/src/utils/modelsolver.c +++ b/src/utils/modelsolver.c @@ -41,6 +41,7 @@ #define LFORCING (1) #define LUPWD (1) #define AC_THERMAL_CONDUCTIVITY ((Scalar)(0.001)) // TODO: make an actual config parameter +#define R_PI ((Scalar)M_PI) typedef AcReal Scalar; // typedef AcReal3 Vector; @@ -54,6 +55,8 @@ typedef float Vector __attribute__((vector_size(4 * sizeof(float)))); #define fabs fabsf #define exp expf #define sqrt sqrtf +#define cos cosf +#define sin sinf #endif typedef struct { @@ -802,9 +805,9 @@ Vector helical_forcing(Scalar magnitude, Vector k_force, Vector xx, Vector ff_re, Vector ff_im, Scalar phi) { (void)magnitude; // WARNING: unused - xx[0] = xx[0] * (2.0 * M_PI / (getReal(AC_dsx) * getInt(AC_nx))); - xx[1] = xx[1] * (2.0 * M_PI / (getReal(AC_dsy) * getInt(AC_ny))); - xx[2] = xx[2] * (2.0 * M_PI / (getReal(AC_dsz) * getInt(AC_nz))); + xx[0] = xx[0] * ((Scalar)2.0 * R_PI / (getReal(AC_dsx) * getInt(AC_nx))); + xx[1] = xx[1] * ((Scalar)2.0 * R_PI / (getReal(AC_dsy) * getInt(AC_ny))); + xx[2] = xx[2] * ((Scalar)2.0 * R_PI / (getReal(AC_dsz) * getInt(AC_nz))); Scalar cos_phi = cos(phi); Scalar sin_phi = sin(phi);