diff --git a/bfps/cpp/rFFTW_interpolator.cpp b/bfps/cpp/rFFTW_interpolator.cpp index 6f1a49bc7b538b94286c397ab4613540a1b72f9f..5e95d742c414c6ee694cad3839a8b4aa4125bd97 100644 --- a/bfps/cpp/rFFTW_interpolator.cpp +++ b/bfps/cpp/rFFTW_interpolator.cpp @@ -26,6 +26,7 @@ #define NDEBUG +#include <cmath> #include "rFFTW_interpolator.hpp" template <class rnumber, int interp_neighbours> @@ -47,6 +48,41 @@ rFFTW_interpolator<rnumber, interp_neighbours>::rFFTW_interpolator( this->f1 = (rnumber*)((void*)fftw_alloc_real(this->field_size)); } this->temp = this->f1; + + // compute dx, dy, dz; + this->dx = 4*acos(0) / (fs->dkx*fs->rd->sizes[2]); + this->dy = 4*acos(0) / (fs->dky*fs->rd->sizes[1]); + this->dz = 4*acos(0) / (fs->dkz*fs->rd->sizes[0]); + + // compute lower and upper bounds + this->lbound = new double[nprocs]; + this->ubound = new double[nprocs]; + double *tbound = new double[nprocs]; + std::fill_n(tbound, nprocs, 0.0); + tbound[this->descriptor->myrank] = fs->rd->starts[0]*this->dz; + MPI_Allreduce( + tbound, + this->lbound, + nprocs, + MPI_DOUBLE, + MPI_SUM, + this->descriptor->comm); + std::fill_n(tbound, this->descriptor->nprocs, 0.0); + tbound[this->descriptor->myrank] = (fs->rd->starts[0] + fs->rd->subsizes[0])*this->dz; + MPI_Allreduce( + tbound, + this->ubound, + nprocs, + MPI_DOUBLE, + MPI_SUM, + this->descriptor->comm); + delete[] tbound; + //for (int r = 0; r<nprocs; r++) + // DEBUG_MSG( + // "lbound[%d] = %lg, ubound[%d] = %lg\n", + // r, this->lbound[r], + // r, this->ubound[r] + // ); } template <class rnumber, int interp_neighbours> @@ -62,6 +98,8 @@ rFFTW_interpolator<rnumber, interp_neighbours>::~rFFTW_interpolator() fftw_free((double*)((void*)this->f0)); fftw_free((double*)((void*)this->f1)); } + delete[] this->lbound; + delete[] this->ubound; } template <class rnumber, int interp_neighbours> diff --git a/bfps/cpp/rFFTW_interpolator.hpp b/bfps/cpp/rFFTW_interpolator.hpp index 7a32e75808ce572b2e902d2ebd0a22b489a4b81e..ea7776b385ac6437d8fc5f7eb99bc527fd6207f0 100644 --- a/bfps/cpp/rFFTW_interpolator.hpp +++ b/bfps/cpp/rFFTW_interpolator.hpp @@ -49,6 +49,13 @@ class rFFTW_interpolator field_descriptor<rnumber> *descriptor; rnumber *f0, *f1, *temp; + /* physical parameters of field */ + double dx, dy, dz; + + /* precomputed boundaries of process's domain */ + double *lbound; + double *ubound; + rFFTW_interpolator( fluid_solver_base<rnumber> *FSOLVER, base_polynomial_values BETA_POLYS); diff --git a/bfps/cpp/rFFTW_particles.cpp b/bfps/cpp/rFFTW_particles.cpp index 20f0eef568f341ed760899ec94528924e747283f..42a308f2d791a83df5208965e18a57898fbe406a 100644 --- a/bfps/cpp/rFFTW_particles.cpp +++ b/bfps/cpp/rFFTW_particles.cpp @@ -24,7 +24,7 @@ -//#define NDEBUG +#define NDEBUG #include <cmath> #include <cassert> @@ -105,12 +105,6 @@ rFFTW_particles<particle_type, rnumber, interp_neighbours>::rFFTW_particles( MPI_SUM, this->comm); delete[] tbound; - //for (int r = 0; r<nprocs; r++) - // DEBUG_MSG( - // "lbound[%d] = %lg, ubound[%d] = %lg\n", - // r, this->lbound[r], - // r, this->ubound[r] - // ); } template <int particle_type, class rnumber, int interp_neighbours> diff --git a/tox_plain.ini b/tox_plain.ini index 1aad555519ed22f2e3c678b96639089120dc7f8c..21413b95082b63474fc6c55c58f187749e492990 100644 --- a/tox_plain.ini +++ b/tox_plain.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27 +envlist = py34 [testenv] sitepackages = True #deps = matplotlib