Skip to content

Commit

Permalink
Merge pull request #245 from OPM/dev
Browse files Browse the repository at this point in the history
Copy up dev to master for release 1.3.0
  • Loading branch information
magnesj committed Sep 24, 2014
2 parents 082adb1 + 85934c4 commit ef05bc5
Show file tree
Hide file tree
Showing 300 changed files with 10,593 additions and 5,667 deletions.
86 changes: 75 additions & 11 deletions ApplicationCode/Application/RiaApplication.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -39,6 +41,8 @@
#include "RimWellPathCollection.h"
#include "RimOilField.h"
#include "RimAnalysisModels.h"
#include "RimFaultCollection.h"
#include "RimFaultResultSlot.h"

#include "cafCeetronNavigation.h"
#include "cafCadNavigation.h"
Expand Down Expand Up @@ -67,7 +71,7 @@

#include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfMat4d.h"
#include "RimReservoirCellResultsCacher.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimCellEdgeResultSlot.h"
#include "RimCellRangeFilterCollection.h"
#include "RimCellPropertyFilterCollection.h"
Expand All @@ -78,6 +82,7 @@

#include "cvfProgramOptions.h"
#include "cvfqtUtils.h"
#include "RimCommandObject.h"


namespace caf
Expand Down Expand Up @@ -834,7 +839,7 @@ bool RiaApplication::parseArguments()
progOpt.setOptionPrefix(cvf::ProgramOptions::DOUBLE_DASH);

m_helpText = QString("\n%1 v. %2\n").arg(RI_APPLICATION_NAME).arg(getVersionStringApp(false));
m_helpText += "Copyright Statoil ASA, Ceetron AS 2011, 2012\n\n";
m_helpText += "Copyright Statoil ASA, Ceetron Solution AS, Ceetron AS\n\n";

const cvf::String usageText = progOpt.usageText(110, 30);
m_helpText += cvfqt::Utils::toQString(usageText);
Expand Down Expand Up @@ -1066,6 +1071,34 @@ QString RiaApplication::octavePath() const
return m_preferences->octaveExecutable();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RiaApplication::octaveArguments() const
{
// http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options

// -p path
// Add path to the head of the search path for function files. The value of path specified on the command line
// will override any value of OCTAVE_PATH found in the environment, but not any commands in the system or
// user startup files that set the internal load path through one of the path functions.


QStringList arguments;
arguments.append("--path");
arguments << QApplication::applicationDirPath();

if (!m_preferences->octaveShowHeaderInfoWhenExecutingScripts)
{
// -q
// Don't print the usual greeting and version message at startup.

arguments.append("-q");
}

return arguments;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1202,7 +1235,7 @@ bool RiaApplication::launchProcessForMultipleCases(const QString& program, const
//--------------------------------------------------------------------------------------------------
/// Read fields of a Pdm object using QSettings
//--------------------------------------------------------------------------------------------------
void RiaApplication::readFieldsFromApplicationStore(caf::PdmObject* object)
void RiaApplication::readFieldsFromApplicationStore(caf::PdmObject* object, const QString context)
{
QSettings settings;
std::vector<caf::PdmFieldHandle*> fields;
Expand All @@ -1213,18 +1246,32 @@ void RiaApplication::readFieldsFromApplicationStore(caf::PdmObject* object)
{
caf::PdmFieldHandle* fieldHandle = fields[i];

if (settings.contains(fieldHandle->keyword()))
std::vector<caf::PdmObject*> children;
fieldHandle->childObjects(&children);
for (size_t childIdx = 0; childIdx < children.size(); childIdx++)
{
QVariant val = settings.value(fieldHandle->keyword());
fieldHandle->setValueFromUi(val);
caf::PdmObject* child = children[childIdx];
QString subContext = context + child->classKeyword() + "/";
readFieldsFromApplicationStore(child, subContext);
}


if (children.size() == 0)
{
QString key = context + fieldHandle->keyword();
if (settings.contains(key))
{
QVariant val = settings.value(key);
fieldHandle->setValueFromUi(val);
}
}
}
}

//--------------------------------------------------------------------------------------------------
/// Write fields of a Pdm object using QSettings
//--------------------------------------------------------------------------------------------------
void RiaApplication::writeFieldsToApplicationStore(const caf::PdmObject* object)
void RiaApplication::writeFieldsToApplicationStore(const caf::PdmObject* object, const QString context)
{
CVF_ASSERT(object);

Expand All @@ -1238,7 +1285,24 @@ void RiaApplication::writeFieldsToApplicationStore(const caf::PdmObject* object)
{
caf::PdmFieldHandle* fieldHandle = fields[i];

settings.setValue(fieldHandle->keyword(), fieldHandle->uiValue());
std::vector<caf::PdmObject*> children;
fieldHandle->childObjects(&children);
for (size_t childIdx = 0; childIdx < children.size(); childIdx++)
{
caf::PdmObject* child = children[childIdx];
QString subContext;
if (context.isEmpty())
{
subContext = context + child->classKeyword() + "/";
}

writeFieldsToApplicationStore(child, subContext);
}

if (children.size() == 0)
{
settings.setValue(context + fieldHandle->keyword(), fieldHandle->uiValue());
}
}
}

Expand Down Expand Up @@ -2000,8 +2064,8 @@ void RiaApplication::regressionTestConfigureProject()
riv->viewer()->setFixedSize(1000, 745);
}

riv->faultCollection->showFaultsOutsideFilters.setValueFromUi(false);
riv->faultCollection->showResultsOnFaults.setValueFromUi(true);
riv->faultCollection->setShowFaultsOutsideFilters(false);
riv->faultResultSettings->showCustomFaultResult.setValueFromUi(false);
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions ApplicationCode/Application/RiaApplication.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -123,15 +125,17 @@ class RiaApplication : public QApplication
RINavigationPolicy navigationPolicy() const;
QString scriptDirectories() const;
QString scriptEditorPath() const;

QString octavePath() const;
QStringList octaveArguments() const;

bool launchProcess(const QString& program, const QStringList& arguments);
bool launchProcessForMultipleCases(const QString& program, const QStringList& arguments, const std::vector<int>& caseIds);
void terminateProcess();

RiaPreferences* preferences();
void readFieldsFromApplicationStore(caf::PdmObject* object);
void writeFieldsToApplicationStore(const caf::PdmObject* object);
void readFieldsFromApplicationStore(caf::PdmObject* object, const QString context = "");
void writeFieldsToApplicationStore(const caf::PdmObject* object, const QString context = "");
void applyPreferences();

cvf::Font* standardFont();
Expand Down
55 changes: 44 additions & 11 deletions ApplicationCode/Application/RiaPreferences.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand All @@ -21,6 +23,8 @@

#include "cafPdmUiFilePathEditor.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "RifReaderSettings.h"

CAF_PDM_SOURCE_INIT(RiaPreferences, "RiaPreferences");
//--------------------------------------------------------------------------------------------------
Expand All @@ -36,8 +40,12 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitField(&scriptEditorExecutable, "scriptEditorExecutable", QString("kate"), "Script Editor", "", "", "");
scriptEditorExecutable.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());

CAF_PDM_InitField(&octaveExecutable, "octaveExecutable", QString("octave"), "Octave", "", "", "");
CAF_PDM_InitField(&octaveExecutable, "octaveExecutable", QString("octave"), "Octave executable location", "", "", "");
octaveExecutable.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
octaveExecutable.setUiLabelPosition(caf::PdmUiItemInfo::TOP);

CAF_PDM_InitField(&octaveShowHeaderInfoWhenExecutingScripts, "octaveShowHeaderInfoWhenExecutingScripts", false, "Show text header when executing scripts", "", "", "");
octaveShowHeaderInfoWhenExecutingScripts.setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);

CAF_PDM_InitField(&ssihubAddress, "ssihubAddress", QString("http://"), "ssihub Address", "", "", "");

Expand All @@ -56,10 +64,14 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
lastUsedProjectFileName.setUiHidden(true);

CAF_PDM_InitField(&autocomputeSOIL, "autocomputeSOIL", true, "SOIL", "", "SOIL = 1.0 - SGAS - SWAT", "");
CAF_PDM_InitField(&autocomputeDepthRelatedProperties,"autocomputeDepth", true, "DEPTH related properties", "", "DEPTH, DX, DY, DZ, TOP, BOTTOM", "");
CAF_PDM_InitField(&autocomputeDepthRelatedProperties, "autocomputeDepth", true, "DEPTH related properties", "", "DEPTH, DX, DY, DZ, TOP, BOTTOM", "");
CAF_PDM_InitField(&autocomputeGridFaults, "autocomputeGridFaults", true, "Grid faults", "", "Detect all fault faces geometrically", "");

autocomputeDepthRelatedProperties.setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
autocomputeGridFaults.setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);

CAF_PDM_InitField(&readFaultData, "readFaultData", true, "Read fault data", "", "", "");
readerSettings = new RifReaderSettings;
CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader settings", "", "", "");
}

//--------------------------------------------------------------------------------------------------
Expand All @@ -75,6 +87,8 @@ RiaPreferences::~RiaPreferences(void)
//--------------------------------------------------------------------------------------------------
void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
{
readerSettings->defineEditorAttribute(field, uiConfigName, attribute);

if (field == &scriptDirectories)
{
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
Expand All @@ -84,6 +98,16 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
myAttr->m_appendUiSelectedFolderToText = true;
}
}
else if (field == &octaveShowHeaderInfoWhenExecutingScripts ||
field == &autocomputeDepthRelatedProperties ||
field == &autocomputeGridFaults)
{
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
if (myAttr)
{
myAttr->m_useNativeCheckBoxLabel = true;
}
}
}

//--------------------------------------------------------------------------------------------------
Expand All @@ -96,7 +120,10 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup("Script configuration");
scriptGroup->add(&scriptDirectories);
scriptGroup->add(&scriptEditorExecutable);
scriptGroup->add(&octaveExecutable);

caf::PdmUiGroup* octaveGroup = uiOrdering.addNewGroup("Octave");
octaveGroup->add(&octaveExecutable);
octaveGroup->add(&octaveShowHeaderInfoWhenExecutingScripts);

caf::PdmUiGroup* defaultSettingsGroup = uiOrdering.addNewGroup("Default settings");
defaultSettingsGroup->add(&defaultScaleFactorZ);
Expand All @@ -107,11 +134,17 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
defaultSettingsGroup->add(&defaultWellLabelColor);

caf::PdmUiGroup* autoComputeGroup = uiOrdering.addNewGroup("Compute when loading new case");
autoComputeGroup->add(&autocomputeSOIL);
autoComputeGroup->add(&autocomputeDepthRelatedProperties);
autoComputeGroup->add(&autocomputeGridFaults);

caf::PdmUiGroup* faultsGroup = uiOrdering.addNewGroup("Faults");
faultsGroup->add(&readFaultData);

caf::PdmUiGroup* readerSettingsGroup = uiOrdering.addNewGroup("Reader settings");
std::vector<caf::PdmFieldHandle*> readerSettingsFields;
readerSettings->fields(readerSettingsFields);
for (size_t i = 0; i < readerSettingsFields.size(); i++)
{
readerSettingsGroup->add(readerSettingsFields[i]);
}
}

//--------------------------------------------------------------------------------------------------
Expand All @@ -123,9 +156,9 @@ void RiaPreferences::configureForRegressionTests()
useShaders = true;
showHud = false;

autocomputeSOIL = true;
autocomputeDepthRelatedProperties = true;

readFaultData = false;
CVF_ASSERT(readerSettings);
readerSettings->importFaults = false;
}

15 changes: 12 additions & 3 deletions ApplicationCode/Application/RiaPreferences.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand All @@ -24,6 +26,10 @@
#include "cafPdmField.h"
#include "cafAppEnum.h"

// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"

class RifReaderSettings;

class RiaPreferences : public caf::PdmObject
{
Expand All @@ -40,7 +46,10 @@ class RiaPreferences : public caf::PdmObject

caf::PdmField<QString> scriptDirectories;
caf::PdmField<QString> scriptEditorExecutable;

caf::PdmField<QString> octaveExecutable;
caf::PdmField<bool> octaveShowHeaderInfoWhenExecutingScripts;

caf::PdmField<QString> ssihubAddress;

caf::PdmField<int> defaultScaleFactorZ;
Expand All @@ -55,10 +64,10 @@ class RiaPreferences : public caf::PdmObject

caf::PdmField<QString> lastUsedProjectFileName;

caf::PdmField<bool> autocomputeSOIL;
caf::PdmField<bool> autocomputeDepthRelatedProperties;
caf::PdmField<bool> autocomputeGridFaults;

caf::PdmField<bool> readFaultData;
caf::PdmField<RifReaderSettings*> readerSettings;

protected:
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
Expand Down
5 changes: 3 additions & 2 deletions ApplicationCode/Application/RiaProjectModifier.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA, Ceetron Solutions AS
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -32,7 +33,7 @@
#include "RimScriptCollection.h"
#include "RimCellPropertyFilterCollection.h"
#include "RimCellPropertyFilter.h"
#include "RimReservoirCellResultsCacher.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimResultSlot.h"
#include "RimCellEdgeResultSlot.h"
#include "RimCellRangeFilterCollection.h"
Expand Down
3 changes: 2 additions & 1 deletion ApplicationCode/Application/RiaProjectModifier.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA, Ceetron Solutions AS
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
Loading

0 comments on commit ef05bc5

Please sign in to comment.