* @Author Christoph Schaefer, EPFL (christophernstrerne.schaefer@epfl.ch), Gilles Fourestey (gilles.fourestey@epfl.ch)
* @date July 2017
* @version 0,1
*
*/
#include "grid_gradient2_CPU.hpp"
//
#ifdef __WITH_MPI
#include<mpi.h>
#endif
//
//
void gradient2_grid_CPU(matrix *grid_grad2, const struct grid_param *frame, const struct Potential_SOA *lens, int nhalos, int nbgridcells, int istart, int jstart)
void gradient2_grid_CPU(matrix *grid_grad2, const struct grid_param *frame, const struct Potential_SOA *lens, int nhalos, int nbgridcells_x, int nbgridcells_y, int istart, int jstart)
void gradient2_grid_CPU(matrix *grid_grad2, const struct grid_param *frame, const struct Potential_SOA *lens, int nhalos, double dx, double dy, int nbgridcells_x, int nbgridcells_y, int istart, int jstart)
void gradient2_grid_general_CPU(matrix *grid_grad2, const struct grid_param *frame, const struct Potential_SOA *lens, int Nlens, type_t dx, type_t dy, int nbgridcells_x, int nbgridcells_y, int istart, int jstart)
{
int bid = 0; // index of the block (and of the set of images)
int tid = 0; // index of the thread within the block
//
type_t /*dx, dy,*/ x_pos, y_pos; //pixelsize
int grid_dim;
point image_point;
matrix Grad;
//
grid_dim = nbgridcells_x*nbgridcells_y;
//
//#pragma omp parallel
//#pragma omp for private(Grad, image_point)
for (int jj = 0; jj < nbgridcells_y; ++jj)
for (int ii = 0; ii < nbgridcells_x; ++ii)
{
int index = jj*nbgridcells_x + ii;
image_point.x = frame->xmin + (ii + istart)*dx;
image_point.y = frame->ymin + (jj + jstart)*dy;
//
Grad = module_potentialDerivatives_totalGradient2_SOA(&image_point, lens, Nlens);