// Layout
//
// This program implements a parallel force directed graph drawing
// algorithm.  The algorithm used is based upon a random decomposition
// of the graph and simulated shared memory of node position and density.
// In this version, the simulated shared memory is spread among all processors
//
// The structure of the inputs and outputs of this code will be displayed
// if the program is called without parameters, or if an erroneous
// parameter is passed to the program.
//
// S. Martin
// 5/6/2005
#pragma warning(disable: 4786)

// C++ library routines
#include <iostream>
#include <fstream>
#include <map>
#include <set>
#include <string>
#include <deque>
#include <vector>

using namespace std;

#include "ebLayout.h"
#include "ebGraph.h"

int eb_layout_3d(char *wel_file, char *gvl_file, float thresh, int absValFlag, int attractFlag, float grav, int springAlgo) {
  
  
  // parameters that must be broadcast to all processors
  int rand_seed;
  float edge_cut;
  
  int int_out = 0;
  int edges_out = 0;
  int parms_in = 0;
  float real_in = -1.0;
  
  // get user input
  rand_seed = 0;
  edge_cut = 32.f / 40.f;
  int_out = 0;
  edges_out = 0;
  parms_in = 0;
  real_in = -1.0;
	
  
  // now we initialize all processors by reading .int file
  eb_graph neighbors ( wel_file );
  neighbors.init_parms ( rand_seed, edge_cut, real_in );

  neighbors.draw_graph ( int_out, gvl_file );

  // finally we output file and quit
  float tot_energy;
  tot_energy = neighbors.get_tot_energy ();
	neighbors.write_gvl ( gvl_file, wel_file, thresh, absValFlag, attractFlag, grav, springAlgo );
	cout << "Total Energy: " << tot_energy << "." << endl;
	return 0;
}
