Whitespace

This commit is contained in:
Magne Sjaastad
2019-02-18 10:55:35 +01:00
parent f9021117f4
commit fdf3313320
3 changed files with 125 additions and 119 deletions

View File

@@ -45,18 +45,16 @@
#include <cmath> // Needed for HUGE_VAL on Linux
namespace caf
{ // Obsolete stuff
template<>
void caf::AppEnum< RimEclipsePropertyFilter::EvaluationRegionType>::setUp()
{
addItem(RimEclipsePropertyFilter::RANGE_FILTER_REGION, "RANGE_FILTER_REGION", "Range filter cells");
addItem(RimEclipsePropertyFilter::GLOBAL_REGION, "GLOBAL_REGION", "All cells");
setDefault(RimEclipsePropertyFilter::RANGE_FILTER_REGION);
}
template<>
void caf::AppEnum<RimEclipsePropertyFilter::EvaluationRegionType>::setUp()
{
addItem(RimEclipsePropertyFilter::RANGE_FILTER_REGION, "RANGE_FILTER_REGION", "Range filter cells");
addItem(RimEclipsePropertyFilter::GLOBAL_REGION, "GLOBAL_REGION", "All cells");
setDefault(RimEclipsePropertyFilter::RANGE_FILTER_REGION);
}
} // namespace caf
CAF_PDM_SOURCE_INIT(RimEclipsePropertyFilter, "CellPropertyFilter");
@@ -131,8 +129,11 @@ bool RimEclipsePropertyFilter::isCategorySelectionActive() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
// clang-format off
if ( &m_lowerBound == changedField
|| &m_upperBound == changedField
|| &obsoleteField_evaluationRegion == changedField
@@ -149,6 +150,7 @@ void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* chang
parentContainer()->updateDisplayModelNotifyManagedViews(this);
}
// clang-format on
}
//--------------------------------------------------------------------------------------------------
@@ -175,7 +177,7 @@ void RimEclipsePropertyFilter::setToDefaultValues()
m_upperBound = m_maximumResultValue;
m_selectedCategoryValues = m_categoryValues;
m_useCategorySelection = true;
m_useCategorySelection = true;
}
//--------------------------------------------------------------------------------------------------
@@ -202,7 +204,7 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
group2.add(&m_useCategorySelection);
}
if ( resultDefinition->hasCategoryResult() && m_useCategorySelection() )
if (resultDefinition->hasCategoryResult() && m_useCategorySelection())
{
group2.add(&m_selectedCategoryValues);
}
@@ -300,7 +302,7 @@ void RimEclipsePropertyFilter::setCategoriesFromTracerNames(const std::vector<QS
tracerNameSet.insert(std::make_pair(tracerNames[i], static_cast<int>(i)));
}
for (auto it : tracerNameSet)
for (const auto& it : tracerNameSet)
{
tracerNameValuesSorted.push_back(it);
}
@@ -320,7 +322,9 @@ void RimEclipsePropertyFilter::updateActiveState()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
void RimEclipsePropertyFilter::defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute)
{
if (m_minimumResultValue == cvf::UNDEFINED_DOUBLE || m_maximumResultValue == cvf::UNDEFINED_DOUBLE)
{
@@ -360,12 +364,12 @@ void RimEclipsePropertyFilter::computeResultValueRange()
int timeStep = 0;
if (view) timeStep = view->currentTimeStep();
RigFlowDiagResultAddress resAddr = resultDefinition->flowDiagResAddress();
if ( resultDefinition->flowDiagSolution() )
if (resultDefinition->flowDiagSolution())
{
RigFlowDiagResults* results = resultDefinition->flowDiagSolution()->flowDiagResults();
results->minMaxScalarValues(resAddr, timeStep, &min, &max);
if ( resultDefinition->hasCategoryResult() )
if (resultDefinition->hasCategoryResult())
{
setCategoriesFromTracerNames(resultDefinition->flowDiagSolution()->tracerNames());
}
@@ -374,34 +378,37 @@ void RimEclipsePropertyFilter::computeResultValueRange()
else
{
RigEclipseResultAddress scalarIndex = resultDefinition->eclipseResultAddress();
if ( scalarIndex.isValid() )
if (scalarIndex.isValid())
{
RigCaseCellResultsData* results = resultDefinition->currentGridCellResults();
if ( results )
if (results)
{
results->minMaxCellScalarValues(scalarIndex, min, max);
if ( resultDefinition->hasCategoryResult() )
if (resultDefinition->hasCategoryResult())
{
if ( resultDefinition->resultType() == RiaDefines::FORMATION_NAMES )
if (resultDefinition->resultType() == RiaDefines::FORMATION_NAMES)
{
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->eclipseCaseData());
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->eclipseCaseData()->activeFormationNames());
const std::vector<QString>& fnVector = parentContainer()->reservoirView()->eclipseCase()->eclipseCaseData()->activeFormationNames()->formationNames();
const std::vector<QString>& fnVector = parentContainer()
->reservoirView()
->eclipseCase()
->eclipseCaseData()
->activeFormationNames()
->formationNames();
setCategoryNames(fnVector);
}
else if (resultDefinition->resultVariable() == RiaDefines::completionTypeResultName())
{
std::vector<RiaDefines::WellPathComponentType> componentTypes =
{
RiaDefines::WELL_PATH, RiaDefines::PERFORATION_INTERVAL,
RiaDefines::FISHBONES, RiaDefines::FRACTURE
};
std::vector<RiaDefines::WellPathComponentType> componentTypes = {
RiaDefines::WELL_PATH, RiaDefines::PERFORATION_INTERVAL, RiaDefines::FISHBONES, RiaDefines::FRACTURE};
std::vector<std::pair<QString, int>> ctNamesAndValues;
for (RiaDefines::WellPathComponentType type : componentTypes)
{
ctNamesAndValues.push_back(std::make_pair(caf::AppEnum<RiaDefines::WellPathComponentType>::uiText(type), type));
ctNamesAndValues.push_back(
std::make_pair(caf::AppEnum<RiaDefines::WellPathComponentType>::uiText(type), type));
}
setCategoryNamesAndValues(ctNamesAndValues);
}
@@ -438,7 +445,7 @@ void RimEclipsePropertyFilter::updateFromCurrentTimeStep()
}
double threshold = 1e-6;
bool followMin = false;
bool followMin = false;
if (fabs(m_lowerBound - m_minimumResultValue) < threshold || m_minimumResultValue == HUGE_VAL)
{
followMin = true;
@@ -458,8 +465,8 @@ void RimEclipsePropertyFilter::updateFromCurrentTimeStep()
Rim3dView* view = nullptr;
this->firstAncestorOrThisOfTypeAsserted(view);
int timeStep = view->currentTimeStep();
RigFlowDiagResultAddress resAddr = resultDefinition->flowDiagResAddress();
int timeStep = view->currentTimeStep();
RigFlowDiagResultAddress resAddr = resultDefinition->flowDiagResAddress();
if (resultDefinition->flowDiagSolution())
{
RigFlowDiagResults* results = resultDefinition->flowDiagSolution()->flowDiagResults();
@@ -511,11 +518,11 @@ void RimEclipsePropertyFilter::updateFilterName()
if (isCategorySelectionActive())
{
if (m_categoryNames.size() == 0)
if (m_categoryNames.empty())
{
newFiltername += " (";
if ( m_selectedCategoryValues().size() && m_selectedCategoryValues().size() == m_categoryValues.size() )
if (!m_selectedCategoryValues().empty() && m_selectedCategoryValues().size() == m_categoryValues.size())
{
newFiltername += QString::number(m_selectedCategoryValues()[0]);
newFiltername += "..";
@@ -537,7 +544,6 @@ void RimEclipsePropertyFilter::updateFilterName()
newFiltername += ")";
}
}
else
{

View File

@@ -41,46 +41,48 @@ public:
caf::PdmChildField<RimEclipseResultDefinition*> resultDefinition;
void rangeValues(double* lower, double* upper) const;
bool isCategorySelectionActive() const;
void rangeValues(double* lower, double* upper) const;
bool isCategorySelectionActive() const;
void setToDefaultValues();
void updateFilterName();
void computeResultValueRange();
void updateFromCurrentTimeStep();
void setToDefaultValues();
void updateFilterName();
void computeResultValueRange();
void updateFromCurrentTimeStep();
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void initAfterRead() override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void initAfterRead() override;
void updateUiFieldsFromActiveResult();
void updateUiFieldsFromActiveResult();
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute) override;
private:
friend class RimEclipsePropertyFilterCollection;
friend class RicEclipsePropertyFilterFeatureImpl;
void updateActiveState();
void updateReadOnlyStateOfAllFields();
void updateRangeLabel();
bool isPropertyFilterControlled();
void setCategoriesFromTracerNames(const std::vector<QString>& tracerNames);
void updateActiveState();
void updateReadOnlyStateOfAllFields();
void updateRangeLabel();
bool isPropertyFilterControlled();
void setCategoriesFromTracerNames(const std::vector<QString>& tracerNames);
RimEclipsePropertyFilterCollection* parentContainer();
RimEclipsePropertyFilterCollection* parentContainer();
private:
caf::PdmField<QString> m_rangeLabelText;
caf::PdmField<double> m_lowerBound;
caf::PdmField<double> m_upperBound;
caf::PdmField<QString> m_rangeLabelText;
caf::PdmField<double> m_lowerBound;
caf::PdmField<double> m_upperBound;
caf::PdmField<bool> m_useCategorySelection;
caf::PdmField<bool> m_useCategorySelection;
double m_minimumResultValue;
double m_maximumResultValue;
double m_minimumResultValue;
double m_maximumResultValue;
public:
// Obsolete stuff
@@ -89,7 +91,7 @@ public:
RANGE_FILTER_REGION,
GLOBAL_REGION
};
private:
caf::PdmField< caf::AppEnum< EvaluationRegionType > > obsoleteField_evaluationRegion;
};
private:
caf::PdmField<caf::AppEnum<EvaluationRegionType>> obsoleteField_evaluationRegion;
};

View File

@@ -169,7 +169,7 @@ void RimEclipseResultDefinition::simpleCopy(const RimEclipseResultDefinition* ot
m_flowTracerSelectionMode = other->m_flowTracerSelectionMode();
m_phaseSelection = other->m_phaseSelection;
m_differenceCase = other->m_differenceCase();
m_differenceCase = other->m_differenceCase();
m_timeLapseBaseTimestep = other->m_timeLapseBaseTimestep();
}
@@ -238,9 +238,9 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
if (&m_resultVariableUiField == changedField)
{
m_porosityModel = m_porosityModelUiField;
m_resultType = m_resultTypeUiField;
m_resultVariable = m_resultVariableUiField;
m_porosityModel = m_porosityModelUiField;
m_resultType = m_resultTypeUiField;
m_resultVariable = m_resultVariableUiField;
if (m_resultTypeUiField() == RiaDefines::FLOW_DIAGNOSTICS)
{
@@ -638,8 +638,11 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
if (otherCase->eclipseCaseData() && otherCase->eclipseCaseData()->mainGrid())
{
options.push_back(
caf::PdmOptionItemInfo(QString("%1 (#%2)").arg(otherCase->caseUserDescription()).arg(otherCase->caseId()), otherCase, false, otherCase->uiIcon()));
options.push_back(caf::PdmOptionItemInfo(
QString("%1 (#%2)").arg(otherCase->caseUserDescription()).arg(otherCase->caseId()),
otherCase,
false,
otherCase->uiIcon()));
}
}
}
@@ -839,7 +842,8 @@ QString RimEclipseResultDefinition::diffResultUiName() const
if (gridCellResults)
{
stepDates = gridCellResults->timeStepDates();
diffResult += QString("<b>Base Time Step</b>: %1").arg(stepDates[m_timeLapseBaseTimestep()].toString(RimTools::dateFormatString()));
diffResult += QString("<b>Base Time Step</b>: %1")
.arg(stepDates[m_timeLapseBaseTimestep()].toString(RimTools::dateFormatString()));
}
}
if (isCaseDiffResult())
@@ -1017,9 +1021,9 @@ void RimEclipseResultDefinition::initAfterRead()
assignFlowSolutionFromCase();
}
m_porosityModelUiField = m_porosityModel;
m_resultTypeUiField = m_resultType;
m_resultVariableUiField = m_resultVariable;
m_porosityModelUiField = m_porosityModel;
m_resultTypeUiField = m_resultType;
m_resultVariableUiField = m_resultVariable;
m_flowSolutionUiField = m_flowSolution();
m_selectedInjectorTracersUiField = m_selectedInjectorTracers;
@@ -1269,10 +1273,8 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
m_differenceCase.uiCapability()->setUiReadOnly(!isCaseDiffResultAvailable());
m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly(!isTimeDiffResultAvailable());
if (isCaseDiffResultAvailable())
differenceGroup->add(&m_differenceCase);
if (isTimeDiffResultAvailable())
differenceGroup->add(&m_timeLapseBaseTimestep);
if (isCaseDiffResultAvailable()) differenceGroup->add(&m_differenceCase);
if (isTimeDiffResultAvailable()) differenceGroup->add(&m_timeLapseBaseTimestep);
QString resultPropertyLabel = "Result Property";
if (isTimeDiffResult() || isCaseDiffResult())
@@ -1921,7 +1923,6 @@ void RimEclipseResultDefinition::syncProducerToInjectorSelection()
bool RimEclipseResultDefinition::enableDiffResultOptions() const
{
return m_diffResultOptionsEnabled;
}
//--------------------------------------------------------------------------------------------------
@@ -1929,9 +1930,7 @@ bool RimEclipseResultDefinition::enableDiffResultOptions() const
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isTimeDiffResultAvailable() const
{
return enableDiffResultOptions() &&
m_resultType() == RiaDefines::DYNAMIC_NATIVE &&
!isTernarySaturationSelected();
return enableDiffResultOptions() && m_resultType() == RiaDefines::DYNAMIC_NATIVE && !isTernarySaturationSelected();
}
//--------------------------------------------------------------------------------------------------
@@ -1948,9 +1947,8 @@ bool RimEclipseResultDefinition::isTimeDiffResult() const
bool RimEclipseResultDefinition::isCaseDiffResultAvailable() const
{
return enableDiffResultOptions() && !isTernarySaturationSelected() &&
(m_resultType() == RiaDefines::DYNAMIC_NATIVE ||
m_resultType() == RiaDefines::STATIC_NATIVE ||
m_resultType() == RiaDefines::GENERATED);
(m_resultType() == RiaDefines::DYNAMIC_NATIVE || m_resultType() == RiaDefines::STATIC_NATIVE ||
m_resultType() == RiaDefines::GENERATED);
}
//--------------------------------------------------------------------------------------------------