Skip to content
Snippets Groups Projects
Commit db8f308d authored by Norihiro Watanabe's avatar Norihiro Watanabe
Browse files

Merge pull request #22 from endJunction/fix-LisMatrix-getMaxDiagCoeff

Fix lis matrix get max diag coeff
parents 038e7fe5 82c6fc94
No related branches found
No related tags found
No related merge requests found
......@@ -13,19 +13,18 @@
*/
#include "LisVector.h"
#include "LisCheck.h"
namespace MathLib
{
LisVector::LisVector(std::size_t length)
: _length(length)
{
lis_vector_create(0, &_vec);
lis_vector_set_size(_vec, 0, length);
}
LisVector::LisVector(LisVector const &src)
: _length(src.size())
{
lis_vector_duplicate(src._vec, &_vec);
lis_vector_copy(src._vec, _vec);
......@@ -58,6 +57,15 @@ LisVector& LisVector::operator= (double v)
return *this;
}
std::size_t LisVector::size() const
{
LIS_INT dummy;
LIS_INT size;
int const ierr = lis_vector_get_size(_vec, &dummy, &size);
checkLisError(ierr);
return size;
}
void LisVector::write (const std::string &filename) const
{
lis_output_vector(_vec, LIS_FMT_PLAIN, const_cast<char*>(filename.c_str()));
......
......@@ -45,13 +45,13 @@ public:
virtual ~LisVector();
/// return a vector length
std::size_t size() const {return _length;};
std::size_t size() const;
/// return a start index of the active data range
std::size_t getRangeBegin() const { return 0;}
/// return an end index of the active data range
std::size_t getRangeEnd() const { return _length; }
std::size_t getRangeEnd() const { return this->size(); }
/// set all values in this vector
LisVector& operator= (double v);
......@@ -103,7 +103,6 @@ public:
}
}
private:
std::size_t const _length;
LIS_VECTOR _vec;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment