epix-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ePiX-users] File ploting


From: Cristóvão Sousa
Subject: Re: [ePiX-users] File ploting
Date: Thu, 25 Sep 2008 10:59:43 +0100
User-agent: KMail/1.10.1 (Linux/2.6.24-21-generic; KDE/4.1.1; x86_64; ; )

> On Tue, 23 Sep 2008, Cristóvão Sousa wrote:
> > As I find the "data_file" frame work very limitative, I'm trying to
> > create a set of functions to read non size limited data files.
> >
> > I want to create a function that reads values in columns and creates
> > std::vector's to be used with epix::path. I want no column number
> > limitations. The file parser should be able to reject comments, spaces
> > and tabs.
>
> Hi Cristóvão,
>
> If you read a disk file into a data_file object, there's no practical
> restriction on the number of columns. Or is that not what you meant...?
>
> Regarding delimiters, do you need to use both spaces and tabs in one file,
> or is it a matter of wanting flexibility to choose for different files?
>
> Best,
> Andy
>
> Andrew D. Hwang                       address@hidden
> Department of Math and CS     http://mathcs.holycross.edu/~ahwang
> College of the Holy Cross     (508) 793-2458 (Office: Swords 339)
> Worcester, MA, 01610-2395     (508) 793-3530 (fax)

I'm though there were data_file (reading from file) columns number restriction.
To demonstrate my problem I did a simple test case.
I have ePiX 1.2.5 (compiled by me) in a 64 bits Kubuntu distro.

The file "dftest.xp":

/////////////////////////////////////////////////////////// begin of file
#include "epix.h"
using namespace ePiX;

double f1(double x){ return x; }
double f2(double x){ return x*x; }
double f3(double x){ return 2*x; }

int main(){

  picture(P(-1,-1), P(1,1), "2x1in");
  begin(); 

  std::clog << "### A ###" << std::endl;

  data_file dout(f1, f2, f3, -1, 1, 3);
  dout.delimiter(" ");
  dout.write("df1.data");

  std::clog << dout.column(1).size() << std::endl;
  std::clog << dout.column(2).size() << std::endl;
  std::clog << dout.column(3).size() << std::endl;

  std::clog << "### B ###" << std::endl;

  data_file din;
  din.delimiter(" ");
  din.read("df1.data");

  std::clog << "### C ###" << std::endl;

  std::clog << din.column(1).size() << std::endl;
  std::clog << din.column(2).size() << std::endl;
  std::clog << din.column(3).size() << std::endl;

  std::clog << "### D ###" << std::endl;

  din.write("df2.data");

  end();
}
//////////////////////////////////////////////////////////////// end of file

, which when compiled with the command:
epix -v dftest.xp

, it outputs:

//////////////////////////////////////////////////////////////// begin
epix: Processing dftest.xp:        
epix: /usr/bin/g++ epix-8880/dftest.exe-tmp.cc -w -o epix-8880/dftest.exe 
-I/usr/local/include -L/usr/local/lib/epix -lm -lepix                           
                                                                          
epix: Writing eepic file: ./epix-8880/dftest.exe > dftest.eepic                 
                                  
### A ###                                                                       
                                  
4                                                                               
                                  
4                                                                               
                                  
4                                                                               
                                  
### B ###                                                                       
                                  
ePiX WARNING: Column count mismatch in file df1.data                            
                                  
### C ###                                                                       
                                  
0
0
ePiX WARNING: Out of range argument to data_file::column()
0
### D ###

Transcript written on dftest_xp.log
//////////////////////////////////////////////////////////////// end


The file df1.data gets the next content:

//////////////////////////////////////////////////////////////// begin of file
-1.00000 1.00000 -2.00000
-0.333333 0.111111 -0.666667
0.333333 0.111111 0.666667
1.00000 1.00000 2.00000
//////////////////////////////////////////////////////////////// end of file

And the file df2.data is just empty.


Am I doing something wrong? Any clues?

Thanks for your support,
Cristóvão Sousa





reply via email to

[Prev in Thread] Current Thread [Next in Thread]