CDataReader Class Reference

General class for datareaders. More...

#include <CDataReader.hpp>

Inheritance diagram for CDataReader:

Inheritance graph
[legend]
Collaboration diagram for CDataReader:

Collaboration graph
[legend]

List of all members.

Signals

void readError (QString)
void readProgress (int, QString, QString)

Public Member Functions

 CDataReader (int ifile=-1)
virtual ~CDataReader ()
virtual int numberOfParticles () const
virtual int particleType (const int &ipart) const
virtual int particleID (const int &ipart) const
virtual int particleIndex (const int &id) const
virtual double particleMass (const int &ipart) const
virtual double particleDensity (const int &ipart) const
virtual double particleSml (const int &ipart) const
virtual double particleSpecEnergy (const int &ipart) const
virtual double particleTemperature (const int &ipart) const
virtual double particleZ (const int &ipart) const
virtual double particleFe (const int &ipart) const
virtual double particleMg (const int &ipart) const
virtual double particleACEntropy (const int &ipart) const
virtual void particlePosition (const int &ipart, double &x, double &y, double &z)
virtual void particleVelocity (const int &ipart, double &x, double &y, double &z)
bool current_file_present (bool showStatus=false)
void set_file (const int &file)
void set_filename (const std::string &filename)
void set_auto_filename (const bool &fn)
 setter for auto_filename_
virtual void convertUnits ()
virtual void setPrefix (const std::string &prefix)
virtual std::string getPrefix () const
virtual int currentFile () const
virtual int firstDump () const
virtual int lastDump () const
virtual std::string get_filename ()
virtual int get_file_size ()
 getter for the file size
virtual int getTypeStart (enums::types_t type)
virtual int getTypeEnd (enums::types_t type)
virtual double getTime (void)
 return the snapshot time
virtual bool check_files_present ()
virtual bool readFile ()
virtual int fortranTypeStart (enums::types_t type)
virtual int fortranTypeEnd (enums::types_t type)

Protected Member Functions

virtual void set_file_size ()
void setFirstDump (int dump)
void setLastDump (int dump)

Protected Attributes

int _currentFile
int file_size_
std::string filename_
std::string _prefix
bool auto_filename_
std::vector< std::string > blocknames_
std::vector< int > blocklens_

Private Attributes

int _firstDump
int _lastDump

Static Private Attributes

static int num_readers = 0


Detailed Description

General class for datareaders.

To read a custom file format this class should be subclassed, where at the very least the pure virtual routines must be reimplemented.

Q_OBJECT because CDataReader can emit signals


Constructor & Destructor Documentation

CDataReader::CDataReader ( int  ifile = -1  ) 

Constructor for the parent class: set the file size, adjust num_readers

CDataReader::~CDataReader (  )  [virtual]

destructor


Member Function Documentation

void CDataReader::convertUnits (  )  [virtual]

Routine should be called _after_ data has been read. It applies the units from the units class cglobals::units to the read data. Can be overriden (virtual) if required.

Current implementation: works on the Fortran-style arrays. Once those are chucked out should use the general data-getting facilities

Program - mass unit: 1.e6 Msol.

  • velocity unit: km/s
  • length unit: kpc

bool CDataReader::current_file_present ( bool  showStatus = false  ) 

returns true if the current file is present, false otherwise. If the argument is true: shows a statusbar message if the file is not found

string CDataReader::get_filename (  )  [virtual]

should be reimplemented by derived classes to return the name of the file to open

Reimplemented in CDataGadget.

double CDataReader::getTime ( void   )  [virtual]

return the snapshot time

should be overridden

Reimplemented in CDataGadget.

int CDataReader::particleIndex ( const int &  id  )  const [virtual]

Get the array index of a particle, based on ID. returns -1 if not found

void CDataReader::set_file ( const int &  file  ) 

switch to a new dump. Also calculate the new file size

void CDataReader::set_file_size (  )  [protected, virtual]

Routine to get the size of the read file (in bytes). Can be overloaded if a different way of getting the size is required.


Member Data Documentation

int CDataReader::_firstDump [private]

Number of the first snapshot present on disk

int CDataReader::_lastDump [private]

Number of the last snapshot present on disk

std::string CDataReader::_prefix [protected]

prefix for the snapshot location (e.g. the file path without the file name)

bool CDataReader::auto_filename_ [protected]

if true: auto-generate file name from run + file + snaploc info


The documentation for this class was generated from the following files:

Generated on Fri Oct 16 18:59:58 2009 for HYPLOT by  doxygen 1.5.8