examples/omp/benchmarks/kastors-1.1/jacobi/src/poisson.c
void rhs(int matrix_size, int matrix_size2, double *f_, int block_size)
{
    double (*f)[matrix_size][matrix_size] = (double (*)[matrix_size][matrix_size])f_;
    int i,ii;
    int j,jj;
    double x;
    double y;

    // The "boundary" entries of F store the boundary values of the solution.
    // The "interior" entries of F store the right hand sides of the Poisson equation.

#pragma omp parallel
#pragma omp master
    //for collapse(2)
    for (j = 0; j < matrix_size; j+=block_size)
        for (i = 0; i < matrix_size; i+=block_size)
#pragma omp task firstprivate(block_size,i,j,matrix_size) private(ii,jj,x,y)
            for (jj=j; jj<j+block_size; ++jj)
            {
                y = (double) (jj) / (double) (matrix_size - 1);
                for (ii=i; ii<i+block_size; ++ii)
                {
                    x = (double) (ii) / (double) (matrix_size - 1);
                    if (ii == 0 || ii == matrix_size - 1 || jj == 0 || jj == matrix_size - 1)
                        (*f)[ii][jj] = u_exact(x, y);
                    else
                        (*f)[ii][jj] = - uxxyy_exact(x, y);
                }
            }
}
/* RHS initializes the right hand side "vector". */
RHS initializes the right hand side "vector".
RHS initializes the right hand side " vector " .
void rhs(int matrix_size, int matrix_size2, double *f_, int block_size)
{
    double (*f)[matrix_size][matrix_size] = (double (*)[matrix_size][matrix_size])f_;
    int i,ii;
    int j,jj;
    double x;
    double y;
#pragma omp parallel
#pragma omp master
    for (j = 0; j < matrix_size; j+=block_size)
        for (i = 0; i < matrix_size; i+=block_size)
#pragma omp task firstprivate(block_size,i,j,matrix_size) private(ii,jj,x,y)
            for (jj=j; jj<j+block_size; ++jj)
            {
                y = (double) (jj) / (double) (matrix_size - 1);
                for (ii=i; ii<i+block_size; ++ii)
                {
                    x = (double) (ii) / (double) (matrix_size - 1);
                    if (ii == 0 || ii == matrix_size - 1 || jj == 0 || jj == matrix_size - 1)
                        (*f)[ii][jj] = u_exact(x, y);
                    else
                        (*f)[ii][jj] = - uxxyy_exact(x, y);
                }
            }
}
void rhs ( int matrix_size , int matrix_size2 , double * f_ , int block_size ) { double ( * f ) [ matrix_size ] [ matrix_size ] = ( double ( * ) [ matrix_size ] [ matrix_size ] ) f_ ; int i , ii ; int j , jj ; double x ; double y ; #pragma  omp parallel #pragma  omp master for ( j = 0 ; j < matrix_size ; j += block_size ) for ( i = 0 ; i < matrix_size ; i += block_size ) #pragma  omp task firstprivate(block_size,i,j,matrix_size) private(ii,jj,x,y) for ( jj = j ; jj < j + block_size ; ++ jj ) { y = ( double ) ( jj ) / ( double ) ( matrix_size - 1 ) ; for ( ii = i ; ii < i + block_size ; ++ ii ) { x = ( double ) ( ii ) / ( double ) ( matrix_size - 1 ) ; if ( ii == 0 || ii == matrix_size - 1 || jj == 0 || jj == matrix_size - 1 ) ( * f ) [ ii ] [ jj ] = u_exact ( x , y ) ; else ( * f ) [ ii ] [ jj ] = - uxxyy_exact ( x , y ) ; } } }
RHS initializes the right hand side "vector".
RHS initializes the right hand side " vector " .
// The "boundary" entries of F store the boundary values of the solution. // The "interior" entries of F store the right hand sides of the Poisson equation. //for collapse(2)