diff options
author | Dominic Steinitz <dominic@steinitz.org> | 2018-03-20 12:03:09 +0000 |
---|---|---|
committer | Dominic Steinitz <dominic@steinitz.org> | 2018-03-20 12:03:09 +0000 |
commit | 755175a557d07c6f73683f358ddd8f8ee07f26a9 (patch) | |
tree | 447227ac65e48e6d4051d3f48ed30c8fc586083f /packages/sundials/src/helpers.c | |
parent | 17ba35af029cee0122f91fc91427a307a5f11dfa (diff) |
Handle arbitrary systems
Diffstat (limited to 'packages/sundials/src/helpers.c')
-rw-r--r-- | packages/sundials/src/helpers.c | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/packages/sundials/src/helpers.c b/packages/sundials/src/helpers.c index 420d3be..f0ca592 100644 --- a/packages/sundials/src/helpers.c +++ b/packages/sundials/src/helpers.c | |||
@@ -42,25 +42,3 @@ int check_flag(void *flagvalue, const char *funcname, int opt) | |||
42 | 42 | ||
43 | return 0; | 43 | return 0; |
44 | } | 44 | } |
45 | |||
46 | /* check the computed solution */ | ||
47 | int check_ans(N_Vector y, realtype t, realtype rtol, realtype atol) | ||
48 | { | ||
49 | int passfail=0; /* answer pass (0) or fail (1) flag */ | ||
50 | realtype ans, err, ewt; /* answer data, error, and error weight */ | ||
51 | realtype ONE=RCONST(1.0); | ||
52 | |||
53 | /* compute solution error */ | ||
54 | ans = atan(t); | ||
55 | ewt = ONE / (rtol * SUNRabs(ans) + atol); | ||
56 | err = ewt * SUNRabs(NV_Ith_S(y,0) - ans); | ||
57 | |||
58 | /* is the solution within the tolerances? */ | ||
59 | passfail = (err < ONE) ? 0 : 1; | ||
60 | |||
61 | if (passfail) { | ||
62 | fprintf(stdout, "\nSUNDIALS_WARNING: check_ans error=%g \n\n", err); | ||
63 | } | ||
64 | |||
65 | return(passfail); | ||
66 | } | ||