Cantera  2.1.2
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. More...
 
 IntStarStar (size_t mcol, size_t nrow, int v=0)
 Constructor. More...
 
 IntStarStar (const IntStarStar &y)
 
IntStarStaroperator= (const IntStarStar &y)
 
void resize (size_t mcol, size_t nrow, int v=0)
 Resize the array, and fill the new entries with 'v'. More...
 
int * operator[] (size_t jcol)
 Pointer to the top of the column. More...
 
const int * operator[] (size_t jcol) const
 Pointer to the top of the column. More...
 
int *const * baseDataAddr ()
 Returns a int** pointer to the base address. More...
 
size_t nRows () const
 Number of rows. More...
 
size_t nColumns () const
 Number of columns. More...
 

Private Attributes

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

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 colum matrix is index = i + (n-1) * j where Matrix[j][i] references the element in row i, column j.

Definition at line 20 of file vcs_IntStarStar.h.

Constructor & Destructor Documentation

Default constructor. Create an empty array.

Definition at line 8 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
vvalue used to initialize elements

Definition at line 16 of file vcs_IntStarStar.cpp.

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

Member Function Documentation

void resize ( size_t  mcol,
size_t  nrow,
int  v = 0 
)

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.

Definition at line 62 of file vcs_IntStarStar.cpp.

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

int * operator[] ( size_t  jcol)

Pointer to the top of the column.

Parameters
jcolPointer to the top of the jth column

Definition at line 105 of file vcs_IntStarStar.cpp.

References IntStarStar::m_colAddr.

const int * operator[] ( size_t  jcol) const

Pointer to the top of the column.

Parameters
jcolPointer to the top of the jth column

Definition at line 110 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 115 of file vcs_IntStarStar.cpp.

References IntStarStar::m_colAddr.

size_t nRows ( ) const

Number of rows.

Definition at line 120 of file vcs_IntStarStar.cpp.

References IntStarStar::m_nrows.

size_t nColumns ( ) const

Number of columns.

Definition at line 125 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 79 of file vcs_IntStarStar.h.

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

std::vector<int*> m_colAddr
private

Vector of column addresses.

Length = number of columns = m_ncols

Definition at line 85 of file vcs_IntStarStar.h.

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

size_t m_nrows
private

number of rows

Definition at line 88 of file vcs_IntStarStar.h.

Referenced by IntStarStar::IntStarStar(), IntStarStar::nRows(), and IntStarStar::resize().

size_t m_ncols
private

number of columns

Definition at line 91 of file vcs_IntStarStar.h.

Referenced by IntStarStar::IntStarStar(), IntStarStar::nColumns(), and IntStarStar::resize().


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