Cantera  2.0
Public Member Functions | Private Attributes | List of all members
IntStarStar Class Reference

A class for 2D int arrays stored in column-major (Fortran-compatible) form. More...

#include <vcs_IntStarStar.h>

Public Member Functions

 IntStarStar ()
 Default constructor. Create an empty array.
 
 IntStarStar (size_t mcol, size_t nrow, int v=0)
 Constructor.
 
 IntStarStar (const IntStarStar &y)
 Copy constructor.
 
IntStarStaroperator= (const IntStarStar &y)
 Assignment operator.
 
void resize (size_t mcol, size_t nrow, int v=0)
 Resize the array, and fill the new entries with 'v'.
 
int * operator[] (size_t jcol)
 Pointer to the top of the column.
 
const int * operator[] (size_t jcol) const
 Pointer to the top of the column.
 
int *const * baseDataAddr ()
 Returns a int ** pointer to the base address.
 
size_t nRows () const
 Number of rows.
 
size_t nColumns () const
 Number of columns.
 

Private Attributes

std::vector< int > m_data
 Storage area for the matrix, layed out in Fortran style, row-inner, column outer format.
 
std::vector< int * > m_colAddr
 Vector of column addresses.
 
size_t m_nrows
 number of rows
 
size_t m_ncols
 number of columns
 

Detailed Description

A class for 2D int arrays stored in column-major (Fortran-compatible) form.

In this form, the data entry for an n row, m col matrix is index = i + (n-1) * j where Matrix[j][i] i = row j = column

Definition at line 26 of file vcs_IntStarStar.h.

Constructor & Destructor Documentation

Default constructor. Create an empty array.

Definition at line 12 of file vcs_IntStarStar.cpp.

References IntStarStar::m_colAddr, and IntStarStar::m_data.

IntStarStar ( size_t  mcol,
size_t  nrow,
int  v = 0 
)

Constructor.

Create an nrow by mcol int array, and initialize all elements to v.

Parameters
mcolNumber of columns
nrowNumber of rows

Definition at line 24 of file vcs_IntStarStar.cpp.

References IntStarStar::m_colAddr, IntStarStar::m_data, IntStarStar::m_ncols, and IntStarStar::m_nrows.

IntStarStar ( const IntStarStar y)

Copy constructor.

Parameters
yObject to be copied

Definition at line 39 of file vcs_IntStarStar.cpp.

References IntStarStar::m_colAddr, IntStarStar::m_data, IntStarStar::m_ncols, and IntStarStar::m_nrows.

Member Function Documentation

IntStarStar & operator= ( const IntStarStar y)

Assignment operator.

Parameters
yObject to be copied

Definition at line 54 of file vcs_IntStarStar.cpp.

References IntStarStar::m_colAddr, IntStarStar::m_data, IntStarStar::m_ncols, and IntStarStar::m_nrows.

void resize ( size_t  m,
size_t  n,
int  v = 0 
)

Resize the array, and fill the new entries with 'v'.

resize the array, and fill the new entries with 'v'

Parameters
mcolThis is the number of columns in the new matrix
nrowThis is the number of rows
vDefault fill value -> defaults to zero.
nThis is the number of rows
mThis is the number of columns in the new matrix
vDefault fill value -> defaults to zero.

Definition at line 79 of file vcs_IntStarStar.cpp.

References IntStarStar::m_colAddr, IntStarStar::m_data, IntStarStar::m_ncols, and IntStarStar::m_nrows.

Referenced by VCS_SOLVE::vcs_initSizes().

int * operator[] ( size_t  jcol)

Pointer to the top of the column.

Parameters
jcolPointer to the top of the jth column

Definition at line 122 of file vcs_IntStarStar.cpp.

References IntStarStar::m_colAddr.

const int * operator[] ( size_t  jcol) const

Pointer to the top of the column.

Parameters
jPointer to the top of the jth column

Definition at line 127 of file vcs_IntStarStar.cpp.

References IntStarStar::m_colAddr.

int *const * baseDataAddr ( )

Returns a int ** pointer to the base address.

This is the second way to get to the data This returns a int ** which can later be used in Imatrix[icol][irow] notation to get to the data

Definition at line 132 of file vcs_IntStarStar.cpp.

References IntStarStar::m_colAddr.

size_t nRows ( ) const

Number of rows.

Definition at line 138 of file vcs_IntStarStar.cpp.

References IntStarStar::m_nrows.

size_t nColumns ( ) const

Number of columns.

Definition at line 144 of file vcs_IntStarStar.cpp.

References IntStarStar::m_ncols.

Member Data Documentation

std::vector<int> m_data
private

Storage area for the matrix, layed out in Fortran style, row-inner, column outer format.

Length = m_nrows * m_ncols

Definition at line 95 of file vcs_IntStarStar.h.

Referenced by IntStarStar::IntStarStar(), IntStarStar::operator=(), and IntStarStar::resize().

std::vector<int*> m_colAddr
private

Vector of column addresses.

Length = number of columns = m_ncols

Definition at line 101 of file vcs_IntStarStar.h.

Referenced by IntStarStar::baseDataAddr(), IntStarStar::IntStarStar(), IntStarStar::operator=(), IntStarStar::operator[](), and IntStarStar::resize().

size_t m_nrows
private
size_t m_ncols
private

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