EqnBuffer Class Reference

#include <fei_EqnBuffer.hpp>

List of all members.

Public Member Functions

 EqnBuffer ()
 EqnBuffer (const EqnBuffer &src)
virtual ~EqnBuffer ()
EqnBufferdeepCopy ()
EqnBufferoperator= (const EqnBuffer &src)
int getNumEqns ()
std::vector< int > & eqnNumbers ()
std::vector< fei::CSVec * > & eqns ()
int getNumRHSs ()
void setNumRHSs (int n)
int addRHS (int eqnNumber, int rhsIndex, double value, bool accumulate=true)
std::vector< std::vector
< double > * > * 
rhsCoefsPtr ()
int getEqnIndex (int eqn)
int isInIndices (int eqn)
int addEqn (int eqnNumber, const double *coefs, const int *indices, int len, bool accumulate, bool create_indices_union=false)
int addEqns (EqnBuffer &inputEqns, bool accumulate)
int getCoef (int eqnNumber, int colIndex, double &coef)
int removeIndex (int eqnNumber, int colIndex)
int getCoefAndRemoveIndex (int eqnNumber, int colIndex, double &coef)
void resetCoefs ()
int addIndices (int eqnNumber, const int *indices, int len)

Detailed Description

A class for holding equation data, along with optional RHS coefficients for the equations.

Definition at line 21 of file fei_EqnBuffer.hpp.

Constructor & Destructor Documentation

EqnBuffer::EqnBuffer (  ) 


Definition at line 17 of file fei_EqnBuffer.cpp.

EqnBuffer::EqnBuffer ( const EqnBuffer src  ) 

copy constructor

Definition at line 32 of file fei_EqnBuffer.cpp.

EqnBuffer::~EqnBuffer (  )  [virtual]


Definition at line 78 of file fei_EqnBuffer.cpp.

Member Function Documentation

EqnBuffer * EqnBuffer::deepCopy (  ) 

Return a 'clone' of this object, including a copy of all internal data.

Definition at line 83 of file fei_EqnBuffer.cpp.

EqnBuffer & EqnBuffer::operator= ( const EqnBuffer src  ) 

assignment operator

Definition at line 48 of file fei_EqnBuffer.cpp.

int EqnBuffer::getNumEqns (  )  [inline]

Return the number of equations held in this object.

Definition at line 40 of file fei_EqnBuffer.hpp.

std::vector<int>& EqnBuffer::eqnNumbers (  )  [inline]

Return a list of the equation-numbers held in this object.

Definition at line 43 of file fei_EqnBuffer.hpp.

std::vector<fei::CSVec*>& EqnBuffer::eqns (  )  [inline]

Return a table (actually an array of pointers to fei::CSVecs) of the equations. Number-of-arrays is 'getNumEqns', length of i-th array is 'lengthsPtr()[i]'.

Definition at line 48 of file fei_EqnBuffer.hpp.

int EqnBuffer::getNumRHSs (  )  [inline]

Return the number of right-hand-side coefficientss stored for each equation.

Definition at line 52 of file fei_EqnBuffer.hpp.

void EqnBuffer::setNumRHSs ( int  n  ) 

Set the number of right-hand-side coefficients to be stored for each equation. This function internally allocates a table to hold the rhs coefficients. This table has number-of-rows == 'getNumEqns()', and number-of-columns == 'n'. Note that this function should not be called after rhs coefficients have been added, because it destroys and re-allocates the rhs-coef table.


Definition at line 112 of file fei_EqnBuffer.cpp.

int EqnBuffer::addRHS ( int  eqnNumber,
int  rhsIndex,
double  value,
bool  accumulate = true 

Set a right-hand-side coefficient.

eqnNumber Must correspond to one of the equation-numbers in the list 'eqnNumbers()'.
rhsIndex Must be in the range [0 .. getNumRHSs()-1].
value The coefficient.

Definition at line 127 of file fei_EqnBuffer.cpp.

std::vector<std::vector<double>*>* EqnBuffer::rhsCoefsPtr (  )  [inline]

Return the table (actually an array of pointers to arrays) of right-hand-side coefficients. Number-of-arrays == 'getNumEqns()', number-of-columns == 'getNumRHSs()'.

Definition at line 76 of file fei_EqnBuffer.hpp.

int EqnBuffer::getEqnIndex ( int  eqn  ) 

Return an offset into the 'eqnNumbers()' list, being the position at which equation-number 'eqn' is located.

offset 'eqn's location, or -1 if 'eqn' is not found.

Definition at line 106 of file fei_EqnBuffer.cpp.

int EqnBuffer::isInIndices ( int  eqn  ) 

Query whether 'eqn' is present in the table of column-indices.

offset Row of the table that contains 'eqn', or -1 if not found.

Definition at line 148 of file fei_EqnBuffer.cpp.

int EqnBuffer::addEqn ( int  eqnNumber,
const double *  coefs,
const int *  indices,
int  len,
bool  accumulate,
bool  create_indices_union = false 

Add an equation, with associated coefficients and column-indices.

len Number of coefficients and indices
accumulate If this equation is already present, indicate whether incoming coefficients should replace existing ones, or be accumulated into them. Note that this only matters if eqnNumber is already present AND if one or more of 'indices' are already present.
create_indices_union defaults to false. If true, adds each set of indices to a union of all indices. This will be used if the 'isInIndices' method is called later.
error-code, 0 if successful

Definition at line 172 of file fei_EqnBuffer.cpp.

int EqnBuffer::addEqns ( EqnBuffer inputEqns,
bool  accumulate 

Add the equations in inputEqns. Upon completion, the set of equations in 'this' EqnBuffer is the union of the equations that were already present, and the equations in inputEqns.

inputEqns EqnBuffer containing equations to be added to this EqnBuffer.
accumulate If an equation is already present, determines whether to add its coefficients to those already in place, or replace them.

Definition at line 271 of file fei_EqnBuffer.cpp.

int EqnBuffer::getCoef ( int  eqnNumber,
int  colIndex,
double &  coef 

Given an equation number and a column-index in that equation, get the corresponding coefficient.

eqnNumber Input Equation-number
colIndex Input Column-index in equation-number.
coef Output coefficient corresponding to colIndex in eqnNumber.
error-code 0 if successful. If eqnNumber is not found, or if equation 'eqnNumber' doesn't contain 'colIndex', then -1 is returned and coef is not referenced.

Definition at line 201 of file fei_EqnBuffer.cpp.

int EqnBuffer::removeIndex ( int  eqnNumber,
int  colIndex 

Remove the specified column-index from the specified equation-number.

error-code 0 if successful. If eqnNumber is not found, -1 is returned. If equation eqnNumber doesn't contain 'colIndex', the remove request is considered successful and 0 is returned.

Definition at line 214 of file fei_EqnBuffer.cpp.

int EqnBuffer::getCoefAndRemoveIndex ( int  eqnNumber,
int  colIndex,
double &  coef 

Combine the functions 'getCoef()' and 'removeIndex()'. Has the same effect as calling those two functions separately, but saves two searches.

error-code 0 if successful. -1 is returned if position (eqnNumber, colIndex is not found.

Definition at line 242 of file fei_EqnBuffer.cpp.

void EqnBuffer::resetCoefs (  ) 

Reset all coefficients to 0.0

Definition at line 351 of file fei_EqnBuffer.cpp.

int EqnBuffer::addIndices ( int  eqnNumber,
const int *  indices,
int  len 

Add an equation, with associated column-indices but not coefficients.

Definition at line 359 of file fei_EqnBuffer.cpp.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Generated on Wed Apr 13 10:08:25 2011 for FEI by  doxygen 1.6.3