Commit 297ed246 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Updated tests related to gravity to compile and run.

parent 8a46038c
......@@ -149,12 +149,10 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_full(
const float h, const float h_inv, const struct multipole *m, float *f_x,
float *f_y, float *f_z, float *pot) {
error("www");
/* In the case where the order is < 3, then there is only a monopole term left.
* We can default to the normal P-P interaction with the mass of the multipole
* and its CoM as the "particle" property */
#if SELF_GRAVITY_MULTIPOLE_ORDER < 3
#if 1 //SELF_GRAVITY_MULTIPOLE_ORDER < 3
float f_ij, pot_ij;
runner_iact_grav_pp_full(r2, h * h, h_inv, h_inv * h_inv * h_inv, m->M_000,
......
......@@ -692,11 +692,11 @@ static INLINE void runner_dopair_grav_pp(struct runner *r, struct cell *ci,
/* Fill the caches */
gravity_cache_populate(e->max_active_bin, periodic, dim, ci_cache, ci->gparts,
gcount_i, gcount_padded_i, shift_i, CoM_j,
rmax2_j, ci, e->gravity_properties);
gcount_i, gcount_padded_i, shift_i, CoM_j, rmax2_j, ci,
e->gravity_properties);
gravity_cache_populate(e->max_active_bin, periodic, dim, cj_cache, cj->gparts,
gcount_j, gcount_padded_j, shift_j, CoM_i,
rmax2_i, cj, e->gravity_properties);
gcount_j, gcount_padded_j, shift_j, CoM_i, rmax2_i, cj,
e->gravity_properties);
/* Can we use the Newtonian version or do we need the truncated one ? */
if (!periodic) {
......
......@@ -20,7 +20,7 @@
/* Some standard headers. */
#include "../config.h"
#ifndef HAVE_FFTW
#ifndef HAVE_FFTW2
int main(int argc, char *argv[]) { return 0; }
......
......@@ -956,7 +956,7 @@ int main(int argc, char* argv[]) {
/* Compute all derivatives */
struct potential_derivatives_M2L pot;
compute_potential_derivatives_M2L(dx, dy, dz, r2, r_inv, eps, eps_inv,
&pot);
/*periodic*/ 0, /* 1/r_s */ 0., &pot);
/* Minimal value we care about */
const double min = 1e-9;
......
......@@ -88,6 +88,11 @@ int main(int argc, char *argv[]) {
unsigned long long cpufreq = 0;
clocks_set_cpufreq(cpufreq);
/* Choke on FPEs */
#ifdef HAVE_FE_ENABLE_EXCEPT
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
#endif
/* Initialise a few things to get us going */
struct engine e;
e.max_active_bin = num_time_bins;
......@@ -95,16 +100,17 @@ int main(int argc, char *argv[]) {
e.ti_current = 8;
e.time_base = 1e-10;
struct space s;
s.periodic = 0;
s.width[0] = 0.2;
s.width[1] = 0.2;
s.width[2] = 0.2;
e.s = &s;
struct pm_mesh mesh;
mesh.periodic = 0;
mesh.dim[0] = 10.;
mesh.dim[1] = 10.;
mesh.dim[2] = 10.;
mesh.r_s_inv = 0.;
mesh.r_cut_min = 0.;
e.mesh = &mesh;
struct gravity_props props;
props.a_smooth = 1.25;
props.r_cut_min = 0.;
props.theta_crit2 = 0.;
props.epsilon_cur = eps;
e.gravity_properties = &props;
......@@ -113,7 +119,7 @@ int main(int argc, char *argv[]) {
bzero(&r, sizeof(struct runner));
r.e = &e;
const double rlr = props.a_smooth * s.width[0] * FLT_MAX;
const double rlr = FLT_MAX;
/* Init the cache for gravity interaction */
gravity_cache_init(&r.ci_gravity_cache, num_tests);
......@@ -206,7 +212,7 @@ int main(int argc, char *argv[]) {
#endif
/* Now compute the forces */
runner_dopair_grav_pp(&r, &ci, &cj);
runner_dopair_grav_pp(&r, &ci, &cj, 1);
/* Verify everything */
for (int n = 0; n < num_tests; ++n) {
......@@ -248,7 +254,7 @@ int main(int argc, char *argv[]) {
ci.multipole->m_pole.M_000 = 1.;
/* Now compute the forces */
runner_dopair_grav_pp(&r, &ci, &cj);
runner_dopair_grav_pp(&r, &ci, &cj, 1);
/* Verify everything */
for (int n = 0; n < num_tests; ++n) {
......@@ -323,7 +329,7 @@ int main(int argc, char *argv[]) {
gravity_multipole_print(&ci.multipole->m_pole);
/* Compute the forces */
runner_dopair_grav_pp(&r, &ci, &cj);
runner_dopair_grav_pp(&r, &ci, &cj, 1);
/* Verify everything */
for (int n = 0; n < num_tests; ++n) {
......
......@@ -91,6 +91,11 @@ int main(int argc, char *argv[]) {
unsigned long long cpufreq = 0;
clocks_set_cpufreq(cpufreq);
/* Choke on FPEs */
#ifdef HAVE_FE_ENABLE_EXCEPT
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
#endif
/* Initialise a few things to get us going */
struct engine e;
e.max_active_bin = num_time_bins;
......@@ -98,11 +103,14 @@ int main(int argc, char *argv[]) {
e.ti_current = 8;
e.time_base = 1e-10;
struct space s;
s.width[0] = 0.2;
s.width[1] = 0.2;
s.width[2] = 0.2;
e.s = &s;
struct pm_mesh mesh;
mesh.periodic = 0;
mesh.dim[0] = 10.;
mesh.dim[1] = 10.;
mesh.dim[2] = 10.;
mesh.r_s_inv = 0.;
mesh.r_cut_min = 0.;
e.mesh = &mesh;
struct gravity_props props;
props.a_smooth = 1.25;
......@@ -113,7 +121,7 @@ int main(int argc, char *argv[]) {
bzero(&r, sizeof(struct runner));
r.e = &e;
const double rlr = props.a_smooth * s.width[0];
const double rlr = FLT_MAX;
/* Init the cache for gravity interaction */
gravity_cache_init(&r.ci_gravity_cache, num_tests * 2);
......@@ -168,7 +176,7 @@ int main(int argc, char *argv[]) {
}
/* Now compute the forces */
runner_doself_grav_pp_truncated(&r, &c);
runner_doself_grav_pp(&r, &c);
/* Verify everything */
for (int n = 1; n < num_tests + 1; ++n) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment