transp to elvis: elvislib by: ben bariteau mentor: doug mccune

27
TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Upload: maximilian-page

Post on 11-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

TRANSP to ElVis: elvislibBy: Ben Bariteau

Mentor: Doug McCune

Page 2: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Scientific Graphics

Page 3: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

3

Data Monitoring Integrated with Job Monitoring

Page 4: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Web Services

Page 5: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

ElVis Software Package

• Display program– 45,000 lines of Java code– 300 classes– Summer ’08: Over 200 updates to the code

• Application Programming Interface (API)– Fortran– C/C++– Java

Page 6: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

TRANSP and elvislib

• elvislib was created primarily for TRANSP so that the Fortran and C programs within TRANSP could take advantage of the Java visualization tool ElVis– elvislib is primarily used with programs like rplot,

cstate, and sigtab for displaying graphs and tables with a GUI that allows for intuitive manipulation and management tools

• ElVis was created with these programs in mind, which led to the creation of elvislib for these programs to send data to ElVis

Page 7: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

elvislib EML Transfer

• elvislib stores information in memory about different types of graphs, including normal two dimensional graphs, surface plots, indexed graphs, and tables– This information is translated into EML when

ef_graphwindowdisplay() is called

TRANSPprograms

elvislib

ElVis

API Calls

EML

Page 8: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

ElVis Markup Language (EML)

• EML is an XML-based language– Designed by Steve

Krenzel• Tags contain information

that is sent from elvislib to ElVis

• elvislib creates these tags and ElVis translates these into graphs

Page 9: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

EML DTD<?xml encoding="UTF-8"?><!ELEMENT visualstate (graphwindow*)>

<!ELEMENT graphwindow (graph*)> <!ATTLIST graphwindow command CDATA #IMPLIED> <!ATTLIST graphwindow columns CDATA #IMPLIED> <!ATTLIST graphwindow graphtype (fx|fxi|table) #IMPLIED> <!ATTLIST graphwindow name CDATA #REQUIRED> <!ATTLIST graphwindow rows CDATA #IMPLIED> <!ATTLIST graphwindow update (true|false) #IMPLIED> <!ATTLIST graphwindow host CDATA #IMPLIED> <!ATTLIST graphwindow appname CDATA #IMPLIED> <!ATTLIST graphwindow user CDATA #IMPLIED> <!ATTLIST graphwindow id CDATA #IMPLIED> <!ATTLIST graphwindow collector (true|false) #IMPLIED> <!ATTLIST graphwindow host CDATA #IMPLIED>

<!ELEMENT graph (label*, axis+, toptext*, bottomtext*, column*, data1d*, xlist*,indexlist*, postlist*, contourlist*)> <!ATTLIST graph numRows CDATA #IMPLIED> <!ATTLIST graph numCols CDATA #IMPLIED> <!ATTLIST graph column CDATA #IMPLIED> <!ATTLIST graph graphtype (fx|fxi|fxim|contour|surface|fx2d|table)#IMPLIED> <!ATTLIST graph height CDATA #IMPLIED> <!ATTLIST graph originx CDATA #IMPLIED> <!ATTLIST graph originy CDATA #IMPLIED> <!ATTLIST graph showlegend (true|false) #IMPLIED> <!ATTLIST graph showGridlines (true|false) #IMPLIED> <!ATTLIST graph legendTitle CDATA #IMPLIED> <!ATTLIST graph surfacegraph CDATA #IMPLIED> <!ATTLIST graph title CDATA #IMPLIED> <!ATTLIST graph shortTitle CDATA #IMPLIED> <!ATTLIST graph row CDATA #IMPLIED> <!ATTLIST graph width CDATA #IMPLIED> <!ATTLIST graph indexText CDATA #IMPLIED> <!ATTLIST graph rows CDATA #IMPLIED> <!ATTLIST graph columns CDATA #IMPLIED>

<!ELEMENT toptext EMPTY> <!ATTLIST toptext text CDATA #IMPLIED> <!ATTLIST toptext font CDATA #IMPLIED> <!ATTLIST toptext fontStyle CDATA #IMPLIED> <!ATTLIST toptext fontColor CDATA #IMPLIED> <!ATTLIST toptext fontSize CDATA #IMPLIED> <!ATTLIST toptext color CDATA #IMPLIED>

<!ELEMENT bottomtext EMPTY> <!ATTLIST bottomtext text CDATA #IMPLIED> <!ATTLIST bottomtext font CDATA #IMPLIED> <!ATTLIST bottomtext fontStyle CDATA #IMPLIED> <!ATTLIST bottomtext fontColor CDATA #IMPLIED> <!ATTLIST bottomtext fontSize CDATA #IMPLIED> <!ATTLIST bottomtext color CDATA #IMPLIED>

<!ELEMENT column (cell*)> <!ATTLIST column num CDATA #REQUIRED> <!ATTLIST column name CDATA #IMPLIED> <!ATTLIST column hasRowLabels (true|false) #IMPLIED> <!ATTLIST column fontName CDATA #IMPLIED> <!ATTLIST column fontStyle CDATA #IMPLIED> <!ATTLIST column fontSize CDATA #IMPLIED> <!ATTLIST column color CDATA #IMPLIED> <!ATTLIST column fontColor CDATA #IMPLIED>

<!ELEMENT cell EMPTY> <!ATTLIST cell value CDATA #REQUIRED>

<!ELEMENT label EMPTY> <!ATTLIST label colorrgb CDATA #IMPLIED> <!ATTLIST label font CDATA #IMPLIED> <!ATTLIST label labeltype CDATA #IMPLIED> <!ATTLIST label size CDATA #IMPLIED> <!ATTLIST label style (plain|bold|italic) #IMPLIED> <!ATTLIST label text CDATA #REQUIRED> <!ATTLIST label x CDATA #REQUIRED> <!ATTLIST label y CDATA #REQUIRED>

<!ELEMENT axis EMPTY> <!ATTLIST axis direction (x|y|z) #REQUIRED> <!ATTLIST axis type CDATA #REQUIRED> <!ATTLIST axis min CDATA #IMPLIED> <!ATTLIST axis max CDATA #IMPLIED> <!ATTLIST axis numberstyle CDATA #IMPLIED> <!ATTLIST axis text CDATA #IMPLIED> <!ATTLIST axis rotation CDATA #IMPLIED> <!ATTLIST axis originX CDATA #IMPLIED> <!ATTLIST axis originY CDATA #IMPLIED> <!ATTLIST axis showGridlines (true|false) #IMPLIED>

<!ELEMENT data1d (point*)> <!ATTLIST data1d index CDATA #IMPLIED> <!ATTLIST data1d name CDATA #REQUIRED> <!ATTLIST data1d showline (true|false) #IMPLIED> <!ATTLIST data1d showmarker (true|false) #IMPLIED> <!ATTLIST data1d markerSkipCount CDATA #IMPLIED> <!ELEMENT point EMPTY> <!ATTLIST point x CDATA #REQUIRED> <!ATTLIST point y CDATA #REQUIRED>

<!ELEMENT xlist (value+)><!ELEMENT indexlist (value+)><!ELEMENT postlist (value+)><!ELEMENT contourlist (value+)>

Page 10: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Hierarchical EML Structure

• All EML is contained within a <visualstate> tag– A graphwindow is

contained within a <graphwindow> tag

• Graphs are contained within a <graph> tag

Page 11: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Tables

• Tables can now be sent to ElVis

• Changes in code:

– Column structure added

• Column structure allows for an array of strings• Columns have their own

background and font colors, as well as

font style (Italic, Bold) and a font (Serif,

Monospaced, etc.)• Column has a header that is the

title of the column.

Page 12: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Tables, contd.

• Changes in code:– columnList added to Graph structure

• A list of Columns contained in a Table graph.– topTextList and bottomTextList added to Graph structure

• Lists of Labels that appear at the top and bottom of the Table, respectively.

• Each label has it's own color, background color, font, and style attributes

– Added EML output for Tables

Page 13: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Table Functions

• Functions added to the API

concerning Tables:– ef_tablecreate()– ef_columncreate()– ef_tableaddcolumn()– ef_graphwindowaddtable()– ef_columnsetrowlabels()

– ef_columnsetbgcolor()– ef_columnsetheader()– ef_columnsetfontname()– ef_columnsetfontstyle()– ef_columnsetfontsize()– ef_columnsetfontcolor()– ef_tableaddtoptext()– ef_tableaddbottomtext()

Page 14: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Tables and EML• Tables use multiple

<column> tags– Within each <column> tag

there can be a number of <cell>s

• Each <cell> contains a value attribute

– A <column> can contain any of the attributes listed on the right

• Tables can also have multiple <toptext> and <bottomtext> tags– These can contain the

attributes listed on the right

<!ELEMENT column (cell*)> <!ATTLIST column num CDATA #REQUIRED> <!ATTLIST column name CDATA #IMPLIED> <!ATTLIST column hasRowLabels (true|false) #IMPLIED> <!ATTLIST column fontName CDATA #IMPLIED> <!ATTLIST column fontStyle CDATA #IMPLIED> <!ATTLIST column fontSize CDATA #IMPLIED> <!ATTLIST column color CDATA #IMPLIED> <!ATTLIST column fontColor CDATA #IMPLIED>

<!ELEMENT cell EMPTY> <!ATTLIST cell value CDATA #REQUIRED>

<!ELEMENT toptext EMPTY> <!ATTLIST toptext text CDATA #IMPLIED>

<!ATTLIST toptext font CDATA #IMPLIED><!ATTLIST toptext fontStyle CDATA #IMPLIED><!ATTLIST toptext fontColor CDATA #IMPLIED><!ATTLIST toptext fontSize CDATA #IMPLIED><!ATTLIST toptext color CDATA #IMPLIED>

<!ELEMENT bottomtext EMPTY> <!ATTLIST bottomtext text CDATA #IMPLIED>

<!ATTLIST bottomtext font CDATA #IMPLIED><!ATTLIST bottomtext fontStyle CDATA #IMPLIED><!ATTLIST bottomtext fontColor CDATA #IMPLIED><!ATTLIST bottomtext fontSize CDATA #IMPLIED><!ATTLIST bottomtext color CDATA #IMPLIED>

Page 15: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Tables - Challenges• Creating a structure that could hold all the data necessary and adding it to the current structures• Getting arrays of strings from Fortran to C• Defining the color mechanism (next section)

Fortran API Calls Fortran API

C API Calls C API elvislib

Sends array of strings Creates column thensends strings one by one

Sends array of strings

Page 16: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Colors• Colors were used in ef_graphaddlabel() ef_tableaddtoptext() ef_tableaddbottomtext() ef_columnsetbgcolor() ef_columnsetfontcolor()

• Previously, the API used 3 floating-point numbers from 0.0 to 1.0 to represent colors

– This made compatibility easy, but it was not intuitive• Now, the API takes a string with either a color value (i.e. “rgb: 0.2 0.5 0.1”) or color name (i.e. “name: blue”)

– Future colorspaces like HSV can be added

Page 17: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Logarithmic Z Axis in Surface Plots

• The index (Z) axis of this surface plot can now be set to be logarithmic, unlike before, where it could only be linear• Default linear on left, logarithmic on right• Used through ef_graphsetzaxis()

Page 18: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Log Z-axis and EML

• The z-axis logarithmic/linear scale control is sent through the <axis> tags– <axis> tags have a

numberstyle attribute which controls the scale of a graph

• This is interpreted through an <axis> with direction of “z” and a numberstyle of “4”

<!ELEMENT axis EMPTY> <!ATTLIST axis direction (x|y|z) #REQUIRED> <!ATTLIST axis type CDATA #REQUIRED> <!ATTLIST axis min CDATA #IMPLIED> <!ATTLIST axis max CDATA #IMPLIED> <!ATTLIST axis numberstyle CDATA #IMPLIED> <!ATTLIST axis text CDATA #IMPLIED> <!ATTLIST axis rotation CDATA #IMPLIED> <!ATTLIST axis originX CDATA #IMPLIED> <!ATTLIST axis originY CDATA #IMPLIED> <!ATTLIST axis showGridlines (true|false) #IMPLIED>

Page 19: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Short Title• shortTitle in the <graph> tag

– i.e., <graph shortTitle=“TG”>

• This allows for the a smaller title to be shown when the graph becomes too small to display the normal title

– The top graph is large enough to show the entire title, while the bottom one is small enough to show a shortened smaller title

Page 20: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Short Title and EML• Short title was added

to the EML through an attribute in the <graph> tag– <graph> now has an

attribute called shortTitle, which specifies the short title

• This is generated by elvislib when a shortTitle is specified

<!ELEMENT graph (label*, axis+, toptext*, bottomtext*, column*, data1d*, xlist*,indexlist*, postlist*, contourlist*)> <!ATTLIST graph numRows CDATA #IMPLIED> <!ATTLIST graph numCols CDATA #IMPLIED> <!ATTLIST graph column CDATA #IMPLIED> <!ATTLIST graph graphtype (fx|fxi|fxim|contour|surface|fx2d|table)#IMPLIED> <!ATTLIST graph height CDATA #IMPLIED> <!ATTLIST graph originx CDATA #IMPLIED> <!ATTLIST graph originy CDATA #IMPLIED> <!ATTLIST graph showlegend (true|false) #IMPLIED> <!ATTLIST graph showGridlines (true|false) #IMPLIED> <!ATTLIST graph legendTitle CDATA #IMPLIED> <!ATTLIST graph surfacegraph CDATA #IMPLIED> <!ATTLIST graph title CDATA #IMPLIED> <!ATTLIST graph shortTitle CDATA #IMPLIED> <!ATTLIST graph row CDATA #IMPLIED> <!ATTLIST graph width CDATA #IMPLIED> <!ATTLIST graph indexText CDATA #IMPLIED> <!ATTLIST graph rows CDATA #IMPLIED> <!ATTLIST graph columns CDATA #IMPLIED>

Page 21: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Gridlines

• It is now possible to add gridlines to normal graphs using ef_setxgrid and ef_setygrid• Examples of their effect can be seen above (no gridlines on left, gridlines on right)

Page 22: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Gridlines and EML<!ELEMENT axis EMPTY> <!ATTLIST axis direction (x|y|z) #REQUIRED> <!ATTLIST axis type CDATA #REQUIRED> <!ATTLIST axis min CDATA #IMPLIED> <!ATTLIST axis max CDATA #IMPLIED> <!ATTLIST axis numberstyle CDATA #IMPLIED> <!ATTLIST axis text CDATA #IMPLIED> <!ATTLIST axis rotation CDATA #IMPLIED> <!ATTLIST axis originX CDATA #IMPLIED> <!ATTLIST axis originY CDATA #IMPLIED> <!ATTLIST axis showGridlines (true|false) #IMPLIED>

• Gridlines are shown through the showGridlines attribute on the axis tag– This can be “true” or

“false”, and is generated by elvislib accordingly

Page 23: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Multiple ElVis Displays

More than one server and/or filename– A filename beginning with '/' or '.'– A hostname or IP– localhost (uses the current computer as the host)– stderr or stdout– filegen automatically generates a filename with PID, application name, and username

Page 24: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Multiple ElVis Displays, contd.• Changes in code:

– In graphwindow.c:• ef_initialize() now handles ElVis output environment variable exclusively• initialize() was changed to use an index to find a certain output an index

to find a certain output• ef_GraphWindowSendEML() now loops through all outputs, sends EML to

each

– In binio.c:• binio_set_gwFile() added to set gwfile in binio.c

• Challenges:– The mechanism for sending output to a file had to be

circumvented with binio_set_gwFile()– All other uses of environment variables removed or changed

Page 25: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Acknowledgments

• Doug McCune, TRANSP developer, my mentor• Eliot Feibush – ElVis creator and developer,

my mentor• Andrew Zwicker, Christine Ritter, James

Morgan – PPPL Science Education Program• Eric Zatz – ElVis Display-side EML Developer

Page 26: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Questions?

Page 27: TRANSP to ElVis: elvislib By: Ben Bariteau Mentor: Doug McCune

Ben – API, EML

Mike Movie Making User Enhancements Tutorials

Eric Zatz -CPPG summer undergrad ElVis Mark-Up Language

Matt System & Services

Eliot - Mentor

Doug – MentorCPPG Group Head