static PetscErrorCode TSComputeLinearStability_Theta(TS ts,PetscReal xr,PetscReal xi,PetscReal *yr,PetscReal *yi) { PetscComplex z = xr + xi*PETSC_i,f; TS_Theta *th = (TS_Theta*)ts->data; const PetscReal one = 1.0; PetscFunctionBegin; f = (one + (one - th->Theta)*z)/(one - th->Theta*z); *yr = PetscRealPartComplex(f); *yi = PetscImaginaryPartComplex(f); PetscFunctionReturn(0); }
PETSC_EXTERN void PetscMin_Local(void *in,void *out,PetscMPIInt *cnt,MPI_Datatype *datatype) { PetscInt i,count = *cnt; PetscFunctionBegin; if (*datatype == MPIU_REAL) { PetscReal *xin = (PetscReal*)in,*xout = (PetscReal*)out; for (i=0; i<count; i++) xout[i] = PetscMin(xout[i],xin[i]); } #if defined(PETSC_HAVE_COMPLEX) else if (*datatype == MPIU_COMPLEX) { PetscComplex *xin = (PetscComplex*)in,*xout = (PetscComplex*)out; for (i=0; i<count; i++) { xout[i] = PetscRealPartComplex(xout[i])>PetscRealPartComplex(xin[i]) ? xin[i] : xout[i]; } } #endif else { (*PetscErrorPrintf)("Can only handle MPIU_REAL or MPIU_SCALAR data (i.e. double or complex) types"); MPI_Abort(MPI_COMM_WORLD,1); } PetscFunctionReturnVoid(); }