Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.6dev
      Class Index
      File List
   Version 1.0.6
   Version 1.0.5new_solver
   Version 1.0.5dev
   Version 1.0.5b
   Version 1.0.4dev
   Version 1.0.4
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads
ReadAscii Class Reference

Class for reading ASCII data files. More...

#include <readascii.hpp>

Public Member Functions

 ReadAscii ()
 Constructor for empty class. More...
 
 ReadAscii (const std::string &filename, int columns=-1)
 Constructor for class from file. More...
 
 ~ReadAscii ()
 Destructor. More...
 
void read (const std::string &filename, int columns=-1)
 Read ASCII data file. More...
 
void set_comment_character (char c)
 
void clear (void)
 Clear data. More...
 
uint32_t columns (void) const
 Return number of columns in data. More...
 
uint32_t rows (void) const
 Return number of rows in data. More...
 
const std::vector< double > & operator[] (uint32_t i) const
 Return const reference to the vector containing column i. More...
 

Detailed Description

Class for reading ASCII data files.

Reads ASCII data file formatted into N columns skipping empty lines and lines starting with a comment character (assignable, defaults to '#'). The number of columns may be given to read function, in which case it is checked to be correct or the number of columns may be determined from the start of the file. The number of columns must be fixed and may not change during the file. Data is stored into N double-type vectors, which can be read from the object after reading a datafile.

Constructor & Destructor Documentation

◆ ReadAscii() [1/2]

ReadAscii::ReadAscii ( )

Constructor for empty class.

◆ ReadAscii() [2/2]

ReadAscii::ReadAscii ( const std::string &  filename,
int  columns = -1 
)

Constructor for class from file.

Read ASCII data file from filename. If columns is -1 the number of data columns is determined from the file. If the number of columns is given the file is checked to have the columns.

◆ ~ReadAscii()

ReadAscii::~ReadAscii ( )

Destructor.

Member Function Documentation

◆ clear()

void ReadAscii::clear ( void  )

Clear data.

◆ columns()

uint32_t ReadAscii::columns ( void  ) const
inline

Return number of columns in data.

◆ operator[]()

const std::vector< double > & ReadAscii::operator[] ( uint32_t  i) const

Return const reference to the vector containing column i.

◆ read()

void ReadAscii::read ( const std::string &  filename,
int  columns = -1 
)

Read ASCII data file.

Read ASCII data file from filename. If columns is -1 the number of data columns is determined from the file. If the number of columns is given the file is checked to have the columns.

◆ rows()

uint32_t ReadAscii::rows ( void  ) const
inline

Return number of rows in data.


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


Reference manual for Ion Beam Simulator 1.0.6dev
Generated by Doxygen 1.9.1 on Thu Sep 11 2025 09:37:24.