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

cleanup

parent b6ac2823
Branches
Tags
No related merge requests found
...@@ -889,7 +889,6 @@ static int compareAbsCurve(const void *a, const void *b) ...@@ -889,7 +889,6 @@ static int compareAbsCurve(const void *a, const void *b)
static void CopyCurve(Curve *c, Curve *cc, bool copyMeshingMethod) static void CopyCurve(Curve *c, Curve *cc, bool copyMeshingMethod)
{ {
int i, j;
cc->Typ = c->Typ; cc->Typ = c->Typ;
if(copyMeshingMethod){ if(copyMeshingMethod){
cc->Method = c->Method; cc->Method = c->Method;
...@@ -898,8 +897,8 @@ static void CopyCurve(Curve *c, Curve *cc, bool copyMeshingMethod) ...@@ -898,8 +897,8 @@ static void CopyCurve(Curve *c, Curve *cc, bool copyMeshingMethod)
cc->coeffTransfinite = c->coeffTransfinite; cc->coeffTransfinite = c->coeffTransfinite;
} }
cc->l = c->l; cc->l = c->l;
for(i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
for(j = 0; j < 4; j++) for(int j = 0; j < 4; j++)
cc->mat[i][j] = c->mat[i][j]; cc->mat[i][j] = c->mat[i][j];
cc->beg = c->beg; cc->beg = c->beg;
cc->end = c->end; cc->end = c->end;
...@@ -908,24 +907,22 @@ static void CopyCurve(Curve *c, Curve *cc, bool copyMeshingMethod) ...@@ -908,24 +907,22 @@ static void CopyCurve(Curve *c, Curve *cc, bool copyMeshingMethod)
cc->Control_Points = List_Create(List_Nbr(c->Control_Points), 1, sizeof(Vertex *)); cc->Control_Points = List_Create(List_Nbr(c->Control_Points), 1, sizeof(Vertex *));
List_Copy(c->Control_Points, cc->Control_Points); List_Copy(c->Control_Points, cc->Control_Points);
End_Curve(cc); End_Curve(cc);
Tree_Insert(GModel::current()->getGEOInternals()->Curves, &cc);
} }
static Curve *DuplicateCurve(Curve *c, bool copyMeshingMethod) static Curve *DuplicateCurve(Curve *c, bool copyMeshingMethod)
{ {
Curve *pc; Curve *pc = Create_Curve(NEWLINE(), 0, 1, NULL, NULL, -1, -1, 0., 1.);
Vertex *v, *newv;
pc = Create_Curve(NEWLINE(), 0, 1, NULL, NULL, -1, -1, 0., 1.);
CopyCurve(c, pc, copyMeshingMethod); CopyCurve(c, pc, copyMeshingMethod);
Tree_Insert(GModel::current()->getGEOInternals()->Curves, &pc);
pc->beg = DuplicateVertex(c->beg);
pc->end = DuplicateVertex(c->end);
for(int i = 0; i < List_Nbr(c->Control_Points); i++) { for(int i = 0; i < List_Nbr(c->Control_Points); i++) {
Vertex *v;
List_Read(pc->Control_Points, i, &v); List_Read(pc->Control_Points, i, &v);
newv = DuplicateVertex(v); Vertex *newv = DuplicateVertex(v);
List_Write(pc->Control_Points, i, &newv); List_Write(pc->Control_Points, i, &newv);
} }
pc->beg = DuplicateVertex(c->beg);
pc->end = DuplicateVertex(c->end);
CreateReversedCurve(pc); CreateReversedCurve(pc);
return pc; return pc;
} }
...@@ -942,19 +939,17 @@ static void CopySurface(Surface *s, Surface *ss, bool copyMeshingMethod) ...@@ -942,19 +939,17 @@ static void CopySurface(Surface *s, Surface *ss, bool copyMeshingMethod)
ss->Generatrices = List_Create(List_Nbr(s->Generatrices), 1, sizeof(Curve *)); ss->Generatrices = List_Create(List_Nbr(s->Generatrices), 1, sizeof(Curve *));
List_Copy(s->Generatrices, ss->Generatrices); List_Copy(s->Generatrices, ss->Generatrices);
End_Surface(ss); End_Surface(ss);
Tree_Insert(GModel::current()->getGEOInternals()->Surfaces, &ss);
} }
static Surface *DuplicateSurface(Surface *s, bool copyMeshingMethod) static Surface *DuplicateSurface(Surface *s, bool copyMeshingMethod)
{ {
Surface *ps; Surface *ps = Create_Surface(NEWSURFACE(), 0);
Curve *c, *newc;
ps = Create_Surface(NEWSURFACE(), 0);
CopySurface(s, ps, copyMeshingMethod); CopySurface(s, ps, copyMeshingMethod);
Tree_Insert(GModel::current()->getGEOInternals()->Surfaces, &ps);
for(int i = 0; i < List_Nbr(ps->Generatrices); i++) { for(int i = 0; i < List_Nbr(ps->Generatrices); i++) {
Curve *c;
List_Read(ps->Generatrices, i, &c); List_Read(ps->Generatrices, i, &c);
newc = DuplicateCurve(c, copyMeshingMethod); Curve *newc = DuplicateCurve(c, copyMeshingMethod);
List_Write(ps->Generatrices, i, &newc); List_Write(ps->Generatrices, i, &newc);
} }
return ps; return ps;
...@@ -971,19 +966,17 @@ static void CopyVolume(Volume *v, Volume *vv, bool copyMeshingMethod) ...@@ -971,19 +966,17 @@ static void CopyVolume(Volume *v, Volume *vv, bool copyMeshingMethod)
List_Copy(v->Surfaces, vv->Surfaces); List_Copy(v->Surfaces, vv->Surfaces);
List_Copy(v->SurfacesOrientations, vv->SurfacesOrientations); List_Copy(v->SurfacesOrientations, vv->SurfacesOrientations);
List_Copy(v->SurfacesByTag, vv->SurfacesByTag); List_Copy(v->SurfacesByTag, vv->SurfacesByTag);
Tree_Insert(GModel::current()->getGEOInternals()->Volumes, &vv);
} }
static Volume *DuplicateVolume(Volume *v, bool copyMeshingMethod) static Volume *DuplicateVolume(Volume *v, bool copyMeshingMethod)
{ {
Volume *pv; Volume *pv = Create_Volume(NEWVOLUME(), 0);
Surface *s, *news;
pv = Create_Volume(NEWVOLUME(), 0);
CopyVolume(v, pv, copyMeshingMethod); CopyVolume(v, pv, copyMeshingMethod);
Tree_Insert(GModel::current()->getGEOInternals()->Volumes, &pv);
for(int i = 0; i < List_Nbr(pv->Surfaces); i++) { for(int i = 0; i < List_Nbr(pv->Surfaces); i++) {
Surface *s;
List_Read(pv->Surfaces, i, &s); List_Read(pv->Surfaces, i, &s);
news = DuplicateSurface(s, copyMeshingMethod); Surface *news = DuplicateSurface(s, copyMeshingMethod);
List_Write(pv->Surfaces, i, &news); List_Write(pv->Surfaces, i, &news);
} }
return pv; return pv;
...@@ -1366,15 +1359,13 @@ void VisibilityShape(char *str, int Type, int Mode) ...@@ -1366,15 +1359,13 @@ void VisibilityShape(char *str, int Type, int Mode)
Curve *CreateReversedCurve(Curve *c) Curve *CreateReversedCurve(Curve *c)
{ {
Curve *newc; Curve *newc = Create_Curve(-c->Num, c->Typ, 1, NULL, NULL, -1, -1, 0., 1.);
Vertex *e1, *e2, *e3, *e4;
int i;
newc = Create_Curve(-c->Num, c->Typ, 1, NULL, NULL, -1, -1, 0., 1.);
if(List_Nbr(c->Control_Points)){ if(List_Nbr(c->Control_Points)){
newc->Control_Points = newc->Control_Points =
List_Create(List_Nbr(c->Control_Points), 1, sizeof(Vertex *)); List_Create(List_Nbr(c->Control_Points), 1, sizeof(Vertex *));
if(c->Typ == MSH_SEGM_ELLI || c->Typ == MSH_SEGM_ELLI_INV) { if(c->Typ == MSH_SEGM_ELLI || c->Typ == MSH_SEGM_ELLI_INV) {
Vertex *e1, *e2, *e3, *e4;
List_Read(c->Control_Points, 0, &e1); List_Read(c->Control_Points, 0, &e1);
List_Read(c->Control_Points, 1, &e2); List_Read(c->Control_Points, 1, &e2);
List_Read(c->Control_Points, 2, &e3); List_Read(c->Control_Points, 2, &e3);
...@@ -1390,7 +1381,7 @@ Curve *CreateReversedCurve(Curve *c) ...@@ -1390,7 +1381,7 @@ Curve *CreateReversedCurve(Curve *c)
if(c->Typ == MSH_SEGM_NURBS && c->k) { if(c->Typ == MSH_SEGM_NURBS && c->k) {
newc->k = new float[c->degre + List_Nbr(c->Control_Points) + 1]; newc->k = new float[c->degre + List_Nbr(c->Control_Points) + 1];
for(i = 0; i < c->degre + List_Nbr(c->Control_Points) + 1; i++) for(int i = 0; i < c->degre + List_Nbr(c->Control_Points) + 1; i++)
newc->k[c->degre + List_Nbr(c->Control_Points) - i] = c->k[i]; newc->k[c->degre + List_Nbr(c->Control_Points) - i] = c->k[i];
} }
...@@ -1427,13 +1418,12 @@ Curve *CreateReversedCurve(Curve *c) ...@@ -1427,13 +1418,12 @@ Curve *CreateReversedCurve(Curve *c)
int recognize_seg(int typ, List_T *liste, int *seg) int recognize_seg(int typ, List_T *liste, int *seg)
{ {
int i, beg, end;
Curve *pc;
List_T *temp = Tree2List(GModel::current()->getGEOInternals()->Curves); List_T *temp = Tree2List(GModel::current()->getGEOInternals()->Curves);
int beg, end;
List_Read(liste, 0, &beg); List_Read(liste, 0, &beg);
List_Read(liste, List_Nbr(liste) - 1, &end); List_Read(liste, List_Nbr(liste) - 1, &end);
for(i = 0; i < List_Nbr(temp); i++) { for(int i = 0; i < List_Nbr(temp); i++) {
Curve *pc;
List_Read(temp, i, &pc); List_Read(temp, i, &pc);
if(pc->Typ == typ && pc->beg->Num == beg && pc->end->Num == end) { if(pc->Typ == typ && pc->beg->Num == beg && pc->end->Num == end) {
List_Delete(temp); List_Delete(temp);
...@@ -1447,13 +1437,11 @@ int recognize_seg(int typ, List_T *liste, int *seg) ...@@ -1447,13 +1437,11 @@ int recognize_seg(int typ, List_T *liste, int *seg)
int recognize_loop(List_T *liste, int *loop) int recognize_loop(List_T *liste, int *loop)
{ {
int i, res; int res = 0;
EdgeLoop *pe;
res = 0;
*loop = 0; *loop = 0;
List_T *temp = Tree2List(GModel::current()->getGEOInternals()->EdgeLoops); List_T *temp = Tree2List(GModel::current()->getGEOInternals()->EdgeLoops);
for(i = 0; i < List_Nbr(temp); i++) { for(int i = 0; i < List_Nbr(temp); i++) {
EdgeLoop *pe;
List_Read(temp, i, &pe); List_Read(temp, i, &pe);
if(!compare2Lists(pe->Curves, liste, fcmp_absint)) { if(!compare2Lists(pe->Curves, liste, fcmp_absint)) {
res = 1; res = 1;
...@@ -1467,13 +1455,11 @@ int recognize_loop(List_T *liste, int *loop) ...@@ -1467,13 +1455,11 @@ int recognize_loop(List_T *liste, int *loop)
int recognize_surfloop(List_T *liste, int *loop) int recognize_surfloop(List_T *liste, int *loop)
{ {
int i, res; int res = 0;
EdgeLoop *pe;
res = 0;
*loop = 0; *loop = 0;
List_T *temp = Tree2List(GModel::current()->getGEOInternals()->SurfaceLoops); List_T *temp = Tree2List(GModel::current()->getGEOInternals()->SurfaceLoops);
for(i = 0; i < List_Nbr(temp); i++) { for(int i = 0; i < List_Nbr(temp); i++) {
EdgeLoop *pe;
List_Read(temp, i, &pe); List_Read(temp, i, &pe);
if(!compare2Lists(pe->Curves, liste, fcmp_absint)) { if(!compare2Lists(pe->Curves, liste, fcmp_absint)) {
res = 1; res = 1;
...@@ -1489,14 +1475,12 @@ int recognize_surfloop(List_T *liste, int *loop) ...@@ -1489,14 +1475,12 @@ int recognize_surfloop(List_T *liste, int *loop)
static void SetTranslationMatrix(double matrix[4][4], double T[3]) static void SetTranslationMatrix(double matrix[4][4], double T[3])
{ {
int i, j; for(int i = 0; i < 4; i++) {
for(int j = 0; j < 4; j++) {
for(i = 0; i < 4; i++) {
for(j = 0; j < 4; j++) {
matrix[i][j] = (i == j) ? 1.0 : 0.0; matrix[i][j] = (i == j) ? 1.0 : 0.0;
} }
} }
for(i = 0; i < 3; i++) for(int i = 0; i < 3; i++)
matrix[i][3] = T[i]; matrix[i][3] = T[i];
} }
...@@ -1626,10 +1610,9 @@ static void SetRotationMatrix(double matrix[4][4], double Axe[3], double alpha) ...@@ -1626,10 +1610,9 @@ static void SetRotationMatrix(double matrix[4][4], double Axe[3], double alpha)
static void vecmat4x4(double mat[4][4], double vec[4], double res[4]) static void vecmat4x4(double mat[4][4], double vec[4], double res[4])
{ {
int i, j; for(int i = 0; i < 4; i++) {
for(i = 0; i < 4; i++) {
res[i] = 0.0; res[i] = 0.0;
for(j = 0; j < 4; j++) { for(int j = 0; j < 4; j++) {
res[i] += mat[i][j] * vec[j]; res[i] += mat[i][j] * vec[j];
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment