Skip to content
Snippets Groups Projects
Commit a5e9a8ab authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

linearSystemCSR : accept zeroMatrix/zeroRHS even if matrix/rhs not yet

allocated
parent ae0db6e5
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ class linearSystemCSR : public linearSystem<scalar> {
std::vector<scalar> *_b, *_x;
public:
linearSystemCSR()
: sorted(false), _a(0) {}
: sorted(false), _a(0), _b(0), _x(0) {}
virtual bool isAllocated() const { return _a != 0; }
virtual void allocate(int) ;
virtual void clear()
......@@ -105,12 +105,14 @@ class linearSystemCSR : public linearSystem<scalar> {
}
virtual void zeroMatrix()
{
if (!_a) return;
int N = CSRList_Nbr(_a);
scalar *a = (scalar*) _a->array;
for (int i = 0; i < N; i++) a[i] = 0;
}
virtual void zeroRightHandSide()
{
if (!_b) return;
for(unsigned int i = 0; i < _b->size(); i++) (*_b)[i] = 0.;
}
virtual double normInfRightHandSide() const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment