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

Version of HXTSPR that will be used in HXT

 - it avoid allocations by having a small SPR_MAX_PTS=32, allowing to put all arrays statically in the SPRCavity structure.

 - exactInit is called once with the Bbox of the entire mesh (it is probably not a good idea, but we cannot change the definition of predicates.h|c for the whole hxt project)

- it doesn't include most define/ifdef that are in the paper version
parent bc5a2a13
......@@ -164,8 +164,8 @@ static SPRNOINLINE uint32_t add_orient3d(SPRCavity* SPR,
uint32_t val = 2 + (orientation>0.0) - (orientation<0.0);
uint32_t oppval = 2 + (orientation<0.0) - (orientation>0.0);
const unsigned n1 = SPR->points.num;
const unsigned n2 = n1*n1;
const unsigned n1 = SPR_MAX_PTS;
const unsigned n2 = SPR_MAX_PTS*SPR_MAX_PTS;
const unsigned n3 = n2*n1;
unsigned ID, index, bit;
for (int i=0; i<12; i++)
......@@ -199,7 +199,7 @@ static int get_orient3d(SPRCavity* SPR,
{
if(v0==v1 || v0==v2 || v0==v3 || v1==v2 || v1==v3 || v2==v3)
return 0;
const unsigned n = SPR->points.num;
const unsigned n = SPR_MAX_PTS;
unsigned ID = v0*(n*n*n)+v1*(n*n)+v2*n+v3;
unsigned index = ID/16;
unsigned bit = ID%16 * 2;
......@@ -953,7 +953,6 @@ static inline int SPR_init(SPRCavity* SPR)
assert(SPR->points.num <= SPR_MAX_PTS);
assert(SPR->edges.num <= SPR_MAX_EDGES);
assert(SPR->triangles.num <= SPR_MAX_FACES);
const size_t n = SPR->points.num;
{ // initializing map.face
size_t face_len = sizeof(SPR->map.faces)/sizeof(uint16_t);
......
......@@ -21,12 +21,14 @@ Author: Célestin Marot (celestin.marot@uclouvain.be) */
* Same benchmark as in the paper *
* "REVIVING THE SEARCH FOR OPTIMAL TETRAHEDRALIZATIONS", *
* section 2.5 *
* + benchmark in Liu's paper: *
**********************************************************/
#include "HXTSPR.h"
#include <math.h>
#include <time.h>
#include <string.h>
#include "predicates.h"
#define HXT_CHECK(x) do{ int _err=x; if(_err) { fprintf(stderr, "error %d\n",_err); return _err;}}while(0)
......@@ -177,7 +179,8 @@ static int benchmark(double coord[][3], int numCoord, uint8_t face[][3], int num
int main()
{
exactinit(2.0, 2.0, 2.0);
{
double coord[25][3] = {
{0.58671240234164312443709832223248668015003204345703,0.03516283877473333485674800158449215814471244812012,0.04997715958560345478334241420270700473338365554810},
......@@ -690,8 +693,8 @@ int main()
{
// for different size of polyhedron
double (* coord)[3] = malloc(3*sizeof(double) * 40); // we will go up to 40 points
uint8_t (* face)[3] = malloc(3*sizeof(uint8_t) * (12+(40-8)*2));
double (* coord)[3] = malloc(3*sizeof(double) * 32); // we will go up to 32 points
uint8_t (* face)[3] = malloc(3*sizeof(uint8_t) * (12+(32-8)*2));
// we begin with a cube
int numCoord = 8;
......@@ -720,11 +723,11 @@ int main()
memcpy(face[11], (uint8_t[3]){2,1,5}, 3*sizeof(uint8_t));
printf("\nusing growing number of points\n");
for (int i=8; i<=40; i++) {
for (int i=8; i<=32; i++) {
printf("with %d points, %d faces\n", numCoord, numFaces);
HXT_CHECK( benchmark(coord, numCoord, face, numFaces, 0.0) );
if(i==40)
if(i==32)
continue;
// we select the biggest triangle and split it by inserting a point
......@@ -782,5 +785,5 @@ int main()
}
}
return 0;
return 0;
}
\ No newline at end of file
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