NeoPZ
pzdatafi.h
Go to the documentation of this file.
1 
6 #ifndef PZDATAFIHPP
7 #define PZDATAFIHPP
8 
9 #include "pzerror.h"
10 
11 #include <stdlib>
12 #include <fstream>
13 
14 
15 class TGeoGrid;
16 class TCompGrid;
17 
39 class TDatafile
40 {
41 protected:
43  filebuf fBuffer;
45  istream fData;
47  char fFilename[256];
50 
51 public:
52 
54  TDatafile(char *fn) : fData(&fBuffer) {
55  fFileError = 0;
56  strcpy (fFilename, fn);
57  if ( fBuffer.open( fn, ios::in) == 0) {
58  pzerror << "\nERROR(TDatafile::const)-> Cannot open " << fn << "\n";
59  // pzerror.show();
60  fFileError = 1;
61  }
62  }
64  int Error() {return fFileError;}
66  virtual ~TDatafile(){ fBuffer.close();}
67 
69  virtual short Read (TCompGrid & malha) = 0;
70 
71 };
72 
73 #endif
int Error()
Returns if could opening or not the data file.
Definition: pzdatafi.h:64
Defines PZError.
istream fData
Data.
Definition: pzdatafi.h:45
char fFilename[256]
File name.
Definition: pzdatafi.h:47
fn
Definition: test.py:253
virtual ~TDatafile()
Destructor.
Definition: pzdatafi.h:66
int fFileError
Flag to report if the file is opening.
Definition: pzdatafi.h:49
TDatafile(char *fn)
Constructor with filename of the data to import.
Definition: pzdatafi.h:54
filebuf fBuffer
File from import data.
Definition: pzdatafi.h:43
TDatafile is a virtual class from which classes with different data formats can be derived...
Definition: pzdatafi.h:39
virtual short Read(TCompGrid &malha)=0
To import data into computational mesh.