#2022 Curve Calculator : Add enum Calculated

This commit is contained in:
Magne Sjaastad 2017-10-17 14:34:02 +02:00
parent f15f55795e
commit bd8abba779
6 changed files with 68 additions and 9 deletions

View File

@ -118,8 +118,12 @@ RicSummaryCurveCreator::RicSummaryCurveCreator() : m_identifierFieldsMap(
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_LGR_NAME) }, { new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_LGR_NAME) },
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_CELL_IJK) }, { new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_CELL_IJK) },
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) } { new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
} },
{ RifEclipseSummaryAddress::SUMMARY_CALCULATED, {
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
} } } }
}) })
{ {
CAF_PDM_InitFieldNoDefault(&m_selectedCases, "SummaryCases", "Cases", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_selectedCases, "SummaryCases", "Cases", "", "", "");
@ -170,6 +174,8 @@ RicSummaryCurveCreator::RicSummaryCurveCreator() : m_identifierFieldsMap(
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][1]->pdmField(), "BlockLgrIjk", "Cell IJK", "", "", ""); CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][1]->pdmField(), "BlockLgrIjk", "Cell IJK", "", "", "");
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField(), "BlockLgrVectors", "Block Vectors", "", "", ""); CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField(), "BlockLgrVectors", "Block Vectors", "", "", "");
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_CALCULATED][0]->pdmField(), "CalculatedVectors", "Calculated Vectors", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_targetPlot, "TargetPlot", "Target Plot", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_targetPlot, "TargetPlot", "Target Plot", "", "", "");
CAF_PDM_InitField(&m_useAutoAppearanceAssignment, "UseAutoAppearanceAssignment", true, "Auto", "", "", ""); CAF_PDM_InitField(&m_useAutoAppearanceAssignment, "UseAutoAppearanceAssignment", true, "Auto", "", "", "");
@ -599,6 +605,10 @@ void RicSummaryCurveCreator::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField(); summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField();
} }
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_CALCULATED)
{
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_CALCULATED][0]->pdmField();
}
CAF_ASSERT(summaryiesField); CAF_ASSERT(summaryiesField);
caf::PdmUiGroup* summariesGroup = uiOrdering.addNewGroupWithKeyword("Summaries", RiuSummaryCurveDefinitionKeywords::summaries()); caf::PdmUiGroup* summariesGroup = uiOrdering.addNewGroupWithKeyword("Summaries", RiuSummaryCurveDefinitionKeywords::summaries());

View File

@ -103,6 +103,18 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fieldVarAddress(const std::st
return fieldAddr; return fieldAddr;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseSummaryAddress RifEclipseSummaryAddress::calculatedCurveAddress(const std::string& curveName)
{
RifEclipseSummaryAddress fieldAddr;
fieldAddr.m_variableCategory = SUMMARY_CALCULATED;
fieldAddr.m_quantityName = curveName;
return fieldAddr;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -45,7 +45,8 @@ public:
SUMMARY_WELL_COMPLETION_LGR, SUMMARY_WELL_COMPLETION_LGR,
SUMMARY_WELL_SEGMENT, SUMMARY_WELL_SEGMENT,
SUMMARY_BLOCK, SUMMARY_BLOCK,
SUMMARY_BLOCK_LGR, SUMMARY_BLOCK_LGR,
SUMMARY_CALCULATED
}; };
enum SummaryIdentifierType enum SummaryIdentifierType
@ -104,6 +105,7 @@ public:
// Static specialized creation methods // Static specialized creation methods
static RifEclipseSummaryAddress fieldVarAddress(const std::string& fieldVarName); static RifEclipseSummaryAddress fieldVarAddress(const std::string& fieldVarName);
static RifEclipseSummaryAddress calculatedCurveAddress(const std::string& curveName);
// Access methods // Access methods

View File

@ -140,6 +140,7 @@ void caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::setUp()
addItem(RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT, "SUMMARY_SEGMENT", "Segment"); addItem(RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT, "SUMMARY_SEGMENT", "Segment");
addItem(RifEclipseSummaryAddress::SUMMARY_BLOCK, "SUMMARY_BLOCK", "Block"); addItem(RifEclipseSummaryAddress::SUMMARY_BLOCK, "SUMMARY_BLOCK", "Block");
addItem(RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR, "SUMMARY_BLOCK_LGR", "Lgr-Block"); addItem(RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR, "SUMMARY_BLOCK_LGR", "Lgr-Block");
addItem(RifEclipseSummaryAddress::SUMMARY_CALCULATED, "SUMMARY_CALCULATED", "Calculated");
setDefault(RifEclipseSummaryAddress::SUMMARY_FIELD); setDefault(RifEclipseSummaryAddress::SUMMARY_FIELD);
} }

View File

@ -104,6 +104,9 @@ RiuSummaryCurveDefSelection::RiuSummaryCurveDefSelection() : m_identifierFieldsM
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_LGR_NAME) }, { new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_LGR_NAME) },
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_CELL_IJK) }, { new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_CELL_IJK) },
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) } { new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
} },
{ RifEclipseSummaryAddress::SUMMARY_CALCULATED, {
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
} } } }
}) })
{ {
@ -156,6 +159,7 @@ RiuSummaryCurveDefSelection::RiuSummaryCurveDefSelection() : m_identifierFieldsM
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][1]->pdmField(), "BlockLgrIjk", "Cell IJK", "", "", ""); CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][1]->pdmField(), "BlockLgrIjk", "Cell IJK", "", "", "");
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField(), "BlockLgrVectors", "Block Vectors", "", "", ""); CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField(), "BlockLgrVectors", "Block Vectors", "", "", "");
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_CALCULATED][0]->pdmField(), "CalculatedVectors", "Calculated vectors", "", "", "");
for (const auto& itemTypes : m_identifierFieldsMap) for (const auto& itemTypes : m_identifierFieldsMap)
{ {
@ -280,6 +284,29 @@ void RiuSummaryCurveDefSelection::setSelectedCurveDefinitions(const std::vector<
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<RifEclipseSummaryAddress> RiuSummaryCurveDefSelection::findPossibleSummaryAddressesFromCalculated()
{
std::set<RifEclipseSummaryAddress> addressSet;
if (m_currentSummaryCategory == RifEclipseSummaryAddress::SUMMARY_CALCULATED)
{
// TODO
// Wire up list of calculated curves here
/*
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::calculatedCurveAddress("a My Test");
addressSet.insert(adr);
RifEclipseSummaryAddress adr2 = RifEclipseSummaryAddress::calculatedCurveAddress("b My Test2");
addressSet.insert(adr2);
*/
}
return addressSet;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -355,13 +382,17 @@ QList<caf::PdmOptionItemInfo> RiuSummaryCurveDefSelection::calculateValueOptions
auto identifierAndField = lookupIdentifierAndFieldFromFieldHandle(fieldNeedingOptions); auto identifierAndField = lookupIdentifierAndFieldFromFieldHandle(fieldNeedingOptions);
if (identifierAndField != nullptr) if (identifierAndField != nullptr)
{ {
enum {SUM_CASES, OBS_DATA}; enum {SUM_CASES, OBS_DATA, CALCULATED_CURVES};
std::set<RifEclipseSummaryAddress> addrUnion[2];
const size_t itemCount = CALCULATED_CURVES + 1;
std::set<RifEclipseSummaryAddress> addrUnion[itemCount];
addrUnion[SUM_CASES] = findPossibleSummaryAddressesFromSelectedCases(identifierAndField); addrUnion[SUM_CASES] = findPossibleSummaryAddressesFromSelectedCases(identifierAndField);
addrUnion[OBS_DATA] = findPossibleSummaryAddressesFromSelectedObservedData(identifierAndField); addrUnion[OBS_DATA] = findPossibleSummaryAddressesFromSelectedObservedData(identifierAndField);
addrUnion[CALCULATED_CURVES] = findPossibleSummaryAddressesFromCalculated();
std::set<QString> itemNames[2]; std::set<QString> itemNames[itemCount];
for (int i = 0; i < 2; i++) for (int i = 0; i < itemCount; i++)
{ {
for (const auto& address : addrUnion[i]) for (const auto& address : addrUnion[i])
{ {
@ -381,7 +412,7 @@ QList<caf::PdmOptionItemInfo> RiuSummaryCurveDefSelection::calculateValueOptions
} }
auto pdmField = identifierAndField->pdmField(); auto pdmField = identifierAndField->pdmField();
for(int i = 0; i < 2; i++) for(int i = 0; i < itemCount; i++)
{ {
// Create headers only for vector fields when observed data is selected // Create headers only for vector fields when observed data is selected
bool hasObservedData = itemNames[OBS_DATA].size() > 0; bool hasObservedData = itemNames[OBS_DATA].size() > 0;
@ -400,8 +431,6 @@ QList<caf::PdmOptionItemInfo> RiuSummaryCurveDefSelection::calculateValueOptions
optionItem.setLevel(1); optionItem.setLevel(1);
options.push_back(optionItem); options.push_back(optionItem);
} }
if (itemNames[OBS_DATA].size() == 0) break;
} }
} }
} }
@ -535,6 +564,10 @@ void RiuSummaryCurveDefSelection::defineUiOrdering(QString uiConfigName, caf::Pd
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField(); summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField();
} }
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_CALCULATED)
{
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_CALCULATED][0]->pdmField();
}
CAF_ASSERT(summaryiesField); CAF_ASSERT(summaryiesField);
caf::PdmUiGroup* summariesGroup = uiOrdering.addNewGroupWithKeyword("Summaries", RiuSummaryCurveDefinitionKeywords::summaries()); caf::PdmUiGroup* summariesGroup = uiOrdering.addNewGroupWithKeyword("Summaries", RiuSummaryCurveDefinitionKeywords::summaries());
@ -714,7 +747,7 @@ std::set<RifEclipseSummaryAddress> RiuSummaryCurveDefSelection::buildAddressList
for (const auto& category : m_selectedSummaryCategories()) for (const auto& category : m_selectedSummaryCategories())
{ {
if (category == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_INVALID) continue; if (category == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_INVALID) continue;
const auto& identifierAndFieldList = m_identifierFieldsMap.at(category); const auto& identifierAndFieldList = m_identifierFieldsMap.at(category);
std::vector<std::pair<RifEclipseSummaryAddress::SummaryIdentifierType, QString>> selectionStack; std::vector<std::pair<RifEclipseSummaryAddress::SummaryIdentifierType, QString>> selectionStack;
buildAddressListForCategoryRecursively(category, identifierAndFieldList.begin(), selectionStack, addressSet); buildAddressListForCategoryRecursively(category, identifierAndFieldList.begin(), selectionStack, addressSet);

View File

@ -89,6 +89,7 @@ private:
const SummaryIdentifierAndField *identifierAndField); const SummaryIdentifierAndField *identifierAndField);
std::set<RifEclipseSummaryAddress> findPossibleSummaryAddressesFromSelectedCases(const SummaryIdentifierAndField *identifierAndField); std::set<RifEclipseSummaryAddress> findPossibleSummaryAddressesFromSelectedCases(const SummaryIdentifierAndField *identifierAndField);
std::set<RifEclipseSummaryAddress> findPossibleSummaryAddressesFromSelectedObservedData(const SummaryIdentifierAndField *identifierAndField); std::set<RifEclipseSummaryAddress> findPossibleSummaryAddressesFromSelectedObservedData(const SummaryIdentifierAndField *identifierAndField);
std::set<RifEclipseSummaryAddress> findPossibleSummaryAddressesFromCalculated();
std::vector<SummaryIdentifierAndField*> buildControllingFieldList(const SummaryIdentifierAndField *identifierAndField) const; std::vector<SummaryIdentifierAndField*> buildControllingFieldList(const SummaryIdentifierAndField *identifierAndField) const;
SummaryIdentifierAndField* lookupIdentifierAndFieldFromFieldHandle(const caf::PdmFieldHandle* pdmFieldHandle) const; SummaryIdentifierAndField* lookupIdentifierAndFieldFromFieldHandle(const caf::PdmFieldHandle* pdmFieldHandle) const;