Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OSCAR::MatrixData Class Reference
[FileData]

Reads data from a file that is represented in matrix format. More...

#include <MatrixData.h>

Inheritance diagram for OSCAR::MatrixData:

Inheritance graph
[legend]
List of all members.

Public Methods

 MatrixData (const String &filename, unsigned int noOfColumns, OSCARError &err=DUMMY_ERROR(noError), const char commentMarker= '#', const String &name=String(""))
 MatrixData (const Matrix &data, OSCARError &err=DUMMY_ERROR(noError), const String &name=String(""))
 MatrixData (const MatrixData &rhs)
virtual ~MatrixData ()
MatrixData & operator= (const MatrixData &rhs)
const MatrixGetParameters () const
unsigned int GetNoRows () const
Vector GetRow (unsigned int rowNumber)
Vector GetCol (unsigned int columnNumber)
double & operator() (unsigned int rowNumber, unsigned int colNumber) const

Protected Methods

virtual void loadParameters (std::ifstream &fileStream, unsigned int noOfColumns, const char commentMarker)

Protected Attributes

unsigned int nrows
Matrixmatrixdata

Detailed Description

Author:
Chetan Kapoor
Reads data from a file that is represented in matrix format. Examples of such data are link inertia matrics (3 by 3), etc. The user has to supply the number of columns of data and the number of rows is automatically figured out by this class from the data file.


Constructor & Destructor Documentation

OSCAR::MatrixData::MatrixData const String   filename,
unsigned int    noOfColumns,
OSCARError   err = DUMMY_ERROR(noError),
const char    commentMarker = '#',
const String   name = String("")
 

Constructor.

This is the Constructor for an object of type MatrixData. Use this to construct an MatrixData object from a data file. Possible errors that may occur include a fileOpenError or badFileData error.

Parameters:
filename A file that contains numerical data that needs to be interpreted as a matrix.
noOfColumns The number of columns that should be used to interpret the data that is being read from the file. For example, if the file contains 20 numerical values and noOfColumns is specified as 4, then a Matrix of size 5 by 4 will be used to store the data.
err A reference to an object of type OSCARError. The default OSCARError object holds values that imply a "No Error" state. This is an error code that is returned.
commentMarker This character defines the beginning of a comment. Once this is encountered, the whole line after this is assumed to be comment information.
name An String that specifies the Name of the object being created.
Exceptions:
fileOpenError fileOpenError Call GetError() for more information.
badFileData badFileData Call GetError() for more information.

OSCAR::MatrixData::MatrixData const Matrix   data,
OSCARError   err = DUMMY_ERROR(noError),
const String   name = String("")
 

Constructor.

This is the Constructor for an object of type MatrixData. Use this to construct an MatrixData object by specifying an Matrix.

Parameters:
data An Matrix object that will be used to initialize the MatrixData object.
err A reference to an object of type OSCARError. The default OSCARError object holds values that imply a "No Error" state. This is an error code that is returned.
name An String that specifies the Name of the object being created.

OSCAR::MatrixData::MatrixData const MatrixData &    rhs
 

Copy Constructor.

This is the Copy Constructor for an object of type MatrixData. Use this to construct an MatrixData object from an existing MatrixData object.

Parameters:
rhs An MatrixData object that will be used to initialize this new object.

virtual OSCAR::MatrixData::~MatrixData   [virtual]
 

Destructor.

This is the Destructor for an object of type MatrixData.


Member Function Documentation

Vector OSCAR::MatrixData::GetCol unsigned int    columnNumber
 

Get a particular column in an Vector form.

Parameters:
columnNumber The column number for which you want the data. This should be less than the total number of columns in the MatrixData. Column numbers start at 0.
Returns:
An Vector containing a particular column of the MatrixData object.
See also:
GetNoRows()

GetParameters()

GetRow()

unsigned int OSCAR::MatrixData::GetNoRows   const
 

Get the number of rows of data.

This method is sued to get the number of rows of data.

Returns:
The number of rows.
See also:
GetParameters()

GetRow()

GetCol()

const Matrix& OSCAR::MatrixData::GetParameters   const
 

Get a matrix representation of the data stored in this object.

This method is used to get a matrix representation of the data stored in this object.

Returns:
An Matrix that contains the data stored in this MatrixData object.
See also:
GetNoRows()

GetRow()

GetCol()

Vector OSCAR::MatrixData::GetRow unsigned int    rowNumber
 

Get a particular row in an Vector form.

This method is used to get a particular row in an Vector form.

Parameters:
rowNumber The row number for which you want the data. This should be less than the total number of rows in the MatrixData as specifed by GetNoRows(). Row numbers start at 0.
Returns:
An Vector containing a particular row of the MatrixData object.
See also:
GetNoRows()

GetParameters()

GetCol()

virtual void OSCAR::MatrixData::loadParameters std::ifstream &    fileStream,
unsigned int    noOfColumns,
const char    commentMarker
[protected, virtual]
 

Load MatrixData data elements from a file.

This method is used to load MatrixData data elements from a file.

Parameters:
fileStream An input stream.
noOfColumns The total number of columns in the file.
commentMarker This character defines the beginning of a comment in the file. Once this is encountered, the whole line after this is assumed to be comment information.

double& OSCAR::MatrixData::operator() unsigned int    rowNumber,
unsigned int    colNumber
const
 

Get a particular element of an MatrixData object.

This method is used to get a particular element of an MatrixData object.

Parameters:
rowNumber The row number for which you want the data. This should be less than the total number of rows in the MatrixData as specifed by GetNoRows(). Row numbers start at 0.
colNumber The column number for which you want the data. This should be less than the total number of columns in the MatrixData. Column numbers start at 0.
Returns:
The element at the specified position.
See also:
GetNoRows()

GetParameters()

GetRow()

GetCol()

MatrixData& OSCAR::MatrixData::operator= const MatrixData &    rhs
 

Assignment Operator.

This is the Assignment Operator for an object of type MatrixData.

Parameters:
rhs A MatrixData object that goes on the right hand side of the = operator
Returns:
A reference to the object on the left hand side of the = operator


Member Data Documentation

Matrix* OSCAR::MatrixData::matrixdata [protected]
 

unsigned int OSCAR::MatrixData::nrows [protected]
 


The documentation for this class was generated from the following file:
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations