#ifndef _GRACEPLOT_H_ #define _GRACEPLOT_H_ // // $Id$ //----------------------------------------------------------------------- // // (c) Copyright 2006 by GATS, Inc., // 11864 Canon Blvd, Suite 101, Newport News VA 23606 // // All Rights Reserved. No part of this software or publication may be // reproduced, stored in a retrieval system, or transmitted, in any form // or by any means, electronic, mechanical, photocopying, recording, or // otherwise without the prior written permission of GATS, Inc. // //----------------------------------------------------------------------- // // Module: GracePlot.h // // Author: John Burton // // Date: Thu Apr 13 10:48:31 2006 // //----------------------------------------------------------------------- // // Modification History: // // $Log$ // //----------------------------------------------------------------------- // based on xmgrace class written by M.Nomura // //----------------------------------------------------------------------- // Include Files: //----------------------------------------------------------------------- // #include #include #include #include #include // //----------------------------------------------------------------------- // Defines, Macros and Type Definitions: //----------------------------------------------------------------------- // #define BUFSIZE 512 // //----------------------------------------------------------------------- // Global Variables: //----------------------------------------------------------------------- // // //----------------------------------------------------------------------- // Function Prototypes: //----------------------------------------------------------------------- // namespace gracesc { const std::string DEFAULTFILE("default.par"); const int GRACEBUFFER=2048; /// /// Class XmgraceGraph creates a single graph of a set of data using an /// external xmgrace process. /// class XmgraceGraph{ private: unsigned int graph_number; unsigned int linemax; bool newline; std::vector > data; public: /// /// Constructor to initialize a single xmgrace graph /// @param number - number identifying the graph instance /// XmgraceGraph(unsigned int number); XmgraceGraph& operator << (const char* command); XmgraceGraph& operator << (const double& variable); void operator << (void (*func)(XmgraceGraph&)); friend void endl(XmgraceGraph&); // void endl(void); void clear(void); void draw(void); void autoscale(void); void timestamp(); void Scale_xAxis(int LogType,int xmin,int xmax); void Scale_xAxis(int LogType,double xmin,double xmax); void Scale_yAxis(int LogType,int vmin,int vmax); void Scale_yAxis(int LogType,double vmin,double vmax); void Display_titles (std::string title, std::string subtitle, std::string xlable, std::string ylable); void SetLegend(int ndx, std::string legend); void Set_legend_location(char *xlocation, char *ylocation); void load_commands(const std::string & filename); }; class Xmgrace{ private: std::vector graph; int max_graph_size; void init(const std::string & parameter_file = "" ); public: Xmgrace(unsigned int size=0); Xmgrace(const std::string ¶meter_file = DEFAULTFILE,unsigned int size=0 ); virtual ~Xmgrace (){GraceClosePipe();} void add(unsigned int size); Xmgrace& operator << (const char* command); XmgraceGraph& operator [] (unsigned int number); bool open(void); void load_commands(const std::string & filename); void redraw(void); // void endl(XmgraceGraph& graph); }; inline void endl(XmgraceGraph& graph) { graph.newline = true; } } #endif