mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch '2018.11.02-patch'
This commit is contained in:
commit
45138cb782
@ -1984,8 +1984,6 @@ bool RiaApplication::openFile(const QString& fileName)
|
||||
if (loadingSucceded)
|
||||
{
|
||||
getOrCreateAndShowMainPlotWindow();
|
||||
|
||||
m_project->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,10 @@ int main(int argc, char *argv[])
|
||||
window.loadWinGeoAndDockToolBarLayout();
|
||||
window.showWindow();
|
||||
|
||||
// Create plot main window to be able to set expanded state on created objects
|
||||
// The plot window is hidden by default
|
||||
RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
|
||||
if (app.parseArguments())
|
||||
{
|
||||
RiaLogging::setLoggerInstance(new RiuMessagePanelLogger(window.messagePanel()));
|
||||
|
@ -142,28 +142,45 @@ QString RiaSummaryCurveDefinition::curveDefinitionText(const QString& caseName,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaSummaryCurveDefinition::operator<(const RiaSummaryCurveDefinition& other) const
|
||||
{
|
||||
if (m_summaryCase != other.summaryCase())
|
||||
{
|
||||
// Try comparing the dereferenced objects first. They have a predictable sorting operator.
|
||||
if (m_summaryCase && other.summaryCase())
|
||||
QString ensembleName;
|
||||
QString otherEnsembleName;
|
||||
|
||||
if (m_ensemble)
|
||||
{
|
||||
return *m_summaryCase < *other.summaryCase();
|
||||
ensembleName = m_ensemble->name();
|
||||
}
|
||||
|
||||
if (other.ensemble())
|
||||
{
|
||||
otherEnsembleName = other.ensemble()->name();
|
||||
}
|
||||
|
||||
if (ensembleName != otherEnsembleName)
|
||||
{
|
||||
return ensembleName < otherEnsembleName;
|
||||
}
|
||||
// Sorting by pointer address, which may appear random to the user.
|
||||
return m_summaryCase < other.summaryCase();
|
||||
}
|
||||
|
||||
if (m_ensemble != other.ensemble())
|
||||
{
|
||||
// Try comparing the dereferenced objects first. They have a predictable sorting operator.
|
||||
if (m_ensemble && other.ensemble())
|
||||
QString summaryCaseName;
|
||||
QString otherSummaryCaseName;
|
||||
|
||||
if (m_summaryCase)
|
||||
{
|
||||
return *m_ensemble < *other.ensemble();
|
||||
summaryCaseName = m_summaryCase->caseName();
|
||||
}
|
||||
if (other.summaryCase())
|
||||
{
|
||||
otherSummaryCaseName = other.summaryCase()->caseName();
|
||||
}
|
||||
|
||||
if (summaryCaseName != otherSummaryCaseName)
|
||||
{
|
||||
return summaryCaseName < otherSummaryCaseName;
|
||||
}
|
||||
// Sorting by pointer address, which may appear random to the user.
|
||||
return (m_ensemble < other.ensemble());
|
||||
}
|
||||
|
||||
|
||||
return (m_summaryAddress < other.summaryAddress());
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ bool RiaArgumentParser::parseArguments()
|
||||
progOpt.setOptionPrefix(cvf::ProgramOptions::DOUBLE_DASH);
|
||||
|
||||
QString helpText = QString("\n%1 v. %2\n").arg(RI_APPLICATION_NAME).arg(RiaApplication::getVersionStringApp(false));
|
||||
helpText += "Copyright Statoil ASA, Ceetron Solution AS, Ceetron AS\n\n";
|
||||
helpText += "Copyright Equinor ASA, Ceetron Solution AS, Ceetron AS\n\n";
|
||||
|
||||
const cvf::String usageText = progOpt.usageText(110, 30);
|
||||
helpText += cvfqt::Utils::toQString(usageText);
|
||||
|
@ -18,7 +18,8 @@
|
||||
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
|
||||
#include "../SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||
#include "SummaryPlotCommands/RicNewSummaryCurveFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
@ -47,6 +48,7 @@
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
@ -90,9 +92,9 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& file
|
||||
if (sumCaseColl)
|
||||
{
|
||||
std::vector<RimSummaryCase*> newSumCases = sumCaseColl->createSummaryCasesFromFileInfos(summaryFileInfos);
|
||||
|
||||
for (RimSummaryCase* newSumCase : newSumCases)
|
||||
{
|
||||
|
||||
RimSummaryCaseCollection* existingCollection = nullptr;
|
||||
QString gridCaseFile = RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile(newSumCase->summaryHeaderFilename());
|
||||
RimEclipseCase* gridCase = project->eclipseCaseFromGridFileName(gridCaseFile);
|
||||
@ -150,6 +152,15 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& file
|
||||
}
|
||||
sumCaseColl->updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
if (!newSumCases.empty())
|
||||
{
|
||||
RimSummaryPlotCollection* summaryPlotColl = project->mainPlotCollection()->summaryPlotCollection();
|
||||
|
||||
RicNewSummaryCurveFeature::ensureAtLeastOnePlot(summaryPlotColl, newSumCases.front());
|
||||
|
||||
RiuPlotMainWindowTools::setExpanded(newSumCases.front());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ void RicHelpAboutFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
dlg.setApplicationName(RI_APPLICATION_NAME);
|
||||
dlg.setApplicationVersion(RiaApplication::getVersionStringApp(true));
|
||||
dlg.setCopyright("Copyright Statoil ASA, Ceetron Solutions AS, Ceetron AS");
|
||||
dlg.setCopyright("Copyright Equinor ASA, Ceetron Solutions AS, Ceetron AS");
|
||||
dlg.showQtVersion(false);
|
||||
#ifdef _DEBUG
|
||||
dlg.setIsDebugBuild(true);
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include "RicImportSummaryCasesFeature.h"
|
||||
|
||||
#include "SummaryPlotCommands/RicNewSummaryCurveFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
@ -187,6 +189,12 @@ void RicImportSummaryCasesFeature::addSummaryCases(const std::vector<RimSummaryC
|
||||
RimProject* proj = app->project();
|
||||
RimSummaryCaseMainCollection* sumCaseColl = proj->activeOilField() ? proj->activeOilField()->summaryCaseMainCollection() : nullptr;
|
||||
sumCaseColl->addCases(cases);
|
||||
|
||||
if (!cases.empty())
|
||||
{
|
||||
RicNewSummaryCurveFeature::createNewPlot(proj->mainPlotCollection->summaryPlotCollection(), cases.front());
|
||||
}
|
||||
|
||||
sumCaseColl->updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@ -21,10 +21,10 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RiaSummaryTools.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
@ -37,20 +37,83 @@
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewSummaryCurveFeature, "RicNewSummaryCurveFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCurve* RicNewSummaryCurveFeature::addCurveToPlot(RimSummaryPlot* plot, RimSummaryCase* summaryCase)
|
||||
{
|
||||
if (plot)
|
||||
{
|
||||
RimSummaryCurve* newCurve = new RimSummaryCurve();
|
||||
|
||||
// Use same counting as RicNewSummaryEnsembleCurveSetFeature::onActionTriggered
|
||||
cvf::Color3f curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(plot->singleColorCurveCount());
|
||||
newCurve->setColor(curveColor);
|
||||
|
||||
plot->addCurveAndUpdate(newCurve);
|
||||
|
||||
if (summaryCase)
|
||||
{
|
||||
newCurve->setSummaryCaseY(summaryCase);
|
||||
}
|
||||
|
||||
newCurve->setSummaryAddressY(RifEclipseSummaryAddress::fieldAddress("FOPT"));
|
||||
|
||||
newCurve->loadDataAndUpdate(true);
|
||||
|
||||
return newCurve;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryCurveFeature::ensureAtLeastOnePlot(RimSummaryPlotCollection* summaryPlotCollection, RimSummaryCase* summaryCase)
|
||||
{
|
||||
if (summaryPlotCollection && summaryCase)
|
||||
{
|
||||
if (summaryPlotCollection->summaryPlots.empty())
|
||||
{
|
||||
createNewPlot(summaryPlotCollection, summaryCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryCurveFeature::createNewPlot(RimSummaryPlotCollection* summaryPlotCollection, RimSummaryCase* summaryCase)
|
||||
{
|
||||
if (summaryPlotCollection && summaryCase)
|
||||
{
|
||||
auto plot = summaryPlotCollection->createSummaryPlotWithAutoTitle();
|
||||
|
||||
auto curve = RicNewSummaryCurveFeature::addCurveToPlot(plot, summaryCase);
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
summaryPlotCollection->updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindowTools::setExpanded(curve);
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(curve);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSummaryCurveFeature::isCommandEnabled()
|
||||
{
|
||||
return (selectedSummaryPlot());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
@ -60,25 +123,14 @@ void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked)
|
||||
RimSummaryPlot* plot = selectedSummaryPlot();
|
||||
if (plot)
|
||||
{
|
||||
RimSummaryCurve* newCurve = new RimSummaryCurve();
|
||||
|
||||
// Use same counting as RicNewSummaryEnsembleCurveSetFeature::onActionTriggered
|
||||
cvf::Color3f curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(plot->singleColorCurveCount());
|
||||
newCurve->setColor(curveColor);
|
||||
|
||||
plot->addCurveAndUpdate(newCurve);
|
||||
|
||||
RimSummaryCase* defaultCase = nullptr;
|
||||
RimSummaryCase* defaultCase = nullptr;
|
||||
if (project->activeOilField()->summaryCaseMainCollection()->summaryCaseCount() > 0)
|
||||
{
|
||||
defaultCase = project->activeOilField()->summaryCaseMainCollection()->summaryCase(0);
|
||||
newCurve->setSummaryCaseY(defaultCase);
|
||||
|
||||
newCurve->setSummaryAddressY(RifEclipseSummaryAddress::fieldAddress("FOPT"));
|
||||
|
||||
newCurve->loadDataAndUpdate(true);
|
||||
}
|
||||
|
||||
|
||||
RimSummaryCurve* newCurve = addCurveToPlot(plot, defaultCase);
|
||||
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(newCurve);
|
||||
@ -89,7 +141,7 @@ void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryCurveFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
@ -98,13 +150,13 @@ void RicNewSummaryCurveFeature::setupActionLook(QAction* actionToSetup)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RicNewSummaryCurveFeature::selectedSummaryPlot() const
|
||||
{
|
||||
RimSummaryPlot* sumPlot = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
||||
if (selObj)
|
||||
{
|
||||
sumPlot = RiaSummaryTools::parentSummaryPlot(selObj);
|
||||
|
@ -23,6 +23,9 @@
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryPlot;
|
||||
class RimSummaryCase;
|
||||
class RimSummaryCurve;
|
||||
class RimSummaryPlotCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -30,6 +33,12 @@ class RimSummaryPlot;
|
||||
class RicNewSummaryCurveFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static RimSummaryCurve* addCurveToPlot(RimSummaryPlot* plot, RimSummaryCase* summaryCase);
|
||||
static void ensureAtLeastOnePlot(RimSummaryPlotCollection* summaryPlotCollection, RimSummaryCase* summaryCase);
|
||||
static void createNewPlot(RimSummaryPlotCollection* summaryPlotCollection, RimSummaryCase* summaryCase);
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
|
@ -223,6 +223,38 @@ RifRestartFileInfo RifReaderEclipseSummary::getFileInfo(const QString& headerFil
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string stringFromPointer(const char* pointerToChar)
|
||||
{
|
||||
std::string myString;
|
||||
|
||||
// NB! Assigning a null pointer to a std::string causes runtime crash
|
||||
if (pointerToChar)
|
||||
{
|
||||
myString = pointerToChar;
|
||||
}
|
||||
|
||||
return myString;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string wellNameFromNode(const smspec_node_type * ertSumVarNode)
|
||||
{
|
||||
return stringFromPointer(smspec_node_get_wgname(ertSumVarNode));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string lgrNameFromNode(const smspec_node_type * ertSumVarNode)
|
||||
{
|
||||
return stringFromPointer(smspec_node_get_lgr_name(ertSumVarNode));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -260,7 +292,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode(const smspec_node_type * ertSu
|
||||
case ECL_SMSPEC_WELL_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL;
|
||||
wellName = smspec_node_get_wgname(ertSumVarNode);
|
||||
wellName = wellNameFromNode(ertSumVarNode);
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_REGION_VAR:
|
||||
@ -277,7 +309,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode(const smspec_node_type * ertSu
|
||||
case ECL_SMSPEC_GROUP_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_GROUP;
|
||||
wellGroupName = smspec_node_get_wgname(ertSumVarNode);
|
||||
wellGroupName = wellNameFromNode(ertSumVarNode);
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_BLOCK_VAR:
|
||||
@ -293,7 +325,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode(const smspec_node_type * ertSu
|
||||
case ECL_SMSPEC_COMPLETION_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION;
|
||||
wellName = smspec_node_get_wgname(ertSumVarNode);
|
||||
wellName = wellNameFromNode(ertSumVarNode);
|
||||
const int* ijk = smspec_node_get_ijk(ertSumVarNode);
|
||||
cellI = ijk[0];
|
||||
cellJ = ijk[1];
|
||||
@ -303,7 +335,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode(const smspec_node_type * ertSu
|
||||
case ECL_SMSPEC_LOCAL_BLOCK_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR;
|
||||
lgrName = smspec_node_get_lgr_name(ertSumVarNode);
|
||||
lgrName = lgrNameFromNode(ertSumVarNode);
|
||||
const int* ijk = smspec_node_get_lgr_ijk(ertSumVarNode);
|
||||
cellI = ijk[0];
|
||||
cellJ = ijk[1];
|
||||
@ -313,8 +345,8 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode(const smspec_node_type * ertSu
|
||||
case ECL_SMSPEC_LOCAL_COMPLETION_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR;
|
||||
wellName = smspec_node_get_wgname(ertSumVarNode);
|
||||
lgrName = smspec_node_get_lgr_name(ertSumVarNode);
|
||||
wellName = wellNameFromNode(ertSumVarNode);
|
||||
lgrName = lgrNameFromNode(ertSumVarNode);
|
||||
const int* ijk = smspec_node_get_lgr_ijk(ertSumVarNode);
|
||||
cellI = ijk[0];
|
||||
cellJ = ijk[1];
|
||||
@ -324,8 +356,8 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode(const smspec_node_type * ertSu
|
||||
case ECL_SMSPEC_LOCAL_WELL_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_LGR;
|
||||
wellName = smspec_node_get_wgname(ertSumVarNode);
|
||||
lgrName = smspec_node_get_lgr_name(ertSumVarNode);
|
||||
wellName = wellNameFromNode(ertSumVarNode);
|
||||
lgrName = lgrNameFromNode(ertSumVarNode);
|
||||
}
|
||||
break;
|
||||
case ECL_SMSPEC_NETWORK_VAR:
|
||||
@ -344,7 +376,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode(const smspec_node_type * ertSu
|
||||
case ECL_SMSPEC_SEGMENT_VAR:
|
||||
{
|
||||
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT;
|
||||
wellName = smspec_node_get_wgname(ertSumVarNode);
|
||||
wellName = wellNameFromNode(ertSumVarNode);
|
||||
wellSegmentNumber = smspec_node_get_num(ertSumVarNode);
|
||||
}
|
||||
break;
|
||||
|
@ -1066,49 +1066,54 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
|
||||
{
|
||||
if (uiConfigName == "PlotWindow")
|
||||
{
|
||||
RimOilField* oilField = activeOilField();
|
||||
if (oilField)
|
||||
{
|
||||
if (oilField->summaryCaseMainCollection())
|
||||
auto itemCollection = uiTreeOrdering.add("Cases", ":/Folder.png");
|
||||
|
||||
RimOilField* oilField = activeOilField();
|
||||
if (oilField)
|
||||
{
|
||||
uiTreeOrdering.add( oilField->summaryCaseMainCollection() );
|
||||
}
|
||||
if (oilField->observedDataCollection())
|
||||
{
|
||||
uiTreeOrdering.add( oilField->observedDataCollection() );
|
||||
if (oilField->summaryCaseMainCollection())
|
||||
{
|
||||
itemCollection->add(oilField->summaryCaseMainCollection());
|
||||
}
|
||||
if (oilField->observedDataCollection())
|
||||
{
|
||||
itemCollection->add(oilField->observedDataCollection());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mainPlotCollection)
|
||||
{
|
||||
if (mainPlotCollection->summaryPlotCollection())
|
||||
auto itemCollection = uiTreeOrdering.add("Plots", ":/Folder.png");
|
||||
if (mainPlotCollection->summaryPlotCollection())
|
||||
{
|
||||
uiTreeOrdering.add(mainPlotCollection->summaryPlotCollection());
|
||||
itemCollection->add(mainPlotCollection->summaryPlotCollection());
|
||||
}
|
||||
|
||||
if (mainPlotCollection->summaryCrossPlotCollection())
|
||||
{
|
||||
uiTreeOrdering.add(mainPlotCollection->summaryCrossPlotCollection());
|
||||
}
|
||||
|
||||
if (mainPlotCollection->wellLogPlotCollection())
|
||||
if (mainPlotCollection->summaryCrossPlotCollection())
|
||||
{
|
||||
uiTreeOrdering.add(mainPlotCollection->wellLogPlotCollection());
|
||||
itemCollection->add(mainPlotCollection->summaryCrossPlotCollection());
|
||||
}
|
||||
|
||||
if (mainPlotCollection->rftPlotCollection())
|
||||
{
|
||||
uiTreeOrdering.add(mainPlotCollection->rftPlotCollection());
|
||||
}
|
||||
|
||||
if (mainPlotCollection->pltPlotCollection())
|
||||
{
|
||||
uiTreeOrdering.add(mainPlotCollection->pltPlotCollection());
|
||||
}
|
||||
|
||||
if (mainPlotCollection->flowPlotCollection())
|
||||
if (mainPlotCollection->wellLogPlotCollection())
|
||||
{
|
||||
uiTreeOrdering.add(mainPlotCollection->flowPlotCollection());
|
||||
itemCollection->add(mainPlotCollection->wellLogPlotCollection());
|
||||
}
|
||||
|
||||
if (mainPlotCollection->rftPlotCollection())
|
||||
{
|
||||
itemCollection->add(mainPlotCollection->rftPlotCollection());
|
||||
}
|
||||
|
||||
if (mainPlotCollection->pltPlotCollection())
|
||||
{
|
||||
itemCollection->add(mainPlotCollection->pltPlotCollection());
|
||||
}
|
||||
|
||||
if (mainPlotCollection->flowPlotCollection())
|
||||
{
|
||||
itemCollection->add(mainPlotCollection->flowPlotCollection());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ float RigGeoMechWellLogExtractor::calculatePorePressureInSegment(int64_t interse
|
||||
double porePressure = hydroStaticPorePressureBar;
|
||||
|
||||
// 1: Try pore pressure from the grid
|
||||
if (porePressure == hydroStaticPorePressureBar && averageSegmentPorePressureBar > 0.0)
|
||||
if (porePressure == hydroStaticPorePressureBar && averageSegmentPorePressureBar != std::numeric_limits<double>::infinity() && averageSegmentPorePressureBar > 0.0)
|
||||
{
|
||||
porePressure = averageSegmentPorePressureBar;
|
||||
}
|
||||
|
@ -557,12 +557,16 @@ void RiuSummaryCurveDefSelection::fieldChangedByUi(const caf::PdmFieldHandle* ch
|
||||
size_t curveCount = allCurveDefinitionsFromSelection().size();
|
||||
size_t curveSetCount = allCurveSetDefinitionsFromSelections().size();
|
||||
|
||||
if (m_toggleChangedHandler != nullptr && (curveCount != m_prevCurveCount || curveSetCount != m_prevCurveSetCount))
|
||||
if (m_toggleChangedHandler != nullptr)
|
||||
{
|
||||
m_toggleChangedHandler();
|
||||
// Do nothing if the curve count and curve set count is identical
|
||||
if ((curveCount != m_prevCurveCount || curveSetCount != m_prevCurveSetCount))
|
||||
{
|
||||
m_toggleChangedHandler();
|
||||
|
||||
m_prevCurveCount = curveCount;
|
||||
m_prevCurveSetCount = curveSetCount;
|
||||
m_prevCurveCount = curveCount;
|
||||
m_prevCurveSetCount = curveSetCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1204,6 +1208,9 @@ void RiuSummaryCurveDefSelection::resetAllFields()
|
||||
a->pdmField()->v().clear();
|
||||
}
|
||||
}
|
||||
|
||||
m_prevCurveCount = 0;
|
||||
m_prevCurveSetCount = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -1,10 +1,10 @@
|
||||
|
||||
set(RESINSIGHT_MAJOR_VERSION 2018)
|
||||
set(RESINSIGHT_MINOR_VERSION 11)
|
||||
set(RESINSIGHT_PATCH_VERSION 1)
|
||||
set(RESINSIGHT_PATCH_VERSION 2)
|
||||
|
||||
# Opional text with no restrictions
|
||||
#set(RESINSIGHT_VERSION_TEXT "-patch_RC02")
|
||||
#set(RESINSIGHT_VERSION_TEXT "-patch_RC04")
|
||||
|
||||
# Optional text
|
||||
# Must be unique and increasing within one combination of major/minor/patch version
|
||||
|
2
ThirdParty/Ert/lib/ecl/ecl_nnc_geometry.cpp
vendored
2
ThirdParty/Ert/lib/ecl/ecl_nnc_geometry.cpp
vendored
@ -92,7 +92,7 @@ static bool ecl_nnc_cmp(const ecl_nnc_pair_type& nnc1, const ecl_nnc_pair_type&
|
||||
if (nnc1.global_index2 != nnc2.global_index2)
|
||||
return nnc1.global_index2 < nnc2.global_index2;
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
11
ThirdParty/Ert/lib/ecl/ecl_smspec.cpp
vendored
11
ThirdParty/Ert/lib/ecl/ecl_smspec.cpp
vendored
@ -844,11 +844,14 @@ static void ecl_smspec_install_special_keys( ecl_smspec_type * ecl_smspec , smsp
|
||||
hash_insert_ref( ecl_smspec->field_var_index , keyword , smspec_node );
|
||||
break;
|
||||
case(ECL_SMSPEC_GROUP_VAR):
|
||||
if (!hash_has_key(ecl_smspec->group_var_index , group))
|
||||
hash_insert_hash_owned_ref(ecl_smspec->group_var_index , group, hash_alloc() , hash_free__);
|
||||
if (group)
|
||||
{
|
||||
hash_type * var_hash = (hash_type*)hash_get(ecl_smspec->group_var_index , group);
|
||||
hash_insert_ref(var_hash , keyword , smspec_node );
|
||||
if (!hash_has_key(ecl_smspec->group_var_index , group))
|
||||
hash_insert_hash_owned_ref(ecl_smspec->group_var_index , group, hash_alloc() , hash_free__);
|
||||
{
|
||||
hash_type * var_hash = (hash_type*)hash_get(ecl_smspec->group_var_index , group);
|
||||
hash_insert_ref(var_hash , keyword , smspec_node );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case(ECL_SMSPEC_REGION_VAR):
|
||||
|
233
ThirdParty/Ert/lib/ecl/fortio.c
vendored
233
ThirdParty/Ert/lib/ecl/fortio.c
vendored
@ -23,7 +23,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/util/type_macros.hpp>
|
||||
#include <ert/util/type_macros.h>
|
||||
#include <ert/ecl/fortio.h>
|
||||
|
||||
#include <ecl/fortio.h>
|
||||
@ -119,9 +119,13 @@ static fortio_type * fortio_alloc__(const char *filename , bool fmt_file , bool
|
||||
*/
|
||||
|
||||
static bool __read_int(FILE * stream , int * value, bool endian_flip) {
|
||||
int ok = eclfio_sizeof( stream, endian_flip ? "c" : "ce", value );
|
||||
fseek( stream, sizeof( int32_t ), SEEK_CUR );
|
||||
return !ok;
|
||||
/* This fread() can legitemately fail - can not use util_fread() here. */
|
||||
if (fread(value , sizeof * value , 1 , stream) == 1) {
|
||||
if (endian_flip)
|
||||
util_endian_flip_vector(value , sizeof * value , 1);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -415,14 +419,30 @@ void fortio_fclose(fortio_type *fortio) {
|
||||
|
||||
|
||||
bool fortio_is_fortio_file(fortio_type * fortio) {
|
||||
fpos_t init_pos;
|
||||
fgetpos( fortio->stream, &init_pos );
|
||||
offset_type init_pos = fortio_ftell(fortio);
|
||||
int elm_read;
|
||||
bool is_fortio_file = false;
|
||||
int record_size;
|
||||
elm_read = fread(&record_size , sizeof(record_size) , 1 , fortio->stream);
|
||||
if (elm_read == 1) {
|
||||
int trailer;
|
||||
|
||||
int err = eclfio_get( fortio->stream, fortio->opts, NULL, NULL );
|
||||
if (fortio->endian_flip_header)
|
||||
util_endian_flip_vector(&record_size , sizeof record_size , 1);
|
||||
|
||||
fsetpos( fortio->stream, &init_pos );
|
||||
if (fortio_fseek(fortio , (offset_type) record_size , SEEK_CUR) == 0) {
|
||||
if (fread(&trailer , sizeof(record_size) , 1 , fortio->stream) == 1) {
|
||||
if (fortio->endian_flip_header)
|
||||
util_endian_flip_vector(&trailer , sizeof trailer , 1);
|
||||
|
||||
return err == ECL_OK;
|
||||
if (trailer == record_size)
|
||||
is_fortio_file = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fortio_fseek(fortio , init_pos , SEEK_SET);
|
||||
return is_fortio_file;
|
||||
}
|
||||
|
||||
|
||||
@ -434,17 +454,26 @@ bool fortio_is_fortio_file(fortio_type * fortio) {
|
||||
*/
|
||||
|
||||
int fortio_init_read(fortio_type *fortio) {
|
||||
int32_t record_size;
|
||||
int err = eclfio_sizeof( fortio->stream, fortio->opts, &record_size );
|
||||
// this function exposes successful reads as advanced file pointers
|
||||
if( err == 0 ) fseek( fortio->stream, 4, SEEK_CUR );
|
||||
return err ? -1 : record_size;
|
||||
int elm_read;
|
||||
int record_size;
|
||||
|
||||
elm_read = fread(&record_size , sizeof(record_size) , 1 , fortio->stream);
|
||||
if (elm_read == 1) {
|
||||
if (fortio->endian_flip_header)
|
||||
util_endian_flip_vector(&record_size , sizeof record_size , 1);
|
||||
|
||||
return record_size;
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bool fortio_data_fskip(fortio_type* fortio, const int element_size, const int element_count, const int block_count) {
|
||||
return !eclfio_skip( fortio->stream, fortio->opts, block_count );
|
||||
int headers = block_count * 4;
|
||||
int trailers = block_count * 4;
|
||||
int bytes_to_skip = headers + trailers + (element_size * element_count);
|
||||
|
||||
return fortio_fseek(fortio, bytes_to_skip, SEEK_CUR);
|
||||
}
|
||||
|
||||
|
||||
@ -456,9 +485,9 @@ void fortio_data_fseek(fortio_type* fortio, offset_type data_offset, size_t data
|
||||
int block_index = data_element / block_size;
|
||||
int headers = (block_index + 1) * 4;
|
||||
int trailers = block_index * 4;
|
||||
offset_type offset = data_offset + headers + trailers + (data_element * element_size);
|
||||
offset_type bytes_to_skip = data_offset + headers + trailers + (data_element * element_size);
|
||||
|
||||
fortio_fseek(fortio, offset, SEEK_SET);
|
||||
fortio_fseek(fortio, bytes_to_skip, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
@ -489,6 +518,28 @@ bool fortio_complete_read(fortio_type *fortio , int record_size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function reads one record from the fortio stream, and fills
|
||||
the buffer with the content. The return value is the number of
|
||||
bytes read; the function will return -1 on failure.
|
||||
*/
|
||||
|
||||
static int fortio_fread_record(fortio_type *fortio , char *buffer) {
|
||||
int record_size = fortio_init_read(fortio);
|
||||
if (record_size >= 0) {
|
||||
size_t items_read = fread(buffer , 1 , record_size , fortio->stream);
|
||||
if (items_read == record_size) {
|
||||
bool complete_ok = fortio_complete_read(fortio , record_size);
|
||||
if (!complete_ok)
|
||||
record_size = -1;
|
||||
} else
|
||||
record_size = -1; /* Failure */
|
||||
}
|
||||
return record_size;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function fills the buffer with 'buffer_size' bytes from the
|
||||
fortio stream. The function works by repeated calls to
|
||||
@ -499,107 +550,75 @@ bool fortio_complete_read(fortio_type *fortio , int record_size) {
|
||||
*/
|
||||
|
||||
bool fortio_fread_buffer(fortio_type * fortio, char * buffer , int buffer_size) {
|
||||
int total_bytes_read = 0;
|
||||
int total_bytes_read = 0;
|
||||
|
||||
while( true ) {
|
||||
int32_t record_size = buffer_size - total_bytes_read;
|
||||
int err = eclfio_get( fortio->stream,
|
||||
fortio->opts,
|
||||
&record_size,
|
||||
buffer );
|
||||
while (true) {
|
||||
char * buffer_ptr = &buffer[total_bytes_read];
|
||||
int bytes_read = fortio_fread_record(fortio , buffer_ptr);
|
||||
|
||||
if( err == ECL_EINVAL ) {
|
||||
err = eclfio_sizeof( fortio->stream, fortio->opts, &record_size );
|
||||
if( err ) util_abort("%s: unable to determine size of record, "
|
||||
"%d bytes read\n",
|
||||
__func__,
|
||||
total_bytes_read );
|
||||
|
||||
if( total_bytes_read + record_size > buffer_size )
|
||||
util_abort("%s: internal inconsistency: "
|
||||
"buffer_size:%d, would read %d bytes\n",
|
||||
__func__,
|
||||
buffer_size,
|
||||
total_bytes_read + record_size );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if( err ) return false;
|
||||
|
||||
buffer += record_size;
|
||||
total_bytes_read += record_size;
|
||||
|
||||
if( total_bytes_read == buffer_size )
|
||||
return true;
|
||||
if (bytes_read < 0)
|
||||
break;
|
||||
else {
|
||||
total_bytes_read += bytes_read;
|
||||
if (total_bytes_read >= buffer_size)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (total_bytes_read == buffer_size)
|
||||
return true;
|
||||
|
||||
if (total_bytes_read < buffer_size)
|
||||
return false;
|
||||
|
||||
util_abort("%s: internal inconsistency: buffer_size:%d read %d bytes \n",__func__ , buffer_size , total_bytes_read);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int fortio_fskip_record(fortio_type *fortio) {
|
||||
int32_t size = 0;
|
||||
const int err = eclfio_get( fortio->stream, fortio->opts, &size, NULL );
|
||||
if( err ) return -1;
|
||||
return size;
|
||||
int record_size = fortio_init_read(fortio);
|
||||
fortio_fseek(fortio , (offset_type) record_size , SEEK_CUR);
|
||||
fortio_complete_read(fortio , record_size);
|
||||
return record_size;
|
||||
}
|
||||
|
||||
void fortio_fskip_buffer(fortio_type * fortio, int buffer_size) {
|
||||
int bytes_skipped = 0;
|
||||
while (bytes_skipped < buffer_size) {
|
||||
int size = fortio_fskip_record(fortio);
|
||||
|
||||
if( size < 0 ) util_abort( "%s: broken record in %s. "
|
||||
"%d bytes skipped so far\n",
|
||||
__func__,
|
||||
fortio->filename,
|
||||
bytes_skipped );
|
||||
|
||||
bytes_skipped += fortio_fskip_record(fortio);
|
||||
}
|
||||
while (bytes_skipped < buffer_size)
|
||||
bytes_skipped += fortio_fskip_record(fortio);
|
||||
|
||||
if (bytes_skipped > buffer_size)
|
||||
util_abort("%s: hmmmm - something is broken. The individual records in %s did not sum up to the expected buffer size \n",__func__ , fortio->filename);
|
||||
}
|
||||
|
||||
|
||||
void fortio_copy_record(fortio_type * src_stream , fortio_type * target_stream , int buffer_size , void * ext_buffer, bool *at_eof) {
|
||||
int bytes_read = 0;
|
||||
void fortio_copy_record(fortio_type * src_stream , fortio_type * target_stream , int buffer_size , void * buffer , bool *at_eof) {
|
||||
int bytes_read;
|
||||
int record_size = fortio_init_read(src_stream);
|
||||
fortio_init_write(target_stream , record_size);
|
||||
|
||||
bytes_read = 0;
|
||||
while (bytes_read < record_size) {
|
||||
int bytes;
|
||||
if (record_size > buffer_size)
|
||||
bytes = buffer_size;
|
||||
else
|
||||
bytes = record_size - bytes_read;
|
||||
|
||||
int32_t size = 0;
|
||||
int err = eclfio_sizeof( src_stream->stream, src_stream->opts, &size );
|
||||
if( err ) {
|
||||
util_abort( "%s: could not peek record size after %d bytes\n",
|
||||
__func__,
|
||||
bytes_read );
|
||||
}
|
||||
util_fread(buffer , 1 , bytes , src_stream->stream , __func__);
|
||||
util_fwrite(buffer , 1 , bytes , target_stream->stream , __func__);
|
||||
|
||||
void* buffer = ext_buffer;
|
||||
if( buffer_size < size ) {
|
||||
buffer = malloc( size );
|
||||
ext_buffer = NULL;
|
||||
}
|
||||
bytes_read += bytes;
|
||||
}
|
||||
|
||||
err = eclfio_get( src_stream->stream, src_stream->opts, &size, buffer );
|
||||
if( err ) {
|
||||
util_abort( "%s: could not read record after %d bytes\n",
|
||||
__func__,
|
||||
bytes_read );
|
||||
}
|
||||
fortio_complete_read(src_stream , record_size);
|
||||
fortio_complete_write(target_stream , record_size);
|
||||
|
||||
err = eclfio_put( target_stream->stream,
|
||||
target_stream->opts,
|
||||
size,
|
||||
buffer );
|
||||
if( err ) {
|
||||
util_abort( "%s: could not write record after %d bytes\n",
|
||||
__func__,
|
||||
bytes_read );
|
||||
}
|
||||
|
||||
if( !ext_buffer ) free( buffer );
|
||||
|
||||
*at_eof = feof( src_stream->stream );
|
||||
if (feof(src_stream->stream))
|
||||
*at_eof = true;
|
||||
else
|
||||
*at_eof = false;
|
||||
}
|
||||
|
||||
|
||||
@ -624,23 +643,19 @@ void fortio_complete_write(fortio_type *fortio , int record_size) {
|
||||
|
||||
|
||||
void fortio_fwrite_record(fortio_type *fortio, const char *buffer , int record_size) {
|
||||
int err = eclfio_put( fortio->stream,
|
||||
fortio->opts,
|
||||
record_size,
|
||||
buffer );
|
||||
|
||||
if( err ) util_abort( "%s: unable to write %d byte record\n",
|
||||
__func__,
|
||||
record_size );
|
||||
fortio_init_write(fortio , record_size);
|
||||
util_fwrite( buffer , 1 , record_size , fortio->stream , __func__);
|
||||
fortio_complete_write(fortio , record_size);
|
||||
}
|
||||
|
||||
|
||||
void * fortio_fread_alloc_record(fortio_type * fortio) {
|
||||
int32_t record_size = 0;
|
||||
eclfio_sizeof( fortio->stream, fortio->opts, &record_size );
|
||||
void* buffer = calloc( 1, record_size );
|
||||
eclfio_get( fortio->stream, fortio->opts, &record_size, buffer );
|
||||
return buffer;
|
||||
void * buffer;
|
||||
int record_size = fortio_init_read(fortio);
|
||||
buffer = util_malloc( record_size );
|
||||
util_fread(buffer , 1 , record_size , fortio->stream , __func__);
|
||||
fortio_complete_read(fortio , record_size);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
|
5
ThirdParty/Ert/lib/util/hash.cpp
vendored
5
ThirdParty/Ert/lib/util/hash.cpp
vendored
@ -82,6 +82,11 @@ static void * __hash_get_node(const hash_type *__hash , const char *key, bool ab
|
||||
hash_type * hash = (hash_type *) __hash; /* The net effect is no change - but .... ?? */
|
||||
hash_node_type * node = NULL;
|
||||
{
|
||||
if (key == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const uint32_t global_index = hash->hashf(key , strlen(key));
|
||||
const uint32_t table_index = (global_index % hash->size);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user