#3299 Compdat export. WELSPEC fixes

This commit is contained in:
Bjørn Erik Jensen 2018-08-31 16:08:03 +02:00
parent 64c3fbd59a
commit 9a94fc2cde
3 changed files with 77 additions and 17 deletions

View File

@ -1082,11 +1082,11 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile(RimEclipse
formatter
.add(completions->wellNameForExport())
.add(completions->wellGroupName())
.add(completions->wellGroupNameForExport())
.addOneBasedCellIndex(ijIntersection.x())
.addOneBasedCellIndex(ijIntersection.y())
.add(completions->referenceDepth())
.add(completions->wellTypeName())
.add(completions->referenceDepthForExport())
.add(completions->wellTypeNameForExport())
.rowCompleted();
}
@ -1147,12 +1147,12 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile(RimEclipse
formatter
.add(completions->wellNameForExport())
.add(completions->wellGroupName())
.add(completions->wellGroupNameForExport())
.add(lgrName)
.addOneBasedCellIndex(ijIntersection.x())
.addOneBasedCellIndex(ijIntersection.y())
.add(completions->referenceDepth())
.add(completions->wellTypeName())
.add(completions->referenceDepthForExport())
.add(completions->wellTypeNameForExport())
.rowCompleted();
}
}

View File

@ -18,6 +18,8 @@
#include "RimWellPathCompletions.h"
#include "RiaStdStringTools.h"
#include "RimFishbonesCollection.h"
#include "RimFishboneWellPathCollection.h"
#include "RimPerforationCollection.h"
@ -27,6 +29,13 @@
#include "cafPdmUiTreeOrdering.h"
#include <cmath>
//--------------------------------------------------------------------------------------------------
/// Internal constants
//--------------------------------------------------------------------------------------------------
#define DOUBLE_INF std::numeric_limits<double>::infinity()
namespace caf {
@ -98,7 +107,8 @@ RimPerforationCollection* RimWellPathCompletions::perforationCollection() const
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletions::setWellNameForExport(const QString& name)
{
m_wellNameForExport = name;
auto n = name;
m_wellNameForExport = n.remove(' ');
}
//--------------------------------------------------------------------------------------------------
@ -106,31 +116,43 @@ void RimWellPathCompletions::setWellNameForExport(const QString& name)
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::wellNameForExport() const
{
return m_wellNameForExport();
return formatStringForExport(m_wellNameForExport());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::wellGroupName() const
QString RimWellPathCompletions::wellGroupNameForExport() const
{
return m_wellGroupName;
return formatStringForExport(m_wellGroupName, "1*");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::referenceDepth() const
QString RimWellPathCompletions::referenceDepthForExport() const
{
return m_referenceDepth;
std::string refDepth = m_referenceDepth.v().toStdString();
if (RiaStdStringTools::isNumber(refDepth, '.'))
{
return m_referenceDepth.v();
}
return "1*";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::wellTypeName() const
QString RimWellPathCompletions::wellTypeNameForExport() const
{
return WellTypeEnum(m_wellType).uiText();
switch (m_wellType.v())
{
case OIL: return "OIL";
case GAS: return "GAS";
case WATER: return "WATER";
case LIQUID: return "LIQ";
}
return "";
}
//--------------------------------------------------------------------------------------------------
@ -190,3 +212,37 @@ void RimWellPathCompletions::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTree
uiTreeOrdering.add(&m_fractureCollection);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletions::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &m_referenceDepth)
{
if (!RiaStdStringTools::isNumber(m_referenceDepth.v().toStdString(), '.'))
{
if (!RiaStdStringTools::isNumber(m_referenceDepth.v().toStdString(), ','))
{
// Remove invalid input text
m_referenceDepth = "";
}
else
{
// Wrong decimal sign entered, replace , by .
auto text = m_referenceDepth.v();
m_referenceDepth = text.replace(',', '.');
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::formatStringForExport(const QString& text, const QString& defaultValue) const
{
if (text.isEmpty()) return defaultValue;
if (text.contains(' ')) return QString("'%1'").arg(text);
return text;
}

View File

@ -47,15 +47,19 @@ public:
void setWellNameForExport(const QString& name);
QString wellNameForExport() const;
QString wellGroupName() const;
QString referenceDepth() const;
QString wellTypeName() const;
QString wellGroupNameForExport() const;
QString referenceDepthForExport() const;
QString wellTypeNameForExport() const;
bool hasCompletions() const;
void setUnitSystemSpecificDefaults();
protected:
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
QString formatStringForExport(const QString& text, const QString& defaultText = "") const;
private:
caf::PdmChildField<RimFishbonesCollection*> m_fishbonesCollection;