Commit f7b61685 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

release some memory

parent 80e38aa5
Pipeline #4581 passed with stage
in 2 minutes and 4 seconds
......@@ -1092,6 +1092,7 @@ void fluid_problem_free(FluidProblem *problem)
free(problem->solution);
free(problem->porosity);
free(problem->oldporosity);
free(problem->node_volume);
hxtLinearSystemDelete(&problem->linear_system);
free(problem->particle_uvw);
free(problem->particle_element_id);
......@@ -1112,6 +1113,7 @@ void fluid_problem_free(FluidProblem *problem)
free(problem->strong_boundaries);
mesh_tree_free(problem->mesh_tree);
mesh_free(problem->mesh);
free(problem);
}
void fluid_problem_adapt_gen_mesh(FluidProblem *problem, double lcmax, double lcmin, double n_el, double cmax, double cmin)
......
......@@ -82,7 +82,7 @@ class FluidProblem :
def __del__(self):
"""Delete the fluid structure."""
if(self._fp != None) :
if(self._fp is not None) :
self._lib.fluid_problem_free(self._fp)
def load_msh(self, mesh_file_name) :
......
......@@ -88,6 +88,11 @@ class ParticleProblem :
if self._p == None :
raise NameError("Cannot create particle problem.")
def __del__(self):
"""Delete the particle solver structure."""
if(self._p is not None) :
self._lib.particleProblemDelete(self._p)
def volume(self):
"""Return the list of particle volumes."""
if self._dim == 2 :
......
......@@ -37,19 +37,6 @@ typedef struct _Disk Disk;
typedef struct _Segment Segment;
typedef struct _Triangle Triangle;
static int check_word_in_file(FILE *f, const char *w) {
char word[256];
if(fscanf(f,"%255s", word) != 1){
printf("Invalid mesh file (\"%s\" expected).\n", w);
return -1;
}
if(strcmp(word, w) != 0){
printf("Invalid mesh file (\"%s\" expected).\n", w);
return -1;
}
return 0;
}
struct _ParticleProblem{
int jacobi;
double relax;
......@@ -1320,6 +1307,10 @@ int particleProblemImportBoundaryVtk(ParticleProblem *p, const char *filename)
else
printf("Unknown boundary object : %i\n", t);
}
free(pts);
free(off);
free(con);
free(typ);
}
else {
printf("unexpected element in \"%s\" : \"%s\"\n",filename, f.name);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment