Merge branch 'master' into gravity-in-wells

This commit is contained in:
Bård Skaflestad 2012-10-24 10:09:31 +02:00
commit 98fd1f05dd

View File

@ -761,16 +761,28 @@ namespace Opm
wells_->ctrls[self_index_]->current = ~ wells_->ctrls[self_index_]->current; wells_->ctrls[self_index_]->current = ~ wells_->ctrls[self_index_]->current;
} }
} }
// macro to insert const_cast to get a round bug in GCC 4.6.3 where it
// suddenly believes that "this" is a const pointer, although we are not
// in a const method.
#if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 6 ) && ( __GNUC_PATCHLEVEL__ == 3 )
#define CONST_CAST(T,v) const_cast<T>(v)
#else
#define CONST_CAST(T,v) v
#endif
std::pair<WellNode*, double> WellNode::getWorstOffending(const std::vector<double>& well_reservoirrates_phase, std::pair<WellNode*, double> WellNode::getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase, const std::vector<double>& well_surfacerates_phase,
ProductionSpecification::ControlMode mode) ProductionSpecification::ControlMode mode)
{ {
const int np = phaseUsage().num_phases; const int np = phaseUsage().num_phases;
const int index = self_index_*np; const int index = self_index_*np;
return std::make_pair<WellNode*, double>(this, rateByMode(&well_reservoirrates_phase[index], // note: CONST_CAST is just to work around a bug in GCC 4.6.3; it
&well_surfacerates_phase[index], // is not really needed, and should be a harmless no-op.
mode)); return std::make_pair<WellNode*, double>(CONST_CAST(WellNode*,this),
rateByMode(&well_reservoirrates_phase[index],
&well_surfacerates_phase[index],
mode));
} }
void WellNode::applyInjGroupControl(const InjectionSpecification::ControlMode control_mode, void WellNode::applyInjGroupControl(const InjectionSpecification::ControlMode control_mode,