mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1635 Use scientific numbers for transmissibility in completion data export
This commit is contained in:
@@ -409,7 +409,7 @@ void RicWellPathExportCompletionDataFeature::generateCompdatTable(RifEclipseData
|
|||||||
RifEclipseOutputTableColumn("K2"),
|
RifEclipseOutputTableColumn("K2"),
|
||||||
RifEclipseOutputTableColumn("Status"),
|
RifEclipseOutputTableColumn("Status"),
|
||||||
RifEclipseOutputTableColumn("SAT"),
|
RifEclipseOutputTableColumn("SAT"),
|
||||||
RifEclipseOutputTableColumn("TR"),
|
RifEclipseOutputTableColumn("TR", RifEclipseOutputTableDoubleFormatting(RifEclipseOutputTableDoubleFormat::SCIENTIFIC)),
|
||||||
RifEclipseOutputTableColumn("DIAM"),
|
RifEclipseOutputTableColumn("DIAM"),
|
||||||
RifEclipseOutputTableColumn("KH"),
|
RifEclipseOutputTableColumn("KH"),
|
||||||
RifEclipseOutputTableColumn("S"),
|
RifEclipseOutputTableColumn("S"),
|
||||||
|
|||||||
@@ -152,8 +152,8 @@ RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add(double num)
|
|||||||
{
|
{
|
||||||
size_t column = m_lineBuffer.size();
|
size_t column = m_lineBuffer.size();
|
||||||
CVF_ASSERT(column < m_columns.size());
|
CVF_ASSERT(column < m_columns.size());
|
||||||
m_columns[column].width = std::max(measure(num), m_columns[column].width);
|
m_columns[column].width = std::max(measure(num, m_columns[column].doubleFormat), m_columns[column].width);
|
||||||
m_lineBuffer.push_back(format(num));
|
m_lineBuffer.push_back(format(num, m_columns[column].doubleFormat));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,9 +220,9 @@ int RifEclipseDataTableFormatter::measure(const QString str)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int RifEclipseDataTableFormatter::measure(double num)
|
int RifEclipseDataTableFormatter::measure(double num, RifEclipseOutputTableDoubleFormatting doubleFormat)
|
||||||
{
|
{
|
||||||
return format(num).length();
|
return format(num, doubleFormat).length();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -244,9 +244,17 @@ int RifEclipseDataTableFormatter::measure(size_t num)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RifEclipseDataTableFormatter::format(double num)
|
QString RifEclipseDataTableFormatter::format(double num, RifEclipseOutputTableDoubleFormatting doubleFormat)
|
||||||
{
|
{
|
||||||
return QString("%1").arg(num, 0, 'f', m_doubleDecimals);
|
switch (doubleFormat.format)
|
||||||
|
{
|
||||||
|
case RifEclipseOutputTableDoubleFormat::FLOAT:
|
||||||
|
return QString("%1").arg(num, 0, 'f', doubleFormat.width);
|
||||||
|
case RifEclipseOutputTableDoubleFormat::SCIENTIFIC:
|
||||||
|
return QString("%1").arg(num, 0, 'e');
|
||||||
|
default:
|
||||||
|
return QString("%1");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -41,6 +41,15 @@ enum RifEclipseOutputTableAlignment
|
|||||||
RIGHT
|
RIGHT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
enum RifEclipseOutputTableDoubleFormat
|
||||||
|
{
|
||||||
|
SCIENTIFIC,
|
||||||
|
FLOAT,
|
||||||
|
};
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@@ -50,19 +59,39 @@ struct RifEclipseOutputTableLine
|
|||||||
std::vector< QString > data;
|
std::vector< QString > data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
struct RifEclipseOutputTableDoubleFormatting
|
||||||
|
{
|
||||||
|
RifEclipseOutputTableDoubleFormatting(RifEclipseOutputTableDoubleFormat format = FLOAT, int width = 5)
|
||||||
|
: format(format),
|
||||||
|
width(width)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
RifEclipseOutputTableDoubleFormat format;
|
||||||
|
int width;
|
||||||
|
};
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
struct RifEclipseOutputTableColumn
|
struct RifEclipseOutputTableColumn
|
||||||
{
|
{
|
||||||
RifEclipseOutputTableColumn(const QString& title, RifEclipseOutputTableAlignment alignment = LEFT, int width = -1)
|
RifEclipseOutputTableColumn(const QString& title,
|
||||||
|
RifEclipseOutputTableDoubleFormatting doubleFormat = RifEclipseOutputTableDoubleFormatting(),
|
||||||
|
RifEclipseOutputTableAlignment alignment = LEFT,
|
||||||
|
int width = -1)
|
||||||
: title(title),
|
: title(title),
|
||||||
|
doubleFormat(doubleFormat),
|
||||||
alignment(alignment),
|
alignment(alignment),
|
||||||
width(width)
|
width(width)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
|
RifEclipseOutputTableDoubleFormatting doubleFormat;
|
||||||
RifEclipseOutputTableAlignment alignment;
|
RifEclipseOutputTableAlignment alignment;
|
||||||
int width;
|
int width;
|
||||||
};
|
};
|
||||||
@@ -90,11 +119,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int measure(const QString str);
|
int measure(const QString str);
|
||||||
int measure(double num);
|
int measure(double num, RifEclipseOutputTableDoubleFormatting doubleFormat);
|
||||||
int measure(int num);
|
int measure(int num);
|
||||||
int measure(size_t num);
|
int measure(size_t num);
|
||||||
|
|
||||||
QString format(double num);
|
QString format(double num, RifEclipseOutputTableDoubleFormatting doubleFormat);
|
||||||
QString format(int num);
|
QString format(int num);
|
||||||
QString format(size_t num);
|
QString format(size_t num);
|
||||||
QString formatColumn(const QString str, RifEclipseOutputTableColumn column);
|
QString formatColumn(const QString str, RifEclipseOutputTableColumn column);
|
||||||
@@ -107,6 +136,5 @@ private:
|
|||||||
std::vector<RifEclipseOutputTableLine> m_buffer;
|
std::vector<RifEclipseOutputTableLine> m_buffer;
|
||||||
std::vector<QString> m_lineBuffer;
|
std::vector<QString> m_lineBuffer;
|
||||||
QTextStream& m_out;
|
QTextStream& m_out;
|
||||||
int m_doubleDecimals = 5;
|
|
||||||
int m_colSpacing = 5;
|
int m_colSpacing = 5;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user