[cleanup] Use class variables instead of creating new vectors inside the apply

method of StandardWellsDense.
This commit is contained in:
Robert Kloefkorn 2016-11-02 10:43:55 +01:00
parent fc15fb821a
commit 11238b1997

View File

@ -152,6 +152,10 @@ namespace Opm {
}
resWell_.resize( nw );
// resize temporary class variables
Cx_.resize( duneC_.N() );
invDrw_.resize( invDuneD_.N() );
}
@ -311,9 +315,10 @@ namespace Opm {
return;
}
BVector invDrw(invDuneD_.N());
invDuneD_.mv(resWell_,invDrw);
duneB_.mmtv(invDrw, r);
assert( invDrw_.size() == invDuneD_.N() );
invDuneD_.mv(resWell_,invDrw_);
duneB_.mmtv(invDrw_, r);
}
// subtract B*inv(D)*C * x from A*x
@ -321,10 +326,13 @@ namespace Opm {
if ( ! localWellsActive() ) {
return;
}
BVector Cx(duneC_.N());
duneC_.mv(x, Cx);
BVector invDCx(invDuneD_.N());
invDuneD_.mv(Cx, invDCx);
assert( Cx_.size() == duneC_.N() );
BVector& invDCx = invDrw_;
assert( invDCx.size() == invDuneD_.N());
duneC_.mv(x, Cx_);
invDuneD_.mv(Cx_, invDCx);
duneB_.mmtv(invDCx,Ax);
}
@ -1408,6 +1416,9 @@ namespace Opm {
BVector resWell_;
mutable BVector Cx_;
mutable BVector invDrw_;
// protected methods
EvalWell getBhp(const int wellIdx) const {
const WellControls* wc = wells().ctrls[wellIdx];