#4683 clang-format on all files in ApplicationCode

This commit is contained in:
Magne Sjaastad
2019-09-06 10:40:57 +02:00
parent 3a317504bb
commit fe9e567825
2092 changed files with 117952 additions and 111846 deletions

View File

@@ -3,17 +3,17 @@
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -36,40 +36,44 @@
namespace caf
{
template<>
void AppEnum< RimCellEdgeColors::PropertyType >::setUp()
{
addItem(RimCellEdgeColors::MULTI_AXIS_STATIC_PROPERTY, "MULTI_AXIS_STATIC_PROPERTY", "Multi Axis Static Property");
addItem(RimCellEdgeColors::ANY_SINGLE_PROPERTY, "ANY_SINGLE_PROPERTY", "Any Single Property");
setDefault(RimCellEdgeColors::MULTI_AXIS_STATIC_PROPERTY);
}
template <>
void AppEnum<RimCellEdgeColors::PropertyType>::setUp()
{
addItem( RimCellEdgeColors::MULTI_AXIS_STATIC_PROPERTY, "MULTI_AXIS_STATIC_PROPERTY", "Multi Axis Static Property" );
addItem( RimCellEdgeColors::ANY_SINGLE_PROPERTY, "ANY_SINGLE_PROPERTY", "Any Single Property" );
setDefault( RimCellEdgeColors::MULTI_AXIS_STATIC_PROPERTY );
}
} // namespace caf
CAF_PDM_SOURCE_INIT(RimCellEdgeColors, "CellEdgeResultSlot");
CAF_PDM_SOURCE_INIT( RimCellEdgeColors, "CellEdgeResultSlot" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimCellEdgeColors::RimCellEdgeColors()
{
CAF_PDM_InitObject("Cell Edge Result", ":/EdgeResult_1.png", "", "");
CAF_PDM_InitObject( "Cell Edge Result", ":/EdgeResult_1.png", "", "" );
CAF_PDM_InitField(&m_enableCellEdgeColors, "EnableCellEdgeColors", true, "Enable Cell Edge Results", "", "", "");
CAF_PDM_InitField( &m_enableCellEdgeColors, "EnableCellEdgeColors", true, "Enable Cell Edge Results", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_propertyType, "propertyType", "Property Type", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_propertyType, "propertyType", "Property Type", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_resultVariable, "CellEdgeVariable", "Result property", "", "", "");
CAF_PDM_InitField(&useXVariable, "UseXVariable", true, "Use X Values", "", "", "");
CAF_PDM_InitField(&useYVariable, "UseYVariable", true, "Use Y Values", "", "", "");
CAF_PDM_InitField(&useZVariable, "UseZVariable", true, "Use Z Values", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_resultVariable, "CellEdgeVariable", "Result property", "", "", "" );
CAF_PDM_InitField( &useXVariable, "UseXVariable", true, "Use X Values", "", "", "" );
CAF_PDM_InitField( &useYVariable, "UseYVariable", true, "Use Y Values", "", "", "" );
CAF_PDM_InitField( &useZVariable, "UseZVariable", true, "Use Z Values", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_legendConfig, "LegendDefinition", "Color Legend", ":/Legend.png", "", "");
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", ":/Legend.png", "", "" );
CAF_PDM_InitFieldNoDefault(&m_singleVarEdgeResultColors, "SingleVarEdgeResult", "Result Property", ":/CellResult.png", "", "");
CAF_PDM_InitFieldNoDefault( &m_singleVarEdgeResultColors,
"SingleVarEdgeResult",
"Result Property",
":/CellResult.png",
"",
"" );
m_singleVarEdgeResultColors = new RimEclipseCellColors();
m_resultVariable.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
m_resultVariable.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
m_legendConfig = new RimRegularLegendConfig();
@@ -78,37 +82,37 @@ RimCellEdgeColors::RimCellEdgeColors()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimCellEdgeColors::~RimCellEdgeColors()
{
}
RimCellEdgeColors::~RimCellEdgeColors() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::setReservoirView(RimEclipseView* ownerReservoirView)
void RimCellEdgeColors::setReservoirView( RimEclipseView* ownerReservoirView )
{
m_reservoirView = ownerReservoirView;
m_singleVarEdgeResultColors->setReservoirView(ownerReservoirView);
m_singleVarEdgeResultColors->setReservoirView( ownerReservoirView );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::loadResult()
{
if (!m_enableCellEdgeColors) return;
if (!m_reservoirView->currentGridCellResults()) return;
if ( !m_enableCellEdgeColors ) return;
if ( !m_reservoirView->currentGridCellResults() ) return;
if (isUsingSingleVariable())
if ( isUsingSingleVariable() )
{
m_singleVarEdgeResultColors->loadResult();;
m_singleVarEdgeResultColors->loadResult();
;
RigEclipseResultAddress resultAddr = m_singleVarEdgeResultColors->eclipseResultAddress();
for (int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
for ( int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx )
{
m_resultNameToAddressPairs[cubeFaceIdx] = std::make_pair(m_singleVarEdgeResultColors->resultVariable(), resultAddr);
m_resultNameToAddressPairs[cubeFaceIdx] = std::make_pair( m_singleVarEdgeResultColors->resultVariable(),
resultAddr );
}
}
else
@@ -118,24 +122,26 @@ void RimCellEdgeColors::loadResult()
updateIgnoredScalarValue();
int i;
for (i = 0; i < vars.size(); ++i)
for ( i = 0; i < vars.size(); ++i )
{
m_reservoirView->currentGridCellResults()->ensureKnownResultLoaded(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, vars[i]));
int cubeFaceIdx;
for (cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
{
if ( ((cubeFaceIdx == 0 || cubeFaceIdx == 1) && useXVariable())
|| ((cubeFaceIdx == 2 || cubeFaceIdx == 3) && useYVariable())
|| ((cubeFaceIdx == 4 || cubeFaceIdx == 5) && useZVariable()))
{
QString varEnd = EdgeFaceEnum::textFromIndex(cubeFaceIdx);
m_reservoirView->currentGridCellResults()->ensureKnownResultLoaded(
RigEclipseResultAddress( RiaDefines::STATIC_NATIVE, vars[i] ) );
int cubeFaceIdx;
for ( cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx )
{
if ( ( ( cubeFaceIdx == 0 || cubeFaceIdx == 1 ) && useXVariable() ) ||
( ( cubeFaceIdx == 2 || cubeFaceIdx == 3 ) && useYVariable() ) ||
( ( cubeFaceIdx == 4 || cubeFaceIdx == 5 ) && useZVariable() ) )
{
QString varEnd = EdgeFaceEnum::textFromIndex( cubeFaceIdx );
if (vars[i].endsWith(varEnd))
{
m_resultNameToAddressPairs[cubeFaceIdx] = std::make_pair(vars[i], RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, vars[i]));
}
}
}
if ( vars[i].endsWith( varEnd ) )
{
m_resultNameToAddressPairs[cubeFaceIdx] =
std::make_pair( vars[i], RigEclipseResultAddress( RiaDefines::STATIC_NATIVE, vars[i] ) );
}
}
}
}
}
@@ -143,7 +149,7 @@ void RimCellEdgeColors::loadResult()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::initAfterRead()
{
@@ -152,15 +158,17 @@ void RimCellEdgeColors::initAfterRead()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
void RimCellEdgeColors::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
loadResult();
if (m_reservoirView) m_reservoirView->createDisplayModelAndRedraw();
if ( m_reservoirView ) m_reservoirView->createDisplayModelAndRedraw();
if (changedField == objectToggleField())
if ( changedField == objectToggleField() )
{
updateUiIconFromToggleField();
}
@@ -168,89 +176,88 @@ void RimCellEdgeColors::fieldChangedByUi(const caf::PdmFieldHandle* changedField
namespace caf
{
template<>
void RimCellEdgeColors::EdgeFaceEnum::setUp()
{
addItem(RimCellEdgeColors::X, "X", "");
addItem(RimCellEdgeColors::NEG_X, "X-", "");
addItem(RimCellEdgeColors::Y, "Y", "");
addItem(RimCellEdgeColors::NEG_Y, "Y-", "");
addItem(RimCellEdgeColors::Z, "Z", "");
addItem(RimCellEdgeColors::NEG_Z, "Z-", "");
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
template <>
void RimCellEdgeColors::EdgeFaceEnum::setUp()
{
if (fieldNeedingOptions == &m_resultVariable)
addItem( RimCellEdgeColors::X, "X", "" );
addItem( RimCellEdgeColors::NEG_X, "X-", "" );
addItem( RimCellEdgeColors::Y, "Y", "" );
addItem( RimCellEdgeColors::NEG_Y, "Y-", "" );
addItem( RimCellEdgeColors::Z, "Z", "" );
addItem( RimCellEdgeColors::NEG_Z, "Z-", "" );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
if ( fieldNeedingOptions == &m_resultVariable )
{
if (m_reservoirView && m_reservoirView->currentGridCellResults())
if ( m_reservoirView && m_reservoirView->currentGridCellResults() )
{
QStringList varList;
varList = m_reservoirView->currentGridCellResults()->resultNames(RiaDefines::STATIC_NATIVE);
varList = m_reservoirView->currentGridCellResults()->resultNames( RiaDefines::STATIC_NATIVE );
//TODO: Must also handle input properties
//varList += m_reservoirView->gridCellResults()->resultNames(RiaDefines::INPUT_PROPERTY);
// TODO: Must also handle input properties
// varList += m_reservoirView->gridCellResults()->resultNames(RiaDefines::INPUT_PROPERTY);
QList<caf::PdmOptionItemInfo> options;
std::map<QString, std::array<QString, 6> > varBaseNameToVarsMap;
std::map<QString, std::array<QString, 6>> varBaseNameToVarsMap;
int i;
for (i = 0; i < varList.size(); ++i)
for ( i = 0; i < varList.size(); ++i )
{
if (RiaDefines::isPerCellFaceResult(varList[i])) continue;
if ( RiaDefines::isPerCellFaceResult( varList[i] ) ) continue;
size_t cubeFaceIdx;
for (cubeFaceIdx = 0; cubeFaceIdx < EdgeFaceEnum::size(); ++cubeFaceIdx)
for ( cubeFaceIdx = 0; cubeFaceIdx < EdgeFaceEnum::size(); ++cubeFaceIdx )
{
QString varEnd = EdgeFaceEnum::textFromIndex(cubeFaceIdx);
if (varList[i].endsWith(varEnd))
QString varEnd = EdgeFaceEnum::textFromIndex( cubeFaceIdx );
if ( varList[i].endsWith( varEnd ) )
{
QStringList splits = varList[i].split(varEnd);
QString variableBasename = splits.front();
QStringList splits = varList[i].split( varEnd );
QString variableBasename = splits.front();
varBaseNameToVarsMap[variableBasename][cubeFaceIdx] = varList[i];
}
}
}
std::map<QString, std::array<QString, 6> >::iterator it;
std::map<QString, std::array<QString, 6>>::iterator it;
for (it = varBaseNameToVarsMap.begin(); it != varBaseNameToVarsMap.end(); ++it)
for ( it = varBaseNameToVarsMap.begin(); it != varBaseNameToVarsMap.end(); ++it )
{
QString optionUiName = it->first;
optionUiName += " (";
int cubeFaceIdx;
int cubeFaceIdx;
bool firstText = true;
for (cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
for ( cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx )
{
if (!it->second[cubeFaceIdx].isEmpty())
if ( !it->second[cubeFaceIdx].isEmpty() )
{
if (firstText)
if ( firstText )
{
optionUiName += it->second[cubeFaceIdx];
firstText = false;
}
else
{
optionUiName += QString(", ") + it->second[cubeFaceIdx];
optionUiName += QString( ", " ) + it->second[cubeFaceIdx];
}
}
}
optionUiName += ")";
options.push_back(caf::PdmOptionItemInfo( optionUiName, QVariant(it->first)));
options.push_back( caf::PdmOptionItemInfo( optionUiName, QVariant( it->first ) ) );
}
options.push_front(caf::PdmOptionItemInfo(RiaDefines::undefinedResultName(), ""));
if (useOptionsOnly) *useOptionsOnly = true;
options.push_front( caf::PdmOptionItemInfo( RiaDefines::undefinedResultName(), "" ) );
if ( useOptionsOnly ) *useOptionsOnly = true;
return options;
}
@@ -260,171 +267,168 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimCellEdgeColors::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add(&m_propertyType);
uiOrdering.add( &m_propertyType );
if (isUsingSingleVariable())
if ( isUsingSingleVariable() )
{
m_singleVarEdgeResultColors->uiOrdering(uiConfigName,uiOrdering );
m_singleVarEdgeResultColors->uiOrdering( uiConfigName, uiOrdering );
}
else
{
uiOrdering.add(&m_resultVariable);
uiOrdering.add( &m_resultVariable );
uiOrdering.add(&useXVariable);
uiOrdering.add(&useYVariable);
uiOrdering.add(&useZVariable);
uiOrdering.add( &useXVariable );
uiOrdering.add( &useYVariable );
uiOrdering.add( &useZVariable );
}
uiOrdering.skipRemainingFields(true);
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
void RimCellEdgeColors::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
{
uiTreeOrdering.add(legendConfig());
uiTreeOrdering.skipRemainingChildren(true);
uiTreeOrdering.add( legendConfig() );
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QStringList RimCellEdgeColors::findResultVariableNames()
{
QStringList varNames;
if (m_reservoirView && m_reservoirView->currentGridCellResults() && !m_resultVariable().isEmpty())
if ( m_reservoirView && m_reservoirView->currentGridCellResults() && !m_resultVariable().isEmpty() )
{
QStringList varList;
varList = m_reservoirView->currentGridCellResults()->resultNames(RiaDefines::STATIC_NATIVE);
//TODO: Must handle Input properties
varList = m_reservoirView->currentGridCellResults()->resultNames( RiaDefines::STATIC_NATIVE );
// TODO: Must handle Input properties
int i;
for (i = 0; i < varList.size(); ++i)
for ( i = 0; i < varList.size(); ++i )
{
if (RiaDefines::isPerCellFaceResult(varList[i])) continue;
if ( RiaDefines::isPerCellFaceResult( varList[i] ) ) continue;
if (varList[i].startsWith(m_resultVariable))
{
varNames.append(varList[i]);
if ( varList[i].startsWith( m_resultVariable ) )
{
varNames.append( varList[i] );
}
}
}
return varNames;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::gridScalarIndices(RigEclipseResultAddress resultIndices[6])
void RimCellEdgeColors::gridScalarIndices( RigEclipseResultAddress resultIndices[6] )
{
int cubeFaceIndex;
for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex)
for ( cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex )
{
resultIndices[cubeFaceIndex] = RigEclipseResultAddress(m_resultNameToAddressPairs[cubeFaceIndex].second);
resultIndices[cubeFaceIndex] = RigEclipseResultAddress( m_resultNameToAddressPairs[cubeFaceIndex].second );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::gridScalarResultNames(std::vector<QString>* resultNames)
void RimCellEdgeColors::gridScalarResultNames( std::vector<QString>* resultNames )
{
CVF_ASSERT(resultNames);
CVF_ASSERT( resultNames );
int cubeFaceIndex;
for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex)
for ( cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex )
{
resultNames->push_back(m_resultNameToAddressPairs[cubeFaceIndex].first);
resultNames->push_back( m_resultNameToAddressPairs[cubeFaceIndex].first );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimCellEdgeColors::isUsingSingleVariable() const
{
return (m_propertyType == ANY_SINGLE_PROPERTY);
return ( m_propertyType == ANY_SINGLE_PROPERTY );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::cellEdgeMetaData(std::vector<RimCellEdgeMetaData>* metaDataVector)
void RimCellEdgeColors::cellEdgeMetaData( std::vector<RimCellEdgeMetaData>* metaDataVector )
{
CVF_ASSERT(metaDataVector);
CVF_ASSERT( metaDataVector );
RigEclipseResultAddress resultIndices[6];
this->gridScalarIndices(resultIndices);
this->gridScalarIndices( resultIndices );
std::vector<QString> resultNames;
this->gridScalarResultNames(&resultNames);
this->gridScalarResultNames( &resultNames );
bool isStatic = true;
if (isUsingSingleVariable())
if ( isUsingSingleVariable() )
{
isStatic = m_singleVarEdgeResultColors->resultType() == RiaDefines::STATIC_NATIVE;
}
for (size_t i = 0; i < 6; i++)
for ( size_t i = 0; i < 6; i++ )
{
RimCellEdgeMetaData metaData;
metaData.m_eclipseResultAddress = resultIndices[i];
metaData.m_resultVariable = resultNames[i];
metaData.m_isStatic = isStatic;
metaData.m_resultVariable = resultNames[i];
metaData.m_isStatic = isStatic;
metaDataVector->push_back(metaData);
metaDataVector->push_back( metaData );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::resetResultAddresses()
{
int cubeFaceIndex;
for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex)
for ( cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex )
{
m_resultNameToAddressPairs[cubeFaceIndex].second = RigEclipseResultAddress();
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimCellEdgeColors::hasResult() const
{
if (!m_enableCellEdgeColors()) return false;
if ( !m_enableCellEdgeColors() ) return false;
if (isUsingSingleVariable() && m_singleVarEdgeResultColors->isFlowDiagOrInjectionFlooding())
if ( isUsingSingleVariable() && m_singleVarEdgeResultColors->isFlowDiagOrInjectionFlooding() )
{
return true;
}
bool hasResult = false;
int cubeFaceIndex;
for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex)
int cubeFaceIndex;
for ( cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex )
{
hasResult |= m_resultNameToAddressPairs[cubeFaceIndex].second.isValid();
hasResult |= m_resultNameToAddressPairs[cubeFaceIndex].second.isValid();
}
return hasResult;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::updateIgnoredScalarValue()
{
if (m_resultVariable == "MULT" || m_resultVariable == "riMULT")
if ( m_resultVariable == "MULT" || m_resultVariable == "riMULT" )
{
m_ignoredResultScalar = 1.0;
}
@@ -435,41 +439,43 @@ void RimCellEdgeColors::updateIgnoredScalarValue()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::minMaxCellEdgeValues(double& min, double& max)
void RimCellEdgeColors::minMaxCellEdgeValues( double& min, double& max )
{
double globalMin, globalMax;
globalMin = HUGE_VAL;
globalMax = -HUGE_VAL;
if (m_reservoirView->currentGridCellResults())
if ( m_reservoirView->currentGridCellResults() )
{
if (isUsingSingleVariable() && singleVarEdgeResultColors()->isFlowDiagOrInjectionFlooding())
if ( isUsingSingleVariable() && singleVarEdgeResultColors()->isFlowDiagOrInjectionFlooding() )
{
int currentTimeStep = m_reservoirView->currentTimeStep();
RigFlowDiagResults* fldResults = singleVarEdgeResultColors()->flowDiagSolution()->flowDiagResults();
RigFlowDiagResultAddress resAddr = singleVarEdgeResultColors()->flowDiagResAddress();
fldResults->minMaxScalarValues(resAddr, currentTimeStep, &globalMin, &globalMax);
fldResults->minMaxScalarValues( resAddr, currentTimeStep, &globalMin, &globalMax );
}
else
{
RigEclipseResultAddress resultAddresses[6];
this->gridScalarIndices(resultAddresses);
this->gridScalarIndices( resultAddresses );
size_t faceIdx;
for (faceIdx = 0; faceIdx < 6; faceIdx++)
for ( faceIdx = 0; faceIdx < 6; faceIdx++ )
{
if (!resultAddresses[faceIdx].isValid()) continue;
if ( !resultAddresses[faceIdx].isValid() ) continue;
{
double cMin, cMax;
m_reservoirView->currentGridCellResults()->minMaxCellScalarValues(resultAddresses[faceIdx], cMin, cMax);
m_reservoirView->currentGridCellResults()->minMaxCellScalarValues( resultAddresses[faceIdx],
cMin,
cMax );
globalMin = CVF_MIN(globalMin, cMin);
globalMax = CVF_MAX(globalMax, cMax);
globalMin = CVF_MIN( globalMin, cMin );
globalMax = CVF_MAX( globalMax, cMax );
}
}
}
@@ -480,33 +486,33 @@ void RimCellEdgeColors::minMaxCellEdgeValues(double& min, double& max)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::posNegClosestToZero(double& pos, double& neg)
void RimCellEdgeColors::posNegClosestToZero( double& pos, double& neg )
{
pos = HUGE_VAL;
neg = -HUGE_VAL;
RigEclipseResultAddress resultAddresses[6];
this->gridScalarIndices(resultAddresses);
this->gridScalarIndices( resultAddresses );
size_t faceIdx;
for (faceIdx = 0; faceIdx < 6; faceIdx++)
for ( faceIdx = 0; faceIdx < 6; faceIdx++ )
{
if (!resultAddresses[faceIdx].isValid()) continue;
if ( !resultAddresses[faceIdx].isValid() ) continue;
{
double localPos, localNeg;
m_reservoirView->currentGridCellResults()->posNegClosestToZero(resultAddresses[faceIdx], localPos, localNeg);
m_reservoirView->currentGridCellResults()->posNegClosestToZero( resultAddresses[faceIdx], localPos, localNeg );
if (localPos > 0 && localPos < pos) pos = localPos;
if (localNeg < 0 && localNeg > neg) neg = localNeg;
if ( localPos > 0 && localPos < pos ) pos = localPos;
if ( localNeg < 0 && localNeg > neg ) neg = localNeg;
}
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::updateUiFieldsFromActiveResult()
{
@@ -514,27 +520,27 @@ void RimCellEdgeColors::updateUiFieldsFromActiveResult()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::setEclipseCase(RimEclipseCase* eclipseCase)
void RimCellEdgeColors::setEclipseCase( RimEclipseCase* eclipseCase )
{
m_singleVarEdgeResultColors->setEclipseCase(eclipseCase);
m_singleVarEdgeResultColors->setEclipseCase( eclipseCase );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::setResultVariable(const QString& variableName)
void RimCellEdgeColors::setResultVariable( const QString& variableName )
{
m_resultVariable = variableName;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimCellEdgeColors::resultVariable() const
{
if (isUsingSingleVariable())
if ( isUsingSingleVariable() )
{
return m_singleVarEdgeResultColors->resultVariable();
}
@@ -545,11 +551,11 @@ QString RimCellEdgeColors::resultVariable() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimCellEdgeColors::resultVariableUiName() const
{
if (isUsingSingleVariable())
if ( isUsingSingleVariable() )
{
return m_singleVarEdgeResultColors->resultVariableUiName();
}
@@ -560,11 +566,11 @@ QString RimCellEdgeColors::resultVariableUiName() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimCellEdgeColors::resultVariableUiShortName() const
{
if (isUsingSingleVariable())
if ( isUsingSingleVariable() )
{
return m_singleVarEdgeResultColors->resultVariableUiShortName();
}
@@ -575,31 +581,31 @@ QString RimCellEdgeColors::resultVariableUiShortName() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::setActive(bool active)
void RimCellEdgeColors::setActive( bool active )
{
m_enableCellEdgeColors = active;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimCellEdgeColors::objectToggleField()
{
return &m_enableCellEdgeColors;
return &m_enableCellEdgeColors;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimCellEdgeColors::hasCategoryResult() const
{
return isUsingSingleVariable() && m_singleVarEdgeResultColors->hasCategoryResult();
return isUsingSingleVariable() && m_singleVarEdgeResultColors->hasCategoryResult();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimEclipseCellColors* RimCellEdgeColors::singleVarEdgeResultColors()
{
@@ -607,11 +613,11 @@ RimEclipseCellColors* RimCellEdgeColors::singleVarEdgeResultColors()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimRegularLegendConfig* RimCellEdgeColors::legendConfig()
{
if (isUsingSingleVariable())
if ( isUsingSingleVariable() )
{
return m_singleVarEdgeResultColors->legendConfig();
}
@@ -622,10 +628,9 @@ RimRegularLegendConfig* RimCellEdgeColors::legendConfig()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimCellEdgeColors::PropertyType RimCellEdgeColors::propertyType() const
{
return m_propertyType();
}