1#include <petscsys.h> 2 3#define NOTLIKELY PETSC_INFINITY 4 5PETSC_EXTERN PetscErrorCode PFApply_String(void *value,PetscInt n,const PetscScalar *in,PetscScalar *out) 6{ 7 PetscInt i; 8 PetscScalar x,y,z,f = NOTLIKELY,x1 = 0,x2 = 0,x3 = 0,x4 = 0,x5 = 0; 9 PetscScalar f1 = NOTLIKELY, f2 = 0,f3 = 0,f4 = 0,f5 = 0; 10 11 (void)x; 12 (void)y; 13 (void)z; 14 (void)f; 15 (void)x1; 16 (void)x2; 17 (void)x3; 18 (void)x4; 19 (void)x5; 20 (void)f1; 21 (void)f2; 22 (void)f3; 23 (void)f4; 24 (void)f5; 25 for (i=0; i<n; i++) { 26 x1 = x = in[_NIN_*i]; 27#if (_NIN_ > 1) 28 x2 = y = in[_NIN_*i+1]; 29#endif 30#if (_NIN_ > 2) 31 x3 = z = in[_NIN_*i+2]; 32#endif 33#if (_NIN_ > 3) 34 x4 = in[_NIN_*i+3]; 35#endif 36#if (_NIN_ > 4) 37 x5 = in[_NIN_*i+4]; 38#endif 39 FUNCTION; 40 if (f == NOTLIKELY) { 41 out[_NOUT_*i] = f1; 42 } else { 43 out[_NOUT_*i] = f; 44 } 45#if (_NOUT_ > 1) 46 out[_NOUT_*i+1] = f2; 47#endif 48#if (_NOUT_ > 2) 49 out[_NOUT_*i+2] = f3; 50#endif 51#if (_NOUT_ > 3) 52 out[_NOUT_*i+3] = f4; 53#endif 54#if (_NOUT_ > 4) 55 out[_NOUT_*i+4] = f5; 56#endif 57 } 58 return(PETSC_SUCCESS); 59} 60