[gts-general] memory issue while remeshing
Brought to you by:
popinet
|
From: Márcio R. P. <pi...@gm...> - 2011-03-15 10:24:01
|
Hi all
I've had some memory issues with GTS about remeshing so I decided to run a
very simple test, which is reproduced bellow. The test is simple:
1. create a sphere using gts_surface_generate_sphere
2. n_edges = gts_surface_edge_number(s)
n_edges_coarsen = 0.7*n_edges
n_edges_refine = n_edges
3. Enter a loop:
3.1 apply gts_surface_coarsen using Lindstrom & Turk's algorithm and edge
number as the stop criteria. stopdata = n_edges_coarsen
3.2 apply gts_surface_refine with default functions and stop_number as the
stop critera. stop_data = n_edges_refine. The idea is to return the mesh to
its original vertex_number, edge_number and face_number
If I run this loop long enough I'll eventually run out of memory (8 GB RAM).
How can I solve this problem?
Could it be a bug in the *object_destroy functions?
------------------------------------
code
------------------------------------
#include "lagrangian.h"
static gboolean stop_number (gdouble cost, guint number, guint * max)
{
if (number > *max)
return TRUE;
return FALSE;
}
int main(int argc, char** argv)
{
GtsVolumeOptimizedParams params;
params.volume_weight = 0.5;
params.boundary_weight = 0.5;
params.shape_weight = 1.0e+2;
GtsSurface *s = gts_surface_new(gts_surface_class(), gts_face_class(),
gts_edge_class(), gts_vertex_class());
s=gts_surface_generate_sphere(s,7);
int n_edges_coarsen = 0.7*gts_surface_edge_number(s);
int n_edges_refine = gts_surface_edge_number(s);
int n=0, i=0;
double min_angle = 5.0*DEGREES_TO_RADIANS;
for(i=0;i<1000;++i)
{
gts_surface_coarsen(s,(GtsKeyFunc)gts_volume_optimized_cost,¶ms,(GtsCoarsenFunc)gts_volume_optimized_vertex,¶ms,(GtsStopFunc)gts_coarsen_stop_number,
&n_edges_coarsen, min_angle);
gts_surface_refine(s,NULL,NULL,NULL,NULL,stop_number,
&n_edges_refine);
}
return 0;
}
Thanks for helping
Márcio
--
Márcio Ricardo Pivello
Universidade Federal de Uberlândia
Faculdade de Engenharia Mecânica
Laboratório de Mecânica dos Fluidos
+55 (34) 3239 4040 ramal 618
|