FEI
Version of the Day
|
#include <fei_EqnBuffer.hpp>
Public Member Functions | |
EqnBuffer () | |
EqnBuffer (const EqnBuffer &src) | |
virtual | ~EqnBuffer () |
EqnBuffer * | deepCopy () |
EqnBuffer & | operator= (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) |
A class for holding equation data, along with optional RHS coefficients for the equations.
Definition at line 21 of file fei_EqnBuffer.hpp.
EqnBuffer::EqnBuffer | ( | ) |
Constructor
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.
|
virtual |
Destructor
Definition at line 78 of file fei_EqnBuffer.cpp.
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.
assignment operator
Definition at line 48 of file fei_EqnBuffer.cpp.
|
inline |
Return the number of equations held in this object.
Definition at line 40 of file fei_EqnBuffer.hpp.
|
inline |
Return a list of the equation-numbers held in this object.
Definition at line 43 of file fei_EqnBuffer.hpp.
|
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.
|
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.
n |
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.
|
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.
eqn |
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.
eqn |
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.
eqnNumber | |
coefs | |
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. |
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. |
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.
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.
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.