From 550110d8abe44a9c8ea29e09b0d95816378f4139 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 5 Sep 2022 18:28:51 +0200 Subject: [PATCH] Allow different definitions of valid result for StimPlan and Thermal template. --- .../ModelVisualization/RivWellFracturePartMgr.cpp | 8 ++++---- .../Completions/RimMeshFractureTemplate.h | 2 ++ .../Completions/RimStimPlanFractureTemplate.cpp | 8 ++++++++ .../Completions/RimStimPlanFractureTemplate.h | 2 ++ .../Completions/RimThermalFractureTemplate.cpp | 8 ++++++++ .../Completions/RimThermalFractureTemplate.h | 1 + 6 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp index d222405714..f966d40b09 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp @@ -463,7 +463,7 @@ cvf::ref RivWellFracturePartMgr::createStimPlanColorInterpolatedSurfa bool includeThisTrianglePair = false; for ( size_t j = 0; j < 6; j++ ) { - if ( perNodeResultValues[triangleIndices[i + j]] > 1e-7 ) + if ( stimPlanFracTemplate->isValidResult( perNodeResultValues[triangleIndices[i + j]] ) ) { includeThisTrianglePair = true; } @@ -578,7 +578,7 @@ cvf::ref RivWellFracturePartMgr::createStimPlanElementColorSurfacePar for ( size_t cIdx = 0; cIdx < stimPlanCells.size(); ++cIdx ) { - if ( prCellResults[cIdx] > 1e-7 ) + if ( stimPlanFracTemplate->isValidResult( prCellResults[cIdx] ) ) { const RigFractureCell& stimPlanCell = stimPlanCells[cIdx]; std::vector stimPlanCellPolygon = stimPlanCell.getPolygon(); @@ -1048,7 +1048,7 @@ void RivWellFracturePartMgr::createVisibleFracturePolygons( RimMeshFractureTempl m_visibleFracturePolygons.clear(); for ( size_t cIdx = 0; cIdx < stimPlanCells.size(); ++cIdx ) { - if ( prCellResults[cIdx] > 1e-7 ) + if ( stimPlanFracTemplate->isValidResult( prCellResults[cIdx] ) ) { const RigFractureCell& stimPlanCell = stimPlanCells[cIdx]; std::vector stimPlanCellPolygon = stimPlanCell.getPolygon(); @@ -1081,7 +1081,7 @@ cvf::ref RivWellFracturePartMgr::createStimPlanMeshDrawable( R for ( size_t cIdx = 0; cIdx < stimPlanCells.size(); ++cIdx ) { - if ( prCellResults[cIdx] > 1e-7 ) + if ( stimPlanFracTemplate->isValidResult( prCellResults[cIdx] ) ) { const RigFractureCell& stimPlanCell = stimPlanCells[cIdx]; std::vector stimPlanCellPolygon = stimPlanCell.getPolygon(); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimMeshFractureTemplate.h b/ApplicationLibCode/ProjectDataModel/Completions/RimMeshFractureTemplate.h index c6bbc5566c..f15311c6b7 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimMeshFractureTemplate.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimMeshFractureTemplate.h @@ -68,6 +68,8 @@ public: size_t i, size_t j ) = 0; + virtual bool isValidResult( double value ) const = 0; + virtual QString getFileSelectionFilter() const = 0; virtual std::vector widthResultValues() const; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index 888884f0ef..ac3ca67fd9 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -838,3 +838,11 @@ void RimStimPlanFractureTemplate::appendTextIfValidValue( QString& body += QString( "%1: %2
" ).arg( name ).arg( RiaNumberFormat::valueToText( value, numberFormat, precision ) ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimStimPlanFractureTemplate::isValidResult( double value ) const +{ + return value > 1e-7; +} diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h index bc358163d5..2c10580918 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h @@ -118,6 +118,8 @@ public: static std::pair widthParameterNameAndUnit( cvf::ref def ); + bool isValidResult( double value ) const override; + protected: void initAfterRead() override; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.cpp index dca38fe560..82e1d708d5 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.cpp @@ -704,3 +704,11 @@ std::pair RimThermalFractureTemplate::computePositionAnd cvf::Vec3d rotation = cvf::Vec3d::UNDEFINED; return std::make_pair( centerPosition, rotation ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimThermalFractureTemplate::isValidResult( double value ) const +{ + return !std::isinf( value ) && !std::isnan( value ); +} diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.h b/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.h index f3e1f77d56..223c5d5b57 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimThermalFractureTemplate.h @@ -75,6 +75,7 @@ public: const QString& unit, MinMaxAccumulator& minMaxAccumulator, PosNegAccumulator& posNegAccumulator ) const override; + bool isValidResult( double value ) const override; void setDefaultConductivityResultIfEmpty(); bool setBorderPolygonResultNameToDefault();