Commit f77edb6f authored by Célestin Marot's avatar Célestin Marot
Browse files

weird bug... don't know when it was introduced

parent 94ec4ec5
cmake_minimum_required(VERSION 3.9)
project(HXT C)
include(CheckCCompilerFlag)
set(EXEC_NAME hxtDelaunay_sequential)
add_executable(${EXEC_NAME}
......@@ -17,15 +15,9 @@ add_executable(${EXEC_NAME}
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s -fvisibility=hidden") #to avoid any function names in the executable
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Ofast -march=native -ffast-math")
set_source_files_properties(./src/predicates.c PROPERTIES COMPILE_FLAGS "-fno-unsafe-math-optimizations -ffp-contract=off")
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Ofast -xHost -std=c99 -ansi-alias -restrict -fp-model fast")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_Float128=__float128") # a bug in my icc
set_source_files_properties(./src/predicates.c PROPERTIES COMPILE_FLAGS "-fp-model strict")
endif()
#debug
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -g -DDEBUG")
......@@ -39,7 +39,7 @@ typedef struct HXT_Delaunay_struct {
uint64_t num_deleted;
uint64_t size_deleted;
uint32_t* buffer;
uint64_t* buffer;
} Delaunay_t;
static inline uint64_t walking2cavity(mesh_t* mesh, uint64_t curTet, const uint32_t vta);
......@@ -226,7 +226,7 @@ status_t HXT_tetrahedra_compute(mesh_t* mesh){
HXT_CHECK( HXT_malloc(&Del.tmp, Del.size_tmp*sizeof(Del.tmp[0])) );
HXT_CHECK( HXT_malloc(&Del.deleted, Del.size_deleted*sizeof(uint64_t)) );
HXT_CHECK( HXT_malloc(&Del.buffer, (mesh->num_vertices+1)*sizeof(uint64_t)) );
HXT_CHECK( HXT_malloc(&Del.buffer, 32*(mesh->num_vertices+1)*sizeof(uint64_t)) );
uint64_t curTet = 0; // we always begin with the first tet. (index 0)
......@@ -570,7 +570,7 @@ status_t computeAdjacencies(mesh_t* mesh, Delaunay_t* Del, const uint64_t start,
if(blength<=60){ // N+2<=32 => N<=30 => 2N<=60
// for each point p on the surface of the cavity, compute p-vti
uint32_t* buffer = Del->buffer;
uint64_t* buffer = Del->buffer;
uint64_t i;
......@@ -597,6 +597,10 @@ status_t computeAdjacencies(mesh_t* mesh, Delaunay_t* Del, const uint64_t start,
buffer[Node[3]+1] = npts++;
}
Node[3] = buffer[Node[3]+1];
HXT_ASSERT(Node[1]<=mesh->num_vertices);
HXT_ASSERT(Node[2]<=mesh->num_vertices);
HXT_ASSERT(Node[3]<=mesh->num_vertices);
}
for (i=0; i<blength; i++)
......
......@@ -112,18 +112,37 @@ status_t create_nodes(bbox_t* bbox, vertex_t** vertices_p, uint32_t npts)
{
HXT_CHECK( HXT_malloc(vertices_p, sizeof(vertex_t)*npts) );
for (uint32_t i=0; i<npts; i++) {
(*vertices_p)[i].coord[0] = (double) rand()/RAND_MAX;
(*vertices_p)[i].coord[1] = (double) rand()/RAND_MAX;
(*vertices_p)[i].coord[2] = (double) rand()/RAND_MAX;
// for (uint32_t i=0; i<npts; i++) {
// (*vertices_p)[i].coord[0] = (double) rand()/RAND_MAX;
// (*vertices_p)[i].coord[1] = (double) rand()/RAND_MAX;
// (*vertices_p)[i].coord[2] = (double) rand()/RAND_MAX;
// }
// bbox->min[0] = 0.0;
// bbox->min[1] = 0.0;
// bbox->min[2] = 0.0;
// bbox->max[0] = 1.0;
// bbox->max[1] = 1.0;
// bbox->max[2] = 1.0;
for(uint32_t i=0; i<npts/2; i++) {
(*vertices_p)[i].coord[0] = 0.0;
(*vertices_p)[i].coord[1] = 2.0*i/npts;
(*vertices_p)[i].coord[2] = 0.5;
}
for(uint32_t i=npts/2; i<npts; i++) {
(*vertices_p)[i].coord[0] = 1.0;
(*vertices_p)[i].coord[1] = 0.5;
(*vertices_p)[i].coord[2] = 2.0*(i - npts/2)/npts;
}
bbox->min[0] = 0.0;
bbox->min[1] = 0.0;
bbox->min[2] = 0.0;
bbox->max[0] = 1.0;
bbox->max[1] = 1.0;
bbox->max[2] = 1.0;
bbox->max[1] = 2.0*(npts-1)/npts;
bbox->max[2] = 2.0*(npts - 1 - npts/2)/npts;
return HXT_STATUS_OK;
}
......@@ -158,6 +177,7 @@ int main(int argc, char **argv)
if(sscanf(argv[1]+1, " %u ", &mesh->num_vertices)==0)
return HXT_ERROR_MSG(HXT_STATUS_ERROR ,"%s is not a valid number", argv[1]+1);
HXT_INFO("creating %u vertices", mesh->num_vertices);
HXT_CHECK( create_nodes(&mesh->bbox, &mesh->vertices, mesh->num_vertices) );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment