diff --git a/src/DDalphaAMG_interface.c b/src/DDalphaAMG_interface.c index 387a31b..0996b28 100644 --- a/src/DDalphaAMG_interface.c +++ b/src/DDalphaAMG_interface.c @@ -594,60 +594,69 @@ void DDalphaAMG_driver( double *vector_out, double *vector_in, DDalphaAMG_status for (i=0; i<4; i++) sl[i] = ll[i]*g.my_coords[i]; /* -#ifndef INIT_ONE_PREC + #ifndef INIT_ONE_PREC if ( g.mixed_precision==2 || vector_index_fct!=NULL || g.bc==_TWISTED) -#else + #else if ( vector_index_fct!=NULL || g.bc==_TWISTED) -#endif + #endif */ - for (t=0, j=0; t vmax) - vmax=vtmp; - if( vtmp > EPS_double && vtmp < vmin ) - vmin=vtmp; - } + if(g.mixed_precision==2) { + vtmp=cabs(rhs[j]); + if(vtmp > vmax) + vmax=vtmp; + if( vtmp > EPS_double && vtmp < vmin ) + vmin=vtmp; } + } #endif - } } } } - /* - else { + } + + /* + else { p->b = (vector_double) vector_in; p->x = (vector_double) vector_out; - } - */ + } + */ + #ifndef INIT_ONE_PREC + + double gvmin, gvmax; + if(g.mixed_precision==2) { + MPI_Allreduce(&vmin, &gvmin, 1, MPI_DOUBLE, MPI_MIN, g.comm_cart); + MPI_Allreduce(&vmax, &gvmax, 1, MPI_DOUBLE, MPI_MAX, g.comm_cart); + } + //switching to double precision on the fine level - if(g.mixed_precision==2 && vmin/vmaxtol = g.p_MP.dp.tol; } else precision_changed=0; #endif - + switch(_TYPE) { case _SOLVE :