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
@@ -70,7 +70,8 @@ void RigEclipseToStimPlanCalculator::computeValues()
{
auto reservoirCellIndicesOpenForFlow = RimFractureContainmentTools::reservoirCellIndicesOpenForFlow( m_case, m_fracture );
auto resultValueAtIJ = []( const std::vector<std::vector<double>>& values, const RigFractureGrid& fractureGrid, size_t i, size_t j ) {
auto resultValueAtIJ = []( const std::vector<std::vector<double>>& values, const RigFractureGrid& fractureGrid, size_t i, size_t j )
{
if ( values.empty() ) return HUGE_VAL;
size_t adjustedI = i + 1;
@@ -145,8 +145,8 @@ double RigTransmissibilityCondenser::condensedTransmissibility( CellAddress exte
std::map<size_t, double> RigTransmissibilityCondenser::scaleMatrixToFracTransByMatrixWellDP( const RigActiveCellInfo* actCellInfo,
double currentWellPressure,
const std::vector<double>& currentMatrixPressures,
double* minPressureDrop,
double* maxPressureDrop )
double* minPressureDrop,
double* maxPressureDrop )
{
std::map<size_t, double> originalLumpedMatrixToFractureTrans; // Sum(T_mf)
@@ -73,7 +73,7 @@ RigVirtualPerforationTransmissibilities::~RigVirtualPerforationTransmissibilitie
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigVirtualPerforationTransmissibilities::setCompletionDataForWellPath( const RimWellPath* wellPath,
void RigVirtualPerforationTransmissibilities::setCompletionDataForWellPath( const RimWellPath* wellPath,
const std::vector<std::vector<RigCompletionData>>& completionsPerTimeStep )
{
CVF_ASSERT( m_mapFromWellToCompletionData.find( wellPath ) == m_mapFromWellToCompletionData.end() );
@@ -124,7 +124,7 @@ const std::map<size_t, std::vector<RigCompletionData>>&
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigVirtualPerforationTransmissibilities::setCompletionDataForSimWell( const RigSimWellData* simWellData,
void RigVirtualPerforationTransmissibilities::setCompletionDataForSimWell( const RigSimWellData* simWellData,
const std::vector<std::vector<RigCompletionData>>& completionsPerTimeStep )
{
m_mapFromSimWellToCompletionData[simWellData] = completionsPerTimeStep;
@@ -72,11 +72,11 @@ private:
class RigWellPathStimplanIntersectorTester
{
public:
static void testCalculate( const cvf::Mat4d& fractureXf,
const std::vector<cvf::Vec3d>& wellPathPoints,
double wellRadius,
double perforationLength,
const std::vector<std::vector<cvf::Vec3d>>& stpCellPolygons,
static void testCalculate( const cvf::Mat4d& fractureXf,
const std::vector<cvf::Vec3d>& wellPathPoints,
double wellRadius,
double perforationLength,
const std::vector<std::vector<cvf::Vec3d>>& stpCellPolygons,
std::map<size_t, RigWellPathStimplanIntersector::WellCellIntersection>& stimPlanCellIdxToIntersectionInfoMap )
{
RigWellPathStimplanIntersector::calculate( fractureXf,
@@ -24,7 +24,7 @@
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
//#include <cmath> // Needed for HUGE_VAL on Linux
// #include <cmath> // Needed for HUGE_VAL on Linux
//--------------------------------------------------------------------------------------------------
///
@@ -1431,7 +1431,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder( const RigEclipseResultAddress& resVarAddr,
size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder( const RigEclipseResultAddress& resVarAddr,
const std::vector<RiaDefines::ResultCatType>& resultCategorySearchOrder )
{
std::set<RiaDefines::ResultCatType> otherResultTypesToSearch = { RiaDefines::ResultCatType::STATIC_NATIVE,
@@ -357,9 +357,9 @@ RigCaseToCaseRangeFilterMapper::CellMatchType RigCaseToCaseRangeFilterMapper::fi
size_t ej,
size_t ek,
const RigFemPart* dependentFemPart,
size_t* fi,
size_t* fj,
size_t* fk )
size_t* fi,
size_t* fj,
size_t* fk )
{
// Find tolerance
@@ -438,9 +438,9 @@ RigCaseToCaseRangeFilterMapper::CellMatchType RigCaseToCaseRangeFilterMapper::fi
///
//--------------------------------------------------------------------------------------------------
RigCaseToCaseRangeFilterMapper::CellMatchType RigCaseToCaseRangeFilterMapper::findBestEclCellFromFemCell( const RigFemPart* dependentFemPart,
size_t fi,
size_t fj,
size_t fk,
size_t fi,
size_t fj,
size_t fk,
const RigMainGrid* masterEclGrid,
size_t* ei,
size_t* ej,
@@ -487,7 +487,7 @@ std::vector<std::vector<cvf::Vec3d>> RigCellGeometryTools::intersectionWithPolyg
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<cvf::Vec3d>> RigCellGeometryTools::subtractPolygons( const std::vector<cvf::Vec3d>& sourcePolygon,
std::vector<std::vector<cvf::Vec3d>> RigCellGeometryTools::subtractPolygons( const std::vector<cvf::Vec3d>& sourcePolygon,
const std::vector<std::vector<cvf::Vec3d>>& polygonsToSubtract )
{
ClipperLib::Clipper clpr;
@@ -48,7 +48,7 @@ public:
static double polygonLengthInLocalXdirWeightedByArea( const std::vector<cvf::Vec3d>& polygon2d );
static std::vector<std::vector<cvf::Vec3d>> intersectionWithPolygons( const std::vector<cvf::Vec3d>& polygon1,
static std::vector<std::vector<cvf::Vec3d>> intersectionWithPolygons( const std::vector<cvf::Vec3d>& polygon1,
const std::vector<std::vector<cvf::Vec3d>>& polygonToIntersectWith );
static std::vector<std::vector<cvf::Vec3d>> intersectionWithPolygon( const std::vector<cvf::Vec3d>& polygon1,
@@ -75,9 +75,8 @@ void RigConvexHull::removePointsWithoutConvexAngle( std::vector<cvf::Vec3d>& poi
// 2D cross product of (a, b) and (a, c) vectors, i.e. z-component of their 3D cross product.
// Returns a positive value, if c->(a,b) makes a counter-clockwise turn,
// negative for clockwise turn, and zero if the points are collinear.
auto counterClockWise = []( const cvf::Vec3d& a, const cvf::Vec3d& b, const cvf::Vec3d& c ) {
return ( b.x() - a.x() ) * ( c.y() - a.y() ) - ( b.y() - a.y() ) * ( c.x() - a.x() );
};
auto counterClockWise = []( const cvf::Vec3d& a, const cvf::Vec3d& b, const cvf::Vec3d& c )
{ return ( b.x() - a.x() ) * ( c.y() - a.y() ) - ( b.y() - a.y() ) * ( c.x() - a.x() ); };
// Remove all points that is not a counter-clockwise turn from current point
while ( points.size() >= 2 && counterClockWise( *( points.rbegin() + 1 ), *( points.rbegin() ), current ) >= 0 )
@@ -77,8 +77,8 @@ RigHistogramData RigEnsembleFractureStatisticsCalculator::createStatisticsData(
//--------------------------------------------------------------------------------------------------
RigHistogramData
RigEnsembleFractureStatisticsCalculator::createStatisticsData( const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& fractureDefinitions,
PropertyType propertyType,
int numBins )
PropertyType propertyType,
int numBins )
{
std::vector<double> samples = calculateProperty( fractureDefinitions, propertyType );
@@ -113,7 +113,7 @@ RigHistogramData
//--------------------------------------------------------------------------------------------------
std::vector<double>
RigEnsembleFractureStatisticsCalculator::calculateProperty( const std::vector<cvf::ref<RigStimPlanFractureDefinition>>& fractureDefinitions,
PropertyType propertyType )
PropertyType propertyType )
{
std::vector<double> samples;
if ( propertyType == PropertyType::HEIGHT )
@@ -668,7 +668,8 @@ bool RigMainGrid::isFaceNormalsOutwards() const
void RigMainGrid::computeFaceNormalsDirection( const std::vector<size_t>& reservoirCellIndices ) const
{
auto isValidAndFaceNormalDir =
[]( const double ijSize, const double kSize, const RigCell& cell, cvf::StructGridInterface::FaceType face ) -> std::pair<bool, bool> {
[]( const double ijSize, const double kSize, const RigCell& cell, cvf::StructGridInterface::FaceType face ) -> std::pair<bool, bool>
{
const cvf::Vec3d cellCenter = cell.center();
const cvf::Vec3d faceCenter = cell.faceCenter( face );
const cvf::Vec3d faceNormal = cell.faceNormalWithAreaLength( face );
@@ -411,7 +411,7 @@ void RigReservoirBuilderMock::addWellData( RigEclipseCaseData* eclipseCase, RigG
size_t connIdx;
for ( connIdx = 0; connIdx < connectionCount; connIdx++ )
{
if ( connIdx == ( size_t )( connectionCount / 4 ) ) continue;
if ( connIdx == (size_t)( connectionCount / 4 ) ) continue;
RigWellResultPoint data;
data.setGridIndex( 0 );
@@ -78,7 +78,7 @@ private:
void addFaults( RigEclipseCaseData* eclipseCase );
static void
addNnc( RigMainGrid* grid, size_t i1, size_t j1, size_t k1, size_t i2, size_t j2, size_t k2, RigConnectionContainer& nncConnections );
addNnc( RigMainGrid* grid, size_t i1, size_t j1, size_t k1, size_t i2, size_t j2, size_t k2, RigConnectionContainer& nncConnections );
void addWellData( RigEclipseCaseData* eclipseCase, RigGridBase* grid );
static void appendCells( size_t nodeStartIndex, size_t cellCount, RigGridBase* hostGrid, std::vector<RigCell>& cells );
@@ -631,38 +631,40 @@ public:
/// Creating useful lambda functions
auto buildResBranchToBranchLineEndsDistMap =
[&unusedBranchLineIterators, &resBranchIdxToBranchLineEndPointsDists, this]( const cvf::Vec3d& fromPoint, int resultBranchIndex ) {
for ( auto it : unusedBranchLineIterators )
[&unusedBranchLineIterators, &resBranchIdxToBranchLineEndPointsDists, this]( const cvf::Vec3d& fromPoint, int resultBranchIndex )
{
for ( auto it : unusedBranchLineIterators )
{
{
{
double dist = calculateFrontToPointDistance( it->second, fromPoint );
resBranchIdxToBranchLineEndPointsDists[resultBranchIndex].insert( DistToEndPoint( dist, it, true ) );
}
{
double dist = calculateEndToPointDistance( it->second, fromPoint );
resBranchIdxToBranchLineEndPointsDists[resultBranchIndex].insert( DistToEndPoint( dist, it, false ) );
}
double dist = calculateFrontToPointDistance( it->second, fromPoint );
resBranchIdxToBranchLineEndPointsDists[resultBranchIndex].insert( DistToEndPoint( dist, it, true ) );
}
};
{
double dist = calculateEndToPointDistance( it->second, fromPoint );
resBranchIdxToBranchLineEndPointsDists[resultBranchIndex].insert( DistToEndPoint( dist, it, false ) );
}
}
};
auto removeBranchLineFromDistanceMap =
[&resBranchIdxToBranchLineEndPointsDists]( std::list<std::pair<bool, std::deque<size_t>>>::iterator branchLineToMergeIt ) {
for ( auto& brIdx_DistToEndPointSet : resBranchIdxToBranchLineEndPointsDists )
[&resBranchIdxToBranchLineEndPointsDists]( std::list<std::pair<bool, std::deque<size_t>>>::iterator branchLineToMergeIt )
{
for ( auto& brIdx_DistToEndPointSet : resBranchIdxToBranchLineEndPointsDists )
{
std::vector<std::multiset<DistToEndPoint>::iterator> iteratorsToErase;
for ( auto it = brIdx_DistToEndPointSet.second.begin(); it != brIdx_DistToEndPointSet.second.end(); ++it )
{
std::vector<std::multiset<DistToEndPoint>::iterator> iteratorsToErase;
for ( auto it = brIdx_DistToEndPointSet.second.begin(); it != brIdx_DistToEndPointSet.second.end(); ++it )
if ( it->branchLineIt == branchLineToMergeIt )
{
if ( it->branchLineIt == branchLineToMergeIt )
{
iteratorsToErase.push_back( it );
}
iteratorsToErase.push_back( it );
}
for ( auto itToErase : iteratorsToErase )
brIdx_DistToEndPointSet.second.erase( itToErase );
}
};
for ( auto itToErase : iteratorsToErase )
brIdx_DistToEndPointSet.second.erase( itToErase );
}
};
// Make the result container ready
@@ -70,7 +70,7 @@ cvf::Vec3d RigSimulationWellCoordsAndMD::interpolatedPointAlongWellPath( double
{
// Do interpolation
double stepsize = ( measuredDepth - m_measuredDepths.at( i - 1 ) ) / ( m_measuredDepths.at( i ) - m_measuredDepths.at( i - 1 ) );
wellPathPoint = m_wellPathPoints.at( i - 1 ) + stepsize * ( m_wellPathPoints.at( i ) - m_wellPathPoints.at( i - 1 ) );
wellPathPoint = m_wellPathPoints.at( i - 1 ) + stepsize * ( m_wellPathPoints.at( i ) - m_wellPathPoints.at( i - 1 ) );
}
}
else
@@ -121,7 +121,7 @@ std::tuple<const RigFault*, double, cvf::Vec3d, double> RigStimPlanModelTools::f
for ( const WellPathCellIntersectionInfo& intersection : intersections )
{
// Find the closest cell face which is a fault
double distance = position.pointDistance( intersection.startPoint );
double distance = position.pointDistance( intersection.startPoint );
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace( intersection.globCellIndex, intersection.intersectedCellFaceIn );
if ( fault && distance < shortestDistance )
{
@@ -85,7 +85,8 @@ cvf::ref<RigSurface> RigSurfaceStatisticsCalculator::computeStatistics( const st
RigStatisticsMath::calculateStatisticsCurves( samples, &p10, &p50, &p90, &mean, RigStatisticsMath::PercentileStyle::SWITCHED );
// TODO: improve handling of these cases
auto makeValid = []( double val ) {
auto makeValid = []( double val )
{
if ( std::isinf( val ) || std::isnan( val ) ) return 0.0;
return val;
};
@@ -176,9 +176,9 @@ void RigThermalFractureResultUtil::createFractureTriangleGeometry( std::shared_p
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigThermalFractureResultUtil::fractureGridResults( std::shared_ptr<const RigThermalFractureDefinition> fractureDefinition,
const QString& resultName,
const QString& unitName,
size_t timeStepIndex )
const QString& resultName,
const QString& unitName,
size_t timeStepIndex )
{
std::vector<double> fractureGridResults;
const std::vector<std::vector<double>>& resultValuesAtTimeStep =
@@ -475,7 +475,8 @@ std::vector<cvf::Vec3d>
r.z() = 0.0;
}
auto findPointsWithMostSimilarDepth = []( const std::vector<cvf::Vec3d>& points, const std::vector<double>& depths ) {
auto findPointsWithMostSimilarDepth = []( const std::vector<cvf::Vec3d>& points, const std::vector<double>& depths )
{
double minDiff = std::numeric_limits<double>::max();
cvf::Vec3d e1 = cvf::Vec3d::UNDEFINED;
@@ -598,7 +599,8 @@ double RigThermalFractureResultUtil::interpolateProperty( const cvf::Vec3d&
std::pair<double, double> RigThermalFractureResultUtil::minMaxDepth( std::shared_ptr<const RigThermalFractureDefinition> fractureDefinition,
int activeTimeStepIndex )
{
auto getBoundingBox = []( const std::vector<cvf::Vec3d>& coords ) {
auto getBoundingBox = []( const std::vector<cvf::Vec3d>& coords )
{
cvf::BoundingBox bb;
for ( auto c : coords )
bb.add( c );
@@ -65,9 +65,9 @@ public:
void setOptionsExclusive( bool exclusive );
std::vector<QString> allSourceUiLabels( const QString& delimiter = " ", double userDefinedValue = std::numeric_limits<double>::infinity() );
QString sourceUiLabel( Source currentSource,
const QString& delimiter = " ",
double userDefinedValue = std::numeric_limits<double>::infinity() );
QString sourceUiLabel( Source currentSource,
const QString& delimiter = " ",
double userDefinedValue = std::numeric_limits<double>::infinity() );
bool operator==( const RigWbsParameter& rhs ) const;
bool operator<( const RigWbsParameter& rhs ) const;
@@ -325,7 +325,8 @@ void RigWellAllocationOverTime::groupAccumulatedFlowVolumes( std::map<QString, s
void RigWellAllocationOverTime::groupAccumulatedFlowVolumeFractionsOrPercentages( std::map<QString, std::map<QDateTime, double>>& rWellValuesMap,
double threshold )
{
auto getMaxValue = []( const std::map<QDateTime, double>& valuesMap ) -> double {
auto getMaxValue = []( const std::map<QDateTime, double>& valuesMap ) -> double
{
double maxValue = 0.0;
for ( const auto& [timeStep, value] : valuesMap )
{
@@ -424,13 +424,16 @@ cvf::ref<RigWellPath> RigWellPath::commonGeometry( const std::vector<const RigWe
{
const cvf::Vec3d& firstGeometryVertex = firstGeometry->wellPathPoints()[vIndex];
bool allMatches = std::all_of( allGeometries.begin() + 1, allGeometries.end(), [=]( const RigWellPath* geometry ) {
if ( geometry->wellPathPoints().size() > vIndex )
{
return ( firstGeometryVertex - geometry->wellPathPoints()[vIndex] ).length() < eps;
}
return false;
} );
bool allMatches = std::all_of( allGeometries.begin() + 1,
allGeometries.end(),
[=]( const RigWellPath* geometry )
{
if ( geometry->wellPathPoints().size() > vIndex )
{
return ( firstGeometryVertex - geometry->wellPathPoints()[vIndex] ).length() < eps;
}
return false;
} );
if ( allMatches )
{
@@ -146,8 +146,8 @@ void RigWellPathFormations::depthAndFormationNamesWithoutDuplicatesOnDepth( std:
///
//--------------------------------------------------------------------------------------------------
void RigWellPathFormations::evaluateFormationsForOnePosition( const std::vector<std::pair<RigWellPathFormation, FormationLevel>>& formations,
const FormationLevel& maxLevel,
const PickPosition& position,
const FormationLevel& maxLevel,
const PickPosition& position,
std::map<double, LevelAndName, DepthComp>* uniqueListMaker,
RimWellLogPlot::DepthTypeEnum depthType ) const
{