accelerInt  v0.1
solver_interface.c
Go to the documentation of this file.
1 
11 #include "solver_interface.h"
12 #include <math.h>
13 
14 #ifdef GENERATE_DOCS
15 namespace generic {
16 #endif
17 
23 void accelerInt_initialize(int num_threads) {
24  initialize_solver(num_threads);
25 }
26 
27 
39 void accelerInt_integrate(const int NUM, const double t_start, const double t_end, const double stepsize,
40  double * __restrict__ y_host, const double * __restrict__ var_host)
41 {
42  double t = t_start;
43  double step = stepsize < 0 ? t_end - t : stepsize;
44  double t_next = fmin(end_time, t + step);
45  int numSteps = 0;
46 
47  // time integration loop
48  while (t + EPS < t_end)
49  {
50  numSteps++;
51  intDriver(NUM, t, t_end, var_host, y_host);
52  t = t_next;
53  t_next = fmin(t_end, (numSteps + 1) * step);
54  }
55 }
56 
57 
63 void accelerInt_cleanup(int num_threads) {
64  cleanup_solver(num_threads);
65 }
66 
67 
68 
69 
70 #ifdef GENERATE_DOCS
71 }
72 #endif
void accelerInt_initialize(int num_threads)
Initializes the solver.
void intDriver(const int NUM, const double t, const double t_end, const double *pr_global, double *y_global)
Integration driver for the CPU integrators.
void cleanup_solver(int num_threads)
Cleans up the created solvers.
Definition: cvodes_init.c:165
void initialize_solver(int num_threads)
Initializes the solver.
Definition: cvodes_init.c:49
void accelerInt_integrate(const int NUM, const double t_start, const double t_end, const double stepsize, double *__restrict__ y_host, const double *__restrict__ var_host)
integrate NUM odes from time t to time t_end, using stepsizes of t_step
void accelerInt_cleanup(int num_threads)
Cleans up the solver.
Definition: solver.h:19
Interface implementation for CPU solvers to be called as a library.
#define EPS
#define end_time