Update clang-format.yml (#10068)

* Update to clang-format-15
Removed two custom .clang-format files in subfolders of AppFwk

* Fixes by clang-format
This commit is contained in:
Magne Sjaastad
2023-04-13 07:05:53 +02:00
committed by GitHub
parent 310b54ef93
commit 952e766c2f
230 changed files with 2010 additions and 2019 deletions

View File

@@ -897,7 +897,8 @@ int RimPolygonFilter::findEclipseKLayer( const std::vector<cvf::Vec3d>& points,
}
}
auto findKLayerBelowPoint = []( const cvf::Vec3d& point, RigMainGrid* mainGrid ) {
auto findKLayerBelowPoint = []( const cvf::Vec3d& point, RigMainGrid* mainGrid )
{
// Create a bounding box (ie a ray) from the point down to minimum of grid
cvf::Vec3d lowestPoint( point.x(), point.y(), mainGrid->boundingBox().min().z() );

View File

@@ -580,9 +580,9 @@ std::set<std::pair<QString, QString>>
//--------------------------------------------------------------------------------------------------
std::vector<cvf::cref<RigFractureGrid>>
RimEnsembleFractureStatistics::createFractureGrids( const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& stimPlanFractureDefinitions,
RiaDefines::EclipseUnitSystem unitSystem,
const QString& resultNameOnFile,
MeshAlignmentType meshAlignmentType )
RiaDefines::EclipseUnitSystem unitSystem,
const QString& resultNameOnFile,
MeshAlignmentType meshAlignmentType )
{
// Defaults to avoid scaling
double halfLengthScaleFactor = 1.0;
@@ -620,8 +620,8 @@ std::vector<cvf::cref<RigFractureGrid>>
//--------------------------------------------------------------------------------------------------
std::tuple<double, double, double, double>
RimEnsembleFractureStatistics::findSamplingIntervals( const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& stimPlanFractureDefinitions,
std::vector<double>& gridXs,
std::vector<double>& gridYs ) const
std::vector<double>& gridXs,
std::vector<double>& gridYs ) const
{
// Find min and max extent of all the grids
auto [minX, maxX, minY, maxY] = findMaxGridExtents( stimPlanFractureDefinitions, m_meshAlignmentType() );
@@ -647,7 +647,7 @@ std::tuple<double, double, double, double>
//--------------------------------------------------------------------------------------------------
std::tuple<double, double, double, double>
RimEnsembleFractureStatistics::findMaxGridExtents( const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& stimPlanFractureDefinitions,
MeshAlignmentType meshAlignmentType )
MeshAlignmentType meshAlignmentType )
{
double minX = std::numeric_limits<double>::max();
double maxX = -std::numeric_limits<double>::max();
@@ -698,13 +698,13 @@ void RimEnsembleFractureStatistics::generateUniformMesh( double mi
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleFractureStatistics::generateNaiveMesh( double minX,
double maxX,
double minY,
double maxY,
void RimEnsembleFractureStatistics::generateNaiveMesh( double minX,
double maxX,
double minY,
double maxY,
const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& stimPlanFractureDefinitions,
std::vector<double>& gridXs,
std::vector<double>& gridYs ) const
std::vector<double>& gridXs,
std::vector<double>& gridYs ) const
{
// Find max number of cells in x direction
int maxNx = 0;
@@ -735,13 +735,13 @@ void RimEnsembleFractureStatistics::generateNaiveMesh( double
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleFractureStatistics::generateAdaptiveMesh( double minX,
double maxX,
double minY,
double maxY,
void RimEnsembleFractureStatistics::generateAdaptiveMesh( double minX,
double maxX,
double minY,
double maxY,
const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& stimPlanFractureDefinitions,
std::vector<double>& gridXs,
std::vector<double>& gridYs ) const
std::vector<double>& gridXs,
std::vector<double>& gridYs ) const
{
// Find max number of cells in x direction
int maxNx = 0;
@@ -792,7 +792,8 @@ void RimEnsembleFractureStatistics::generateAdaptiveMesh( double
}
// Find the index of the last item where value is smaller
auto findSmallerIndex = []( double value, const std::vector<double>& vec ) {
auto findSmallerIndex = []( double value, const std::vector<double>& vec )
{
for ( size_t i = 0; i < vec.size(); i++ )
if ( vec[i] > value ) return i - 1;
return vec.size();
@@ -900,8 +901,8 @@ void RimEnsembleFractureStatistics::computeMeanThicknessPerLayer( const std::vec
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleFractureStatistics::generateAllLayers( const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& stimPlanFractureDefinitions,
std::vector<Layer>& layers,
MeshAlignmentType meshAlignmentType )
std::vector<Layer>& layers,
MeshAlignmentType meshAlignmentType )
{
for ( auto def : stimPlanFractureDefinitions )
{
@@ -1008,7 +1009,8 @@ void RimEnsembleFractureStatistics::sampleAllGrids( const std::vector<cvf::cref<
std::shared_ptr<RigSlice2D> areaGrid,
std::shared_ptr<RigSlice2D> distanceGrid )
{
auto computeCellSideLength = []( const std::vector<double>& values, size_t idx ) {
auto computeCellSideLength = []( const std::vector<double>& values, size_t idx )
{
if ( idx < values.size() - 1 )
return values[idx + 1] - values[idx];
else
@@ -1116,13 +1118,15 @@ void RimEnsembleFractureStatistics::generateStatisticsGrids(
std::shared_ptr<RigSlice2D> areaGrid,
std::shared_ptr<RigSlice2D> distanceGrid )
{
auto setValueNoInf = []( RigSlice2D& grid, size_t x, size_t y, double value ) {
auto setValueNoInf = []( RigSlice2D& grid, size_t x, size_t y, double value )
{
// Guard against inf (happens in the regions not covered by any mesh)
if ( std::isinf( value ) ) value = 0.0;
grid.setValue( x, y, value );
};
auto removeNonPositiveValues = []( const std::vector<double>& values ) {
auto removeNonPositiveValues = []( const std::vector<double>& values )
{
std::vector<double> nonZeroValues;
for ( double value : values )
if ( value > 0.0 ) nonZeroValues.push_back( value );
@@ -1288,7 +1292,8 @@ QString RimEnsembleFractureStatistics::generateStatisticsTable(
text += "</thead>";
text += "<tbody>";
auto emptyTextOnInf = []( double value, RiaNumberFormat::NumberFormatType numberFormat, int precision ) {
auto emptyTextOnInf = []( double value, RiaNumberFormat::NumberFormatType numberFormat, int precision )
{
if ( std::isinf( value ) )
return QString( "" );
else

View File

@@ -179,10 +179,10 @@ protected:
const RigSlice2D& distanceGrid,
double targetArea );
static void generateStatisticsGrids( const std::vector<std::vector<double>>& samples,
size_t numSamplesX,
size_t numSamplesY,
size_t numGrids,
static void generateStatisticsGrids( const std::vector<std::vector<double>>& samples,
size_t numSamplesX,
size_t numSamplesY,
size_t numGrids,
std::map<RimEnsembleFractureStatistics::StatisticsType, std::shared_ptr<RigSlice2D>>& statisticsGrids,
const std::vector<caf::AppEnum<RimEnsembleFractureStatistics::StatisticsType>>& statisticsTypes,
const RigHistogramData& areaHistogram,

View File

@@ -164,7 +164,8 @@ void RimThermalFractureTemplate::loadDataAndUpdate()
m_fractureDefinitionData = fractureDefinitionData;
if ( m_fractureDefinitionData )
{
auto addInjectivityFactor = []( std::shared_ptr<RigThermalFractureDefinition> def ) {
auto addInjectivityFactor = []( std::shared_ptr<RigThermalFractureDefinition> def )
{
int leakoffPressureDropIndex = def->getPropertyIndex( RiaDefines::leakoffPressureDropResultName() );
int filtratePressureDropIndex = def->getPropertyIndex( RiaDefines::filtratePressureDropResultName() );
QString injectivityValueTag = RiaDefines::injectivityFactorResultName();
@@ -185,7 +186,8 @@ void RimThermalFractureTemplate::loadDataAndUpdate()
}
};
auto addFilterCakeMobility = []( std::shared_ptr<RigThermalFractureDefinition> def ) {
auto addFilterCakeMobility = []( std::shared_ptr<RigThermalFractureDefinition> def )
{
int leakoffPressureDropIndex = def->getPropertyIndex( RiaDefines::leakoffPressureDropResultName() );
int filtratePressureDropIndex = def->getPropertyIndex( RiaDefines::filtratePressureDropResultName() );
int leakoffMobilityIndex = def->getPropertyIndex( RiaDefines::leakoffMobilityResultName() );

View File

@@ -441,7 +441,8 @@ void eraseInvalidEntries( std::vector<CorrelationMatrixRowOrColumn<KeyType, Valu
{
matrix.erase( std::remove_if( matrix.begin(),
matrix.end(),
[=]( const CorrelationMatrixRowOrColumn<KeyType, ValueType>& entry ) {
[=]( const CorrelationMatrixRowOrColumn<KeyType, ValueType>& entry )
{
bool isValid = RiaCurveDataTools::isValidValue( entry.m_correlationSum, false );
return !isValid;
} ),
@@ -454,7 +455,8 @@ void sortEntries( std::vector<CorrelationMatrixRowOrColumn<KeyType, ValueType>>&
std::sort( matrix.begin(),
matrix.end(),
[&sortByAbsoluteValues]( const CorrelationMatrixRowOrColumn<KeyType, ValueType>& lhs,
const CorrelationMatrixRowOrColumn<KeyType, ValueType>& rhs ) -> bool {
const CorrelationMatrixRowOrColumn<KeyType, ValueType>& rhs ) -> bool
{
if ( sortByAbsoluteValues )
return lhs.m_correlationAbsSum > rhs.m_correlationAbsSum;
else

View File

@@ -369,8 +369,8 @@ void RimWellAllocationOverTimePlot::updateFromWell()
const QBrush fillBrush( fillColor, Qt::BrushStyle::SolidPattern );
auto interpolationType = m_flowValueType == FlowValueType::ACCUMULATED_FLOW_VOLUME ||
m_flowValueType == FlowValueType::ACCUMULATED_FLOW_VOLUME_PERCENTAGE
? RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_POINT_TO_POINT
: RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT;
? RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_POINT_TO_POINT
: RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT;
RiuPlotCurve* curve = m_plotWidget->createPlotCurve( nullptr, wellName );
curve->setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID, interpolationType, 2, qColor, fillBrush );
@@ -792,9 +792,8 @@ void RimWellAllocationOverTimePlot::setValidTimeStepRangeForCase()
return;
}
auto isTimeStepInCase = [&]( const QDateTime timeStep ) -> bool {
return std::find( m_case->timeStepDates().cbegin(), m_case->timeStepDates().cend(), timeStep ) != m_case->timeStepDates().cend();
};
auto isTimeStepInCase = [&]( const QDateTime timeStep ) -> bool
{ return std::find( m_case->timeStepDates().cbegin(), m_case->timeStepDates().cend(), timeStep ) != m_case->timeStepDates().cend(); };
if ( m_selectedFromTimeStep().isValid() && isTimeStepInCase( m_selectedFromTimeStep() ) && m_selectedToTimeStep().isValid() &&
isTimeStepInCase( m_selectedToTimeStep() ) )
{

View File

@@ -303,13 +303,11 @@ void RimWellAllocationPlot::updateFromWell()
accumulatedWellFlowPlot()->addPlot( plotTrack );
const std::vector<double>& depthValues = depthType == RiaDefines::DepthTypeEnum::CONNECTION_NUMBER
? wfCalculator->connectionNumbersFromTop( brIdx )
: depthType == RiaDefines::DepthTypeEnum::PSEUDO_LENGTH
? wfCalculator->pseudoLengthFromTop( brIdx )
: depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH
? wfCalculator->trueVerticalDepth( brIdx )
: std::vector<double>();
const std::vector<double>& depthValues =
depthType == RiaDefines::DepthTypeEnum::CONNECTION_NUMBER ? wfCalculator->connectionNumbersFromTop( brIdx )
: depthType == RiaDefines::DepthTypeEnum::PSEUDO_LENGTH ? wfCalculator->pseudoLengthFromTop( brIdx )
: depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH ? wfCalculator->trueVerticalDepth( brIdx )
: std::vector<double>();
if ( !depthValues.empty() )
{

View File

@@ -65,7 +65,7 @@ std::map<QString, const std::vector<double>*>
{
if ( flowDiagSolution->tracerStatusInTimeStep( tracerName, timeStepIndex ) == requestedTracerType )
{
RigFlowDiagResultAddress resAddr( RIG_FLD_CELL_FRACTION_RESNAME, phaseSelection, tracerName.toStdString() );
RigFlowDiagResultAddress resAddr( RIG_FLD_CELL_FRACTION_RESNAME, phaseSelection, tracerName.toStdString() );
const std::vector<double>* tracerCellFractions = flowDiagSolution->flowDiagResults()->resultValues( resAddr, timeStepIndex );
if ( tracerCellFractions )
{

View File

@@ -828,7 +828,8 @@ QString RimWellConnectivityTable::createTableTitle() const
RiaDefines::EclipseUnitSystem unitSet = m_case->eclipseCaseData()->unitsType();
RimWellLogFile::WellFlowCondition condition = RimWellLogFile::WELL_FLOW_COND_RESERVOIR;
auto timeSampleValueTypeText = [&]() -> QString {
auto timeSampleValueTypeText = [&]() -> QString
{
if ( m_timeSampleValueType == TimeSampleValueType::FLOW_RATE_PERCENTAGE )
{
return QString( "Percentage of Total Reservoir Flow Rate [%]" );
@@ -844,7 +845,8 @@ QString RimWellConnectivityTable::createTableTitle() const
return QString();
};
auto timeRangeValueTypeText = [&]() -> QString {
auto timeRangeValueTypeText = [&]() -> QString
{
if ( m_timeRangeValueType() == TimeRangeValueType::ACCUMULATED_FLOW_VOLUME )
{
return "Accumulated Total " + RimWellPlotTools::flowVolumePlotAxisTitle( condition, unitSet );
@@ -1150,7 +1152,8 @@ std::vector<QString> RimWellConnectivityTable::getViewFilteredWellNamesFromFilte
{
if ( !m_cellFilterView || !m_case || !m_case->eclipseCaseData() ) return {};
auto isProductionTypeOfFilterType = [&]( RiaDefines::WellProductionType productionType ) -> bool {
auto isProductionTypeOfFilterType = [&]( RiaDefines::WellProductionType productionType ) -> bool
{
if ( filterType == ViewFilterType::FILTER_BY_VISIBLE_PRODUCERS )
{
return productionType == RiaDefines::WellProductionType::PRODUCER ||
@@ -1338,8 +1341,8 @@ RigWellAllocationOverTime RimWellConnectivityTable::createWellAllocationOverTime
///
//--------------------------------------------------------------------------------------------------
void RimWellConnectivityTable::createAndEmplaceTimeStepAndCalculatorPairInMap( std::map<QDateTime, RigAccWellFlowCalculator>& rTimeStepAndCalculatorPairs,
const QDateTime timeStep,
int timeStepIndex,
const QDateTime timeStep,
int timeStepIndex,
const RigSimWellData* simWellData ) const
{
if ( timeStepIndex < 0 ) return;
@@ -1365,9 +1368,9 @@ void RimWellConnectivityTable::createAndEmplaceTimeStepAndCalculatorPairInMap( s
simWellData->wellProductionType( timeStepIndex ) == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE );
// Retrieve cell visibilities for valid cell filter view
const auto* cellVisibilities = m_cellFilterView && m_viewFilterType == ViewFilterType::CALCULATE_BY_VISIBLE_CELLS
? m_cellFilterView->currentTotalCellVisibility().p()
: nullptr;
const auto* cellVisibilities = m_cellFilterView && m_viewFilterType == ViewFilterType::CALCULATE_BY_VISIBLE_CELLS
? m_cellFilterView->currentTotalCellVisibility().p()
: nullptr;
RigEclCellIndexCalculator cellIdxCalc( m_case->eclipseCaseData()->mainGrid(),
m_case->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ),
cellVisibilities );

View File

@@ -703,17 +703,20 @@ QString RimWellPlotTools::simWellName( const QString& wellPathNameOrSimWellName
//--------------------------------------------------------------------------------------------------
bool RimWellPlotTools::tryMatchChannelName( const std::set<QString>& channelNames, const QString& channelNameToMatch )
{
auto itr = std::find_if( channelNames.begin(), channelNames.end(), [&]( const QString& channelName ) {
if ( channelName.startsWith( '^' ) )
{
std::regex pattern( channelName.toStdString() );
return std::regex_match( channelNameToMatch.toStdString(), pattern );
}
else
{
return (bool)channelName.contains( channelNameToMatch, Qt::CaseInsensitive );
}
} );
auto itr = std::find_if( channelNames.begin(),
channelNames.end(),
[&]( const QString& channelName )
{
if ( channelName.startsWith( '^' ) )
{
std::regex pattern( channelName.toStdString() );
return std::regex_match( channelNameToMatch.toStdString(), pattern );
}
else
{
return (bool)channelName.contains( channelNameToMatch, Qt::CaseInsensitive );
}
} );
return itr != channelNames.end();
}
@@ -1323,7 +1326,7 @@ std::map<QDateTime, std::set<RifDataSourceForRftPlt>>
void RimWellPlotTools::calculateValueOptionsForTimeSteps( const QString& wellPathNameOrSimWellName,
const std::vector<RifDataSourceForRftPlt>& selSources,
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults,
QList<caf::PdmOptionItemInfo>& options )
QList<caf::PdmOptionItemInfo>& options )
{
auto timestepsToShowWithSources = calculateRelevantTimeStepsFromCases( wellPathNameOrSimWellName, selSources, interestingRFTResults );

View File

@@ -562,11 +562,10 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
std::vector<QString> tracerNames = wfPhaseAccumulator.tracerNames();
for ( const QString& tracerName : tracerNames )
{
auto color = tracerName == RIG_FLOW_OIL_NAME
? cvf::Color3f::DARK_GREEN
: tracerName == RIG_FLOW_GAS_NAME
? cvf::Color3f::DARK_RED
: tracerName == RIG_FLOW_WATER_NAME ? cvf::Color3f::BLUE : cvf::Color3f::DARK_GRAY;
auto color = tracerName == RIG_FLOW_OIL_NAME ? cvf::Color3f::DARK_GREEN
: tracerName == RIG_FLOW_GAS_NAME ? cvf::Color3f::DARK_RED
: tracerName == RIG_FLOW_WATER_NAME ? cvf::Color3f::BLUE
: cvf::Color3f::DARK_GRAY;
if ( tracerName == RIG_FLOW_OIL_NAME && selectedPhases.count( FLOW_PHASE_OIL ) ||
tracerName == RIG_FLOW_GAS_NAME && selectedPhases.count( FLOW_PHASE_GAS ) ||
@@ -633,12 +632,10 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
const auto& channelName = std::get<1>( channelInfo );
if ( selectedPhases.count( RimWellPlotTools::flowPhaseFromChannelName( channelName ) ) > 0 )
{
auto color = RimWellPlotTools::isOilFlowChannel( channelName )
? cvf::Color3f::DARK_GREEN
: RimWellPlotTools::isGasFlowChannel( channelName )
? cvf::Color3f::DARK_RED
: RimWellPlotTools::isWaterFlowChannel( channelName ) ? cvf::Color3f::BLUE
: cvf::Color3f::DARK_GRAY;
auto color = RimWellPlotTools::isOilFlowChannel( channelName ) ? cvf::Color3f::DARK_GREEN
: RimWellPlotTools::isGasFlowChannel( channelName ) ? cvf::Color3f::DARK_RED
: RimWellPlotTools::isWaterFlowChannel( channelName ) ? cvf::Color3f::BLUE
: cvf::Color3f::DARK_GRAY;
FlowPhase flowPhase = FLOW_PHASE_NONE;
if ( RimWellPlotTools::isOilFlowChannel( channelName ) )

View File

@@ -1346,9 +1346,9 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
for ( RimWellRftEnsembleCurveSet* curveSet : m_ensembleCurveSets() )
{
CAF_ASSERT( curveSet );
auto ensemble_it = std::find_if( ensembles.begin(), ensembles.end(), [&curveSet]( const RimSummaryCaseCollection* ensemble ) {
return curveSet->ensemble() == ensemble;
} );
auto ensemble_it = std::find_if( ensembles.begin(),
ensembles.end(),
[&curveSet]( const RimSummaryCaseCollection* ensemble ) { return curveSet->ensemble() == ensemble; } );
if ( ensemble_it != ensembles.end() )
{
curveSet->initializeLegend();

View File

@@ -68,9 +68,9 @@ protected:
std::vector<double> retrieveParameterWeights() override;
std::vector<double> generateResults( int viewerStepIndex ) override;
std::vector<double>
generateResultsFromAddress( RigFemResultAddress resultAddress, const std::vector<bool>& mapCellVisibility, int viewerStepIndex );
bool resultVariableChanged() const override;
void clearResultVariable() override;
generateResultsFromAddress( RigFemResultAddress resultAddress, const std::vector<bool>& mapCellVisibility, int viewerStepIndex );
bool resultVariableChanged() const override;
void clearResultVariable() override;
RimGridView* baseView() const override;
std::vector<size_t> findIntersectingCells( const cvf::BoundingBox& bbox ) const override;
size_t kLayer( size_t globalCellIdx ) const override;

View File

@@ -1118,7 +1118,7 @@ void Rim3dView::addMeasurementToModel( cvf::ModelBasicList* measureModel )
{
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
cvf::Camera* mainOrComparisonCamera = isUsingOverrideViewer() ? nativeOrOverrideViewer()->comparisonMainCamera()
: nativeOrOverrideViewer()->mainCamera();
: nativeOrOverrideViewer()->mainCamera();
m_measurementPartManager->appendGeometryPartsToModel( mainOrComparisonCamera,
measureModel,
transForm.p(),

View File

@@ -873,7 +873,7 @@ void RimContourMapProjection::generateTrianglesWithVertexValues()
bool anyValidVertex = false;
for ( size_t n = 0; n < 3; ++n )
{
uint vn = ( *faceList )[i + n];
uint vn = ( *faceList )[i + n];
double value = vn < m_aggregatedVertexResults.size() ? m_aggregatedVertexResults[vn] : std::numeric_limits<double>::infinity();
triangle[n] = vertices[vn];
triangleWithValues[n] = cvf::Vec4d( vertices[vn], value );

View File

@@ -170,8 +170,8 @@ protected:
std::vector<cvf::Vec3d> generateVertices() const;
void generateContourPolygons();
ContourPolygons createContourPolygonsFromLineSegments( caf::ContourLines::ListOfLineSegments& unorderedLineSegments, double contourValue );
void smoothContourPolygons( ContourPolygons* contourPolygons, bool favourExpansion );
void clipContourPolygons( ContourPolygons* contourPolygons, const ContourPolygons* clipBy );
void smoothContourPolygons( ContourPolygons* contourPolygons, bool favourExpansion );
void clipContourPolygons( ContourPolygons* contourPolygons, const ContourPolygons* clipBy );
static double sumPolygonArea( const ContourPolygons& contourPolygons );
static double sumTriangleAreas( const std::vector<cvf::Vec4d>& triangles );

View File

@@ -55,7 +55,8 @@ std::vector<RimGridCalculation*> RimGridCalculationCollection::sortedGridCalcula
}
// Check if source calculation is depending on other. Will check one level dependency.
auto isSourceDependingOnOther = []( const RimGridCalculation* source, const RimGridCalculation* other ) -> bool {
auto isSourceDependingOnOther = []( const RimGridCalculation* source, const RimGridCalculation* other ) -> bool
{
auto outputCase = source->outputEclipseCase();
auto outputAdr = source->outputAddress();

View File

@@ -53,8 +53,8 @@ public:
RimGridTimeHistoryCurve();
~RimGridTimeHistoryCurve() override;
void setFromSelectionItem( const RiuSelectionItem* selectionItem );
void setFromEclipseCellAndResult( RimEclipseCase* eclCase, size_t gridIdx, size_t i, size_t j, size_t k, const RigEclipseResultAddress& resAddr );
void setFromSelectionItem( const RiuSelectionItem* selectionItem );
void setFromEclipseCellAndResult( RimEclipseCase* eclCase, size_t gridIdx, size_t i, size_t j, size_t k, const RigEclipseResultAddress& resAddr );
RiuPlotAxis yAxis() const;
void setYAxis( RiaDefines::PlotAxis plotAxis );

View File

@@ -390,11 +390,14 @@ void RimMultiPlot::doRenderWindowContent( QPaintDevice* paintDevice )
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::updatePlotOrderFromGridWidget()
{
std::sort( m_plots.begin(), m_plots.end(), [this]( RimPlot* lhs, RimPlot* rhs ) {
auto indexLhs = m_viewer->indexOfPlotWidget( lhs->plotWidget() );
auto indexRhs = m_viewer->indexOfPlotWidget( rhs->plotWidget() );
return indexLhs < indexRhs;
} );
std::sort( m_plots.begin(),
m_plots.end(),
[this]( RimPlot* lhs, RimPlot* rhs )
{
auto indexLhs = m_viewer->indexOfPlotWidget( lhs->plotWidget() );
auto indexRhs = m_viewer->indexOfPlotWidget( rhs->plotWidget() );
return indexLhs < indexRhs;
} );
updateSubPlotNames();
updateConnectedEditors();
}

View File

@@ -40,7 +40,7 @@ public:
void removeObservedFmuRftData( RimObservedFmuRftData* observedFmuRftData );
RimObservedSummaryData* createAndAddRsmObservedSummaryDataFromFile( const QString& fileName, QString* errorText = nullptr );
RimObservedSummaryData*
createAndAddCvsObservedSummaryDataFromFile( const QString& fileName, bool useSavedFieldsValuesInDialog, QString* errorText = nullptr );
createAndAddCvsObservedSummaryDataFromFile( const QString& fileName, bool useSavedFieldsValuesInDialog, QString* errorText = nullptr );
RimObservedFmuRftData* createAndAddFmuRftDataFromPath( const QString& directoryPath );
RimPressureDepthData* createAndAddPressureDepthDataFromPath( const QString& fileName );
std::vector<RimObservedSummaryData*> allObservedSummaryData() const;

View File

@@ -160,7 +160,7 @@ void RimReservoirCellResultsStorage::setupBeforeSave()
if ( data && data->size() )
{
stream << ( quint64 )( data->size() );
stream << (quint64)( data->size() );
for ( size_t cIdx = 0; cIdx < data->size(); ++cIdx )
{
stream << ( *data )[cIdx];

View File

@@ -395,7 +395,8 @@ void RimStimPlanColors::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
colorGroup->add( &m_resultNameAndUnit );
colorGroup->add( &m_defaultColor );
auto hasMeshTemplate = []() {
auto hasMeshTemplate = []()
{
std::vector<RimFractureTemplate*> fracTemplates = RimProject::current()->allFractureTemplates();
for ( auto fractemplate : fracTemplates )
{

View File

@@ -505,9 +505,9 @@ std::vector<RimSummaryCalculationAddress>
else if ( category == RifEclipseSummaryAddress::SUMMARY_AQUIFER )
{
std::set<int> uniqueNumbers;
std::for_each( allResultAddresses.begin(), allResultAddresses.end(), [&]( const auto& addr ) {
uniqueNumbers.insert( addr.aquiferNumber() );
} );
std::for_each( allResultAddresses.begin(),
allResultAddresses.end(),
[&]( const auto& addr ) { uniqueNumbers.insert( addr.aquiferNumber() ); } );
for ( auto num : uniqueNumbers )
{
@@ -525,9 +525,9 @@ std::vector<RimSummaryCalculationAddress>
else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL )
{
std::set<std::string> uniqueWellNames;
std::for_each( allResultAddresses.begin(), allResultAddresses.end(), [&]( const auto& addr ) {
uniqueWellNames.insert( addr.wellName() );
} );
std::for_each( allResultAddresses.begin(),
allResultAddresses.end(),
[&]( const auto& addr ) { uniqueWellNames.insert( addr.wellName() ); } );
for ( auto wellName : uniqueWellNames )
{
@@ -537,9 +537,9 @@ std::vector<RimSummaryCalculationAddress>
else if ( category == RifEclipseSummaryAddress::SUMMARY_GROUP )
{
std::set<std::string> uniqueGroupNames;
std::for_each( allResultAddresses.begin(), allResultAddresses.end(), [&]( const auto& addr ) {
uniqueGroupNames.insert( addr.groupName() );
} );
std::for_each( allResultAddresses.begin(),
allResultAddresses.end(),
[&]( const auto& addr ) { uniqueGroupNames.insert( addr.groupName() ); } );
for ( auto groupName : uniqueGroupNames )
{
@@ -549,9 +549,9 @@ std::vector<RimSummaryCalculationAddress>
else if ( category == RifEclipseSummaryAddress::SUMMARY_REGION )
{
std::set<int> uniqueRegionNumbers;
std::for_each( allResultAddresses.begin(), allResultAddresses.end(), [&]( const auto& addr ) {
uniqueRegionNumbers.insert( addr.regionNumber() );
} );
std::for_each( allResultAddresses.begin(),
allResultAddresses.end(),
[&]( const auto& addr ) { uniqueRegionNumbers.insert( addr.regionNumber() ); } );
for ( auto regionNumber : uniqueRegionNumbers )
{
@@ -561,9 +561,9 @@ std::vector<RimSummaryCalculationAddress>
else if ( category == RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION )
{
std::set<std::pair<int, int>> uniqueRegionNumbers;
std::for_each( allResultAddresses.begin(), allResultAddresses.end(), [&]( const auto& addr ) {
uniqueRegionNumbers.insert( std::make_pair( addr.regionNumber(), addr.regionNumber2() ) );
} );
std::for_each( allResultAddresses.begin(),
allResultAddresses.end(),
[&]( const auto& addr ) { uniqueRegionNumbers.insert( std::make_pair( addr.regionNumber(), addr.regionNumber2() ) ); } );
for ( auto regionNumber : uniqueRegionNumbers )
{

View File

@@ -355,11 +355,11 @@ bool RimStimPlanModelCalculator::calculateStressWithGradients( std::vector<doubl
int timeStep = m_stimPlanModel->timeStep();
std::vector<RiaDefines::CurveProperty> inputProperties = { RiaDefines::CurveProperty::BIOT_COEFFICIENT,
RiaDefines::CurveProperty::K0,
RiaDefines::CurveProperty::PRESSURE,
RiaDefines::CurveProperty::INITIAL_PRESSURE,
RiaDefines::CurveProperty::POISSONS_RATIO,
RiaDefines::CurveProperty::PRESSURE_GRADIENT };
RiaDefines::CurveProperty::K0,
RiaDefines::CurveProperty::PRESSURE,
RiaDefines::CurveProperty::INITIAL_PRESSURE,
RiaDefines::CurveProperty::POISSONS_RATIO,
RiaDefines::CurveProperty::PRESSURE_GRADIENT };
std::map<RiaDefines::CurveProperty, std::vector<double>> inputData;
for ( auto inputProperty : inputProperties )
{
@@ -417,7 +417,7 @@ bool RimStimPlanModelCalculator::calculateStressWithGradients( std::vector<doubl
double pressureDiff = timeStepPressure - initialPressure;
// Vertical stress diff assumed to be zero
double Sv_diff = 0.0;
double Sv_diff = 0.0;
double deltaHorizontalStress = poissonsRatio / ( 1.0 - poissonsRatio ) * ( Sv_diff - biot * pressureDiff ) + ( biot * pressureDiff );
if ( std::isnan( deltaHorizontalStress ) || std::isinf( deltaHorizontalStress ) )
{

View File

@@ -196,9 +196,8 @@ bool RimStimPlanModelPressureCalculator::extractValuesForProperty( RiaDefines::C
bool useEqlnumForPressureInterpolation = stimPlanModel->stimPlanModelTemplate()->useEqlnumForPressureInterpolation();
if ( curveProperty == RiaDefines::CurveProperty::INITIAL_PRESSURE )
{
auto hasMissingValues = []( const std::vector<double>& vec ) {
return std::find( vec.begin(), vec.end(), std::numeric_limits<double>::infinity() ) != vec.end();
};
auto hasMissingValues = []( const std::vector<double>& vec )
{ return std::find( vec.begin(), vec.end(), std::numeric_limits<double>::infinity() ) != vec.end(); };
if ( hasMissingValues( values ) )
{
@@ -649,7 +648,7 @@ bool RimStimPlanModelPressureCalculator::interpolatePressureDifferenceByEquilibr
const std::vector<double>& measuredDepthValues,
const std::vector<double>& tvDepthValues,
const std::vector<double>& initialPressureValues,
std::vector<double>& values ) const
std::vector<double>& values ) const
{
std::vector<double> eqlNumValues;
std::vector<double> eqlNumMeasuredDepthsValues;

View File

@@ -385,10 +385,10 @@ void RimStimPlanModelTemplate::setFaciesProperties( RimFaciesProperties* faciesP
{
for ( RimColorLegendItem* item : faciesColors->colorLegendItems() )
{
bool exists =
std::find_if( m_faciesInitialPressureConfigs.begin(), m_faciesInitialPressureConfigs.end(), [item]( const auto& c ) {
return c->faciesValue() == item->categoryValue();
} ) != m_faciesInitialPressureConfigs.end();
bool exists = std::find_if( m_faciesInitialPressureConfigs.begin(),
m_faciesInitialPressureConfigs.end(),
[item]( const auto& c )
{ return c->faciesValue() == item->categoryValue(); } ) != m_faciesInitialPressureConfigs.end();
if ( !exists )
{
RimFaciesInitialPressureConfig* fipConfig = new RimFaciesInitialPressureConfig;

View File

@@ -406,9 +406,10 @@ void RimDerivedEnsembleCaseCollection::deleteCasesNoInUse()
{
std::vector<RimDerivedSummaryCase*> inactiveCases;
auto allCases = allDerivedCases( false );
std::copy_if( allCases.begin(), allCases.end(), std::back_inserter( inactiveCases ), []( RimDerivedSummaryCase* derCase ) {
return !derCase->isInUse();
} );
std::copy_if( allCases.begin(),
allCases.end(),
std::back_inserter( inactiveCases ),
[]( RimDerivedSummaryCase* derCase ) { return !derCase->isInUse(); } );
for ( auto derCase : inactiveCases )
{

View File

@@ -1899,9 +1899,9 @@ std::vector<std::pair<RigEnsembleParameter, double>> RimEnsembleCurveSet::ensemb
if ( sortingMode == ParameterSorting::ALPHABETICALLY )
{
auto parameters = ensemble->parameterCorrelationsAllTimeSteps( summaryAddress() );
std::sort( parameters.begin(), parameters.end(), []( const auto& lhs, const auto& rhs ) {
return lhs.first.name < rhs.first.name;
} );
std::sort( parameters.begin(),
parameters.end(),
[]( const auto& lhs, const auto& rhs ) { return lhs.first.name < rhs.first.name; } );
return parameters;
}

View File

@@ -175,7 +175,7 @@ cvf::Color3f RimEnsembleCurveSetColorManager::caseColor( const RimRegularLegendC
QString tValue = summaryCase->hasCaseRealizationParameters()
? summaryCase->caseRealizationParameters()->parameterValue( ensembleParam.name ).textValue()
: "";
double nValue = legendConfig->categoryValueFromCategoryName( tValue );
double nValue = legendConfig->categoryValueFromCategoryName( tValue );
if ( nValue != std::numeric_limits<double>::infinity() )
{
int iValue = static_cast<int>( nValue );

View File

@@ -183,23 +183,26 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::set<RifEclip
// Sort addresses to have calculated results last per category
std::vector<RifEclipseSummaryAddress> sortedAddresses( addresses.size() );
std::copy( addresses.begin(), addresses.end(), sortedAddresses.begin() );
std::sort( sortedAddresses.begin(), sortedAddresses.end(), []( const RifEclipseSummaryAddress& a, const RifEclipseSummaryAddress& b ) -> bool {
if ( a.category() != b.category() ) return a.category() < b.category();
if ( a.wellName() != b.wellName() ) return a.wellName() < b.wellName();
if ( a.regionNumber() != b.regionNumber() ) return a.regionNumber() < b.regionNumber();
if ( a.regionNumber2() != b.regionNumber2() ) return a.regionNumber2() < b.regionNumber2();
if ( a.groupName() != b.groupName() ) return a.groupName() < b.groupName();
if ( a.lgrName() != b.lgrName() ) return a.lgrName() < b.lgrName();
if ( a.cellK() != b.cellK() ) return a.cellK() < b.cellK();
if ( a.cellJ() != b.cellJ() ) return a.cellJ() < b.cellJ();
if ( a.cellI() != b.cellI() ) return a.cellI() < b.cellI();
if ( a.wellSegmentNumber() != b.wellSegmentNumber() ) return a.wellSegmentNumber() < b.wellSegmentNumber();
if ( a.aquiferNumber() != b.aquiferNumber() ) return a.aquiferNumber() < b.aquiferNumber();
std::sort( sortedAddresses.begin(),
sortedAddresses.end(),
[]( const RifEclipseSummaryAddress& a, const RifEclipseSummaryAddress& b ) -> bool
{
if ( a.category() != b.category() ) return a.category() < b.category();
if ( a.wellName() != b.wellName() ) return a.wellName() < b.wellName();
if ( a.regionNumber() != b.regionNumber() ) return a.regionNumber() < b.regionNumber();
if ( a.regionNumber2() != b.regionNumber2() ) return a.regionNumber2() < b.regionNumber2();
if ( a.groupName() != b.groupName() ) return a.groupName() < b.groupName();
if ( a.lgrName() != b.lgrName() ) return a.lgrName() < b.lgrName();
if ( a.cellK() != b.cellK() ) return a.cellK() < b.cellK();
if ( a.cellJ() != b.cellJ() ) return a.cellJ() < b.cellJ();
if ( a.cellI() != b.cellI() ) return a.cellI() < b.cellI();
if ( a.wellSegmentNumber() != b.wellSegmentNumber() ) return a.wellSegmentNumber() < b.wellSegmentNumber();
if ( a.aquiferNumber() != b.aquiferNumber() ) return a.aquiferNumber() < b.aquiferNumber();
// Calculated results are sorted last.
if ( a.isCalculated() != b.isCalculated() ) return a.isCalculated() < b.isCalculated();
return a.vectorName() < b.vectorName();
} );
// Calculated results are sorted last.
if ( a.isCalculated() != b.isCalculated() ) return a.isCalculated() < b.isCalculated();
return a.vectorName() < b.vectorName();
} );
for ( const auto& address : sortedAddresses )
{

View File

@@ -96,9 +96,10 @@ void RimSummaryCaseCollection::sortByBinnedVariation( std::vector<RigEnsemblePar
// Sort by variation bin (highest first) but keep name as sorting parameter when parameters have the same variation
// index
std::stable_sort( parameterVector.begin(), parameterVector.end(), [&bins]( const RigEnsembleParameter& lhs, const RigEnsembleParameter& rhs ) {
return lhs.variationBin > rhs.variationBin;
} );
std::stable_sort( parameterVector.begin(),
parameterVector.end(),
[&bins]( const RigEnsembleParameter& lhs, const RigEnsembleParameter& rhs )
{ return lhs.variationBin > rhs.variationBin; } );
}
//--------------------------------------------------------------------------------------------------
@@ -472,9 +473,8 @@ std::vector<std::pair<RigEnsembleParameter, double>>
auto parameters = parameterCorrelationsAllTimeSteps( address );
std::sort( parameters.begin(),
parameters.end(),
[]( const std::pair<RigEnsembleParameter, double>& lhs, const std::pair<RigEnsembleParameter, double>& rhs ) {
return std::abs( lhs.second ) > std::abs( rhs.second );
} );
[]( const std::pair<RigEnsembleParameter, double>& lhs, const std::pair<RigEnsembleParameter, double>& rhs )
{ return std::abs( lhs.second ) > std::abs( rhs.second ); } );
return parameters;
}
@@ -487,9 +487,8 @@ std::vector<std::pair<RigEnsembleParameter, double>>
auto parameters = parameterCorrelations( address, selectedTimeStep );
std::sort( parameters.begin(),
parameters.end(),
[]( const std::pair<RigEnsembleParameter, double>& lhs, const std::pair<RigEnsembleParameter, double>& rhs ) {
return std::abs( lhs.second ) > std::abs( rhs.second );
} );
[]( const std::pair<RigEnsembleParameter, double>& lhs, const std::pair<RigEnsembleParameter, double>& rhs )
{ return std::abs( lhs.second ) > std::abs( rhs.second ); } );
return parameters;
}

View File

@@ -81,7 +81,7 @@ public:
int ensembleId() const;
bool hasEnsembleParameters() const;
std::vector<RigEnsembleParameter> variationSortedEnsembleParameters( bool excludeNoVariation = false ) const;
std::vector<RigEnsembleParameter> variationSortedEnsembleParameters( bool excludeNoVariation = false ) const;
std::vector<std::pair<RigEnsembleParameter, double>> correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address ) const;
std::vector<std::pair<RigEnsembleParameter, double>> correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address,
time_t selectedTimeStep ) const;

View File

@@ -473,7 +473,8 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions( const caf:
QList<caf::PdmOptionItemInfo> options = this->RimPlotCurve::calculateValueOptions( fieldNeedingOptions );
if ( !options.isEmpty() ) return options;
auto createOptionsForSummaryCase = []( RimSummaryCase* summaryCase, QList<caf::PdmOptionItemInfo>& options ) {
auto createOptionsForSummaryCase = []( RimSummaryCase* summaryCase, QList<caf::PdmOptionItemInfo>& options )
{
RimProject* proj = RimProject::current();
std::vector<RimSummaryCase*> cases = proj->allSummaryCases();

View File

@@ -929,7 +929,8 @@ void RimSummaryMultiPlot::syncTimeAxisRanges( RimSummaryPlot* sourceSummaryPlot
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::computeAggregatedAxisRange()
{
auto readValues = []( RimSummaryCase* summaryCase, RifEclipseSummaryAddress addr ) {
auto readValues = []( RimSummaryCase* summaryCase, RifEclipseSummaryAddress addr )
{
std::vector<double> values;
if ( summaryCase && summaryCase->summaryReader() )
{
@@ -940,7 +941,8 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
return values;
};
auto findMinMaxForSummaryCase = [readValues]( RimSummaryCase* summaryCase, RifEclipseSummaryAddress addr, bool onlyPositiveValues ) {
auto findMinMaxForSummaryCase = [readValues]( RimSummaryCase* summaryCase, RifEclipseSummaryAddress addr, bool onlyPositiveValues )
{
auto values = readValues( summaryCase, addr );
if ( onlyPositiveValues )
{
@@ -962,7 +964,8 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
return std::make_pair( caseMinimum, caseMaximum );
};
auto summaryCasesForCurve = []( RimSummaryCurve* curve, AxisRangeAggregation axisRangeAggregation ) {
auto summaryCasesForCurve = []( RimSummaryCurve* curve, AxisRangeAggregation axisRangeAggregation )
{
std::vector<RimSummaryCase*> summaryCases;
if ( axisRangeAggregation == AxisRangeAggregation::REALIZATIONS )
@@ -989,7 +992,8 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
return summaryCases;
};
auto addressesForCurve = []( RimSummaryCurve* curve, AxisRangeAggregation axisRangeAggregation ) {
auto addressesForCurve = []( RimSummaryCurve* curve, AxisRangeAggregation axisRangeAggregation )
{
std::vector<RifEclipseSummaryAddress> addresses;
auto addr = curve->summaryAddressY();
@@ -1041,7 +1045,8 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
auto findMinMaxForAddressesInSummaryCases = [findMinMaxForSummaryCase]( const std::vector<RifEclipseSummaryAddress>& addresses,
const std::vector<RimSummaryCase*>& summaryCases,
bool onlyPositiveValues ) {
bool onlyPositiveValues )
{
double minimum = HUGE_VAL;
double maximum = -HUGE_VAL;
for ( auto summaryCase : summaryCases )
@@ -1081,7 +1086,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
}
else
{
auto& [currentMin, currentMax] = axisRanges[axis->plotAxisType()];
auto& [currentMin, currentMax] = axisRanges[axis->plotAxisType()];
axisRanges[axis->plotAxisType()] = std::make_pair( std::min( currentMin, minimum ), std::max( currentMax, maximum ) );
}
}
@@ -1120,7 +1125,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
}
else
{
auto& [currentMin, currentMax] = axisRanges[axis->plotAxisType()];
auto& [currentMin, currentMax] = axisRanges[axis->plotAxisType()];
axisRanges[axis->plotAxisType()] = std::make_pair( std::min( currentMin, minimum ), std::max( currentMax, maximum ) );
}
}
@@ -1153,7 +1158,8 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::updatePlotVisibility()
{
auto hasValuesAboveLimit = []( RimSummaryPlot* plot, double limit ) {
auto hasValuesAboveLimit = []( RimSummaryPlot* plot, double limit )
{
for ( auto curve : plot->summaryAndEnsembleCurves() )
{
auto address = curve->valuesY();

View File

@@ -558,9 +558,10 @@ std::vector<RimSummaryCurve*> RimSummaryPlot::visibleStackedSummaryCurvesForAxis
std::vector<RimSummaryCurve*> visibleStackedCurves;
std::copy_if( visibleCurves.begin(), visibleCurves.end(), std::back_inserter( visibleStackedCurves ), []( RimSummaryCurve* curve ) {
return curve->isStacked();
} );
std::copy_if( visibleCurves.begin(),
visibleCurves.end(),
std::back_inserter( visibleStackedCurves ),
[]( RimSummaryCurve* curve ) { return curve->isStacked(); } );
return visibleStackedCurves;
}
@@ -761,9 +762,10 @@ void RimSummaryPlot::updatePlotInfoLabel()
bool RimSummaryPlot::containsResamplableCurves() const
{
std::vector<RimSummaryCurve*> summaryCurves = summaryAndEnsembleCurves();
size_t resamplableSummaryCurveCount = std::count_if( summaryCurves.begin(), summaryCurves.end(), []( RimSummaryCurve* curve ) {
return curve->summaryCaseY() ? !curve->summaryCaseY()->isObservedData() : false;
} );
size_t resamplableSummaryCurveCount =
std::count_if( summaryCurves.begin(),
summaryCurves.end(),
[]( RimSummaryCurve* curve ) { return curve->summaryCaseY() ? !curve->summaryCaseY()->isObservedData() : false; } );
return !m_gridTimeHistoryCurves.empty() || resamplableSummaryCurveCount > 0;
}
@@ -774,9 +776,10 @@ bool RimSummaryPlot::containsResamplableCurves() const
size_t RimSummaryPlot::singleColorCurveCount() const
{
auto allCurveSets = ensembleCurveSetCollection()->curveSets();
size_t colorIndex = std::count_if( allCurveSets.begin(), allCurveSets.end(), []( RimEnsembleCurveSet* curveSet ) {
return curveSet->colorMode() == RimEnsembleCurveSet::ColorMode::SINGLE_COLOR;
} );
size_t colorIndex = std::count_if( allCurveSets.begin(),
allCurveSets.end(),
[]( RimEnsembleCurveSet* curveSet )
{ return curveSet->colorMode() == RimEnsembleCurveSet::ColorMode::SINGLE_COLOR; } );
colorIndex += curveCount();
@@ -2658,7 +2661,8 @@ void RimSummaryPlot::initAfterRead()
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2021.10.2" ) )
{
auto copyAxis = [this]( RiuPlotAxis axis, auto sourceObject ) {
auto copyAxis = [this]( RiuPlotAxis axis, auto sourceObject )
{
auto axisProperties = axisPropertiesForPlotAxis( axis );
if ( axisProperties )
{
@@ -3004,7 +3008,8 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* destinationCurve )
auto destinationUnit = RiaStdStringTools::toUpper( destinationCurve->unitNameY() );
if ( destinationUnit.empty() ) strategy = AxisAssignmentStrategy::USE_MATCHING_VECTOR;
auto anyCurveWithUnitText = [this, destinationCurve] {
auto anyCurveWithUnitText = [this, destinationCurve]
{
for ( auto c : summaryCurves() )
{
if ( c == destinationCurve ) continue;

View File

@@ -162,7 +162,8 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot
auto qtChartsPlotWidget = dynamic_cast<RiuQtChartsPlotWidget*>( plotWidget );
if ( qtChartsPlotWidget )
{
auto mapToRiaNumberFormatType = []( RimPlotAxisProperties::NumberFormatType formatType ) {
auto mapToRiaNumberFormatType = []( RimPlotAxisProperties::NumberFormatType formatType )
{
if ( formatType == RimPlotAxisProperties::NumberFormatType::NUMBER_FORMAT_DECIMAL )
return RiaNumberFormat::NumberFormatType::FIXED;
@@ -207,7 +208,8 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
{
std::map<std::string, std::set<std::string>> unitToQuantityNameMap;
auto addToUnitToQuantityMap = [&]( const std::string& unitText, const RifEclipseSummaryAddress& sumAddress ) {
auto addToUnitToQuantityMap = [&]( const std::string& unitText, const RifEclipseSummaryAddress& sumAddress )
{
size_t cutPos = sumAddress.vectorName().find( ':' );
if ( cutPos == std::string::npos ) cutPos = -1;
@@ -345,7 +347,8 @@ QString RimSummaryPlotAxisFormatter::createAxisObjectName() const
{
std::set<std::string> vectorNames;
auto addVectorNames = [&]( const RifEclipseSummaryAddress& sumAddress ) {
auto addVectorNames = [&]( const RifEclipseSummaryAddress& sumAddress )
{
size_t cutPos = sumAddress.vectorName().find( ':' );
if ( cutPos == std::string::npos ) cutPos = -1;

View File

@@ -407,13 +407,16 @@ void RimSummaryTable::onLoadDataAndUpdate()
}
// Sort vector data on date (vectors with no values above threshold placed last):
std::sort( vectorDataCollection.begin(), vectorDataCollection.end(), []( const VectorData& v1, const VectorData& v2 ) {
if ( !v1.hasValueAboveThreshold ) return false;
if ( v1.hasValueAboveThreshold && !v2.hasValueAboveThreshold ) return true;
if ( v1.firstTimeStep < v2.firstTimeStep ) return true;
if ( v1.firstTimeStep == v2.firstTimeStep && v1.lastTimeStep < v2.lastTimeStep ) return true;
return false;
} );
std::sort( vectorDataCollection.begin(),
vectorDataCollection.end(),
[]( const VectorData& v1, const VectorData& v2 )
{
if ( !v1.hasValueAboveThreshold ) return false;
if ( v1.hasValueAboveThreshold && !v2.hasValueAboveThreshold ) return true;
if ( v1.firstTimeStep < v2.firstTimeStep ) return true;
if ( v1.firstTimeStep == v2.firstTimeStep && v1.lastTimeStep < v2.lastTimeStep ) return true;
return false;
} );
// Convert to strings
std::vector<QString> timeStepStrings;

View File

@@ -412,7 +412,8 @@ QList<double> RimSummaryTimeAxisProperties::createTickmarkList( const QDateTime&
if ( tickmarkStep < 1 ) return {};
// Convert from list of QDateTime items to double values for Qwt
auto toDoubleList = []( const QList<QDateTime>& dateTimeList ) {
auto toDoubleList = []( const QList<QDateTime>& dateTimeList )
{
QList<double> output;
for ( const auto& elm : dateTimeList )
{

View File

@@ -411,13 +411,15 @@ bool RimGridCaseSurface::findValidCellIndex( const RigMainGrid*
const size_t layer,
size_t& cellFaceIndex )
{
auto getCellFromRowColumnLayer = [grid, faceType]( size_t row, size_t column, size_t layer ) -> size_t {
auto getCellFromRowColumnLayer = [grid, faceType]( size_t row, size_t column, size_t layer ) -> size_t
{
if ( faceType == cvf::StructGridInterface::NEG_I ) return grid->cellIndexFromIJK( layer, column, row );
if ( faceType == cvf::StructGridInterface::NEG_J ) return grid->cellIndexFromIJK( column, layer, row );
return grid->cellIndexFromIJK( column, row, layer );
};
auto isCellValid = [grid, faceType]( size_t row, size_t column, size_t layer ) -> bool {
auto isCellValid = [grid, faceType]( size_t row, size_t column, size_t layer ) -> bool
{
if ( faceType == cvf::StructGridInterface::NEG_I )
{
return column < grid->cellCountJ() && row < grid->cellCountK() &&

View File

@@ -70,7 +70,8 @@ RiaVariableMapper::RiaVariableMapper( const QString& variableNameValueTable )
//--------------------------------------------------------------------------------------------------
QString RiaVariableMapper::addPathAndGetId( const QString& path )
{
auto computePathId = [this]( const auto& trimmedPath ) -> QString {
auto computePathId = [this]( const auto& trimmedPath ) -> QString
{
QString pathId;
auto pathToIdIt = m_valueToVariableMap.find( trimmedPath );
if ( pathToIdIt != m_valueToVariableMap.end() )
@@ -117,15 +118,18 @@ QString RiaVariableMapper::variableTableAsText() const
const QString pathText = variableToken() + pathIdBaseString();
// Put path variables at the end of the list
std::sort( sortedVariables.begin(), sortedVariables.end(), [pathText]( const auto& lhs, const auto& rhs ) {
bool isLhsPath = lhs.first.startsWith( pathText );
bool isRhsPath = rhs.first.startsWith( pathText );
std::sort( sortedVariables.begin(),
sortedVariables.end(),
[pathText]( const auto& lhs, const auto& rhs )
{
bool isLhsPath = lhs.first.startsWith( pathText );
bool isRhsPath = rhs.first.startsWith( pathText );
if ( isLhsPath && !isRhsPath ) return false;
if ( !isLhsPath && isRhsPath ) return true;
if ( isLhsPath && !isRhsPath ) return false;
if ( !isLhsPath && isRhsPath ) return true;
return lhs.first < rhs.first;
} );
return lhs.first < rhs.first;
} );
QString textTable;
textTable += "\n";

View File

@@ -914,7 +914,8 @@ void RimEnsembleWellLogCurveSet::updateStatisticsCurves( const std::vector<RimWe
statisticsTypes.push_back( RimEnsembleWellLogStatistics::StatisticsType::MEAN );
}
auto statisticsCurveSymbolFromStatistics = []( RimEnsembleWellLogStatistics::StatisticsType statisticsType ) {
auto statisticsCurveSymbolFromStatistics = []( RimEnsembleWellLogStatistics::StatisticsType statisticsType )
{
if ( statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P10 ) return RiuPlotCurveSymbol::SYMBOL_TRIANGLE;
if ( statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P90 ) return RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE;
if ( statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P50 ) return RiuPlotCurveSymbol::SYMBOL_DIAMOND;

View File

@@ -40,7 +40,7 @@ public:
static QList<caf::PdmOptionItemInfo> segmentTimeStepOptions( RifReaderRftInterface* readerRft, const QString& wellName );
static QList<caf::PdmOptionItemInfo>
segmentResultNameOptions( RifReaderRftInterface* readerRft, const QString& wellName, const QDateTime& timeStep );
segmentResultNameOptions( RifReaderRftInterface* readerRft, const QString& wellName, const QDateTime& timeStep );
static QList<caf::PdmOptionItemInfo> segmentBranchIndexOptions( RifReaderRftInterface* readerRft,
const QString& wellName,
const QDateTime& timeStep,

View File

@@ -752,7 +752,8 @@ void RimWellLogExtractionCurve::mapPropertyValuesFromReferenceWell( std::vector<
}
// Only allow asymptotically increasing k-layers - break at first decreasing k-layer value
auto createKLayerAndIndexMap = []( const std::vector<double>& indexKValues, int minLayerK, int maxLayerK ) {
auto createKLayerAndIndexMap = []( const std::vector<double>& indexKValues, int minLayerK, int maxLayerK )
{
int prevKLayer = -1;
std::map<int, std::vector<size_t>> kLayerAndIndexesMap = {};
for ( size_t i = 0; i < indexKValues.size(); ++i )

View File

@@ -165,7 +165,7 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
QString depthTitle = wellLogPlot->depthAxisTitle();
errMsg = QString( "Display of %1 for LAS curves is not possible without %2 "
"values in the LAS-file or a well path to derive them from." )
"values in the LAS-file or a well path to derive them from." )
.arg( depthTitle )
.arg( depthTitle );
}
@@ -221,14 +221,16 @@ std::pair<std::vector<double>, std::vector<double>>
{
CAF_ASSERT( values.size() == kIndexValues.size() );
auto findFirstIndex = []( int kLayer, const std::vector<double>& vals ) {
auto findFirstIndex = []( int kLayer, const std::vector<double>& vals )
{
for ( size_t i = 0; i < vals.size(); i++ )
if ( kLayer == static_cast<int>( vals[i] ) ) return i;
return vals.size();
};
auto findLastIndex = []( int kLayer, const std::vector<double>& vals ) {
auto findLastIndex = []( int kLayer, const std::vector<double>& vals )
{
for ( int i = static_cast<int>( vals.size() ) - 1; i >= 0; i-- )
if ( kLayer == static_cast<int>( vals[i] ) ) return static_cast<size_t>( i );

View File

@@ -667,7 +667,8 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
std::vector<double> errors = errorValues();
std::vector<QString> perPointLabels;
auto anyValidValuesPresent = []( const std::vector<double>& values ) -> bool {
auto anyValidValuesPresent = []( const std::vector<double>& values ) -> bool
{
for ( const auto& v : values )
{
if ( RiaStatisticsTools::isValidNumber<double>( v ) ) return true;

View File

@@ -842,7 +842,8 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals()
if ( m_propertyAxisMinAndMaxTicksOnly )
{
auto roundToDigits = []( double value, int numberOfDigits, bool useFloor ) {
auto roundToDigits = []( double value, int numberOfDigits, bool useFloor )
{
if ( value == 0.0 ) return 0.0;
double factor = std::pow( 10.0, numberOfDigits - std::ceil( std::log10( std::fabs( value ) ) ) );
@@ -1324,7 +1325,8 @@ void RimWellLogTrack::updateAxesVisibility( RiaDefines::Orientation orientation,
{
if ( !m_plotWidget ) return;
auto setAxisVisible = [this]( QwtAxis::Position axis, bool enable ) {
auto setAxisVisible = [this]( QwtAxis::Position axis, bool enable )
{
auto plot = m_plotWidget->qwtPlot();
if ( !plot ) return false;
@@ -3345,16 +3347,15 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
std::stable_sort( allWellPathComponents.begin(),
allWellPathComponents.end(),
[&sortIndices]( const RimWellPathComponentInterface* lhs, const RimWellPathComponentInterface* rhs ) {
return sortIndices.at( lhs->componentType() ) < sortIndices.at( rhs->componentType() );
} );
[&sortIndices]( const RimWellPathComponentInterface* lhs, const RimWellPathComponentInterface* rhs )
{ return sortIndices.at( lhs->componentType() ) < sortIndices.at( rhs->componentType() ); } );
std::set<QString> completionsAssignedToLegend;
for ( const RimWellPathComponentInterface* component : allWellPathComponents )
{
std::unique_ptr<RiuWellPathComponentPlotItem> plotItem( new RiuWellPathComponentPlotItem( wellPathAttributeSource(), component ) );
QString legendTitle = plotItem->legendTitle();
bool contributeToLegend = m_wellPathCompletionsInLegend() && !completionsAssignedToLegend.count( legendTitle );
QString legendTitle = plotItem->legendTitle();
bool contributeToLegend = m_wellPathCompletionsInLegend() && !completionsAssignedToLegend.count( legendTitle );
plotItem->setContributeToLegend( contributeToLegend );
m_wellPathAttributePlotObjects.push_back( std::move( plotItem ) );
completionsAssignedToLegend.insert( legendTitle );

View File

@@ -879,9 +879,10 @@ double RimWellPath::datumElevation() const
void RimWellPath::addWellLogFile( RimWellLogFile* logFileInfo )
{
// Prevent the same file from being loaded more than once
auto itr = std::find_if( m_wellLogFiles.begin(), m_wellLogFiles.end(), [&]( const RimWellLogFile* file ) {
return QString::compare( file->fileName(), logFileInfo->fileName(), Qt::CaseInsensitive ) == 0;
} );
auto itr = std::find_if( m_wellLogFiles.begin(),
m_wellLogFiles.end(),
[&]( const RimWellLogFile* file )
{ return QString::compare( file->fileName(), logFileInfo->fileName(), Qt::CaseInsensitive ) == 0; } );
// Todo: Verify well name to ensure all well log files having the same well name

View File

@@ -364,7 +364,8 @@ void RimWellPathGroup::makeMoreLevelsIfNecessary()
auto wellPathPoints = this->wellPathGeometry()->wellPathPoints();
auto comp = []( const cvf::Vec3d& lhs, const cvf::Vec3d& rhs ) {
auto comp = []( const cvf::Vec3d& lhs, const cvf::Vec3d& rhs )
{
auto diff = rhs - lhs;
if ( diff.length() < 1.0e-8 ) return false;