#3433 Non-Darcy Fracture: Regression tests : Add compare between two well path fractures

This commit is contained in:
Magne Sjaastad
2018-10-11 09:26:51 +02:00
parent 6ff94e1be7
commit b5ab2968dd
3 changed files with 42 additions and 25 deletions

View File

@@ -87,7 +87,7 @@ QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(
textStream << lineStart << "\n"; textStream << lineStart << "\n";
auto proj = RiaApplication::instance()->project(); auto proj = RiaApplication::instance()->project();
auto fractureTemplates = proj->activeOilField()->fractureDefinitionCollection()->fractureTemplates(); auto fractureTemplates = proj->activeOilField()->fractureDefinitionCollection()->fractureTemplates();
std::vector<RimStimPlanFractureTemplate*> stimPlanTemplates; std::vector<RimStimPlanFractureTemplate*> stimPlanTemplates;
@@ -108,7 +108,6 @@ QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(
} }
} }
if (!RiaRegressionTestRunner::instance()->isRunningRegressionTests()) if (!RiaRegressionTestRunner::instance()->isRunningRegressionTests())
{ {
if (sourceCase) if (sourceCase)
@@ -124,7 +123,6 @@ QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(
textStream << lineStart << "\n"; textStream << lineStart << "\n";
} }
{ {
QString tableText = createStimPlanFileLocationText(stimPlanTemplates); QString tableText = createStimPlanFileLocationText(stimPlanTemplates);
textStream << tableText; textStream << tableText;
@@ -154,19 +152,14 @@ QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(
std::vector<RimWellPathFracture*> wellPathFractures; std::vector<RimWellPathFracture*> wellPathFractures;
for (const auto& w : wellPaths) for (const auto& w : wellPaths)
{ {
std::set<std::pair<double, RimWellPathFracture*>> sortedFracturesByMd;
for (const auto& frac : w->fractureCollection()->activeFractures()) for (const auto& frac : w->fractureCollection()->activeFractures())
{ {
sortedFracturesByMd.insert(std::make_pair(frac->fractureMD(), frac)); wellPathFractures.push_back(frac);
}
for (const auto& mdAndFracture : sortedFracturesByMd)
{
wellPathFractures.push_back(mdAndFracture.second);
} }
} }
std::sort(wellPathFractures.begin(), wellPathFractures.end(), RimWellPathFracture::compareByWellPathNameAndMD);
{ {
QString tableText = createFractureInstancesText(wellPathFractures); QString tableText = createFractureInstancesText(wellPathFractures);
textStream << tableText; textStream << tableText;
@@ -303,8 +296,8 @@ QString RicWellPathFractureTextReportFeatureImpl::createStimPlanFractureText(
QString tableText; QString tableText;
RiaEclipseUnitTools::UnitSystem unitSystem = stimPlanTemplates.front()->fractureTemplateUnit(); RiaEclipseUnitTools::UnitSystem unitSystem = stimPlanTemplates.front()->fractureTemplateUnit();
bool isFieldUnits = unitSystem == RiaEclipseUnitTools::UNITS_FIELD; bool isFieldUnits = unitSystem == RiaEclipseUnitTools::UNITS_FIELD;
QTextStream stream(&tableText); QTextStream stream(&tableText);
RifEclipseDataTableFormatter formatter(stream); RifEclipseDataTableFormatter formatter(stream);
@@ -355,8 +348,8 @@ QString RicWellPathFractureTextReportFeatureImpl::createEllipseFractureText(
QString tableText; QString tableText;
RiaEclipseUnitTools::UnitSystem unitSystem = ellipseTemplates.front()->fractureTemplateUnit(); RiaEclipseUnitTools::UnitSystem unitSystem = ellipseTemplates.front()->fractureTemplateUnit();
bool isFieldUnits = unitSystem == RiaEclipseUnitTools::UNITS_FIELD; bool isFieldUnits = unitSystem == RiaEclipseUnitTools::UNITS_FIELD;
QTextStream stream(&tableText); QTextStream stream(&tableText);
RifEclipseDataTableFormatter formatter(stream); RifEclipseDataTableFormatter formatter(stream);
@@ -500,8 +493,8 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureInstancesText(
{ {
if (fractures.empty()) return ""; if (fractures.empty()) return "";
RiaEclipseUnitTools::UnitSystem unitSystem = fractures.front()->fractureUnit(); // Fix RiaEclipseUnitTools::UnitSystem unitSystem = fractures.front()->fractureUnit(); // Fix
bool isFieldUnits = unitSystem == RiaEclipseUnitTools::UNITS_FIELD; bool isFieldUnits = unitSystem == RiaEclipseUnitTools::UNITS_FIELD;
QString tableText; QString tableText;
@@ -599,8 +592,8 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureCompletionSummar
{ {
QString tableText; QString tableText;
RiaEclipseUnitTools::UnitSystem unitSystem = wellPathFractureReportItems.front().unitSystem(); RiaEclipseUnitTools::UnitSystem unitSystem = wellPathFractureReportItems.front().unitSystem();
bool isFieldUnits = unitSystem == RiaEclipseUnitTools::UNITS_FIELD; bool isFieldUnits = unitSystem == RiaEclipseUnitTools::UNITS_FIELD;
QTextStream stream(&tableText); QTextStream stream(&tableText);
RifEclipseDataTableFormatter formatter(stream); RifEclipseDataTableFormatter formatter(stream);
@@ -672,9 +665,10 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureCompletionSummar
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RicWellPathFractureTextReportFeatureImpl::createConnectionsPerWellText(const std::vector<RicWellPathFractureReportItem>& wellPathFractureReportItems) const QString RicWellPathFractureTextReportFeatureImpl::createConnectionsPerWellText(
const std::vector<RicWellPathFractureReportItem>& wellPathFractureReportItems) const
{ {
QString tableText; QString tableText;
@@ -682,10 +676,7 @@ QString RicWellPathFractureTextReportFeatureImpl::createConnectionsPerWellText(c
RifEclipseDataTableFormatter formatter(stream); RifEclipseDataTableFormatter formatter(stream);
configureFormatter(&formatter); configureFormatter(&formatter);
std::vector<RifEclipseOutputTableColumn> header = { std::vector<RifEclipseOutputTableColumn> header = {RifEclipseOutputTableColumn("Well"), floatNumberColumn("ConnCount")};
RifEclipseOutputTableColumn("Well"),
floatNumberColumn("ConnCount")
};
formatter.header(header); formatter.header(header);
formatter.addHorizontalLine('-'); formatter.addHorizontalLine('-');

View File

@@ -162,6 +162,30 @@ std::vector<cvf::Vec3d> RimWellPathFracture::perforationLengthCenterLineCoords()
return wellPathCoords; return wellPathCoords;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPathFracture::compareByWellPathNameAndMD(const RimWellPathFracture* lhs, const RimWellPathFracture* rhs)
{
CVF_TIGHT_ASSERT(lhs && rhs);
RimWellPath* lhsWellPath = nullptr;
lhs->firstAncestorOrThisOfType(lhsWellPath);
RimWellPath* rhsWellPath = nullptr;
rhs->firstAncestorOrThisOfType(rhsWellPath);
if (lhsWellPath && rhsWellPath)
{
if (lhsWellPath->name() != rhsWellPath->name())
{
return lhsWellPath->name() < rhsWellPath->name();
}
}
return lhs->fractureMD() < rhs->fractureMD();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -49,6 +49,8 @@ public:
virtual std::vector<cvf::Vec3d> perforationLengthCenterLineCoords() const override; virtual std::vector<cvf::Vec3d> perforationLengthCenterLineCoords() const override;
static bool compareByWellPathNameAndMD(const RimWellPathFracture* lhs, const RimWellPathFracture* rhs);
protected: protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override; virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;