]> granicus.if.org Git - graphviz/commitdiff
generateNonoverlapConstraints: take a C99 bool instead of boolean
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 27 Dec 2021 02:52:23 +0000 (18:52 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 5 Jan 2022 16:04:03 +0000 (08:04 -0800)
Note that this required propagating this change through to `genXConstraints` as
well.

lib/neatogen/constrained_majorization_ipsep.c
lib/neatogen/quad_prog_vpsc.c
lib/neatogen/quad_prog_vpsc.h
lib/vpsc/csolve_VPSC.cpp
lib/vpsc/csolve_VPSC.h

index e4c9f5288533d3d9c63036b76495b34153cd8f29..3c05ee476b4fecf356b46b2ad2b0585775ed3190 100644 (file)
@@ -32,6 +32,7 @@
  **********************************************************/
 
 #include <neatogen/digcola.h>
+#include <stdbool.h>
 #ifdef IPSEPCOLA
 #include <math.h>
 #include <stdlib.h>
@@ -411,7 +412,7 @@ int stress_majorization_cola(vtx_data * graph,      /* Input graph in sparse represen
        if (opt->noverlap == 1 && nsizeScale > 0.001) {
            generateNonoverlapConstraints(cMajEnvHor, nsizeScale, coords,
                                          0,
-                                         nsizeScale < 0.5 ? FALSE : TRUE,
+                                         nsizeScale >= 0.5,
                                          opt);
        }
        if (cMajEnvHor->m > 0) {
@@ -435,7 +436,7 @@ int stress_majorization_cola(vtx_data * graph,      /* Input graph in sparse represen
        }
        if (opt->noverlap == 1 && nsizeScale > 0.001) {
            generateNonoverlapConstraints(cMajEnvVrt, nsizeScale, coords,
-                                         1, FALSE, opt);
+                                         1, false, opt);
        }
        if (cMajEnvVrt->m > 0) {
 #ifdef MOSEK
index bdac4fab6aa69a0d5dfbf8b0e2f7e18ade725a6b..c892e5931c7a12ae6d62142546410fcd8bc19fcf 100644 (file)
@@ -375,7 +375,7 @@ void generateNonoverlapConstraints(CMajEnvVPSC * e,
                                   float nsizeScale,
                                   float **coords,
                                   int k,
-                                  boolean transitiveClosure,
+                                  bool transitiveClosure,
                                   ipsep_options * opt)
 {
     Constraint **csol, **csolptr;
@@ -587,12 +587,12 @@ void removeoverlaps(int n, float **coords, ipsep_options * opt)
 {
     int i;
     CMajEnvVPSC *e = initCMajVPSC(n, NULL, NULL, opt, 0);
-    generateNonoverlapConstraints(e, 1.0, coords, 0, TRUE, opt);
+    generateNonoverlapConstraints(e, 1.0, coords, 0, true, opt);
     solveVPSC(e->vpsc);
     for (i = 0; i < n; i++) {
        coords[0][i] = getVariablePos(e->vs[i]);
     }
-    generateNonoverlapConstraints(e, 1.0, coords, 1, FALSE, opt);
+    generateNonoverlapConstraints(e, 1.0, coords, 1, false, opt);
     solveVPSC(e->vpsc);
     for (i = 0; i < n; i++) {
        coords[1][i] = getVariablePos(e->vs[i]);
index f9a57372de3173452a30d117862f0d9e8db56aa8..7f5b3740969553818b9a6fc4b968baf0c3bcfc4b 100644 (file)
@@ -32,6 +32,7 @@ extern "C" {
 #ifdef MOSEK
 #include <neatogen/mosek_quad_solve.h>
 #endif /* MOSEK */
+#include <stdbool.h>
 
 typedef struct CMajEnvVPSC {
        float **A;
@@ -64,7 +65,7 @@ extern void generateNonoverlapConstraints(
         float nsizeScale,
         float** coords,
         int k,
-       boolean transitiveClosure,
+       bool transitiveClosure,
        ipsep_options* opt
 );
 
index 8002431ff2ea8e7ba80c935f8c6ee11eecf17611..ef2f004b1ed84c994f14fc4b92918d9157c3d57e 100644 (file)
@@ -35,12 +35,13 @@ VPSC* newIncVPSC(int n, Variable* vs[], int m, Constraint* cs[]) {
        return new IncVPSC(n,vs,m,cs);
 }
 
-int genXConstraints(int n, boxf* bb, Variable** vs, Constraint*** cs,int transitiveClosure) {
+int genXConstraints(int n, boxf *bb, Variable **vs, Constraint ***cs,
+                    bool transitiveClosure) {
        std::vector<Rectangle> rs;
        for(int i=0;i<n;i++) {
                rs.emplace_back(bb[i].LL.x,bb[i].UR.x,bb[i].LL.y,bb[i].UR.y);
        }
-       int m = generateXConstraints(rs,vs,*cs,transitiveClosure?true:false);
+       int m = generateXConstraints(rs, vs, *cs, transitiveClosure);
        return m;
 }
 int genYConstraints(int n, boxf* bb, Variable** vs, Constraint*** cs) {
index a5deac8959bd049ae9bb00283aa62f98eee9c4ba..0ea15ecea5020e134d14ce400b8f520206bdd02c 100644 (file)
@@ -15,6 +15,9 @@
  * Adaptagrams repository.
  */
 #pragma once
+
+#include <stdbool.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -43,7 +46,7 @@ typedef struct pointf_s { double x, y; } pointf;
 typedef struct { pointf LL, UR; } boxf;
 #endif
 int genXConstraints(int n, boxf[], Variable** vs, Constraint*** cs,
-               int transitiveClosure);
+               bool transitiveClosure);
 int genYConstraints(int n, boxf[], Variable** vs, Constraint*** cs);
 
 void satisfyVPSC(VPSC*);