Cantera  2.1.2
Public Member Functions | Private Attributes | List of all members
DoubleStarStar Class Reference

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

#include <vcs_DoubleStarStar.h>

Public Member Functions

 DoubleStarStar ()
 Default constructor. Create an empty array. More...
 
 DoubleStarStar (size_t mcol, size_t nrow, double v=0.0)
 Constructor. More...
 
 DoubleStarStar (const DoubleStarStar &y)
 
DoubleStarStaroperator= (const DoubleStarStar &y)
 
void resize (size_t mcol, size_t nrow, double v=0.0)
 Resize the array, and fill the new entries with v More...
 
double * operator[] (size_t jcol)
 Pointer to the top of the column. More...
 
const double * operator[] (size_t jcol) const
 Returns a const Pointer to the top of the jth column. More...
 
double *const * baseDataAddr ()
 Returns a double** pointer to the base address. More...
 
double const *const * constBaseDataAddr () const
 Returns a const double** 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< double > m_data
 Storage area. More...
 
std::vector< double * > m_colAddr
 Vector of addresses for the top of the columns. More...
 
size_t m_nrows
 number of rows More...
 
size_t m_ncols
 number of columns More...
 

Detailed Description

A class for 2D double 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.

The way this is instantiated is via the constructor, DoubleStarStar Dmatrix(mcol, mrow)`.

The way this is referenced is via the notation: Dmatrix[icol][irow].

Definition at line 28 of file vcs_DoubleStarStar.h.

Constructor & Destructor Documentation

Default constructor. Create an empty array.

Definition at line 11 of file vcs_DoubleStarStar.cpp.

References DoubleStarStar::m_colAddr, and DoubleStarStar::m_data.

DoubleStarStar ( size_t  mcol,
size_t  nrow,
double  v = 0.0 
)

Constructor.

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

Parameters
mcolNumber of columns
nrowNumber of rows
vvalue used to initialize elements

Definition at line 19 of file vcs_DoubleStarStar.cpp.

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

Member Function Documentation

void resize ( size_t  mcol,
size_t  nrow,
double  v = 0.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 63 of file vcs_DoubleStarStar.cpp.

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

Referenced by VCS_PROB::resizeElements(), VCS_PROB::resizeSpecies(), and VCS_PROB::VCS_PROB().

double * operator[] ( size_t  jcol)

Pointer to the top of the column.

Parameters
jcolThis is the jth column
Returns
returns the pointer to the top of the jth column

Definition at line 108 of file vcs_DoubleStarStar.cpp.

References DoubleStarStar::m_colAddr.

const double * operator[] ( size_t  jcol) const

Returns a const Pointer to the top of the jth column.

Parameters
jcolThis is the jth column
Returns
returns the pointer to the top of the jth column

Definition at line 113 of file vcs_DoubleStarStar.cpp.

References DoubleStarStar::m_colAddr.

double *const * baseDataAddr ( )

Returns a double** pointer to the base address.

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

Definition at line 118 of file vcs_DoubleStarStar.cpp.

References DoubleStarStar::m_colAddr.

Referenced by VCS_PROB::set_gai(), and VCS_SOLVE::vcs_CalcLnActCoeffJac().

double const *const * constBaseDataAddr ( ) const

Returns a const double** pointer to the base address.

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

Definition at line 123 of file vcs_DoubleStarStar.cpp.

References DoubleStarStar::m_colAddr.

size_t nRows ( ) const

Number of rows.

Definition at line 128 of file vcs_DoubleStarStar.cpp.

References DoubleStarStar::m_nrows.

size_t nColumns ( ) const

Number of columns.

Definition at line 133 of file vcs_DoubleStarStar.cpp.

References DoubleStarStar::m_ncols.

Member Data Documentation

std::vector<double> m_data
private

Storage area.

Definition at line 97 of file vcs_DoubleStarStar.h.

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

std::vector<double*> m_colAddr
private

Vector of addresses for the top of the columns.

Length = mcol

Definition at line 103 of file vcs_DoubleStarStar.h.

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

size_t m_nrows
private

number of rows

Definition at line 106 of file vcs_DoubleStarStar.h.

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

size_t m_ncols
private

number of columns

Definition at line 109 of file vcs_DoubleStarStar.h.

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


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