 					//the neighbor seed is new!
 					if (!has_visited_flag)
 					{
-						to_visit[to_visit_pos++] = ns;
+						to_visit[idx][to_visit_pos++] = ns;
 						//has_visited[has_visited_nb++] = ns;
 						atomicAdd(&has_visited_nb[facetidx_in_block], 1);
 						index_t idx = has_visited_nb[facetidx_in_block] - 1;

		
		has_visited_nb[facetidx_in_block] = 0;
		//load \memory[facets_nn] 1 time.
		to_visit[to_visit_pos++] = facets_nn[pid + tid * k_f];
		//has_visited[has_visited_nb++] = to_visit[0];
		atomicAdd(&has_visited_nb[facetidx_in_block], 1);
		has_visited[facetidx_in_block][pid] = to_visit[0];
		__syncthreads();
		//----------------Time Consuming 1 ms----------------
		//has_visited[facetidx_in_block][has_visited_nb[facetidx_in_block]++] = to_visit[0];

			<< "Starting cudaMalloc..\n";
		host_ret_ = (double*)malloc(sizeof(double) * points_nb_ * (dimension_ + 1));
		//host_ret_ = (double*)malloc(sizeof(double) * facet_nb_ * 10 * 40);
		//cudaMalloc((void**)&dev_seeds_info_, DOUBLE_SIZE * points_nb_ * (dimension_ + 1));
		//cudaMemcpyToSymbol(g_seeds_information, &dev_seeds_info_, sizeof(double*), size_t(0), cudaMemcpyHostToDevice);
		//cudaMalloc((void**)&dev_seeds_poly_nb, INT_SIZE * points_nb_);
		//cudaMemcpyToSymbol(g_seeds_polygon_nb, &dev_seeds_poly_nb, sizeof(int*), size_t(0), cudaMemcpyHostToDevice);

		switch (mode)
		{
