From 4bf8de278704f17be6c7bd93f4f7149ea02cf971 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 15 Jan 2018 14:48:00 +0100 Subject: [PATCH] #2369 Elm props: Clear cell results on deletion --- .../Commands/RicImportElementPropertyFeature.cpp | 4 ++-- .../FileInterface/RifElementPropertyReader.cpp | 9 +++++++-- .../GeoMech/GeoMechDataModel/RigFemResultAddress.h | 7 +++++++ ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp | 11 +++++++++++ .../RimGeoMechPropertyFilterCollection.h | 10 +++++----- 5 files changed, 32 insertions(+), 9 deletions(-) diff --git a/ApplicationCode/Commands/RicImportElementPropertyFeature.cpp b/ApplicationCode/Commands/RicImportElementPropertyFeature.cpp index 72bda624e3..6f33931e88 100644 --- a/ApplicationCode/Commands/RicImportElementPropertyFeature.cpp +++ b/ApplicationCode/Commands/RicImportElementPropertyFeature.cpp @@ -48,9 +48,9 @@ void RicImportElementPropertyFeature::onActionTriggered(bool isChecked) QString defaultDir = app->lastUsedDialogDirectory("ELM_PROPS"); QStringList fileNames = - QFileDialog::getOpenFileNames(NULL, "Import Element Property Table", defaultDir, "Property Table (*.inp)"); + QFileDialog::getOpenFileNames(nullptr, "Import Element Property Table", defaultDir, "Property Table (*.inp)"); - if (fileNames.size()) + if (!fileNames.empty()) { defaultDir = QFileInfo(fileNames.last()).absolutePath(); } diff --git a/ApplicationCode/FileInterface/RifElementPropertyReader.cpp b/ApplicationCode/FileInterface/RifElementPropertyReader.cpp index 0188b2de38..6339aa8f0d 100644 --- a/ApplicationCode/FileInterface/RifElementPropertyReader.cpp +++ b/ApplicationCode/FileInterface/RifElementPropertyReader.cpp @@ -87,6 +87,13 @@ std::map> RifElementPropertyReader::scalar std::map> RifElementPropertyReader::readAllElementPropertiesInFileContainingField(const std::string& fieldName) { + std::map> fieldAndData; + + if (m_fieldsMetaData.find(fieldName) == m_fieldsMetaData.end()) + { + return fieldAndData; + } + RifElementPropertyTable table; RifElementPropertyTableReader::readData(&m_fieldsMetaData[fieldName], &table); @@ -97,8 +104,6 @@ std::map> CVF_ASSERT(table.data[i].size() == table.elementIds.size()); } - std::map> fieldAndData; - const std::vector& elementIdsFromFile = table.elementIds; if (elementIdsFromFile == m_elementIdxToId) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h index bcf3a8df8e..f55e9426fd 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h @@ -29,6 +29,13 @@ class RigFemResultAddress { public: + RigFemResultAddress() + { + resultPosType = RIG_NODAL; + fieldName = ""; + componentName = ""; + } + RigFemResultAddress(RigFemResultPosEnum resPosType, const std::string& aFieldName, const std::string& aComponentName) diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp index 3a88a52077..efd6fae769 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -561,6 +561,17 @@ void RimGeoMechCase::closeSelectedElementPropertyFiles() { geoMechData()->femPartResults()->removeElementPropertyFiles(filesToClose); } + + for (RimGeoMechView* view : geoMechViews()) + { + view->cellResult()->setResultAddress(RigFemResultAddress()); + for (RimGeoMechPropertyFilter* propertyFilter : view->geoMechPropertyFilterCollection()->propertyFilters()) + { + propertyFilter->resultDefinition().p()->setResultAddress(RigFemResultAddress()); + } + + view->loadDataAndUpdate(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilterCollection.h b/ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilterCollection.h index 440f0a9d9e..d27fac7ec2 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilterCollection.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechPropertyFilterCollection.h @@ -45,14 +45,14 @@ public: caf::PdmChildArrayField propertyFilters; // Methods - bool hasActiveFilters() const; - bool hasActiveDynamicFilters() const; + bool hasActiveFilters() const override; + bool hasActiveDynamicFilters() const override; bool isUsingFormationNames() const; - void loadAndInitializePropertyFilters(); - void updateIconState(); + void loadAndInitializePropertyFilters() override; + void updateIconState() override; protected: // Overridden methods - virtual void initAfterRead(); + virtual void initAfterRead() override; };