Conversation
I thought I could get another backend supporting StaticCondensation, but no, we'll need shell matrix solves from Eigen too.
We now support another backend; also this wording seemed clearer to me.
| template <typename T> | ||
| void EigenSparseVector<T>::create_subvector(NumericVector<T> & subvector, | ||
| const std::vector<numeric_index_type> & rows, | ||
| const bool /* supplying_global_rows */) const |
There was a problem hiding this comment.
Is Eigen always a serial vector?
src/numerics/eigen_sparse_vector.C
Outdated
| // Construct index set | ||
| //Eigen::Map<Eigen::ArrayXi> ind_vec_map(rows.data(), | ||
| //cast_int<Eigen::Index>(rows.size())); | ||
|
|
There was a problem hiding this comment.
| // Construct index set | |
| //Eigen::Map<Eigen::ArrayXi> ind_vec_map(rows.data(), | |
| //cast_int<Eigen::Index>(rows.size())); |
src/numerics/eigen_sparse_vector.C
Outdated
| //cast_int<Eigen::Index>(rows.size())); | ||
|
|
||
| eigen_subvector->vec() = this->vec()(rows); | ||
| // eigen_subvector->vec() = ind_vec_map.unaryExpr(this->vec()); |
There was a problem hiding this comment.
| // eigen_subvector->vec() = ind_vec_map.unaryExpr(this->vec()); |
src/numerics/eigen_sparse_vector.C
Outdated
| // Construct index set | ||
| // Eigen::Map<Eigen::ArrayXi> ind_vec_map(rows.data(), | ||
| // cast_int<Eigen::Index>(rows.size())); | ||
|
|
There was a problem hiding this comment.
| // Construct index set | |
| // Eigen::Map<Eigen::ArrayXi> ind_vec_map(rows.data(), | |
| // cast_int<Eigen::Index>(rows.size())); |
src/numerics/eigen_sparse_vector.C
Outdated
| // Eigen::Map<Eigen::ArrayXi> ind_vec_map(rows.data(), | ||
| // cast_int<Eigen::Index>(rows.size())); | ||
|
|
||
| DataType subvec = eigen_subvector->vec(); |
There was a problem hiding this comment.
It is - artifact (along with those comments) of a previous uglier implementation. I'll clean it up too.
|
|
||
| DataType subvec = eigen_subvector->vec(); | ||
| this->vec()(rows) = eigen_subvector->vec(); | ||
| this->_is_closed = true; |
There was a problem hiding this comment.
Hmm, should we mark this->_is_closed = false in the getter? Wondering whether we could also do the same in petsc_vector
There was a problem hiding this comment.
We're basically not supposed to touch the original vector until the subvector is restored, right? Marking it non-closed would make that misuse subject to a whole bunch more assertions. I'll do it.
There was a problem hiding this comment.
Whoops - you already did it in the PETSc version. I just missed that when I was implementing here.
There was a problem hiding this comment.
Should we assert that we're already closed when we get_subvector(), though?
|
|
||
|
|
||
| template <class Base, class Derived> | ||
| void Subvectors() |
There was a problem hiding this comment.
Nah; I'm trying to match the naming scheme of the other tests here.
Co-authored-by: Alex Lindsay <alexander.lindsay@inl.gov>
That way our assertions to the contrary will scream if anyone tries to use the parent before the subvector is restored.
|
It looks like I just don't understand what
So I supplied a globally-synchronized set of 10 row ids for that case, corresponding to all the rows I wanted in the subvector ... And I got a vector of length 20 on two processors, I suppose corresponding to two copies of all the rows I asked for? @lindsayad , clarification? |
Not sure how far I'm going to go with the Eigen support here (I wanted something a little simpler than PETSc to use for testing other code) but what's here so far was simple enough and was good motivation for adding missing test coverage.