mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7761 Objective Function : Change formula and add several options
This commit is contained in:
@@ -20,8 +20,7 @@
|
||||
|
||||
#include "RimCustomObjectiveFunction.h"
|
||||
#include "RimCustomObjectiveFunctionCollection.h"
|
||||
#include "RimCustomObjectiveFunctionWeight.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimObjectiveFunctionTools.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
@@ -53,8 +52,7 @@ void RicNewCustomObjectiveFunctionFeature::onActionTriggered( bool isChecked )
|
||||
if ( coll.size() == 1 )
|
||||
{
|
||||
RimCustomObjectiveFunction* newFunc = coll[0]->addObjectiveFunction();
|
||||
RimCustomObjectiveFunctionWeight* newWeight = newFunc->addWeight();
|
||||
newWeight->setSummaryAddress( newWeight->parentCurveSet()->summaryAddress() );
|
||||
RimCustomObjectiveFunctionWeight* newWeight = RimObjectiveFunctionTools::addWeight( newFunc );
|
||||
coll[0]->updateConnectedEditors();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newFunc );
|
||||
RiuPlotMainWindowTools::setExpanded( coll.front() );
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "RimCustomObjectiveFunction.h"
|
||||
#include "RimCustomObjectiveFunctionWeight.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimObjectiveFunctionTools.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
@@ -51,16 +51,11 @@ void RicNewCustomObjectiveFunctionWeightFeature::onActionTriggered( bool isCheck
|
||||
|
||||
if ( func.size() == 1 )
|
||||
{
|
||||
RimCustomObjectiveFunctionWeight* newWeight = func[0]->addWeight();
|
||||
if ( func[0]->weights().size() > 1 )
|
||||
{
|
||||
newWeight->setSummaryAddress( func[0]->weights()[0]->summaryAddresses().front() );
|
||||
}
|
||||
else
|
||||
{
|
||||
newWeight->setSummaryAddress( newWeight->parentCurveSet()->summaryAddress() );
|
||||
}
|
||||
func[0]->updateConnectedEditors();
|
||||
auto firstObjectiveFunction = func.front();
|
||||
|
||||
auto newWeight = RimObjectiveFunctionTools::addWeight( firstObjectiveFunction );
|
||||
|
||||
firstObjectiveFunction->updateConnectedEditors();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newWeight );
|
||||
RiuPlotMainWindowTools::setExpanded( func.front() );
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ class RicNewCustomObjectiveFunctionWeightFeature : public caf::CmdFeature
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "RimEnsembleCurveFilter.h"
|
||||
#include "RimEnsembleCurveFilterCollection.h"
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimObjectiveFunctionTools.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
@@ -67,7 +68,11 @@ void RicNewEnsembleCurveFilterFeature::onActionTriggered( bool isChecked )
|
||||
else
|
||||
{
|
||||
std::vector<RifEclipseSummaryAddress> addresses;
|
||||
addresses.push_back( newFilter->parentCurveSet()->summaryAddress() );
|
||||
|
||||
auto candidateAdr = newFilter->parentCurveSet()->summaryAddress();
|
||||
auto nativeQuantityName = RimObjectiveFunctionTools::nativeQuantityName( candidateAdr.quantityName() );
|
||||
candidateAdr.setQuantityName( nativeQuantityName );
|
||||
addresses.push_back( candidateAdr );
|
||||
newFilter->setSummaryAddresses( addresses );
|
||||
}
|
||||
newFilter->loadDataAndUpdate();
|
||||
|
||||
Reference in New Issue
Block a user