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

@@ -4,7 +4,7 @@ on: [push]
jobs:
clang-format-job:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Set apt mirror
# GitHub Actions apt proxy is super unstable
@@ -15,25 +15,26 @@ jobs:
curl http://mirrors.ubuntu.com/mirrors.txt | sudo tee --append /etc/apt/mirrors.txt
sudo sed -i 's/http:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/mirrors.txt/' /etc/apt/sources.list
- name: Install clang-format 10.0
- name: Install clang-format 15.0
run: |
sudo apt-get install --option="APT::Acquire::Retries=3" clang-format-10
clang-format-10 --version
sudo apt-get update
sudo apt-get install --option="APT::Acquire::Retries=3" clang-format-15
clang-format-15 --version
- uses: actions/checkout@v3
- name: Check format - ApplicationLibCode
run: |
cd ApplicationLibCode
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-10 -i
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
git diff
- name: Check format - ApplicationExeCode
run: |
cd ApplicationExeCode
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-10 -i
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
git diff
- name: Check format - AppFwk
run: |
cd Fwk/AppFwk
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | grep -v gtest | xargs clang-format-10 -i
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | grep -v gtest | xargs clang-format-15 -i
git diff
- uses: peter-evans/create-pull-request@v4
with:

View File

@@ -64,12 +64,14 @@ QDateTime RiaDateStringParser::parseDateString( const std::string& dateString, O
//--------------------------------------------------------------------------------------------------
bool RiaDateStringParser::parseDateStringWithSeparators( const std::string& dateString, int& year, int& month, int& day, OrderPreference preference )
{
auto tryParseAllYearFirst = []( const std::string& dateString, int& year, int& month, int& day ) {
auto tryParseAllYearFirst = []( const std::string& dateString, int& year, int& month, int& day )
{
return tryParseYearFirst( dateString, year, month, day ) || tryParseDayFirst( dateString, year, month, day ) ||
tryParseMonthFirst( dateString, year, month, day );
};
auto tryParseAllDayFirst = []( const std::string& dateString, int& year, int& month, int& day ) {
auto tryParseAllDayFirst = []( const std::string& dateString, int& year, int& month, int& day )
{
return tryParseDayFirst( dateString, year, month, day ) || tryParseYearFirst( dateString, year, month, day ) ||
tryParseMonthFirst( dateString, year, month, day );
};
@@ -83,12 +85,14 @@ bool RiaDateStringParser::parseDateStringWithSeparators( const std::string& date
//--------------------------------------------------------------------------------------------------
bool RiaDateStringParser::parseDateStringWithoutSeparators( const std::string& dateString, int& year, int& month, int& day, OrderPreference preference )
{
auto tryParseAllYearFirstNoSeparators = []( const std::string& dateString, int& year, int& month, int& day ) {
auto tryParseAllYearFirstNoSeparators = []( const std::string& dateString, int& year, int& month, int& day )
{
return tryParseYearFirstNoSeparators( dateString, year, month, day ) ||
tryParseDayFirstNoSeparators( dateString, year, month, day ) || tryParseMonthFirstNoSeparators( dateString, year, month, day );
};
auto tryParseAllDayFirstNoSeparators = []( const std::string& dateString, int& year, int& month, int& day ) {
auto tryParseAllDayFirstNoSeparators = []( const std::string& dateString, int& year, int& month, int& day )
{
return tryParseDayFirstNoSeparators( dateString, year, month, day ) || tryParseYearFirstNoSeparators( dateString, year, month, day ) ||
tryParseMonthFirstNoSeparators( dateString, year, month, day );
};

View File

@@ -61,11 +61,11 @@ void RiaImageTools::distanceTransform2d( std::vector<std::vector<unsigned int>>&
}
}
auto f = []( int64_t x, int64_t i, const std::vector<std::vector<int64_t>>& g, int64_t y ) {
return ( x - i ) * ( x - i ) + g[i][y] * g[i][y];
};
auto f = []( int64_t x, int64_t i, const std::vector<std::vector<int64_t>>& g, int64_t y )
{ return ( x - i ) * ( x - i ) + g[i][y] * g[i][y]; };
auto sep = []( int64_t i, int64_t u, const std::vector<std::vector<int64_t>>& g, int64_t y ) {
auto sep = []( int64_t i, int64_t u, const std::vector<std::vector<int64_t>>& g, int64_t y )
{
if ( i == u ) return (int64_t)0;
int64_t numerator = u * u - i * i + g[u][y] * g[u][y] - g[i][y] * g[i][y];

View File

@@ -33,7 +33,10 @@ std::vector<const RigWellPath*> RiaSimWellBranchTools::simulationWellBranches( c
{
std::vector<RimEclipseCase*> simCases = RimEclipseCaseTools::eclipseCases();
auto caseItr = std::find_if( simCases.begin(), simCases.end(), [&simWellName]( const RimEclipseCase* eclCase ) {
auto caseItr = std::find_if( simCases.begin(),
simCases.end(),
[&simWellName]( const RimEclipseCase* eclCase )
{
const auto& eclData = eclCase->eclipseCaseData();
return eclData != nullptr && eclData->hasSimulationWell( simWellName );
} );

View File

@@ -80,9 +80,8 @@ void RiaStdStringTools::splitByDelimiter( const std::string& str, Container& con
template <typename InputIt>
std::string join( InputIt begin, InputIt end, const std::string& separator = ", " )
{
auto compose_key = [&separator]( std::string& key, const std::string& key_part ) -> std::string {
return key.empty() ? key_part : key + separator + key_part;
};
auto compose_key = [&separator]( std::string& key, const std::string& key_part ) -> std::string
{ return key.empty() ? key_part : key + separator + key_part; };
return std::accumulate( begin, end, std::string(), compose_key );
}

View File

@@ -79,7 +79,10 @@ QString RiaWellNameComparer::tryMatchNameInList( QString searchName, const std::
}
// Try matching ignoring spaces, dashes and underscores
matchedName = tryMatchName( searchName, nameList, []( const QString& str ) {
matchedName = tryMatchName( searchName,
nameList,
[]( const QString& str )
{
QString s = str;
s = removeWellNamePrefix( s );
return s.remove( ' ' ).remove( '-' ).remove( '_' );

View File

@@ -704,7 +704,8 @@ std::vector<cvf::Vec3d> RicExportFractureCompletionsImpl::computeWellPointsInFra
RiaLogging::info( QString( "Angle: %1 degrees." ).arg( cvf::Math::toDegrees( angle ) ) );
auto rotMat = cvf::GeometryTools::rotationMatrixBetweenVectors( directionToStartPos, directionToStartPosInFracturePlane );
auto rotatePoint = []( const cvf::Vec3d& point, const cvf::Vec3d& offset, auto rotMat ) {
auto rotatePoint = []( const cvf::Vec3d& point, const cvf::Vec3d& offset, auto rotMat )
{
cvf::Vec3d p = point - offset;
p.transformPoint( rotMat );
p += offset;

View File

@@ -115,14 +115,18 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions( c
auto allCompletions = wellPath->allCompletionsRecursively();
bool exportFractures =
exportSettings.includeFractures() && std::any_of( allCompletions.begin(), allCompletions.end(), []( auto completion ) {
return completion->isEnabled() && completion->componentType() == RiaDefines::WellPathComponentType::FRACTURE;
} );
exportSettings.includeFractures() &&
std::any_of( allCompletions.begin(),
allCompletions.end(),
[]( auto completion )
{ return completion->isEnabled() && completion->componentType() == RiaDefines::WellPathComponentType::FRACTURE; } );
bool exportFishbones =
exportSettings.includeFishbones() && std::any_of( allCompletions.begin(), allCompletions.end(), []( auto completion ) {
return completion->isEnabled() && completion->componentType() == RiaDefines::WellPathComponentType::FISHBONES;
} );
exportSettings.includeFishbones() &&
std::any_of( allCompletions.begin(),
allCompletions.end(),
[]( auto completion )
{ return completion->isEnabled() && completion->componentType() == RiaDefines::WellPathComponentType::FISHBONES; } );
if ( exportSettings.fileSplit() == RicExportCompletionDataSettingsUi::ExportSplit::SPLIT_ON_WELL && !unifiedWellPathFile )
{
@@ -157,10 +161,13 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForAllCompletions( c
}
else
{
bool anyPerforationsPresent =
exportSettings.includeFractures() && std::any_of( allCompletions.begin(), allCompletions.end(), []( auto completion ) {
bool anyPerforationsPresent = exportSettings.includeFractures() &&
std::any_of( allCompletions.begin(),
allCompletions.end(),
[]( auto completion ) {
return completion->isEnabled() &&
completion->componentType() == RiaDefines::WellPathComponentType::PERFORATION_INTERVAL;
completion->componentType() ==
RiaDefines::WellPathComponentType::PERFORATION_INTERVAL;
} );
QString perforationText = anyPerforationsPresent ? "Perforation_" : "";
@@ -350,7 +357,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForFractures( RimEcl
RicMswExportInfo& exportInfo,
const RimWellPath* wellPath,
bool completionSegmentsAfterMainBore,
bool exportLgrData ) {
bool exportLgrData )
{
formatter.setOptionalComment( exportDataSourceAsComment );
double maxSegmentLength = wellPath->mswCompletionParameters()->maxSegmentLength();

View File

@@ -265,9 +265,9 @@ std::string RicCreateDepthAdjustedLasFilesImpl::createDepthUnitText( RiaDefines:
//--------------------------------------------------------------------------------------------------
std::string RicCreateDepthAdjustedLasFilesImpl::createDepthUnitComment( RiaDefines::DepthUnitType depthUnitType )
{
return depthUnitType == RiaDefines::DepthUnitType::UNIT_METER
? "in meters"
: depthUnitType == RiaDefines::DepthUnitType::UNIT_FEET ? "in feet" : "in Connection number";
return depthUnitType == RiaDefines::DepthUnitType::UNIT_METER ? "in meters"
: depthUnitType == RiaDefines::DepthUnitType::UNIT_FEET ? "in feet"
: "in Connection number";
}
//--------------------------------------------------------------------------------------------------

View File

@@ -114,9 +114,10 @@ public:
int priority() const
{
return type == RigCompletionData::CompletionType::FRACTURE
? 1
: type == RigCompletionData::CompletionType::FISHBONES ? 2 : type == RigCompletionData::CompletionType::PERFORATION ? 3 : 4;
return type == RigCompletionData::CompletionType::FRACTURE ? 1
: type == RigCompletionData::CompletionType::FISHBONES ? 2
: type == RigCompletionData::CompletionType::PERFORATION ? 3
: 4;
}
// Sort by priority, then name, then number

View File

@@ -116,7 +116,8 @@ std::vector<T*> RicMeshFractureTemplateHelper<T>::createNewTemplatesFromFiles( c
RimFractureTemplateCollection* fracDefColl = oilfield->fractureDefinitionCollection();
if ( !fracDefColl ) return std::vector<T*>();
auto findTemplateByName = []( RimFractureTemplateCollection* coll, const QString& name ) -> T* {
auto findTemplateByName = []( RimFractureTemplateCollection* coll, const QString& name ) -> T*
{
for ( auto t : coll->fractureTemplates() )
if ( t->name() == name ) return dynamic_cast<T*>( t );

View File

@@ -63,9 +63,8 @@ bool RicCloseSummaryCaseInCollectionFeature::isCommandEnabled()
summaryCaseCollections.erase( std::remove_if( summaryCaseCollections.begin(),
summaryCaseCollections.end(),
[]( RimSummaryCaseCollection* coll ) {
return dynamic_cast<RimDerivedEnsembleCaseCollection*>( coll ) != nullptr;
} ),
[]( RimSummaryCaseCollection* coll )
{ return dynamic_cast<RimDerivedEnsembleCaseCollection*>( coll ) != nullptr; } ),
summaryCaseCollections.end() );
return ( summaryCaseMainCollections.size() > 0 || summaryCaseCollections.size() > 0 );

View File

@@ -188,7 +188,8 @@ std::vector<std::pair<QString, RiaDefines::ResultCatType>>
const RigEclipseCaseData* caseData )
{
auto findResultCategory =
[]( const QString& keyword, const std::vector<RiaDefines::ResultCatType>& categories, const RigEclipseCaseData* caseData ) {
[]( const QString& keyword, const std::vector<RiaDefines::ResultCatType>& categories, const RigEclipseCaseData* caseData )
{
// Find the result category for a given keyword
auto resultData = caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
for ( auto category : categories )

View File

@@ -70,9 +70,8 @@ bool RicDeleteSummaryCaseCollectionFeature::isCommandEnabled()
selection.erase( std::remove_if( selection.begin(),
selection.end(),
[]( RimSummaryCaseCollection* coll ) {
return dynamic_cast<RimDerivedEnsembleCaseCollection*>( coll ) != nullptr;
} ),
[]( RimSummaryCaseCollection* coll )
{ return dynamic_cast<RimDerivedEnsembleCaseCollection*>( coll ) != nullptr; } ),
selection.end() );
return ( selection.size() > 0 );
}

View File

@@ -112,9 +112,9 @@ void RicElasticPropertiesImportTools::importElasticPropertiesFromFile( const QSt
}
// Sort the matching items by porosity
std::sort( matchingFacies.begin(), matchingFacies.end(), []( const RifElasticProperties& a, const RifElasticProperties& b ) {
return a.porosity < b.porosity;
} );
std::sort( matchingFacies.begin(),
matchingFacies.end(),
[]( const RifElasticProperties& a, const RifElasticProperties& b ) { return a.porosity < b.porosity; } );
std::vector<QString> matchingFormations;
if ( formationName == formationWildCard )

View File

@@ -146,9 +146,10 @@ QString RicImportEnsembleFeature::askForEnsembleName( const QString& suggestion
{
RimProject* project = RimProject::current();
std::vector<RimSummaryCaseCollection*> groups = project->summaryGroups();
int ensemblesStartingWithRoot = std::count_if( groups.begin(), groups.end(), [suggestion]( RimSummaryCaseCollection* group ) {
return group->isEnsemble() && group->name().startsWith( suggestion );
} );
int ensemblesStartingWithRoot = std::count_if( groups.begin(),
groups.end(),
[suggestion]( RimSummaryCaseCollection* group )
{ return group->isEnsemble() && group->name().startsWith( suggestion ); } );
QInputDialog dialog;
dialog.setInputMode( QInputDialog::TextInput );

View File

@@ -436,9 +436,9 @@ RicSummaryCaseRestartDialogResult RicSummaryCaseRestartDialog::openDialog( const
//--------------------------------------------------------------------------------------------------
RicSummaryCaseRestartDialog::ImportOptions RicSummaryCaseRestartDialog::selectedSummaryImportOption() const
{
return m_summaryReadAllBtn->isChecked()
? ImportOptions::IMPORT_ALL
: m_summarySeparateCasesBtn->isChecked() ? ImportOptions::SEPARATE_CASES : ImportOptions::NOT_IMPORT;
return m_summaryReadAllBtn->isChecked() ? ImportOptions::IMPORT_ALL
: m_summarySeparateCasesBtn->isChecked() ? ImportOptions::SEPARATE_CASES
: ImportOptions::NOT_IMPORT;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -90,7 +90,8 @@ void RicThemeColorEditorFeature::onActionTriggered( bool isChecked )
completer->setWrapAround( false );
editor->setCompleter( completer );
auto generateColorFields = [themeSelector, widget, editor]() -> void {
auto generateColorFields = [themeSelector, widget, editor]() -> void
{
QLayoutItem* item;
if ( widget->layout() )
{
@@ -114,7 +115,10 @@ void RicThemeColorEditorFeature::onActionTriggered( bool isChecked )
column );
QPushButton* colorBox = new QPushButton( "" );
colorBox->setStyleSheet( QString( "background-color: %0;" ).arg( variableValueMap.value( variableName ) ) );
connect( colorBox, &QPushButton::clicked, [variableValueMap, variableName, theme, editor, widget, colorBox]() -> void {
connect( colorBox,
&QPushButton::clicked,
[variableValueMap, variableName, theme, editor, widget, colorBox]() -> void
{
QColor color = QColorDialog::getColor( colorBox->palette().color( QPalette::Button ), widget );
if ( color.isValid() )
{
@@ -137,7 +141,10 @@ void RicThemeColorEditorFeature::onActionTriggered( bool isChecked )
// A more elegant way, but not supported in old Qt version.
// connect( themeSelector, qOverload<int>( &QComboBox::currentIndexChanged ), [=]() {
connect( themeSelector, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), [=]() {
connect( themeSelector,
static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ),
[=]()
{
generateColorFields();
RiaDefines::ThemeEnum theme = static_cast<RiaDefines::ThemeEnum>( themeSelector->currentData().toInt() );
RiuGuiTheme::updateGuiTheme( static_cast<RiaDefines::ThemeEnum>( theme ) );
@@ -156,7 +163,10 @@ void RicThemeColorEditorFeature::onActionTriggered( bool isChecked )
QPushButton* button = new QPushButton( "Apply style sheet changes" );
layout->addWidget( button, 6, 1 );
connect( button, &QPushButton::clicked, [themeSelector, editor, generateColorFields]() {
connect( button,
&QPushButton::clicked,
[themeSelector, editor, generateColorFields]()
{
RiaDefines::ThemeEnum theme = static_cast<RiaDefines::ThemeEnum>( themeSelector->currentData().toInt() );
RiuGuiTheme::writeStyleSheetToFile( theme, editor->toPlainText() );
generateColorFields();

View File

@@ -509,9 +509,10 @@ void RicSummaryPlotEditorUi::updatePreviewCurvesFromCurveDefinitions( const std:
// Set single curve set color
auto allCurveSets = m_previewPlot->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; } );
curveSet->setColor( RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex ) );
// Add curve to plot
@@ -976,9 +977,9 @@ void RicSummaryPlotEditorUi::setInitialCurveVisibility( const RimSummaryPlot* ta
//--------------------------------------------------------------------------------------------------
int ensembleCurveCount( const std::set<RiaSummaryCurveDefinition>& allCurveDefs )
{
return std::count_if( allCurveDefs.begin(), allCurveDefs.end(), []( const RiaSummaryCurveDefinition& def ) {
return def.isEnsembleCurve();
} );
return std::count_if( allCurveDefs.begin(),
allCurveDefs.end(),
[]( const RiaSummaryCurveDefinition& def ) { return def.isEnsembleCurve(); } );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -109,7 +109,8 @@ std::set<RimViewWindow*> RicWellLogFileCloseFeature::referringWellLogPlots( cons
RimViewWindow* plot = allocationPlot ? dynamic_cast<RimViewWindow*>( allocationPlot )
: pltPlot ? dynamic_cast<RimViewWindow*>( pltPlot )
: rftPlot ? dynamic_cast<RimViewWindow*>( rftPlot )
: wellLogPlot ? dynamic_cast<RimViewWindow*>( wellLogPlot ) : nullptr;
: wellLogPlot ? dynamic_cast<RimViewWindow*>( wellLogPlot )
: nullptr;
if ( plot != nullptr )
{

View File

@@ -89,7 +89,8 @@ std::pair<std::string, std::vector<float>>
{
std::vector<float> values;
auto isKeywordWithoutData = []( const std::string& keyword ) {
auto isKeywordWithoutData = []( const std::string& keyword )
{
std::vector<std::string> keywords = { "ECHO", "NOECHO" };
return std::find( keywords.begin(), keywords.end(), keyword ) != keywords.end();
};

View File

@@ -98,9 +98,8 @@ std::vector<time_t> RifHdf5SummaryReader::timeSteps() const
// Add custom method to convert from time_point to time_t. The usual implementation of
// chrono::system_clock::to_time_t() uses nanoseconds which will overflow on data with
// long time spans.
auto convertTimePointToTimeT = []( const TP& value ) {
return std::chrono::duration_cast<std::chrono::seconds>( value.time_since_epoch() ).count();
};
auto convertTimePointToTimeT = []( const TP& value )
{ return std::chrono::duration_cast<std::chrono::seconds>( value.time_since_epoch() ).count(); };
auto startDat = std::chrono::system_clock::from_time_t( startDate() );

View File

@@ -348,7 +348,8 @@ std::vector<std::vector<cvf::Vec3d>>
std::sort( zDistanceAlongPillar.begin(), zDistanceAlongPillar.end() );
auto normalize = []( const std::vector<double>& values ) -> std::vector<double> {
auto normalize = []( const std::vector<double>& values ) -> std::vector<double>
{
if ( values.size() < 2 ) return {};
std::vector<double> normalizedValues;

View File

@@ -72,7 +72,8 @@ bool RifRoffFileTools::openGridFile( const QString& fileName, RigEclipseCaseData
return false;
}
auto getInt = []( auto values, const std::string& name ) {
auto getInt = []( auto values, const std::string& name )
{
auto v = std::find_if( values.begin(), values.end(), [&name]( const auto& arg ) { return arg.first == name; } );
if ( v != values.end() )
return std::get<int>( v->second );
@@ -80,7 +81,8 @@ bool RifRoffFileTools::openGridFile( const QString& fileName, RigEclipseCaseData
throw std::runtime_error( "Missing parameter (integer): " + name );
};
auto getFloat = []( auto values, const std::string& name ) {
auto getFloat = []( auto values, const std::string& name )
{
auto v = std::find_if( values.begin(), values.end(), [&name]( const auto& arg ) { return arg.first == name; } );
if ( v != values.end() )
return std::get<float>( v->second );

View File

@@ -55,8 +55,7 @@ bool vectorContains( const std::vector<T>& vector, T item )
//--------------------------------------------------------------------------------------------------
RicSummaryCaseRestartDialog::ImportOptions mapReadOption( RiaPreferencesSummary::SummaryRestartFilesImportMode mode )
{
return mode == RiaPreferencesSummary::SummaryRestartFilesImportMode::NOT_IMPORT
? RicSummaryCaseRestartDialog::ImportOptions::NOT_IMPORT
return mode == RiaPreferencesSummary::SummaryRestartFilesImportMode::NOT_IMPORT ? RicSummaryCaseRestartDialog::ImportOptions::NOT_IMPORT
: mode == RiaPreferencesSummary::SummaryRestartFilesImportMode::SEPARATE_CASES
? RicSummaryCaseRestartDialog::ImportOptions::SEPARATE_CASES
: RicSummaryCaseRestartDialog::ImportOptions::IMPORT_ALL;

View File

@@ -377,7 +377,8 @@ std::pair<std::vector<cvf::Vec3d>, std::vector<unsigned>> RifSurfaceImporter::re
// of axesVectorCandidates. Also increases the number of occurrences of vector candidates.
auto maybeInsertAxisVectorCandidate = [epsilon]( const cvf::Vec2d vector,
std::map<cvf::Vec2d, double, vec2dCompare>& axesVectorCandidates,
std::map<cvf::Vec2d, unsigned, vec2dCompare>& axesVectorCandidatesNum ) -> bool {
std::map<cvf::Vec2d, unsigned, vec2dCompare>& axesVectorCandidatesNum ) -> bool
{
double length = vector.length();
cvf::Vec2d normalizedVector = vector.getNormalized();
for ( std::map<cvf::Vec2d, double, vec2dCompare>::iterator iter = axesVectorCandidates.begin(); iter != axesVectorCandidates.end();
@@ -471,9 +472,9 @@ std::pair<std::vector<cvf::Vec3d>, std::vector<unsigned>> RifSurfaceImporter::re
pairs.push_back( *itr );
}
sort( pairs.begin(), pairs.end(), [=]( std::pair<cvf::Vec2d, unsigned>& a, std::pair<cvf::Vec2d, unsigned>& b ) {
return a.second > b.second;
} );
sort( pairs.begin(),
pairs.end(),
[=]( std::pair<cvf::Vec2d, unsigned>& a, std::pair<cvf::Vec2d, unsigned>& b ) { return a.second > b.second; } );
cvf::Vec2d primaryAxisVector = pairs[0].first * axesVectorCandidates[pairs[0].first];
@@ -488,7 +489,8 @@ std::pair<std::vector<cvf::Vec3d>, std::vector<unsigned>> RifSurfaceImporter::re
auto distanceOnLine = [to3d, to2d, surfacePoints, primaryAxisVector, epsilon]( const cvf::Vec2d linePoint1,
const cvf::Vec2d linePoint2,
const cvf::Vec2d point ) -> int {
const cvf::Vec2d point ) -> int
{
double normalizedIntersection = 0.0;
cvf::Vec2d projectedPoint =
to2d( cvf::GeometryTools::projectPointOnLine( to3d( linePoint1 ), to3d( linePoint2 ), to3d( point ), &normalizedIntersection ) );
@@ -632,7 +634,8 @@ bool RifSurfaceImporter::generateTriangleIndices( const std::vector<std::vector<
//--------------------------------------------------------------------------------------------------
bool RifSurfaceImporter::vectorFuzzyCompare( const cvf::Vec2d& vector1, const cvf::Vec2d& vector2, double epsilon )
{
auto AlmostEqualRelativeAndAbs = [=]( double A, double B, double maxRelDiff ) -> bool {
auto AlmostEqualRelativeAndAbs = [=]( double A, double B, double maxRelDiff ) -> bool
{
// Check if the numbers are really close -- needed
// when comparing numbers near zero.
double diff = fabs( A - B );

View File

@@ -49,7 +49,8 @@ std::pair<std::shared_ptr<RigThermalFractureDefinition>, QString> RifThermalFrac
QString separator = ",";
auto appendPropertyValues = [definition]( int nodeIndex, int valueOffset, const QStringList& values, double conductivityFactor ) {
auto appendPropertyValues = [definition]( int nodeIndex, int valueOffset, const QStringList& values, double conductivityFactor )
{
CAF_ASSERT( valueOffset <= values.size() );
for ( int i = valueOffset; i < values.size(); i++ )
{

View File

@@ -268,9 +268,10 @@ void RifWellPathImporter::readAllAsciiWellData( const QString& filePath )
// name <WellNameA>
// wellname: <WellNameA>
std::string lineLowerCase = line;
transform( lineLowerCase.begin(), lineLowerCase.end(), lineLowerCase.begin(), []( const char c ) -> char {
return (char)::tolower( c );
} );
transform( lineLowerCase.begin(),
lineLowerCase.end(),
lineLowerCase.begin(),
[]( const char c ) -> char { return (char)::tolower( c ); } );
std::string tokenName = "name";
std::size_t foundNameIdx = lineLowerCase.find( tokenName );

View File

@@ -62,7 +62,8 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorEV::calculate( int partIndex
caf::ProgressInfo stepCountProgress( static_cast<size_t>( m_resultCollection->timeStepCount() ) * 4, progressText );
auto loadFrameLambda = [&]( const QString& component ) {
auto loadFrameLambda = [&]( const QString& component )
{
auto task = stepCountProgress.task( "Loading " + component, m_resultCollection->timeStepCount() );
return m_resultCollection->findOrLoadScalarResult( partIndex, resAddr.copyWithComponent( component.toStdString() ) );
};

View File

@@ -63,7 +63,8 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorPoreCompressibility::calcula
{
caf::ProgressInfo stepCountProgress( static_cast<size_t>( m_resultCollection->timeStepCount() ) * 7, "Calculating Pore Compressibility" );
auto loadFrameLambda = [&]( RigFemResultAddress addr, const QString& errMsg = "" ) -> RigFemScalarResultFrames* {
auto loadFrameLambda = [&]( RigFemResultAddress addr, const QString& errMsg = "" ) -> RigFemScalarResultFrames*
{
auto task = stepCountProgress.task( QString( "Loading %1: %2" )
.arg( QString::fromStdString( addr.fieldName ) )
.arg( QString::fromStdString( addr.componentName ) ),

View File

@@ -76,7 +76,8 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorPrincipalStrain::calculate(
caf::ProgressInfo stepCountProgress( static_cast<size_t>( m_resultCollection->timeStepCount() ) * 7, progressText );
auto loadFrameLambda = [&]( const std::string& component ) {
auto loadFrameLambda = [&]( const std::string& component )
{
auto task = stepCountProgress.task( QString::fromStdString( "Loading " + component ), m_resultCollection->timeStepCount() );
return m_resultCollection->findOrLoadScalarResult( partIndex, resAddr.copyWithComponent( component ) );
};

View File

@@ -62,7 +62,8 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorSFI::calculate( int partInde
caf::ProgressInfo stepCountProgress( static_cast<size_t>( m_resultCollection->timeStepCount() ) * 3, progressText );
auto loadFrameLambda = [&]( const QString& component ) {
auto loadFrameLambda = [&]( const QString& component )
{
auto task = stepCountProgress.task( "Loading " + component, m_resultCollection->timeStepCount() );
return m_resultCollection->findOrLoadScalarResult( partIndex, resAddr.copyWithComponent( component.toStdString() ) );
};

View File

@@ -62,7 +62,8 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorSM::calculate( int partIndex
caf::ProgressInfo stepCountProgress( static_cast<size_t>( m_resultCollection->timeStepCount() ) * 4, progressText );
auto loadFrameLambda = [&]( const QString& component ) {
auto loadFrameLambda = [&]( const QString& component )
{
auto task = stepCountProgress.task( component );
return m_resultCollection->findOrLoadScalarResult( partIndex, resVarAddr.copyWithComponent( component.toStdString() ) );
};

View File

@@ -155,7 +155,8 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
auto getFaceCenterAndNormal = [activeCellInfo, cells, arrowScaling, displayCordXf]( size_t globalCellIdx,
cvf::StructGridInterface::FaceType faceType,
cvf::Vec3d& faceCenter,
cvf::Vec3d& faceNormal ) {
cvf::Vec3d& faceNormal )
{
faceCenter = displayCordXf->transformToDisplayCoord( cells[globalCellIdx].faceCenter( faceType ) );
cvf::Vec3d cellCenter = displayCordXf->transformToDisplayCoord( cells[globalCellIdx].center() );
faceNormal = ( faceCenter - cellCenter ).getNormalized() * arrowScaling;

View File

@@ -167,7 +167,8 @@ void RivSimWellPipesPartMgr::buildWellPipeParts( const caf::DisplayCoordTransfor
m_wellBranches.clear();
m_flattenedBranchWellHeadOffsets.clear();
auto createSimWells = []( RimSimWellInView* simWellInView ) -> std::vector<SimulationWellCellBranch> {
auto createSimWells = []( RimSimWellInView* simWellInView ) -> std::vector<SimulationWellCellBranch>
{
std::vector<SimulationWellCellBranch> simWellBranches;
const RigSimWellData* simWellData = simWellInView->simWellData();
if ( simWellData && simWellData->isMultiSegmentWell() )
@@ -449,7 +450,8 @@ void RivSimWellPipesPartMgr::appendValvesGeo( const RimEclipseView*
RivPipeGeometryGenerator::tubeWithCenterLinePartsAndVariableWidth( &pbd.m_valveParts, displayCoords, radii, valveColor );
auto computeRotationAxisAndAngle = []( const cvf::Vec3f& direction ) {
auto computeRotationAxisAndAngle = []( const cvf::Vec3f& direction )
{
// Compute upwards normal based on direction
// Compute the rotation axis and angle between up vector and Z_AXIS

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

@@ -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();
@@ -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

@@ -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

@@ -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,12 +303,10 @@ 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 )
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

@@ -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 ||

View File

@@ -703,7 +703,10 @@ 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 ) {
auto itr = std::find_if( channelNames.begin(),
channelNames.end(),
[&]( const QString& channelName )
{
if ( channelName.startsWith( '^' ) )
{
std::regex pattern( channelName.toStdString() );

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,10 +632,8 @@ 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
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;

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

@@ -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

@@ -390,7 +390,10 @@ void RimMultiPlot::doRenderWindowContent( QPaintDevice* paintDevice )
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::updatePlotOrderFromGridWidget()
{
std::sort( m_plots.begin(), m_plots.end(), [this]( RimPlot* lhs, RimPlot* rhs ) {
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;

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

@@ -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 ) )
{

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

@@ -183,7 +183,10 @@ 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 {
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();

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

@@ -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 )
@@ -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,7 +407,10 @@ 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 ) {
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;

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,7 +118,10 @@ 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 ) {
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 );

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

@@ -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

@@ -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,9 +3347,8 @@ 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 )

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;

View File

@@ -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;

View File

@@ -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 )

View File

@@ -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 );

View File

@@ -631,7 +631,8 @@ public:
/// Creating useful lambda functions
auto buildResBranchToBranchLineEndsDistMap =
[&unusedBranchLineIterators, &resBranchIdxToBranchLineEndPointsDists, this]( const cvf::Vec3d& fromPoint, int resultBranchIndex ) {
[&unusedBranchLineIterators, &resBranchIdxToBranchLineEndPointsDists, this]( const cvf::Vec3d& fromPoint, int resultBranchIndex )
{
for ( auto it : unusedBranchLineIterators )
{
{
@@ -647,7 +648,8 @@ public:
};
auto removeBranchLineFromDistanceMap =
[&resBranchIdxToBranchLineEndPointsDists]( std::list<std::pair<bool, std::deque<size_t>>>::iterator branchLineToMergeIt ) {
[&resBranchIdxToBranchLineEndPointsDists]( std::list<std::pair<bool, std::deque<size_t>>>::iterator branchLineToMergeIt )
{
for ( auto& brIdx_DistToEndPointSet : resBranchIdxToBranchLineEndPointsDists )
{
std::vector<std::multiset<DistToEndPoint>::iterator> iteratorsToErase;

View File

@@ -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;
};

View File

@@ -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 );

View File

@@ -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 )
{

View File

@@ -424,7 +424,10 @@ 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 ) {
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;

View File

@@ -55,7 +55,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
{ { QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::curve\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]\\s*\\{("
"?<properties>([\\n\\r]*\\s*((line-color|symbol-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
@@ -114,7 +115,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::grid\\[\"(?<itemName>[a-zA-Z0-9-_\\*]+)\"\\]\\s*\\{("
"?<properties>([\\n\\r]*\\s*((color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
@@ -151,7 +153,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
{ QString( "QwtPlot\\[\"(?<plotName>[a-zA-Z0-9-_\\*]+)\"\\]::legend\\s*\\{("
"?<properties>([\\n\\r]*\\s*((text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "text-color:\\s*([#0-9a-zA-Z]+)" );
@@ -184,7 +187,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
"\\s*\\{("
"?<properties>([\\n\\r]*\\s*((color|text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
@@ -237,7 +241,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
"\\s*\\{("
"?<properties>([\\n\\r]*\\s*((color|text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression colorRegExp( "color:\\s*([#0-9a-zA-Z]+)" );
@@ -292,7 +297,8 @@ QMap<QString, CustomStyleSheetApplicator> RiuGuiTheme:
"\\s*\\{("
"?<properties>([\\n\\r]*\\s*((text-color):"
"\\s*([a-zA-Z0-9#]+)\\s*;))*)[\\n\\r]*\\s*\\}" ),
[]( QRegularExpressionMatch& match ) {
[]( QRegularExpressionMatch& match )
{
QRegExp plotNameRegExp( match.captured( "plotName" ) );
QRegExp itemNameRegExp( match.captured( "itemName" ) );
QRegularExpression textColorRegExp( "text-color:\\s*([#a-zA-Z0-9]+)" );

View File

@@ -71,7 +71,9 @@ std::list<QMdiSubWindow*> RiuMdiArea::subWindowListSortedByPosition()
// Sort of list so we first sort by window position but retain activation order
// for windows with the same position
windowList.sort( [this]( QMdiSubWindow* lhs, QMdiSubWindow* rhs ) {
windowList.sort(
[this]( QMdiSubWindow* lhs, QMdiSubWindow* rhs )
{
if ( lhs->frameGeometry().topLeft().rx() == rhs->frameGeometry().topLeft().rx() )
{
return lhs->frameGeometry().topLeft().ry() < rhs->frameGeometry().topLeft().ry();
@@ -92,7 +94,9 @@ std::list<QMdiSubWindow*> RiuMdiArea::subWindowListSortedByVerticalPosition()
windowList.push_back( subWindow );
}
windowList.sort( [this]( QMdiSubWindow* lhs, QMdiSubWindow* rhs ) {
windowList.sort(
[this]( QMdiSubWindow* lhs, QMdiSubWindow* rhs )
{
if ( lhs->frameGeometry().topLeft().ry() == rhs->frameGeometry().topLeft().ry() )
{
return lhs->frameGeometry().topLeft().rx() < rhs->frameGeometry().topLeft().rx();

View File

@@ -168,9 +168,8 @@ void RiuMultiPlotPage::insertPlot( RiuPlotWidget* plotWidget, size_t index )
m_subTitles.insert( static_cast<int>( index ), subTitle );
// Remove legend overlays already attached to the plot widget
auto matcher = []( RiuDraggableOverlayFrame* p ) {
return dynamic_cast<RiuQwtLegendOverlayContentFrame*>( p->contentFrame() ) != nullptr;
};
auto matcher = []( RiuDraggableOverlayFrame* p )
{ return dynamic_cast<RiuQwtLegendOverlayContentFrame*>( p->contentFrame() ) != nullptr; };
plotWidget->clearOverlayFrames( matcher );
RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast<RiuQwtPlotWidget*>( plotWidget );
@@ -1158,7 +1157,8 @@ void RiuMultiPlotPage::alignAxes()
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotPage::alignAxis( QwtAxisId axis, int targetRowOrColumn, std::function<bool( int, int, int )> matchPosition )
{
auto rowAndColumnFromIdx = [this]( int idx ) {
auto rowAndColumnFromIdx = [this]( int idx )
{
auto hit = m_visibleIndexToPositionMapping.find( idx );
CAF_ASSERT( hit != m_visibleIndexToPositionMapping.end() );
return hit->second;

View File

@@ -68,7 +68,8 @@ void QssSyntaxHighligter::highlightBlock( const QString& text )
setCurrentBlockState( -1 );
auto parseClass = [this, text]( int startIndex, int length ) {
auto parseClass = [this, text]( int startIndex, int length )
{
QTextCharFormat propertyFormat;
propertyFormat.setFontWeight( QFont::Bold );

View File

@@ -502,7 +502,8 @@ void RiuQtChartsPlotCurve::setVisibleInLegend( bool isVisibleInLegend )
bool showScatterMarker = isVisibleInLegend && m_symbol;
bool showLineMarker = isVisibleInLegend && !m_symbol;
auto setLegendVisibility = [this]( auto series, bool isVisible ) {
auto setLegendVisibility = [this]( auto series, bool isVisible )
{
if ( series )
{
auto markers = m_plotWidget->qtChart()->legend()->markers( series );

View File

@@ -307,7 +307,8 @@ void RiuQtChartsPlotWidget::setInternalLegendVisible( bool visible )
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::insertLegend( RiuPlotWidget::Legend legendPosition )
{
auto mapLegendPosition = []( RiuPlotWidget::Legend pos ) {
auto mapLegendPosition = []( RiuPlotWidget::Legend pos )
{
if ( pos == RiuPlotWidget::Legend::BOTTOM )
return Qt::AlignBottom;
else if ( pos == RiuPlotWidget::Legend::TOP )
@@ -860,7 +861,8 @@ void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve,
auto series,
auto xAxis,
auto yAxis,
RiuQtChartsPlotCurve* qtChartsPlotCurve ) {
RiuQtChartsPlotCurve* qtChartsPlotCurve )
{
if ( !series->chart() )
{
curveSeriesMap[plotCurve] = series;

View File

@@ -1450,7 +1450,8 @@ void RiuQwtPlotWidget::onMouseMoveEvent( QMouseEvent* event )
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::moveAxis( RiuPlotAxis oldAxis, RiuPlotAxis newAxis )
{
auto countAxis = [this]( RiaDefines::PlotAxis axis ) {
auto countAxis = [this]( RiaDefines::PlotAxis axis )
{
int count = 0;
for ( auto [plotAxis, qwtMapping] : m_axisMapping )
{
@@ -1459,12 +1460,14 @@ void RiuQwtPlotWidget::moveAxis( RiuPlotAxis oldAxis, RiuPlotAxis newAxis )
return count;
};
auto isLastItem = [this]( RiuPlotAxis plotAxis, int count ) {
auto isLastItem = [this]( RiuPlotAxis plotAxis, int count )
{
auto qwtAxis = toQwtPlotAxis( plotAxis );
return qwtAxis.id == ( count - 1 );
};
auto removeAxis = [this, countAxis, isLastItem]( RiuPlotAxis plotAxis ) {
auto removeAxis = [this, countAxis, isLastItem]( RiuPlotAxis plotAxis )
{
auto qwtAxisPos = RiuQwtPlotTools::toQwtPlotAxisEnum( plotAxis.axis() );
int count = countAxis( plotAxis.axis() );

View File

@@ -167,10 +167,8 @@ void RiuSummaryPlot::showContextMenu( QPoint pos )
ensemble->parameterCorrelations( clickedEnsembleCurveSet->summaryAddress(), timeStep );
std::sort( ensembleParameters.begin(),
ensembleParameters.end(),
[]( const std::pair<RigEnsembleParameter, double>& lhs,
const std::pair<RigEnsembleParameter, double>& rhs ) {
return std::fabs( lhs.second ) > std::fabs( rhs.second );
} );
[]( const std::pair<RigEnsembleParameter, double>& lhs, const std::pair<RigEnsembleParameter, double>& rhs )
{ return std::fabs( lhs.second ) > std::fabs( rhs.second ); } );
for ( const auto& param : ensembleParameters )
{

View File

@@ -39,7 +39,10 @@ void RiuTools::enableAllActionsOnShow( QObject* object, QMenu* menu )
{
if ( object && menu )
{
object->connect( menu, &QMenu::aboutToShow, [menu]() {
object->connect( menu,
&QMenu::aboutToShow,
[menu]()
{
for ( auto act : menu->actions() )
act->setEnabled( true );
} );

View File

@@ -152,10 +152,10 @@ void RiuWellPathComponentPlotItem::calculateColumnOffsets( const RimWellPathComp
const RimWellPathAttribute* myAttribute = dynamic_cast<const RimWellPathAttribute*>( component );
if ( myAttribute && myAttribute->componentType() == RiaDefines::WellPathComponentType::CASING )
{
int nNarrowerCasings =
std::count_if( uniqueCasingDiameters.begin(), uniqueCasingDiameters.end(), [myAttribute]( double otherCasingDiameter ) {
return otherCasingDiameter < myAttribute->diameterInInches();
} );
int nNarrowerCasings = std::count_if( uniqueCasingDiameters.begin(),
uniqueCasingDiameters.end(),
[myAttribute]( double otherCasingDiameter )
{ return otherCasingDiameter < myAttribute->diameterInInches(); } );
m_columnOffset = nNarrowerCasings * 0.25;
}

View File

@@ -71,6 +71,9 @@ SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 0
Maximum: -1
SpacesInParentheses: true
SpacesInSquareBrackets: false
Standard: Cpp11

View File

@@ -1,79 +0,0 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
JavaScriptQuotes: Leave
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
PenaltyBreakAssignment: 13
PenaltyBreakBeforeFirstCallParameter: 10000
PenaltyBreakComment: 20
PenaltyBreakFirstLessLess: 12
PenaltyBreakString: 100
PenaltyExcessCharacter: 5
PenaltyReturnTypeOnItsOwnLine: 30
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: true
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...

View File

@@ -68,7 +68,8 @@ QString caf::PdmMarkdownBuilder::generateDocDataModelObjects( std::vector<std::s
// Sort to make sure super classes get created before sub classes
std::sort( dataModelObjects.begin(),
dataModelObjects.end(),
[]( std::shared_ptr<const PdmObject> lhs, std::shared_ptr<const PdmObject> rhs ) {
[]( std::shared_ptr<const PdmObject> lhs, std::shared_ptr<const PdmObject> rhs )
{
auto lhsStack = lhs->classInheritanceStack();
auto rhsStack = rhs->classInheritanceStack();

View File

@@ -81,7 +81,10 @@ QString caf::PdmPythonGenerator::generate( PdmObjectFactory* factory, std::vecto
}
// Sort to make sure super classes get created before sub classes
std::sort( dummyObjects.begin(), dummyObjects.end(), []( std::shared_ptr<PdmObject> lhs, std::shared_ptr<PdmObject> rhs ) {
std::sort( dummyObjects.begin(),
dummyObjects.end(),
[]( std::shared_ptr<PdmObject> lhs, std::shared_ptr<PdmObject> rhs )
{
if ( lhs->inheritsClassWithKeyword( rhs->classKeyword() ) )
{
return false;

View File

@@ -62,7 +62,8 @@ template <typename PdmObjectType>
void AsyncPdmObjectVectorDeleter<PdmObjectType>::start()
{
std::thread thread(
[]( std::vector<PdmObjectHandle*>&& pointerVector ) {
[]( std::vector<PdmObjectHandle*>&& pointerVector )
{
for ( PdmObjectHandle* pointerToDelete : pointerVector )
{
delete pointerToDelete;

View File

@@ -123,7 +123,8 @@ public:
template <typename ClassType>
void connect( ClassType* observer, void ( ClassType::*method )( const SignalEmitter*, Args... args ) )
{
MemberCallback lambda = [=]( const SignalEmitter* emitter, Args... args ) {
MemberCallback lambda = [=]( const SignalEmitter* emitter, Args... args )
{
// Call method
( observer->*method )( emitter, args... );
};

View File

@@ -61,7 +61,10 @@ public: \
/// editor factory Place this in the cpp file, preferably above the constructor
#define CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT( EditorClassName ) \
QString EditorClassName::uiEditorTypeName() { return #EditorClassName; } \
QString EditorClassName::uiEditorTypeName() \
{ \
return #EditorClassName; \
} \
CAF_FACTORY_REGISTER( caf::PdmUi3dObjectEditorHandle, EditorClassName, QString, EditorClassName::uiEditorTypeName() )
//==================================================================================================

View File

@@ -65,7 +65,10 @@ public: \
/// factory Place this in the cpp file, preferably above the constructor
#define CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT( EditorClassName ) \
QString EditorClassName::uiEditorTypeName() { return #EditorClassName; } \
QString EditorClassName::uiEditorTypeName() \
{ \
return #EditorClassName; \
} \
CAF_FACTORY_REGISTER( caf::PdmUiFieldEditorHandle, EditorClassName, QString, EditorClassName::uiEditorTypeName() )
/// CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR registers what default editor to use with a field of a certain type

View File

@@ -40,8 +40,14 @@ public:
return false; \
} \
\
QString ClassName::classKeyword() const { return classKeywordStatic(); } \
QString ClassName::classKeywordStatic() { return classKeywordAliases().front(); } \
QString ClassName::classKeyword() const \
{ \
return classKeywordStatic(); \
} \
QString ClassName::classKeywordStatic() \
{ \
return classKeywordAliases().front(); \
} \
std::vector<QString> ClassName::classKeywordAliases() \
{ \
CAF_PDM_VERIFY_XML_KEYWORD( keyword ) \

View File

@@ -1,90 +0,0 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 130
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
JavaScriptQuotes: Leave
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...

View File

@@ -74,7 +74,9 @@ CustomObjectEditor::CustomObjectEditor()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
CustomObjectEditor::~CustomObjectEditor() {}
CustomObjectEditor::~CustomObjectEditor()
{
}
//--------------------------------------------------------------------------------------------------
///
@@ -88,16 +90,12 @@ void CustomObjectEditor::defineGridLayout(int rowCount, int columnCount)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void CustomObjectEditor::addWidget(QWidget* widget,
int row,
int column,
int rowSpan,
int columnSpan,
Qt::Alignment alignment /*= 0*/)
void CustomObjectEditor::addWidget( QWidget* widget, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment /*= 0*/ )
{
CAF_ASSERT( isAreaAvailable( row, column, rowSpan, columnSpan ) );
m_customWidgetAreas.push_back(WidgetCellIds(widget, CustomObjectEditor::cellIds(row, column, rowSpan, columnSpan)));
m_customWidgetAreas.push_back(
WidgetCellIds( widget, CustomObjectEditor::cellIds( row, column, rowSpan, columnSpan ) ) );
// The ownership of item is transferred to the layout, and it's the layout's responsibility to delete it.
m_layout->addWidget( widget, row, column, rowSpan, columnSpan, alignment );

View File

@@ -22,10 +22,10 @@ LineEditAndPushButtons::LineEditAndPushButtons()
CAF_PDM_InitFieldNoDefault( &m_labelField, "LabelField", "Medium length text in label", "", "", "" );
m_labelField.uiCapability()->setUiEditorTypeName( caf::PdmUiLabelEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault(
&m_labelLongTextField,
CAF_PDM_InitFieldNoDefault( &m_labelLongTextField,
"LongTextField",
"Long length text in label length text in label length text in label length text in label length text in label",
"Long length text in label length text in label length text in label length text in "
"label length text in label",
"",
"",
"" );
@@ -111,7 +111,9 @@ void LineEditAndPushButtons::fieldChangedByUi(const caf::PdmFieldHandle* changed
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void LineEditAndPushButtons::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) {}
void LineEditAndPushButtons::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
}
//--------------------------------------------------------------------------------------------------
///

Some files were not shown because too many files have changed in this diff Show More