mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Minor changes
This commit is contained in:
parent
a30d6586a3
commit
36f0e7531f
@ -75,7 +75,7 @@ namespace Opm
|
|||||||
: type_(D),
|
: type_(D),
|
||||||
rows_(d.rows()),
|
rows_(d.rows()),
|
||||||
cols_(d.cols()),
|
cols_(d.cols()),
|
||||||
diag_(Diag(d.diagonal().array().data(), d.diagonal().array().data() + d.rows()))
|
diag_(d.diagonal().array().data(), d.diagonal().array().data() + d.rows())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ namespace Opm
|
|||||||
std::swap(rows_, other.rows_);
|
std::swap(rows_, other.rows_);
|
||||||
std::swap(cols_, other.cols_);
|
std::swap(cols_, other.cols_);
|
||||||
diag_.swap(other.diag_);
|
diag_.swap(other.diag_);
|
||||||
sparse_[0].swap(other.sparse_[0]);
|
std::swap(sparse_, other.sparse_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
AutoDiffMatrix retval(*this);
|
AutoDiffMatrix retval(*this);
|
||||||
retval.type_ = D;
|
retval.type_ = D;
|
||||||
retval.diag_ = Diag(rows_, rhs);
|
retval.diag_.assign(rows_, rhs);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
case D:
|
case D:
|
||||||
@ -352,13 +352,9 @@ namespace Opm
|
|||||||
case I:
|
case I:
|
||||||
return rhs;
|
return rhs;
|
||||||
case D:
|
case D:
|
||||||
{
|
return Eigen::Map<const Eigen::VectorXd>(diag_.data(), rows_) * rhs;
|
||||||
return Eigen::Map<const Eigen::VectorXd>(diag_.data(), rows_) * rhs;
|
|
||||||
}
|
|
||||||
case S:
|
case S:
|
||||||
{
|
return sparse_[0] * rhs;
|
||||||
return sparse_[0] * rhs;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << type_);
|
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << type_);
|
||||||
}
|
}
|
||||||
@ -531,7 +527,7 @@ namespace Opm
|
|||||||
case D:
|
case D:
|
||||||
return rows_;
|
return rows_;
|
||||||
case S:
|
case S:
|
||||||
return sparse_->nonZeros();
|
return sparse_[0].nonZeros();
|
||||||
default:
|
default:
|
||||||
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << type_);
|
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << type_);
|
||||||
}
|
}
|
||||||
@ -548,7 +544,7 @@ namespace Opm
|
|||||||
case D:
|
case D:
|
||||||
return (row == col) ? diag_[row] : 0.0;
|
return (row == col) ? diag_[row] : 0.0;
|
||||||
case S:
|
case S:
|
||||||
return sparse_->coeff(row, col);
|
return sparse_[0].coeff(row, col);
|
||||||
default:
|
default:
|
||||||
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << type_);
|
OPM_THROW(std::logic_error, "Invalid AutoDiffMatrix type encountered: " << type_);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user