FEI Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
fei_EqnBuffer.hpp
Go to the documentation of this file.
1#ifndef _fei_EqnBuffer_hpp_
2#define _fei_EqnBuffer_hpp_
3
4/*--------------------------------------------------------------------*/
5/* Copyright 2005 Sandia Corporation. */
6/* Under the terms of Contract DE-AC04-94AL85000, there is a */
7/* non-exclusive license for use of this work by or on behalf */
8/* of the U.S. Government. Export of this program may require */
9/* a license from the United States Government. */
10/*--------------------------------------------------------------------*/
11
12#include "fei_fwd.hpp"
13
14#include <vector>
15
21class EqnBuffer {
22 public:
24 EqnBuffer();
25
27 EqnBuffer(const EqnBuffer& src);
28
30 virtual ~EqnBuffer();
31
35
37 EqnBuffer& operator=(const EqnBuffer& src);
38
40 int getNumEqns() {return(eqnNumbers_.size());};
41
43 std::vector<int>& eqnNumbers() {return(eqnNumbers_);};
44
48 std::vector<fei::CSVec*>& eqns() {return(eqns_);};
49
52 int getNumRHSs() {return(numRHSs_);};
53
62 void setNumRHSs(int n);
63
70 int addRHS(int eqnNumber, int rhsIndex, double value, bool accumulate=true);
71
76 std::vector<std::vector<double>*>* rhsCoefsPtr() {return(&rhsCoefs_);};
77
83 int getEqnIndex(int eqn);
84
89 int isInIndices(int eqn);
90
105 int addEqn(int eqnNumber, const double* coefs, const int* indices,
106 int len, bool accumulate, bool create_indices_union=false);
107
116 int addEqns(EqnBuffer& inputEqns, bool accumulate);
117
127 int getCoef(int eqnNumber, int colIndex, double& coef);
128
134 int removeIndex(int eqnNumber, int colIndex);
135
141 int getCoefAndRemoveIndex(int eqnNumber, int colIndex, double& coef);
142
144 void resetCoefs();
145
147 int addIndices(int eqnNumber, const int* indices, int len);
148
150
151 private:
152 void deleteMemory();
153 int insertNewEqn(int eqn, int insertPoint);
154
155 int internalAddEqn(int index, const double* coefs,
156 const int* indices, int len, bool accumulate);
157
158 std::vector<int> eqnNumbers_; //list of equation-numbers
159
160 std::vector<fei::CSVec*> eqns_;
161
162 std::vector<int> indices_union_; //union of all equation-indices
163
164 int numRHSs_; //number of right-hand-side coefficients per equation
165 std::vector<std::vector<double>*> rhsCoefs_; //list of vector-pointers, each
166 //vector is of length numRHSs_
169
170 std::vector<double> dummyCoefs_;
171};
172
173std::ostream& operator<<(std::ostream& os, EqnBuffer& eq);
174
175#endif
176
int internalAddEqn(int index, const double *coefs, const int *indices, int len, bool accumulate)
EqnBuffer * deepCopy()
void resetCoefs()
std::vector< int > indices_union_
int isInIndices(int eqn)
bool rhsCoefsAllocated_
void setNumRHSs(int n)
int getCoefAndRemoveIndex(int eqnNumber, int colIndex, double &coef)
virtual ~EqnBuffer()
int insertNewEqn(int eqn, int insertPoint)
std::vector< std::vector< double > * > * rhsCoefsPtr()
int addEqns(EqnBuffer &inputEqns, bool accumulate)
bool setNumRHSsCalled_
int removeIndex(int eqnNumber, int colIndex)
std::vector< int > & eqnNumbers()
void deleteMemory()
int addEqn(int eqnNumber, const double *coefs, const int *indices, int len, bool accumulate, bool create_indices_union=false)
int addRHS(int eqnNumber, int rhsIndex, double value, bool accumulate=true)
std::vector< int > eqnNumbers_
std::vector< std::vector< double > * > rhsCoefs_
EqnBuffer & operator=(const EqnBuffer &src)
int getCoef(int eqnNumber, int colIndex, double &coef)
int getEqnIndex(int eqn)
std::vector< double > dummyCoefs_
std::vector< fei::CSVec * > & eqns()
int addIndices(int eqnNumber, const int *indices, int len)
std::vector< fei::CSVec * > eqns_
std::ostream & operator<<(std::ostream &os, EqnBuffer &eq)