From 6dc9d9c5dcfb3dd76cff69b290fe4a34bf4bdd5a Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Wed, 24 Apr 2019 22:07:47 +0200 Subject: [PATCH 1/5] Restructured function "MaxPerpendicular" and "MaxRightAngle" in "gm/rm.cc" Moved declarations of variables to their initialization and restricted their scope. Added a new case for "imin" to get rid of the if condition and deleted the now unused variable "TBFR". --- gm/rm.cc | 59 +++++++++++++++++++++++++------------------------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/gm/rm.cc b/gm/rm.cc index 46e6a2857..dda1681bd 100644 --- a/gm/rm.cc +++ b/gm/rm.cc @@ -1870,23 +1870,24 @@ static INT BestLaplaceMMatrix (ELEMENT *theElement) static INT MaxPerpendicular (ELEMENT *theElement) { DOUBLE *Corners[MAX_CORNERS_OF_ELEM]; - DOUBLE_VECTOR MidPoints[MAX_EDGES_OF_ELEM],a,b,c; - INT i,j,imin,TBFR,refrule; - DOUBLE sprd,Max; + DOUBLE_VECTOR MidPoints[MAX_EDGES_OF_ELEM]; /* get physical position of the corners */ - for (i=0; i<CORNERS_OF_ELEM(theElement); i++) + for (INT i=0; i<CORNERS_OF_ELEM(theElement); i++) Corners[i] = CVECT(MYVERTEX(CORNER(theElement,i))); /* get physical position of the midpoints of the edges */ - for (i=0; i<EDGES_OF_ELEM(theElement); i++) + for (INT i=0; i<EDGES_OF_ELEM(theElement); i++) V3_LINCOMB(0.5, Corners[CORNER_OF_EDGE(theElement,i,0)], 0.5, Corners[CORNER_OF_EDGE(theElement,i,1)], MidPoints[i]); - /* try possebilities */ - Max = -MAX_C; imin = -1; - for (i=0; i<3; i++) + /* try possibilities */ + DOUBLE Max = -MAX_C; + INT imin = -1; + for (INT i=0; i<3; i++) { - j = OPPOSITE_EDGE(theElement,i); + DOUBLE_VECTOR a,b,c; + DOUBLE sprd; + INT j = OPPOSITE_EDGE(theElement,i); V3_SUBTRACT(Corners[CORNER_OF_EDGE(theElement,i,0)],Corners[CORNER_OF_EDGE(theElement,i,1)],a) V3_SUBTRACT(Corners[CORNER_OF_EDGE(theElement,j,0)],Corners[CORNER_OF_EDGE(theElement,j,1)],b) @@ -1904,8 +1905,12 @@ static INT MaxPerpendicular (ELEMENT *theElement) } } + INT refrule = ShortestInteriorEdge (theElement); switch (imin) { + case -1 : + UserWrite ("#"); + break; case 0 : refrule = FULL_REFRULE_0_5; break; @@ -1917,14 +1922,6 @@ static INT MaxPerpendicular (ELEMENT *theElement) break; } - - TBFR = ShortestInteriorEdge (theElement); - if (imin == -1) - { - refrule = TBFR; - UserWrite ("#"); - } - return (refrule); } @@ -1951,19 +1948,19 @@ static INT MaxPerpendicular (ELEMENT *theElement) static INT MaxRightAngle (ELEMENT *theElement) { DOUBLE *Corners[MAX_CORNERS_OF_ELEM]; - DOUBLE_VECTOR a,b; - INT i,j,imin,TBFR,refrule; - DOUBLE sprd,Min; /* get physical position of the corners */ - for (i=0; i<CORNERS_OF_ELEM(theElement); i++) + for (INT i=0; i<CORNERS_OF_ELEM(theElement); i++) Corners[i] = CVECT(MYVERTEX(CORNER(theElement,i))); - /* try possebilities */ - Min = MAX_C; imin = -1; - for (i=0; i<3; i++) + /* try possibilities */ + DOUBLE Min = MAX_C; + INT imin = -1; + for (INT i=0; i<3; i++) { - j = OPPOSITE_EDGE(theElement,i); + DOUBLE_VECTOR a,b; + DOUBLE sprd; + INT j = OPPOSITE_EDGE(theElement,i); V3_SUBTRACT(Corners[CORNER_OF_EDGE(theElement,i,0)],Corners[CORNER_OF_EDGE(theElement,i,1)],a) V3_Normalize(a); @@ -1979,8 +1976,12 @@ static INT MaxRightAngle (ELEMENT *theElement) } } + INT refrule = ShortestInteriorEdge (theElement); switch (imin) { + case -1 : + UserWrite ("#"); + break; case 0 : refrule = FULL_REFRULE_0_5; break; @@ -1992,14 +1993,6 @@ static INT MaxRightAngle (ELEMENT *theElement) break; } - - TBFR = ShortestInteriorEdge (theElement); - if (imin == -1) - { - refrule = TBFR; - UserWrite ("#"); - } - return (refrule); } -- GitLab From 7d6bdf9b81c37446a0d4c5d1b0d0041d950ff978 Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Wed, 24 Apr 2019 22:12:29 +0200 Subject: [PATCH 2/5] Restructured function "MaxArea" in "gm/rm.cc" Moved declarations of variables to their initialization and restricted their scope. Added a new case for "imin" to get rid of the if condition and deleted now unused variable "TBFR". --- gm/rm.cc | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/gm/rm.cc b/gm/rm.cc index dda1681bd..82b0c52e0 100644 --- a/gm/rm.cc +++ b/gm/rm.cc @@ -2019,19 +2019,19 @@ static INT MaxRightAngle (ELEMENT *theElement) static INT MaxArea (ELEMENT *theElement) { DOUBLE *Corners[MAX_CORNERS_OF_ELEM]; - DOUBLE_VECTOR a,b,c; - INT i,j,imin,TBFR,refrule; - DOUBLE norm,Max; /* get physical position of the corners */ - for (i=0; i<CORNERS_OF_ELEM(theElement); i++) + for (INT i=0; i<CORNERS_OF_ELEM(theElement); i++) Corners[i] = CVECT(MYVERTEX(CORNER(theElement,i))); /* try possebilities */ - Max = -MAX_C; imin = -1; - for (i=0; i<3; i++) + DOUBLE Max = -MAX_C; + INT imin = -1; + for (INT i=0; i<3; i++) { - j = OPPOSITE_EDGE(theElement,i); + DOUBLE_VECTOR a,b,c; + DOUBLE norm; + INT j = OPPOSITE_EDGE(theElement,i); V3_SUBTRACT(Corners[CORNER_OF_EDGE(theElement,i,0)],Corners[CORNER_OF_EDGE(theElement,i,1)],a) V3_SUBTRACT(Corners[CORNER_OF_EDGE(theElement,j,0)],Corners[CORNER_OF_EDGE(theElement,j,1)],b) @@ -2045,8 +2045,12 @@ static INT MaxArea (ELEMENT *theElement) } } + INT refrule =ShortestInteriorEdge (theElement); switch (imin) { + case -1 : + UserWrite ("#"); + break; case 0 : refrule = FULL_REFRULE_0_5; break; @@ -2058,14 +2062,6 @@ static INT MaxArea (ELEMENT *theElement) break; } - - TBFR = ShortestInteriorEdge (theElement); - if (imin == -1) - { - refrule = TBFR; - UserWrite ("#"); - } - return (refrule); } -- GitLab From 3b6aec9b06f98ce050f970d47c2a52d27bf1b30e Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Sun, 28 Apr 2019 19:48:26 +0200 Subject: [PATCH 3/5] Changed structure of function "MinimalSideAngle" in "gm/rm.cc" Changed this function like the other functions on this branch.(i.e. moved variable declarations to their initialization ) This function was not mentioned by any CI-test. This is probably due to the variable "__ALLRULES__" being undefined. --- gm/rm.cc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/gm/rm.cc b/gm/rm.cc index 82b0c52e0..dfb5276ca 100644 --- a/gm/rm.cc +++ b/gm/rm.cc @@ -1629,37 +1629,38 @@ static INT MinimalSideAngle (ELEMENT *theElement) { DOUBLE *Corners[MAX_CORNERS_OF_ELEM]; DOUBLE_VECTOR MidPoints[MAX_EDGES_OF_ELEM]; - INT i,j,k,l,imin; - DOUBLE MaxAngle,Max,Min; /* get physical position of the corners */ - for (i=0; i<CORNERS_OF_ELEM(theElement); i++) + for (INT i=0; i<CORNERS_OF_ELEM(theElement); i++) Corners[i] = CVECT(MYVERTEX(CORNER(theElement,i))); /* get physical position of the midpoints of the edges */ - for (i=0; i<EDGES_OF_ELEM(theElement); i++) + for (INT i=0; i<EDGES_OF_ELEM(theElement); i++) V3_LINCOMB(0.5, Corners[CORNER_OF_EDGE(theElement,i,0)], 0.5, Corners[CORNER_OF_EDGE(theElement,i,1)], MidPoints[i]); - /* try possebilities */ - Min = 190.0; - for (i=0; i<3; i++) + /* try possibilities */ + DOUBLE Min = 190.0; + INT imin = 0; + for (INT i=0; i<3; i++) { - j = OPPOSITE_EDGE(theElement,i); + INT j = OPPOSITE_EDGE(theElement,i); Corners[2] = MidPoints[i]; Corners[3] = MidPoints[j]; - Max = 0.0; - for (k=0; k<2; k++) + DOUBLE Max = 0.0; + for (INT k=0; k<2; k++) { - for (l=0; l<2; l++) + DOUBLE MaxAngle; + for (INT l=0; l<2; l++) Corners[l] = MidPoints[SideEdgesOfEdge[i][k][l]]; if (TetMaxSideAngle(theElement,Corners,&MaxAngle)) return (FULL_REFRULE_0_5); Max = MAX(Max,MaxAngle); } - for (k=0; k<2; k++) + for (INT k=0; k<2; k++) { - for (l=0; l<2; l++) + DOUBLE MaxAngle; + for (INT l=0; l<2; l++) Corners[l] = MidPoints[SideEdgesOfEdge[j][k][l]]; if (TetMaxSideAngle(theElement,Corners,&MaxAngle)) return (FULL_REFRULE_0_5); -- GitLab From 27bcec49cfc7cf933286e12c69f04793d50d9f31 Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Sun, 5 May 2019 15:51:06 +0000 Subject: [PATCH 4/5] Apply suggestion to gm/rm.cc --- gm/rm.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gm/rm.cc b/gm/rm.cc index 82b0c52e0..1d3f13c54 100644 --- a/gm/rm.cc +++ b/gm/rm.cc @@ -1976,10 +1976,11 @@ static INT MaxRightAngle (ELEMENT *theElement) } } - INT refrule = ShortestInteriorEdge (theElement); + INT refrule; switch (imin) { case -1 : + refrule = ShortestInteriorEdge (theElement); UserWrite ("#"); break; case 0 : -- GitLab From 799de85e81a36c500bb9ac6fa12bfab76675cf25 Mon Sep 17 00:00:00 2001 From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de> Date: Sun, 5 May 2019 18:02:33 +0200 Subject: [PATCH 5/5] Changed assignment regarding "refrule" in "MaxArea", "MaxPerpendicular" and "MaxRightAngle". Changed the assignment of `refrule` as suggested. --- gm/rm.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gm/rm.cc b/gm/rm.cc index 0e6daff1c..d63c0f2b1 100644 --- a/gm/rm.cc +++ b/gm/rm.cc @@ -1906,10 +1906,11 @@ static INT MaxPerpendicular (ELEMENT *theElement) } } - INT refrule = ShortestInteriorEdge (theElement); + INT refrule; switch (imin) { case -1 : + refrule = ShortestInteriorEdge (theElement); UserWrite ("#"); break; case 0 : @@ -2047,10 +2048,11 @@ static INT MaxArea (ELEMENT *theElement) } } - INT refrule =ShortestInteriorEdge (theElement); + INT refrule; switch (imin) { case -1 : + refrule = ShortestInteriorEdge (theElement); UserWrite ("#"); break; case 0 : -- GitLab