Skip to content

Commit

Permalink
Merge pull request #8 from rveltz/pull-julia-wrapper
Browse files Browse the repository at this point in the history
add memory management for a Julia wrapper
  • Loading branch information
sdwfrost authored Apr 13, 2017
2 parents 56796da + cb7ebee commit 014a16b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
20 changes: 20 additions & 0 deletions src/lsoda.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,3 +878,23 @@ int lsoda(struct lsoda_context_t * ctx, double *y, double *t, double tout) {
} /* end while */

} /* end lsoda */

///////////////////////////////////
struct lsoda_context_t * lsoda_create_ctx()
{
struct lsoda_context_t * mem = malloc(sizeof(struct lsoda_context_t));
return mem;
}

struct lsoda_opt_t * lsoda_create_opt()
{
struct lsoda_opt_t * mem = malloc(sizeof(struct lsoda_opt_t));
return mem;
}

void lsoda_free_opt(struct lsoda_opt_t * opt)
{
free(opt->atol);
free(opt->rtol);
free(opt);
}
8 changes: 6 additions & 2 deletions src/lsoda.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef _LSODA_H_
#define _LSODA_H_

#include <stdlib.h>
/* ************************************
*
*/
Expand Down Expand Up @@ -34,10 +34,14 @@ struct lsoda_context_t {
struct lsoda_opt_t * opt;
};


int lsoda_prepare(struct lsoda_context_t * ctx, struct lsoda_opt_t * opt);
void lsoda_reset(struct lsoda_context_t * ctx);
int lsoda(struct lsoda_context_t * ctx, double *y, double *t, double tout);
void lsoda_free(struct lsoda_context_t * ctx);
void lsoda_free_opt(struct lsoda_opt_t * opt);

struct lsoda_context_t * lsoda_create_ctx();
struct lsoda_opt_t * lsoda_create_opt();


#endif

0 comments on commit 014a16b

Please sign in to comment.