Skip to content
Snippets Groups Projects
Commit 32e8ad2a authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

add prototype rhs function for particles

parent 375ca5f6
Branches
Tags
No related merge requests found
......@@ -89,7 +89,7 @@ class convergence_test(bfps.code):
fs->ru);
fs->compute_velocity(fs->cvorticity);
fftwf_execute(*((fftwf_plan*)fs->c2r_velocity));
ps->rFFTW_to_buffered(ps->source_data, ps->data);
ps->transfer_data();
t = 0.0;
do_stats(fs);
fs->write('u', 'r');
......
......@@ -97,12 +97,16 @@ slab_field_particles<rnumber>::~slab_field_particles()
delete[] this->ubound;
}
template <class rnumber>
void slab_field_particles<rnumber>::get_rhs(double *x, double *y)
{
std::fill_n(y, this->array_size, 0.0);
}
template <class rnumber>
void slab_field_particles<rnumber>::jump_estimate(double *dest)
{
std::copy(this->state,
this->state + this->array_size,
dest);
std::fill_n(dest, this->array_size, 0.0);
}
template <class rnumber>
......@@ -156,9 +160,6 @@ void slab_field_particles<rnumber>::rFFTW_to_buffered(rnumber *src, rnumber *dst
const MPI_Datatype MPI_RNUM = (sizeof(rnumber) == 4) ? MPI_REAL4 : MPI_REAL8;
const ptrdiff_t bsize = this->buffer_size*this->fs->rd->slice_size;
MPI_Request *mpirequest = new MPI_Request;
// first, remove 0 buffer.
// keep in mind that the source data MUST be in FFTW format
clip_zero_padding(this->fs->rd, src, 3);
/* do big copy of middle stuff */
std::copy(src,
src + this->fs->rd->local_size,
......
......@@ -73,6 +73,7 @@ class slab_field_particles
const int BUFFERSIZE);
~slab_field_particles();
virtual void get_rhs(double *x, double *rhs);
/* an Euler step is needed to compute an estimate of future positions,
* which is needed for synchronization.
* function is virtual since we want children to do different things,
......
......@@ -20,8 +20,29 @@
#include "fftw_tools.hpp"
#include "tracers.hpp"
template <class rnumber>
void tracers<rnumber>::jump_estimate(double *jump)
{
std::fill_n(jump, this->nparticles, 0.0);
}
template <class rnumber>
void tracers<rnumber>::get_rhs(double *x, double *y)
{
std::fill_n(y, this->array_size, 0.0);
}
template<class rnumber>
void tracers<rnumber>::transfer_data(bool clip_on)
{
if (clip_on)
clip_zero_padding(this->fs->rd, this->source_data, 3);
this->rFFTW_to_buffered(this->source_data, this->data);
}
/*****************************************************************************/
/* macro for specializations to numeric types compatible with FFTW */
......
......@@ -45,7 +45,9 @@ class tracers:public slab_field_particles<rnumber>
rnumber *SOURCE_DATA);
~tracers();
void transfer_data(bool clip_on = true);
virtual void get_rhs(double *x, double *rhs);
virtual void jump_estimate(double *jump_length);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment