Skip to content
Snippets Groups Projects
Commit dabe1e51 authored by David Hendriks's avatar David Hendriks
Browse files

Working on the gridcode for M&S

parent 66ae521a
No related branches found
No related tags found
No related merge requests found
...@@ -1443,6 +1443,7 @@ class Population: ...@@ -1443,6 +1443,7 @@ class Population:
# TODO: Check whether all the probability and phasevol values are correct. # TODO: Check whether all the probability and phasevol values are correct.
# TODO: import only the necessary packages/functions # TODO: import only the necessary packages/functions
# TODO: Put all the masses, eccentricities and periods in there already # TODO: Put all the masses, eccentricities and periods in there already
# TODO: Put the certain blocks that are repeated in some subfunctions
Results in a generated file that contains a system_generator function. Results in a generated file that contains a system_generator function.
""" """
...@@ -1723,6 +1724,11 @@ class Population: ...@@ -1723,6 +1724,11 @@ class Population:
# whether this is the last loop. # whether this is the last loop.
if loopnr == len(self.grid_options["_grid_variables"]) - 1: if loopnr == len(self.grid_options["_grid_variables"]) - 1:
code_string = self._write_gridcode_system_call(code_string, indent, depth, grid_variable, dry_run)
def _write_gridcode_system_call(self, code_string, indent, depth, grid_variable, dry_run):
################################################################################# #################################################################################
# Here are the calls to the queuing or other solution. this part is for every system # Here are the calls to the queuing or other solution. this part is for every system
# Add comment # Add comment
...@@ -1802,9 +1808,11 @@ class Population: ...@@ -1802,9 +1808,11 @@ class Population:
depth -= 1 depth -= 1
code_string += "\n" code_string += "\n"
# Write parts to write below the part that yield the results. # Write parts to write below the part that yield the results.
# this has to go in a reverse order: # this has to go in a reverse order:
# Here comes the stuff that is put after the deepest nested part that calls returns stuff. # Here comes the stuff that is put after the deepest nested part that calls returns stuff.
# Here we will have a
for loopnr, grid_variable_el in enumerate( for loopnr, grid_variable_el in enumerate(
sorted( sorted(
self.grid_options["_grid_variables"].items(), self.grid_options["_grid_variables"].items(),
......
...@@ -669,6 +669,23 @@ int run_system(char * argstring, ...@@ -669,6 +669,23 @@ int run_system(char * argstring,
// store can be NULL, but could be a valid pointer to a store // store can be NULL, but could be a valid pointer to a store
// persistent_data can be NULL, but could be a valid pointer to a persistent_data // persistent_data can be NULL, but could be a valid pointer to a persistent_data
/* Determine whether to free the store memory adress*/
Boolean free_store = FALSE;
if (store==NULL)
{
debug_printf("Decided to free the store memaddr\n");
free_store = TRUE;
}
/* Determine whether to free the persistent data memory adress*/
Boolean free_persistent_data = FALSE;
if (persistent_data == NULL)
{
debug_printf("Decided to free the persistent_data memaddr\n");
free_persistent_data = TRUE;
}
/* Set up new system */ /* Set up new system */
binary_c_new_system(&stardata, // stardata binary_c_new_system(&stardata, // stardata
NULL, // previous_stardatas NULL, // previous_stardatas
...@@ -715,22 +732,6 @@ int run_system(char * argstring, ...@@ -715,22 +732,6 @@ int run_system(char * argstring,
/* get error buffer pointer */ /* get error buffer pointer */
binary_c_error_buffer(stardata, error_buffer); binary_c_error_buffer(stardata, error_buffer);
/* Determine whether to free the store memory adress*/
Boolean free_store = FALSE;
if (store == NULL)
{
debug_printf("Decided to free the store memaddr\n");
free_store = TRUE;
}
/* Determine whether to free the persistent data memory adress*/
Boolean free_persistent_data = FALSE;
if (persistent_data == NULL)
{
debug_printf("Decided to free the persistent_data memaddr\n");
free_persistent_data = TRUE;
}
/* free stardata (except the buffer) */ /* free stardata (except the buffer) */
binary_c_free_memory(&stardata, // Stardata binary_c_free_memory(&stardata, // Stardata
TRUE, // free_preferences TRUE, // free_preferences
...@@ -989,7 +990,7 @@ int return_minimum_orbit_for_RLOF(char * argstring, ...@@ -989,7 +990,7 @@ int return_minimum_orbit_for_RLOF(char * argstring,
binary_c_error_buffer(stardata, error_buffer); binary_c_error_buffer(stardata, error_buffer);
/* Determine whether to free the store memory adress*/ /* Determine whether to free the store memory adress*/
Boolean free_store = FALSE; Boolean free_store = FALSE; // TODO: fix this. Its using capsules now
if (store_memaddr == -1) if (store_memaddr == -1)
{ {
debug_printf("Decided to free the store memaddr\n"); debug_printf("Decided to free the store memaddr\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment