diff --git a/include/binary_c_python.h b/include/binary_c_python.h index be717c3b993eb85baac6bf7b7c28a6eecb819432..3fba5fdf3cae65e0eee7c3ae20ca8cee9b452c8c 100644 --- a/include/binary_c_python.h +++ b/include/binary_c_python.h @@ -41,7 +41,7 @@ int return_version_info(char ** const outstring, int return_minimum_orbit_for_RLOF(char * argstring, - long int store_memaddr, + struct libbinary_c_store_t * store, char ** const buffer, char ** const error_buffer, size_t * const nbytes); diff --git a/src/binary_c_python.c b/src/binary_c_python.c index d0156e6dab2e751168682f1db45e636370d2a9e9..c10f8dfd030c0ea6823b6c76c1ba10ff5197db94 100644 --- a/src/binary_c_python.c +++ b/src/binary_c_python.c @@ -71,32 +71,32 @@ static char module_docstring[] MAYBE_UNUSED = // Evolution function docstrings static char run_system_docstring[] = - "Function to run a system. This is a general function that will be able to handle different kinds of situations: single system run with different settings, population run with different settings, etc. To avoid having too many functions doing slightly different things. \n\nArguments:\n\targstring: argument string for binary_c\n\t(opt) custom_logging_func_memaddr: memory address value for custom logging function. Default = -1 (None)\n\t(opt) store_memaddr: memory adress of the store. Default = -1 (None)\n\t(opt) write_logfile: Boolean (in int form) for whether to enable the writing of the log function. Default = 0\n\t(opt) population: Boolean (in int form) for whether this system is part of a population run. Default = 0."; + "Function to run a system. This is a general function that will be able to handle different kinds of situations: single system run with different settings, population run with different settings, etc. To avoid having too many functions doing slightly different things.\n\nArguments:\n\targstring: argument string for binary_c\n\t(opt) custom_logging_func_memaddr: memory address value for custom logging function. Default = -1 (None)\n\t(opt) store_memaddr: memory adress of the store. Default = -1 (None)\n\t(opt) write_logfile: Boolean (in int form) for whether to enable the writing of the log function. Default = 0\n\t(opt) population: Boolean (in int form) for whether this system is part of a population run. Default = 0."; // Utility function docstrings static char return_arglines_docstring[] = - "Return the default args for a binary_c system"; + "Return the default args for a binary_c system\n\nArguments:\n\tNo arguments."; static char return_help_info_docstring[] = - "Return the help info for a given parameter"; + "Return the help info for a given parameter\n\nArguments:\n\tparameter: parameter name."; static char return_help_all_info_docstring[] = - "Return an overview of all the parameters, their description, categorized in sections"; + "Return an overview of all the parameters, their description, categorized in sections\n\nArguments:\n\tNo arguments."; static char return_version_info_docstring[] = - "Return the version information of the used binary_c build"; + "Return the version information of the used binary_c build\n\nArguments:\n\tNo arguments."; static char return_minimum_orbit_for_RLOF_docstring[] = - "Returns a string containing the minimum orbit and separation for which a binary system does not RLOF at zams. Please use the wrapper functions in utils for this except when you know what you're doing"; + "Returns a string containing the minimum orbit and separation for which a binary system does not RLOF at ZAMS. Please use the wrapper functions in utils for this except when you know what you're doing.\n\nArguments:\n\targstring: argument string for binary_c\n\t(opt) store_capsule: capsule containing memory adress for the store object.unction. Default = Null"; static char return_maximum_mass_ratio_for_RLOF_docstring[] = - "Returns a string containing the maximum mass ratio for which a binary system does not RLOF at zams. Optionally accepts a store_capsule. Please use the wrapper functions in utils for this except when you know what you're doing"; + "Returns a string containing the maximum mass ratio for which a binary system does not RLOF at ZAMS. Please use the wrapper functions in utils for this except when you know what you're doing.\n\nArguments:\n\targstring: argument string for binary_c\n\t(opt) store_capsule: capsule containing memory adress for the store object.unction. Default = Null"; // other functionality static char return_store_memaddr_docstring[] = - "Return the store memory adress that will be passed to run_population"; + "Return the store memory adress that will be passed to run_population\n\nArguments:\n\tNo arguments."; static char return_persistent_data_memaddr_docstring[] = - "Return the store memory adress that will be passed to run_population"; + "Return the store memory adress that will be passed to run_population\n\nArguments:\n\tNo arguments."; static char free_persistent_data_memaddr_and_return_json_output_docstring[] = - "Frees the persistent_data memory and returns the json output"; + "Frees the persistent_data memory and returns the json output.\n\nArguments:\n\tstore capsule: capsule containing the memory adress of the persistent data object (contains the ensemble)"; static char free_store_memaddr_docstring[] = - "Frees the store memaddr"; + "Frees the store memaddr.\n\nArguments:\n\tstore capsule: capsule containing the memory adress of the store object"; static char test_func_docstring[] = "Function that contains random snippets. Do not expect this to remain available, or reliable. i.e. dont use it. "; @@ -421,7 +421,7 @@ static PyObject* python_return_minimum_orbit_for_RLOF(PyObject *self, PyObject * /* Call c-function */ int out MAYBE_UNUSED = return_minimum_orbit_for_RLOF( argstring, // String containing the arguments for the system - store_memaddr, // value for store memaddr + store, // value for store memaddr &buffer, &error_buffer, &nbytes); @@ -1068,7 +1068,7 @@ int return_version_info(char ** const buffer, } int return_minimum_orbit_for_RLOF(char * argstring, - long int store_memaddr, + struct libbinary_c_store_t * store, char ** buffer, char ** error_buffer, size_t * nbytes) @@ -1078,23 +1078,20 @@ int return_minimum_orbit_for_RLOF(char * argstring, * that leads to RLOF */ + + /* memory for system */ struct libbinary_c_stardata_t *stardata = NULL; - // Store: - /* Check the value of the store_memaddr */ - struct libbinary_c_store_t *store; - if(store_memaddr != -1) - { - // load the store from the integer that has been passed - store = (void*)store_memaddr; - } - else + /* Determine whether to free the store memory adress*/ + Boolean free_store = FALSE; + if (store==NULL) { - // struct libbinary_c_store_t * store = NULL; - store = NULL; + debug_printf("Decided to free the store memaddr\n"); + free_store = TRUE; } - + + // binary_c_new_system(&stardata, NULL, NULL, @@ -1122,13 +1119,7 @@ int return_minimum_orbit_for_RLOF(char * argstring, /* Put errors in error buffer */ binary_c_error_buffer(stardata, error_buffer); - /* Determine whether to free the store memory adress*/ - Boolean free_store = FALSE; // TODO: fix this. Its using capsules now - if (store_memaddr == -1) - { - debug_printf("Decided to free the store memaddr\n"); - free_store = TRUE; - } + // Boolean free_persistent_data = FALSE; /* free stardata (except the buffer) */