mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Do not abort if the folder cannot be openned!
This commit is contained in:
parent
3e7bc8d686
commit
8bc26562f4
@ -47,15 +47,12 @@ class MatrixMarketIterator
|
|||||||
typedef SparseMatrix<Scalar,ColMajor> MatrixType;
|
typedef SparseMatrix<Scalar,ColMajor> MatrixType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MatrixMarketIterator(const std::string folder):m_sym(0),m_isvalid(false),m_matIsLoaded(false),m_hasRhs(false),m_hasrefX(false),m_folder(folder)
|
MatrixMarketIterator(const std::string &folder)
|
||||||
|
: m_sym(0), m_isvalid(false), m_matIsLoaded(false), m_hasRhs(false), m_hasrefX(false), m_folder(folder)
|
||||||
{
|
{
|
||||||
m_folder_id = opendir(folder.c_str());
|
m_folder_id = opendir(folder.c_str());
|
||||||
if (!m_folder_id){
|
if(m_folder_id)
|
||||||
m_isvalid = false;
|
Getnextvalidmatrix();
|
||||||
std::cerr << "The provided Matrix folder could not be opened \n\n";
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
Getnextvalidmatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~MatrixMarketIterator()
|
~MatrixMarketIterator()
|
||||||
@ -82,7 +79,7 @@ class MatrixMarketIterator
|
|||||||
std::string matrix_file = m_folder + "/" + m_matname + ".mtx";
|
std::string matrix_file = m_folder + "/" + m_matname + ".mtx";
|
||||||
if ( !loadMarket(m_mat, matrix_file))
|
if ( !loadMarket(m_mat, matrix_file))
|
||||||
{
|
{
|
||||||
std::cerr << "Warning loadMarket failed when loading \"" << matrix_file << "\"\n";
|
std::cerr << "Warning loadMarket failed when loading \"" << matrix_file << "\"" << std::endl;
|
||||||
m_matIsLoaded = false;
|
m_matIsLoaded = false;
|
||||||
return m_mat;
|
return m_mat;
|
||||||
}
|
}
|
||||||
@ -167,8 +164,9 @@ class MatrixMarketIterator
|
|||||||
|
|
||||||
inline int sym() { return m_sym; }
|
inline int sym() { return m_sym; }
|
||||||
|
|
||||||
inline bool hasRhs() {return m_hasRhs; }
|
bool hasRhs() {return m_hasRhs; }
|
||||||
inline bool hasrefX() {return m_hasrefX; }
|
bool hasrefX() {return m_hasrefX; }
|
||||||
|
bool isFolderValid() { return bool(m_folder_id); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user