//start2 = clock();
#endif
-#ifdef GVIEWER
- if (Gviewer){
- char lab[100];
- snprintf(lab, sizeof(lab), "sfdp, iter=%d", iter);
- gviewer_set_label(lab);
- gviewer_reset_graph_coord(A, dim, x);
- drawScene();
- gviewer_dump_current_frame();
- //if ((adaptive_cooling && iter%100 == 0) || (!adaptive_cooling && iter%10 == 0)) gviewer_dump_current_frame();
- }
-#endif
-
iter++;
memcpy(xold, x, sizeof(real)*dim*n);
Fnorm0 = Fnorm;
fclose(f);
}
#endif
-#ifdef GVIEWER
- if (Gviewer){
- char lab[100];
- snprintf(lab, sizeof(lab), "sfdp, adaptive_cooling = %d iter=%d",
- adaptive_cooling, iter);
- gviewer_set_label(lab);
- gviewer_reset_graph_coord(A, dim, x);
- drawScene();
- gviewer_dump_current_frame();
- //if ((adaptive_cooling && iter%100 == 0) || (!adaptive_cooling && iter%10 == 0)) gviewer_dump_current_frame();
- }
-#endif
iter++;
memcpy(xold, x, sizeof(real)*dim*n);
Multilevel_delete(grid0);
}
-#ifdef GVIEWER
-struct multilevel_spring_electrical_embedding_data {
- int dim;
- SparseMatrix A;
- SparseMatrix D;
- spring_electrical_control ctrl;
- real *node_weights;
- real *label_sizes;
- real *x;
- int n_edge_label_nodes;
- int *edge_label_nodes;
- int *flag;
-};
-
-void multilevel_spring_electrical_embedding_gv(void* data){
- struct multilevel_spring_electrical_embedding_data* d;
-
- d = (struct multilevel_spring_electrical_embedding_data*) data;
- multilevel_spring_electrical_embedding_core(d->dim, d->A, d->D, d->ctrl, d->node_weights, d->label_sizes, d->x, d->n_edge_label_nodes, d->edge_label_nodes, d->flag);
- gviewer_reset_graph_coord(d->A, d->dim, d->x);/* A inside spring_electrical gets deleted */
-}
-void multilevel_spring_electrical_embedding(int dim, SparseMatrix A, SparseMatrix D, spring_electrical_control ctrl, real *node_weights, real *label_sizes,
- real *x, int n_edge_label_nodes, int *edge_label_nodes, int *flag){
- struct multilevel_spring_electrical_embedding_data data = {dim, A, D, ctrl, node_weights, label_sizes, x, n_edge_label_nodes, edge_label_nodes, flag};
-
- int argcc = 1;
- char **argvv;
-
- if (!Gviewer) return multilevel_spring_electrical_embedding_core(dim, A, D, ctrl, node_weights, label_sizes, x, n_edge_label_nodes, edge_label_nodes, flag);
-
- argcc = 1;
- argvv = malloc(sizeof(char*)*argcc);
- argvv[0] = malloc(sizeof(char));
- argvv[0][0] = '1';
-
- gviewer_set_edge_color_scheme(COLOR_SCHEME_NO);
- //gviewer_set_edge_color_scheme(COLOR_SCHEME_MEDIAN_AS_GREEN);
- gviewer_toggle_bgcolor();
- //gviewer_toggle_vertex();
- //gviewer_init(&argcc, argvv, 0.01, 20, 60, 2*1010, 2*770, A, dim, x, &(data), multilevel_spring_electrical_embedding_gv);
- gviewer_init(&argcc, argvv, 0.01, 20, 60, 320, 320, A, dim, x, &(data), multilevel_spring_electrical_embedding_gv);
- free(argvv);
-
-}
-#else
void multilevel_spring_electrical_embedding(int dim, SparseMatrix A, SparseMatrix D, spring_electrical_control ctrl, real *node_weights, real *label_sizes,
real *x, int n_edge_label_nodes, int *edge_label_nodes, int *flag){
multilevel_spring_electrical_embedding_core(dim, A, D, ctrl, node_weights, label_sizes, x, n_edge_label_nodes, edge_label_nodes, flag);
}
-#endif
if (A != B) SparseMatrix_delete(A);
}
-#ifdef GVIEWER
-#include <gviewer.h>
-#include <get_ps.h>
-struct stress_model_data {
- int dim;
- SparseMatrix D;
- real **x;
- int edge_len_weighted;
- int maxit_sm;
- real tol;
- int *flag;
-};
-
-void stress_model_gv(void* data){
- struct stress_model_data* d;
-
- d = (struct stress_model_data*) data;
- return stress_model_core(d->dim, d->D, d->x, d->edge_len_weighted, d->maxit_sm, d->tol, d->flag);
-}
-void stress_model(int dim, SparseMatrix A, SparseMatrix D, real **x, int edge_len_weighted, int maxit_sm, real tol, int *flag){
- struct stress_model_data data = {dim, D, x, edge_len_weighted, maxit_sm, tol, flag};
-
- int argcc = 1;
- char **argvv;
-
- if (!Gviewer) return stress_model_core(dim, D, x, edge_len_weighted, maxit_sm, tol, flag);
- argcc = 1;
- argvv = malloc(sizeof(char*)*argcc);
- argvv[0] = malloc(sizeof(char));
- argvv[0][0] = '1';
- gviewer_set_edge_color_scheme(COLOR_SCHEME_NO);
- gviewer_toggle_bgcolor();
- gviewer_init(&argcc, argvv, 0.1, 20, 60, 720, 720, A, dim, *x, &(data), stress_model_gv);
- free(argvv);
-
-}
-#else
void stress_model(int dim, SparseMatrix A, SparseMatrix D, real **x, int edge_len_weighted, int maxit_sm, real tol, int *flag){
stress_model_core(dim, D, x, edge_len_weighted, maxit_sm, tol, flag);
}
-#endif