Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Stack overflow error - dD Convex Hulls and Delaunay Triangulations - CGAL

Subject: CGAL users discussion list

List archive

[cgal-discuss] Stack overflow error - dD Convex Hulls and Delaunay Triangulations - CGAL


Chronological Thread 
  • From: Muhammad Abdelghaffar <>
  • To:
  • Subject: [cgal-discuss] Stack overflow error - dD Convex Hulls and Delaunay Triangulations - CGAL
  • Date: Sat, 8 Mar 2014 21:46:08 +0200

Hi, 

I'm trying to construct the delaunay graph for a point set in $d=6$ using the CGAL dD Convex Hulls and Delaunay Triangulations package , but I'm getting a stack overflow error. After inspecting the mesh statistics as the code insert points I found out that the number of "Unbounded simplices" increase dramatically, not sure why. Could you please help me out here ?

I've attached a main.cpp file for my project and my input file, a point set in $d =6$. Also, three snapshots for the mesh statistics, and the stack overflow problem.  


Thanks,

Muhammad A. Awad
MSc Student, Naval Architecture & Marine Engineering
Alexandria University

Attachment: print_statistics_48points.PNG
Description: PNG image

Attachment: stack_overflow.png
Description: PNG image

Attachment: print_statistics_1point.PNG
Description: PNG image

//#include <CGAL/Homogeneous_d.h>
//#include <CGAL/leda_integer.h>
#include <CGAL/Cartesian_d.h>
//#include <CGAL/leda_bigfloat.h>
#include <CGAL/Delaunay_d.h>

#include <list>
#include <iostream>
#include <fstream>


typedef double RT;
typedef CGAL::Cartesian_d<RT> Kernel;
typedef CGAL::Delaunay_d<Kernel> Delaunay_d;
typedef Delaunay_d::Point_d Point;
typedef Delaunay_d::Simplex_handle Simplex_handle;
typedef Delaunay_d::Vertex_handle Vertex_handle;
int main()
{

//	srand (time(NULL));

	size_t num_dim,num_points;

	printf("Reading points.dat input file ..\n");
	std::fstream input("points.dat",std::ios::in);

	size_t domain;
	input >> num_dim >> num_points >> domain;

	Delaunay_d T(num_dim);
	
	double** x = new double* [num_points];
	double bla;
	for (int i = 0; i < num_points; i++)
	{
		x[i] = new double [num_dim];
		for (int j = 0; j < num_dim; j++)
		{
			input >> x[i][j];
			//x[i][j] = double(rand())/double(RAND_MAX);
		}
		input >> bla;
	}

	printf("\t Done Reading ..\n");
	printf("\t num_points = %i ..\n",num_points);

	Vertex_handle* A = new Vertex_handle[num_points];

	printf("Creating the mesh ..\n");

	clock_t start_time = clock();

	for (int i = 0; i < num_points; i++)
	{
		printf("ip = %i \n",i);
		A[i] = T.insert(Point(num_dim,x[i],x[i]+num_dim));

		T.print_statistics();

	}
	
	clock_t end_time = clock();

	printf("\t Done Meshing ..\n");

//	Vertex_handle v1 = T.insert(Point(5,x,x+5));

	T.print_statistics();

//	Simplex_handle s1 = T.simplex(A[0]);

//	T.print_statistics();
   
	
	
	std::list<Simplex_handle> simp_list = T.all_simplices();
 
	std::fstream file("CGALDel.dat",std::ios::out);
	file.precision(45);
	file << simp_list.size()<<std::endl;
	std::fstream timing("CGALDel.txt",std::ios::out);	
	timing <<"Time \t" <<((double) (end_time - start_time)) / CLOCKS_PER_SEC<<"\t seconds" << std::endl;

	printf("Writing output mesh ..\n");

	for (std::list<Simplex_handle>::iterator it=simp_list.begin(); it != simp_list.end(); ++it)
	{
		for (int i = 0; i <= num_dim; i++)
		{
		
			Vertex_handle v1 = T.vertex_of_simplex(*it,i);
			Delaunay_d::Point_d p1 = T.point_of_simplex(*it,i);
		
			file << p1 << std::endl;
	//		printf("%i	",T.index(v1));
		}			
	}

	printf("\t done Writing ..\n");


	system("pause");
}

Attachment: points.dat
Description: Binary data




Archive powered by MHonArc 2.6.18.

Top of Page