Skip to content

Commit

Permalink
fixing a compilation issue with visual studio
Browse files Browse the repository at this point in the history
  • Loading branch information
BDonnot committed Jul 22, 2024
1 parent a22b604 commit e06bf18
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/GridModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,7 @@ class GridModel : public GenericContainer
// TODO optim : if relabel_row is false, then we can just copy
// paste the columns easily in the target matrix, which should be
// way faster than this function.
typedef typename Eigen::SparseMatrix<T>::StorageIndex index_type;
if(id_solver_to_me.size() == 0) throw std::runtime_error("GridModel::_relabel_matrix: impossible to retrieve the `gridmodel` bus label as it appears no powerflow has run.");
if(Ybus.cols() != nb_bus()) throw std::runtime_error("GridModel::_relabel_matrix: impossible to retrieve the `gridmodel`: the input matrix has not the right number of columns, (.., nb connected bus) expected");
if(relabel_row & (Ybus.rows() != nb_bus())) throw std::runtime_error("GridModel::_relabel_matrix: impossible to retrieve the `gridmodel`: the input matrix has not the right number of columnd (nb connected bus, ...) expected");
Expand All @@ -1082,8 +1083,12 @@ class GridModel : public GenericContainer
for (Eigen::Index col_=0; col_ < n_col; ++col_){
for (typename Eigen::SparseMatrix<T>::InnerIterator it(Ybus, col_); it; ++it)
{
if(relabel_row) tripletList.push_back({id_solver_to_me[it.row()], id_solver_to_me[it.col()], it.value()});
else tripletList.push_back({it.row(), id_solver_to_me[it.col()], it.value()});
if(relabel_row) tripletList.push_back({static_cast<index_type>(id_solver_to_me[it.row()]),
static_cast<index_type>(id_solver_to_me[it.col()]),
it.value()});
else tripletList.push_back({static_cast<index_type>(it.row()),
static_cast<index_type>(id_solver_to_me[it.col()]),
it.value()});
}
}
res.setFromTriplets(tripletList.begin(), tripletList.end());
Expand Down

0 comments on commit e06bf18

Please sign in to comment.