@@ -76,6 +76,9 @@ SimpleX::SimpleX(const string& output_path, const string& data_path){
7676 // Random number generator
7777 ran = gsl_rng_alloc (gsl_rng_taus);
7878
79+ // Qhull library
80+ qh = &Qhull;
81+
7982 // Method for RT
8083 ballisticTransport = 0 ;
8184 dirConsTransport = 0 ;
@@ -1183,7 +1186,7 @@ void SimpleX::compute_triangulation(){
11831186 // assume for now the triangulation will be correct, check will follow
11841187 correct = 1 ;
11851188 // call to qhull to do triangulation
1186- int qh_error = qh_new_qhull (dimension, in_box.size (), pt_array, ismalloc, flags, NULL , errfile);
1189+ int qh_error = qh_new_qhull (qh, dimension, in_box.size (), pt_array, ismalloc, flags, NULL , errfile);
11871190 if (!qh_error) {
11881191 // loop over all facets
11891192 FORALLfacets {
@@ -1192,11 +1195,11 @@ void SimpleX::compute_triangulation(){
11921195 // store the simplex in simplices vector
11931196 unsigned int r=0 ;
11941197 Simpl tempSimpl;
1195- tempSimpl.set_volume ( qh_facetarea (facet) );
1198+ tempSimpl.set_volume ( qh_facetarea (qh, facet) );
11961199
11971200 FOREACHvertex_ (facet->vertices ) {
11981201 // store the indices of each simplex
1199- ids[r++]=idList[qh_pointid (vertex->point )];
1202+ ids[r++]=idList[qh_pointid (qh, vertex->point )];
12001203 }// for each facet
12011204
12021205 tempSimpl.set_id1 ( in_box[ ids[0 ] ] );
@@ -1447,10 +1450,10 @@ void SimpleX::compute_triangulation(){
14471450 }
14481451
14491452 // free long memory
1450- qh_freeqhull (!qh_ALL);
1453+ qh_freeqhull (qh, !qh_ALL);
14511454
14521455 // free short memory and memory allocator
1453- qh_memfreeshort (&curlong, &totlong);
1456+ qh_memfreeshort (qh, &curlong, &totlong);
14541457 if (curlong || totlong) {
14551458 fprintf (errfile, " QHull: did not free %d bytes of long memory (%d pieces)" , totlong, curlong);
14561459 }
0 commit comments