Typedefs | Functions | Variables

spart_2d_visual.cpp File Reference

#include <algorithm>
#include "util/compact.hpp"
#include "util/rect_list.hpp"
#include <iostream>
#include <sstream>
#include <fstream>
#include <cstring>
#include <assert.h>
#include <iomanip>
#include "util/prefix_sum_tools.hpp"

Typedefs

typedef double T
typedef util::Prefix2D< double > Pr

Functions

std::string getColor (T max, T min, T val, double perfect)
 Returns string in format "R,G,B" where R:Red, G:Green, B:Blue is the color code.
void draw_rectangle (double x, double y, double w, double h, std::string color_in, double stroke_width=0.1, std::string color_out="0,0,0")
 Draws a single rectangle at a specified location, dimensions and color.
void draw_text (double x, double y, std::string text, double font_size, std::string anchor="bottom", double angle=0)
 Prints text on SVG.
void draw_bar (double x, double y, T max_load, T min_load, double avg)
 Draws color legend to figure out load imbalance.
void draw_footer (double x, double y, char *instName, char *cutName, int proc)
 Prints instance and cut filename, and processor count as text.
void draw_rectangles (RectList< T, Pr > &rl, const Pr &pr, int numProc, char *inst, char *cuts, T min_load, T max_load, bool legend)
 Draws a complete SVG image of Load imbalance chart with legends and other information.
std::string get_svg_header ()
 Prints standard SVG header to the SVG file.
int main (int argc, char *argv[])

Variables

double largex
double largey

Typedef Documentation

typedef util::Prefix2D<double> Pr
typedef double T

Function Documentation

void draw_bar ( double  x,
double  y,
T  max_load,
T  min_load,
double  avg 
)

Draws color legend to figure out load imbalance.

Parameters:
x Coordinate -- distance from top.
y Coordinate -- distance from left.
max Maximum value in the input space. Maps to complete red color (255,0,0).
min Minimum value in the input space. Maps to complete blue color (0,0,255).
avg Perfect load imbalance value. Maps to complete white color (255,255,255).
void draw_footer ( double  x,
double  y,
char *  instName,
char *  cutName,
int  proc 
)

Prints instance and cut filename, and processor count as text.

Parameters:
x Coordinate -- distance from top.
y Coordinate -- distance from left.
instName Instance file name.
cutName Cuts file name.
proc Processor count.
void draw_rectangle ( double  x,
double  y,
double  w,
double  h,
std::string  color_in,
double  stroke_width = 0.1,
std::string  color_out = "0,0,0" 
)

Draws a single rectangle at a specified location, dimensions and color.

Parameters:
x Coordinate -- distance from top.
y Coordinate -- distance from left.
w Rectangle width.
h Rectangle height.
color_in Input color string in format "R,G,B" (This is the output of getColor() function)
stroke_width Stroke width in SVG. This looks like a frame around the rectangle. (0.1 by default)
color_out Stroke color.
void draw_rectangles ( RectList< T, Pr > &  rl,
const Pr pr,
int  numProc,
char *  inst,
char *  cuts,
T  min_load,
T  max_load,
bool  legend 
)

Draws a complete SVG image of Load imbalance chart with legends and other information.

Parameters:
rl Input rectangle list.
pr Input prefix sum array.
numProc Number of processors.
inst Instance file name.
cuts Cut file name.
min_load Minimum value in the input space. Maps to complete blue color (0,0,255).
max_load Maximum value in the input space. Maps to complete red color (255,0,0).
legend Set to true to draw a color legend.
void draw_text ( double  x,
double  y,
std::string  text,
double  font_size,
std::string  anchor = "bottom",
double  angle = 0 
)

Prints text on SVG.

Parameters:
x Coordinate -- distance from top.
y Coordinate -- distance from left.
text Text to print.
font_size Font size in SVG.
anchor Anchor in SVG. (bottom by default)
angle To rotate text in SVG. (0 by default)
std::string get_svg_header (  ) 

Prints standard SVG header to the SVG file.

Returns:
SVG header that goes to the beginning of the .svg file.
std::string getColor ( T  max,
T  min,
T  val,
double  perfect 
)

Returns string in format "R,G,B" where R:Red, G:Green, B:Blue is the color code.

Returns string in format "R,G,B" where R:Red, G:Green, B:Blue is the color code. This is used to draw rectangles in SVG.

Parameters:
max maximum value in the input space. Maps to complete red color (255,0,0).
min minimum value in the input space. Maps to complete blue color (0,0,255).
val input value to be converted to color.
perfect perdect load inbalance value (that will map to white color).
Returns:
Color string in "R,G,B" format.
int main ( int  argc,
char *  argv[] 
)

Synopsis: spart_2d_visual <instance> <nbproc> <cut_file> instance: Begins with a line with number of tasks in X and Y dimension. The rest of the lines contain 1 task load per line. nbproc: number of processors cutfile: List of rectangle cuts

Parameters:
argc 
argv 
Returns:
Given 2d instance and cut rectangles, outputs SVG image of load heat map or partition scheme

Variable Documentation

double largex
double largey
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines