*** empty log message ***
authorarif <devnull@localhost>
Fri, 14 Mar 2008 14:46:20 +0000 (14:46 +0000)
committerarif <devnull@localhost>
Fri, 14 Mar 2008 14:46:20 +0000 (14:46 +0000)
13 files changed:
cmd/smyrna/draw.c
cmd/smyrna/gui/menucallbacks.c
cmd/smyrna/gui/menucallbacks.h
cmd/smyrna/hier.c
cmd/smyrna/hier.h
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topview.c
cmd/smyrna/topview.h
cmd/smyrna/viewport.c
lib/glcomp/glcompset.c
lib/topfish/delaunay.c
lib/topfish/hierarchy.c
lib/topfish/rescale_layout.c

index 1805585717bfca01ce05b9cd49a8ba4efe7163ca..5aa0d447f252f84ea1ea79d9a9b476130228dd86 100755 (executable)
@@ -63,7 +63,7 @@ void DrawBezier(GLfloat* xp,GLfloat* yp,GLfloat* zp, int filled,int param)
                if (param==0)
                        glColor4f(view->penColor.R,view->penColor.G,view->penColor.B,view->penColor.A);
                if (param==1)   //selected
-                       glColor4f(view->selectColor.R,view->selectColor.G,view->selectColor.B,view->selectColor.A);
+                       glColor4f(view->selectedNodeColor.R,view->selectedNodeColor.G,view->selectedNodeColor.B,view->selectedNodeColor.A);
                glBegin(GL_LINE_STRIP);
        }
        else
@@ -71,7 +71,7 @@ void DrawBezier(GLfloat* xp,GLfloat* yp,GLfloat* zp, int filled,int param)
                if (param==0)
                        glColor4f(view->fillColor.R,view->fillColor.G,view->fillColor.B,view->penColor.A);
                if (param==1)   //selected
-                       glColor4f(view->selectColor.R,view->selectColor.G,view->selectColor.B,view->selectColor.A);
+                       glColor4f(view->selectedNodeColor.R,view->selectedNodeColor.G,view->selectedNodeColor.B,view->selectedNodeColor.A);
                glBegin(GL_POLYGON);
        }
        /* We will not actually draw a curve, but we will divide the curve into small
@@ -205,7 +205,7 @@ void DrawEllipse(xdot_op* op,int param)
                if (param==0)   
                        glColor4f(view->fillColor.R,view->fillColor.G,view->fillColor.B,view->fillColor.A);
                if (param==1)   //selected
-                       glColor4f(view->selectColor.R,view->selectColor.G,view->selectColor.B,view->selectColor.A);
+                       glColor4f(view->selectedNodeColor.R,view->selectedNodeColor.G,view->selectedNodeColor.B,view->selectedNodeColor.A);
 
                filled=1;
        }
@@ -214,7 +214,7 @@ void DrawEllipse(xdot_op* op,int param)
                if (param==0)
                        glColor4f(view->penColor.R,view->penColor.G,view->penColor.B,view->penColor.A);
                if (param==1)   //selected
-                       glColor4f(view->selectColor.R,view->selectColor.G,view->selectColor.B,view->selectColor.A);
+                       glColor4f(view->selectedNodeColor.R,view->selectedNodeColor.G,view->selectedNodeColor.B,view->selectedNodeColor.A);
 
                filled=0;
        }
@@ -246,7 +246,7 @@ void DrawPolygon(xdot_op* op,int param)
                if(param==0)
                        glColor4f(view->fillColor.R,view->fillColor.G,view->fillColor.B,view->fillColor.A);
                if (param==1)   //selected
-                       glColor4f(view->selectColor.R,view->selectColor.G,view->selectColor.B,view->selectColor.A);
+                       glColor4f(view->selectedNodeColor.R,view->selectedNodeColor.G,view->selectedNodeColor.B,view->selectedNodeColor.A);
 
                filled=1;
        }
@@ -256,7 +256,7 @@ void DrawPolygon(xdot_op* op,int param)
                if(param==0)
                        glColor4f(view->penColor.R,view->penColor.G,view->penColor.B,view->penColor.A);
                if (param==1)   //selected
-                       glColor4f(view->selectColor.R,view->selectColor.G,view->selectColor.B,view->selectColor.A);
+                       glColor4f(view->selectedNodeColor.R,view->selectedNodeColor.G,view->selectedNodeColor.B,view->selectedNodeColor.A);
 
        }
        glLineWidth(view->LineWidth);
@@ -278,7 +278,7 @@ void DrawPolyline(xdot_op* op,int param)
        if(param==0)    
                glColor4f(view->penColor.R,view->penColor.G,view->penColor.B,view->penColor.A);
        if (param==1)   //selected
-               glColor4f(view->selectColor.R,view->selectColor.G,view->selectColor.B,view->selectColor.A);
+               glColor4f(view->selectedNodeColor.R,view->selectedNodeColor.G,view->selectedNodeColor.B,view->selectedNodeColor.A);
        SelectPolyline(op);
        set_options(op,param);
        glLineWidth(view->LineWidth);
@@ -358,7 +358,7 @@ void EmbedText(xdot_op* op,int param)
        if(param==0)
                fontColor (view->penColor.R,view->penColor.G,view->penColor.B);
        if (param==1)   //selected
-               fontColor (view->selectColor.R,view->selectColor.G,view->selectColor.B);
+               fontColor (view->selectedNodeColor.R,view->selectedNodeColor.G,view->selectedNodeColor.B);
 
        fontDrawString ((int)(x-dx),op->u.text.y-(int)dy,op->u.text.text,op->u.text.width);
 }
index 27cee7af97b3d7dc935f07489659f0633a5eda66..6a5b08e402aefd1ee201f09d629225087125266c 100755 (executable)
@@ -18,6 +18,7 @@
 #include "viewport.h"
 #include "tvnodes.h"
 #include "selection.h"
+#include "topviewsettings.h"
 
 
 //file
@@ -120,6 +121,10 @@ void mNewSlot (GtkWidget *widget,gpointer user_data)
   void mDeleteSlot (GtkWidget *widget,gpointer user_data)
 {
 }
+void mTopviewSettingsSlot (GtkWidget *widget,gpointer user_data)
+{
+       show_settings_form();
+}
 
 
 
index 4d1ebd512852e192095a7baeccacbc2f1cf371aa..1b8bc15ee047a1e188e95e69eb24cbdafdd200cf 100755 (executable)
@@ -33,6 +33,7 @@ _BB void mCutSlot (GtkWidget *widget,gpointer user_data);
 _BB void mCopySlot (GtkWidget *widget,gpointer user_data);
 _BB void mPasteSlot (GtkWidget *widget,gpointer user_data);
 _BB void mDeleteSlot (GtkWidget *widget,gpointer user_data);
+_BB void mTopviewSettingsSlot (GtkWidget *widget,gpointer user_data);
 
 //view
 _BB void mShowToolBoxSlot(GtkWidget *widget,gpointer user_data);
index e0ca07226c961ec679a3b7ea618707313d81e9da..557c3140c250d7e14a2204a063cce1dd72450a8b 100644 (file)
@@ -29,7 +29,7 @@
     set_active_levels(hierarchy, fs->foci_nodes, fs->num_foci);
     positionAllItems(hierarchy, fs, parms)
 
-  When done:
+  When done:973 377 2462
     release (hierarchy);
 */
 
@@ -186,4 +186,13 @@ makeHier (int nn, int ne, vtx_data* graph, double* x_coords, double* y_coords)
 
     return hp;
 }
+focus_t* initFocus (int ncnt)
+{
+    focus_t* fs = NEW(focus_t);
+    fs->num_foci = 0;
+    fs->foci_nodes = N_NEW(ncnt, int);
+    fs->x_foci = N_NEW(ncnt, double);
+    fs->y_foci = N_NEW(ncnt,double);
+    return fs;
+}
 
index 1a3a9e52d5b6e2a9b1618a1a7e3400a13aec27f7..433954d6fda48aa5d5c74c87f3b99f63b3dbfc17 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef HIER_H
 #define HIER_H
 
-#include "topview.h"
 #include "hierarchy.h"
-
+#include "topview.h"
 typedef struct {
     int num_foci;
     int* foci_nodes;
@@ -22,5 +21,6 @@ typedef struct {
 void positionAllItems (Hierarchy* hp, focus_t* fs, hierparms_t* parms);
 vtx_data* makeGraph (topview* tv, int* nedges);
 Hierarchy* makeHier (int nnodes, int nedges, vtx_data*, double*, double*);
+focus_t* initFocus (int ncnt);
 
 #endif
index 74bb9632ed9be962c48da018732601e7f8e37f1a..02bc3198fa85ec87b6afa583587801c53d33f46f 100644 (file)
@@ -3,11 +3,12 @@
 
 #ifdef WIN32
 #include "windows.h"
-#define        SMYRNA_GLADE "C:/Projects/graphviz2/share/gui/smyrna.glade"
+//#define      SMYRNA_GLADE "C:/Projects/graphviz2/share/gui/smyrna.glade"
 #define        SMYRNA_ATTRS "c:/Projects/graphviz2/share/gui/attrs.txt"
 #endif
 #ifdef _WIN32
-#define GTKTOPVIEW_GLADE "c:\\Projects\\ATT\\GTK\\gtktopview\\lib\\GUI\\smyrna.glade"
+//#define GTKTOPVIEW_GLADE "c:\\Projects\\ATT\\GTK\\gtktopview\\lib\\GUI\\smyrna.glade"
+#define SMYRNA_GLADE "c:\\Projects\\ATT\\GTK\\gtktopview\\lib\\GUI\\smyrna.glade"
 #define GTKTOPVIEW_ATTRS "c:\\Projects\\ATT\\GTK\\GTKTest2\\attrs.txt"
 // #else
 // using -DGTKTOPVIEW_GLADE from Makefile.am and configure.ac
@@ -29,6 +30,8 @@
 #include <GL/glu.h>    
 #include <gtk/gtkgl.h>
 #include "glcompset.h"
+#include "hierarchy.h"
+
 
 #define IS_TEST_MODE_ON                                0
 #define        DEFAULT_MAGNIFIER_WIDTH         300
@@ -125,6 +128,9 @@ typedef struct {
        glCompSet* topviewmenu; //for novice user open gl menu
        topviewdata* TopviewData;
        void* customptr;
+       Hierarchy* h;
+
+
 } topview;
 enum
 {
@@ -255,10 +261,18 @@ typedef struct _ViewInfo
        RGBColor penColor;
        /*default fill color*/
        RGBColor fillColor;
-       /*selection color, selected items appear in this color*/
-       RGBColor selectColor;
+       /*highlighted Node Color*/
+       RGBColor highlightedNodeColor;
+       /*highlighted Edge Color*/
+       RGBColor highlightedEdgeColor;
        /*grid color*/
        RGBColor gridColor;     //grid color
+       /*border color*/
+       RGBColor borderColor;
+       /*selected node color*/
+       RGBColor selectedNodeColor;
+       /*selected edge color*/
+       RGBColor selectedEdgeColor;
 
        /*default line width*/
        float LineWidth;
@@ -270,9 +284,10 @@ typedef struct _ViewInfo
 
        /*draws a border in border colors if it is 1*/
        int bdVisible;  //if borders are visible (boundries of the drawing,
-       /*border color*/
-       RGBColor borderColor;
        /*border coordinates, needs to be calculated for each graph*/
+
+
+
        float bdxLeft,bdyTop,bdzTop;    
        float bdxRight,bdyBottom,bdzBottom; 
 
index 4875c1fdd8d06ee0c3b5574bc1630a0aee2b6fbf..8c5321ba013b725314b7c9ac750d8db7890f213b 100755 (executable)
@@ -24,6 +24,7 @@
 #include "draw.h"
 #include "selection.h"
 #include "topviewdata.h"
+#include "hier.h"
 
 static float dx=0.0;
 static float dy=0.0;
@@ -189,7 +190,8 @@ void preparetopview(Agraph_t *g,topview* t)
        set_boundries(t);
        set_update_required(t);
        t->topviewmenu=glcreate_gl_topview_menu();
-       load_host_buttons(t,g,t->topviewmenu);
+       //load_host_buttons(t,g,t->topviewmenu);
+       prepare_topological_fisheye(t);
 
 
 
@@ -240,7 +242,7 @@ void drawTopViewGraph(Agraph_t *g)
                                                update_topview_node_from_cgraph(v);
                                        if( ((custom_object_data*)AGDATA(v->Node))->Selected==1)
                                        {
-                                               glColor4f(view->selectColor.R,view->selectColor.G,view->selectColor.B,view->selectColor.A);
+                                               glColor4f(view->selectedNodeColor.R,view->selectedNodeColor.G,view->selectedNodeColor.B,view->selectedNodeColor.A);
                                                ddx=dx;ddy=dy;
                                        }
                                        else            //get the color from node
@@ -559,7 +561,7 @@ int get_color_from_edge(topview_edge *e)
                        )
        {
 //             glColor4f(0,0,1,1);
-               glColor4f(view->selectColor.R,view->selectColor.G,view->selectColor.B,view->selectColor.A);
+               glColor4f(view->selectedNodeColor.R,view->selectedNodeColor.G,view->selectedNodeColor.B,view->selectedNodeColor.A);
                return return_value;
        }
        if(             ( ((custom_object_data*)AGDATA(e->Node1->Node))->Highlighted==1)
@@ -1081,7 +1083,75 @@ glCompSet* glcreate_gl_topview_menu()
        return s;
 
 }
-//calbacks
+
+void prepare_topological_fisheye(topview* t)
+{
+/* To use:
+  double* x_coords; // initial x coordinates
+  double* y_coords; // initial y coordinates
+  focus_t* fs;
+  int ne;
+  vtx_data* graph = makeGraph (topview*, &ne);
+  hierarchy = makeHier(topview->NodeCount, ne, graph, x_coords, y_coords);
+  freeGraph (graph);
+  fs = initFocus (topview->Nodecount); // create focus set
+
+  In loop, 
+    update fs.
+      For example, if user clicks mouse at (p.x,p.y) to pick a single new focus,
+        int closest_fine_node;
+        find_closest_active_node(hierarchy, p.x, p.y, &closest_fine_node);
+        fs->num_foci = 1;
+        fs->foci_nodes[0] = closest_fine_node;
+        fs->x_foci[0] = hierarchy->geom_graphs[cur_level][closest_fine_node].x_coord; 
+        fs->y_foci[0] = hierarchy->geom_graphs[cur_level][closest_fine_node].y_coord;
+
+
+      
+    set_active_levels(hierarchy, fs->foci_nodes, fs->num_foci);
+    positionAllItems(hierarchy, fs, parms)
+
+  When done:
+    release (hierarchy);
+*/
+       double* x_coords=0; // initial x coordinates
+       double* y_coords=0; // initial y coordinates
+       focus_t* fs;
+       int ne;
+       int ind;
+       int closest_fine_node;
+       int cur_level=0;
+       hierparms_t parms;
+       vtx_data* graph = makeGraph (t, &ne);
+       t->h = makeHier(t->Nodecount, ne, graph, x_coords, y_coords);
+       freeGraph (graph);
+       fs = initFocus (t->Nodecount); // create focus set
+
+       find_closest_active_node(t->h, 50.0, 50.0, &closest_fine_node);
+       fs->num_foci = 1;
+       fs->foci_nodes[0] = closest_fine_node;
+       fs->x_foci[0] = t->h->geom_graphs[cur_level][closest_fine_node].x_coord; 
+       fs->y_foci[0] = t->h->geom_graphs[cur_level][closest_fine_node].y_coord;
+
+      
+    set_active_levels(t->h, fs->foci_nodes, fs->num_foci);
+    positionAllItems(t->h, fs, &parms);
+       //DEBUG
+       //show coordinates and active levels
+       for (ind ; ind < t->Nodecount;ind ++)
+       {
+               
+               printf ("original coords (%f,%f)\n",t->Nodes[ind].x,t->Nodes[ind].y);
+               printf ("local coords (%f,%f)\n",t->h->geom_graphs[cur_level][ind].local_x_coord,t->h->geom_graphs[cur_level][ind].local_y_coord);
+               printf ("physical coords (%f,%f)\n",t->h->geom_graphs[cur_level][ind].new_physical_x_coord,t->h->geom_graphs[cur_level][ind].new_physical_y_coord);
+               printf ("local coords (%f,%f)\n",t->h->geom_graphs[cur_level][ind].local_x_coord,t->h->geom_graphs[cur_level][ind].local_y_coord);
+       }
+
+
+
+
+}
+
 
 
 
index 1c5ded7f5556e46b9ef160bc373c90200ff312e0..098555eb75f1838d8e3f4d14eadaaecd8c189645 100755 (executable)
@@ -46,6 +46,7 @@ double dist(double x1, double y1, double x2, double y2);
 double G(double x);
 glCompSet* glcreate_gl_topview_menu();
 void fisheye_polar(double x_focus, double y_focus,topview* t);
+void prepare_topological_fisheye(topview* t);
 
 
 #endif
index 306f31b844b999a2b9bcceeb0b5f5360802ec15d..24279377e24b2e27db915cf8e8d663ca33ecd21d 100755 (executable)
@@ -100,10 +100,10 @@ void init_viewport(ViewInfo* view)
        view->bgColor.A=1;
 
        //selected objets are drawn with this color
-       view->selectColor.R=1;
-       view->selectColor.G=0;
-       view->selectColor.B=0;
-       view->selectColor.A=1;
+       view->selectedNodeColor.R=1;
+       view->selectedNodeColor.G=0;
+       view->selectedNodeColor.B=0;
+       view->selectedNodeColor.A=1;
 
        //default line width;
        view->LineWidth=1;
@@ -141,6 +141,7 @@ void init_viewport(ViewInfo* view)
        view->Selection.SelectionColor.A=1;
        view->Selection.Anti=0;
        view->Topview=malloc(sizeof(topview));
+       view->Topview->topviewmenu='\0';
 }
 
 int add_graph_to_viewport_from_file (char* fileName)
index b8a0f9c6fe0e85410650428ee6cd54071565236d..1e767457639bb028f8f01d77e0e6684368e85213 100644 (file)
@@ -464,13 +464,16 @@ int glCompSetRelease(glCompSet* s,int x,int y)
 {
        
        int ind=0;
-       for (ind=0 ; ind < s->buttoncount; ind ++)
+       if (s)
        {
-               if((s->buttons[ind]->visible) && (s->buttons[ind]->enabled))
+               for (ind=0 ; ind < s->buttoncount; ind ++)
                {
-                       if((glCompPointInButton(s->buttons[ind],s->clickedX,s->clickedY)))
+                       if((s->buttons[ind]->visible) && (s->buttons[ind]->enabled))
                        {
-                               glCompButtonClick(s->buttons[ind]);
+                               if((glCompPointInButton(s->buttons[ind],s->clickedX,s->clickedY)))
+                               {
+                                       glCompButtonClick(s->buttons[ind]);
+                               }
                        }
                }
        }
index 62ede31dedddd72d0f4e67b8f0f27465ba068072..998793f60ea6536e001267ab23e8fdeb820fbfa6 100644 (file)
@@ -126,6 +126,7 @@ vtx_data *UG_graph(double *x, double *y, int n, int accurate_computation)
     double dist_ij, dist_ik, dist_jk, x_i, y_i, x_j, y_j;
     int j, k, neighbor_j, neighbor_k;
     int removed;
+    int source, dest;
 
     in.pointlist = N_NEW(2 * n, REAL);
     for (i = 0; i < n; i++) {
@@ -208,7 +209,6 @@ vtx_data *UG_graph(double *x, double *y, int n, int accurate_computation)
        delaunay[i].edges[0] = i;
        delaunay[i].nedges = 1;
     }
-    int source, dest;
     for (i = 0; i < nedges; i++) {
        source = out.edgelist[2 * i];
        dest = out.edgelist[2 * i + 1];
index e2b25d601e78290883be8ff3713ff45cfb907aaf..cf74ffaeff9cfab83f37bec0db2acaa41b8bfa48 100644 (file)
@@ -164,11 +164,21 @@ static int maxmatch(vtx_data * graph,     /* array of vtx data for graph */
     int neighbor;              /* neighbor of a vertex */
     int nmerged = 0;           /* number of edges in matching */
     int i, j;                  /* loop counters */
+    float max_norm_edge_weight;
+    double inv_size;
+    double *matchability = N_NEW(nvtxs, double);
+    double min_edge_len;
+    double closest_val = -1, val;
+    int closest_neighbor;
+    float *vtx_vec = N_NEW(nvtxs, float);
+    float *weighted_vtx_vec = N_NEW(nvtxs, float);
+    float sum_weights;
 
     // gather statistics, to enable normalizing the values
     double avg_edge_len = 0, avg_deg_2 = 0;
     int nedges = 0;
-    for (i = 0; i < nvtxs; i++) {
+
+       for (i = 0; i < nvtxs; i++) {
        avg_deg_2 += graph[i].nedges;
        for (j = 1; j < graph[i].nedges; j++) {
            avg_edge_len += dist(geom_graph, i, graph[i].edges[j]);
@@ -182,8 +192,6 @@ static int maxmatch(vtx_data * graph,       /* array of vtx data for graph */
     // the normalized edge weight of edge <v,u> is defined as:
     // weight(<v,u>)/sqrt(size(v)*size(u))
     // Now we compute the maximal normalized weight
-    float max_norm_edge_weight;
-    double inv_size;
     if (graph[0].ewgts != NULL) {
        max_norm_edge_weight = -1;
        for (i = 0; i < nvtxs; i++) {
@@ -221,8 +229,6 @@ static int maxmatch(vtx_data * graph,       /* array of vtx data for graph */
        }
 */
     // Option 2: sort the nodes begining with the ones highly approriate for matching
-    double *matchability = N_NEW(nvtxs, double);
-    double min_edge_len;
     for (i = 0; i < nvtxs; i++) {
        vtx = order[i];
        matchability[vtx] = graph[vtx].nedges;  // we less want to match high degree nodes
@@ -241,11 +247,6 @@ static int maxmatch(vtx_data * graph,      /* array of vtx data for graph */
     free(matchability);
 
     // Start determining the matched pairs
-    double closest_val = -1, val;
-    int closest_neighbor;
-    float *vtx_vec = N_NEW(nvtxs, float);
-    float *weighted_vtx_vec = N_NEW(nvtxs, float);
-    float sum_weights;
     for (i = 0; i < nvtxs; i++) {
        vtx_vec[i] = 0;
     }
@@ -1364,15 +1365,16 @@ static int
 isActiveAncestorOfNeighbors(Hierarchy * hierarchy, int node, int level,
                            int activeAncestorIdx)
 {
-    int i;
-    vtx_data neighborsInLevel;
+    int i,     active_level ;
+
+       vtx_data neighborsInLevel;
     int neighbor, neighborLevel;
     assert(hierarchy);
     neighborsInLevel = hierarchy->graphs[level][node];
 
     for (i = 1; i < neighborsInLevel.nedges; i++) {
        neighbor = neighborsInLevel.edges[i];
-       int active_level =
+       active_level =
            hierarchy->geom_graphs[level][neighbor].active_level;
        if (active_level > level) {
            // ancestor of neighbor is active
@@ -1402,7 +1404,7 @@ findGlobalIndexesOfActiveNeighbors(Hierarchy * hierarchy, int index,
     int numNeighbors = 0;
     int *neighbors;
     int i, j;
-    int level, node;
+    int level, node,active_level,found;
     vtx_data neighborsInLevel;
     int nAllocNeighbors;
     int *stack;                        // 4*hierarchy->nlevels should be enough for the DFS scan
@@ -1423,7 +1425,7 @@ findGlobalIndexesOfActiveNeighbors(Hierarchy * hierarchy, int index,
 
     for (i = 1; i < neighborsInLevel.nedges; i++) {
        neighbor = neighborsInLevel.edges[i];
-       int active_level =
+       active_level =
            hierarchy->geom_graphs[level][neighbor].active_level;
        if (active_level == level) {
            // neighbor is active - add it
@@ -1442,7 +1444,7 @@ findGlobalIndexesOfActiveNeighbors(Hierarchy * hierarchy, int index,
                neighbor = hierarchy->v2cv[neighborLevel][neighbor];
                neighborLevel++;
            } while (active_level > neighborLevel);
-           int found = 0;
+           found = 0;
            for (j = 0; j < numNeighbors && !found; j++) {
                if (neighbors[j] ==
                    hierarchy->geom_graphs[neighborLevel][neighbor].
index 972607e0619548ce0af278906486854463782f4c..65b292a8070a659b22859283204e16bd99bdec18 100644 (file)
@@ -84,9 +84,10 @@ static double *smooth_vec(double *vec, int *ordering, int n, int interval,
 {
 // smooth 'vec' by setting each components to the average of is 'interval'-neighborhood in 'ordering'
     int len, i, n1;
+       double sum;
     smoothed_vec = RALLOC(n, smoothed_vec, double);
     n1 = MIN(1 + interval, n);
-    double sum = 0;
+    sum = 0;
     for (i = 0; i < n1; i++) {
        sum += vec[ordering[i]];
     }