Skip to content
Snippets Groups Projects
Commit 749e1550 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fixed memory leak introduced when I added support for curved elements
parent ba55ac39
No related branches found
No related tags found
No related merge requests found
// $Id: Views.cpp,v 1.173 2005-04-06 16:30:52 geuzaine Exp $ // $Id: Views.cpp,v 1.174 2005-04-06 19:03:01 geuzaine Exp $
// //
// Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
// //
...@@ -345,6 +345,7 @@ void EndView(Post_View * v, int add_in_gui, char *file_name, char *name) ...@@ -345,6 +345,7 @@ void EndView(Post_View * v, int add_in_gui, char *file_name, char *name)
Stat_Text(v, v->T3D, v->T3C, 5); Stat_Text(v, v->T3D, v->T3C, 5);
// convert all curved (geometrically 2nd order) elements into linear // convert all curved (geometrically 2nd order) elements into linear
// elements *AND* free all the data associated with the curved
// elements // elements
v->splitCurvedElements(); v->splitCurvedElements();
...@@ -582,6 +583,7 @@ void FreeView(Post_View * v) ...@@ -582,6 +583,7 @@ void FreeView(Post_View * v)
List_Delete(v->SY); List_Delete(v->VY); List_Delete(v->TY); List_Delete(v->SY); List_Delete(v->VY); List_Delete(v->TY);
List_Delete(v->T2D); List_Delete(v->T2C); List_Delete(v->T2D); List_Delete(v->T2C);
List_Delete(v->T3D); List_Delete(v->T3C); List_Delete(v->T3D); List_Delete(v->T3C);
// Note: all the second order elements have already been freed in xxxx
if(v->normals) delete v->normals; if(v->normals) delete v->normals;
if(v->TriVertexArray) delete v->TriVertexArray; if(v->TriVertexArray) delete v->TriVertexArray;
if(v->adaptive) delete v->adaptive; if(v->adaptive) delete v->adaptive;
...@@ -1380,15 +1382,15 @@ void WriteView(Post_View *v, char *filename, int format, int append) ...@@ -1380,15 +1382,15 @@ void WriteView(Post_View *v, char *filename, int format, int append)
} }
// Transform curved elements into linear ones. This is a temporary // Transform curved elements into linear ones and delete all the
// solution, until we can use an Adaptive_Post_View on curved // curved element data. This is a temporary solution, until we can use
// elements, too. // an Adaptive_Post_View on curved elements, too.
void splitCurvedElement(List_T **in, int *nbin, List_T *out, int *nbout, void splitCurvedElement(List_T **in, int *nbin, List_T *out, int *nbout,
int nodin, int nodout, int nbcomp, int nbsplit, int split[][8], int nodin, int nodout, int nbcomp, int nbsplit, int split[][8],
int remove=1) int remove=1)
{ {
if(*nbin == 0) return; if(*nbin){
int nb = List_Nbr(*in) / *nbin; int nb = List_Nbr(*in) / *nbin;
int nbstep = (nb - 3 * nodin) / (nodin * nbcomp); // we don't know this yet for the view int nbstep = (nb - 3 * nodin) / (nodin * nbcomp); // we don't know this yet for the view
for(int i = 0; i < List_Nbr(*in); i += nb) { for(int i = 0; i < List_Nbr(*in); i += nb) {
...@@ -1411,6 +1413,7 @@ void splitCurvedElement(List_T **in, int *nbin, List_T *out, int *nbout, ...@@ -1411,6 +1413,7 @@ void splitCurvedElement(List_T **in, int *nbin, List_T *out, int *nbout,
(*nbout)++; (*nbout)++;
} }
} }
}
if(remove){ if(remove){
*nbin = 0; *nbin = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment