Skip to content
Snippets Groups Projects
Commit e1fe26aa authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

reduce POINT memory footprint (remove all unused stuff!)
parent bb929483
No related branches found
No related tags found
No related merge requests found
// $Id: DivideAndConquer.cpp,v 1.2 2006-11-25 16:52:44 geuzaine Exp $ // $Id: DivideAndConquer.cpp,v 1.3 2006-11-25 21:33:25 geuzaine Exp $
// //
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
// //
...@@ -55,16 +55,6 @@ static PointRecord *pPointArray; ...@@ -55,16 +55,6 @@ static PointRecord *pPointArray;
int Insert(PointNumero a, PointNumero b); int Insert(PointNumero a, PointNumero b);
int Delete(PointNumero a, PointNumero b); int Delete(PointNumero a, PointNumero b);
void PushgPointArray(PointRecord * ptr)
{
pPointArray = ptr;
}
PointRecord *PopgPointArray(void)
{
return pPointArray;
}
PointNumero Predecessor(PointNumero a, PointNumero b) PointNumero Predecessor(PointNumero a, PointNumero b)
{ {
DListPeek p = pPointArray[a].adjacent; DListPeek p = pPointArray[a].adjacent;
...@@ -119,13 +109,12 @@ PointNumero First(PointNumero x) ...@@ -119,13 +109,12 @@ PointNumero First(PointNumero x)
return (pPointArray[x].adjacent)->point_num; return (pPointArray[x].adjacent)->point_num;
} }
// we use robust predicates here
int Is_left_of(PointNumero x, PointNumero y, PointNumero check) int Is_left_of(PointNumero x, PointNumero y, PointNumero check)
{ {
double pa[2] = {(double)pPointArray[x].where.h, (double)pPointArray[x].where.v}; double pa[2] = {(double)pPointArray[x].where.h, (double)pPointArray[x].where.v};
double pb[2] = {(double)pPointArray[y].where.h, (double)pPointArray[y].where.v}; double pb[2] = {(double)pPointArray[y].where.h, (double)pPointArray[y].where.v};
double pc[2] = {(double)pPointArray[check].where.h, (double)pPointArray[check].where.v}; double pc[2] = {(double)pPointArray[check].where.h, (double)pPointArray[check].where.v};
// we use robust predicates here
double result = gmsh::orient2d(pa, pb, pc); double result = gmsh::orient2d(pa, pb, pc);
return result > 0; return result > 0;
} }
...@@ -207,6 +196,7 @@ int Qtest(PointNumero h, PointNumero i, PointNumero j, PointNumero k) ...@@ -207,6 +196,7 @@ int Qtest(PointNumero h, PointNumero i, PointNumero j, PointNumero k)
double pc[2] = {(double)pPointArray[j].where.h, (double)pPointArray[j].where.v}; double pc[2] = {(double)pPointArray[j].where.h, (double)pPointArray[j].where.v};
double pd[2] = {(double)pPointArray[k].where.h, (double)pPointArray[k].where.v}; double pd[2] = {(double)pPointArray[k].where.h, (double)pPointArray[k].where.v};
// we use robust predicates here
double result = gmsh::incircle(pa, pb, pc, pd) * gmsh::orient2d(pa, pb, pc); double result = gmsh::incircle(pa, pb, pc, pd) * gmsh::orient2d(pa, pb, pc);
return (result < 0) ? 1 : 0; return (result < 0) ? 1 : 0;
...@@ -361,7 +351,7 @@ int comparePoints(const void *i, const void *j) ...@@ -361,7 +351,7 @@ int comparePoints(const void *i, const void *j)
for a window. All error handling is done here. */ for a window. All error handling is done here. */
int DelaunayAndVoronoi(DocPeek doc) int DelaunayAndVoronoi(DocPeek doc)
{ {
PushgPointArray(doc->points); pPointArray = doc->points;
if(doc->numPoints < 2) if(doc->numPoints < 2)
return 1; return 1;
...@@ -474,8 +464,6 @@ int Insert(PointNumero a, PointNumero b) ...@@ -474,8 +464,6 @@ int Insert(PointNumero a, PointNumero b)
return rslt; return rslt;
} }
int DListDelete(DListPeek * dlist, PointNumero oldPoint) int DListDelete(DListPeek * dlist, PointNumero oldPoint)
{ {
DListPeek p; DListPeek p;
...@@ -508,7 +496,6 @@ int DListDelete(DListPeek * dlist, PointNumero oldPoint) ...@@ -508,7 +496,6 @@ int DListDelete(DListPeek * dlist, PointNumero oldPoint)
return 0; return 0;
} }
/* This routine removes the point 'a' in the adjency list of 'b' and /* This routine removes the point 'a' in the adjency list of 'b' and
the point 'b' in the adjency list of 'a'. */ the point 'b' in the adjency list of 'a'. */
......
...@@ -21,10 +21,8 @@ ...@@ -21,10 +21,8 @@
// Please report all bugs and problems to <gmsh@geuz.org>. // Please report all bugs and problems to <gmsh@geuz.org>.
typedef struct _POINT PointRecord, *PointPeek; typedef struct _POINT PointRecord, *PointPeek;
typedef struct _CONTOUR ContourRecord, *ContourPeek;
typedef struct _DOC DocRecord, *DocPeek; typedef struct _DOC DocRecord, *DocPeek;
typedef struct _CDLIST DListRecord, *DListPeek; typedef struct _CDLIST DListRecord, *DListPeek;
typedef struct _MAILLAGE maillage, *maipeek;
typedef struct _DELAUNAY Delaunay, *delpeek; typedef struct _DELAUNAY Delaunay, *delpeek;
typedef int PointNumero; typedef int PointNumero;
...@@ -43,7 +41,6 @@ typedef struct{ ...@@ -43,7 +41,6 @@ typedef struct{
struct _POINT{ struct _POINT{
MPoint where; MPoint where;
DListPeek adjacent; DListPeek adjacent;
int initial, permu, numcontour;
double quality; double quality;
void *data; void *data;
}; };
...@@ -64,13 +61,6 @@ typedef struct{ ...@@ -64,13 +61,6 @@ typedef struct{
int t_length, info_length; int t_length, info_length;
}Striangle; }Striangle;
typedef struct {
PointNumero from;
PointNumero to;
int num;
int seg;
}edge;
typedef struct{ typedef struct{
PointNumero begin; PointNumero begin;
PointNumero end; PointNumero end;
...@@ -97,20 +87,6 @@ struct _DELAUNAY{ ...@@ -97,20 +87,6 @@ struct _DELAUNAY{
Voronoi v; Voronoi v;
}; };
struct _CONTOUR{
PointRecord *oriented_points;
MPoint *perturbations;
int numpoints, numerocontour, numerozon, info;
};
struct _MAILLAGE{
PointRecord *points;
delpeek *listdel;
edge *listedges;
int numedges, numtriangles, numpoints;
int zone;
};
void Make_Mesh_With_Points(DocRecord * ptr, PointRecord * Liste, int Numpoints); void Make_Mesh_With_Points(DocRecord * ptr, PointRecord * Liste, int Numpoints);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment