Cantera  2.0
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.
 
 DoubleStarStar (size_t mcol, size_t nrow, double v=0.0)
 Constructor.
 
 DoubleStarStar (const DoubleStarStar &y)
 copy constructor
 
DoubleStarStaroperator= (const DoubleStarStar &y)
 assignment operator
 
void resize (size_t mcol, size_t nrow, double v=0.0)
 Resize the array, and fill the new entries with 'v'.
 
double * operator[] (size_t jcol)
 Pointer to the top of the column.
 
const double * operator[] (size_t jcol) const
 Returns a const Pointer to the top of the jth column.
 
double *const * baseDataAddr ()
 Returns a double ** pointer to the base address.
 
double const *const * constBaseDataAddr () const
 Returns a const double ** pointer to the base address.
 
size_t nRows () const
 Number of rows.
 
size_t nColumns () const
 Number of columns.
 

Private Attributes

std::vector< double > m_data
 Storage area.
 
std::vector< double * > m_colAddr
 Vector of addresses for the top of the columns.
 
size_t m_nrows
 number of rows
 
size_t m_ncols
 number of columns
 

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 col matrix is index = i + (n-1) * j where Matrix[j][i] i = row j = column 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 32 of file vcs_DoubleStarStar.h.

Constructor & Destructor Documentation

Default constructor. Create an empty array.

Definition at line 12 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

Definition at line 24 of file vcs_DoubleStarStar.cpp.

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

copy constructor

Parameters
yobject to be copied

Definition at line 37 of file vcs_DoubleStarStar.cpp.

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

Member Function Documentation

DoubleStarStar & operator= ( const DoubleStarStar y)

assignment operator

Parameters
yobject to be copied

Definition at line 52 of file vcs_DoubleStarStar.cpp.

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

void resize ( size_t  mcol,
size_t  nrow,
double  v = 0.0 
)

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

Parameters
mrowThis is the number of columns in the new matrix
ncolThis is the number of rows
vDefault fill value -> defaults to zero.

Definition at line 77 of file vcs_DoubleStarStar.cpp.

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

Referenced by vcs_VolPhase::operator=(), vcs_VolPhase::resize(), VCS_PROB::resizeElements(), VCS_PROB::resizeSpecies(), vcs_VolPhase::transferElementsFM(), VCS_SOLVE::vcs_initSizes(), 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 122 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 127 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 132 of file vcs_DoubleStarStar.cpp.

References DoubleStarStar::m_colAddr.

Referenced by VCS_PROB::set_gai(), and vcs_VolPhase::transferElementsFM().

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 137 of file vcs_DoubleStarStar.cpp.

References DoubleStarStar::m_colAddr.

Referenced by vcs_VolPhase::getFormulaMatrix().

size_t nRows ( ) const

Number of rows.

Definition at line 143 of file vcs_DoubleStarStar.cpp.

References DoubleStarStar::m_nrows.

size_t nColumns ( ) const

Number of columns.

Definition at line 149 of file vcs_DoubleStarStar.cpp.

References DoubleStarStar::m_ncols.

Member Data Documentation

std::vector<double> m_data
private
std::vector<double*> m_colAddr
private
size_t m_nrows
private
size_t m_ncols
private

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