From 118980d568a4a1b94f036604cb370099afb34825 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Wed, 10 Jan 2018 12:55:36 +0100 Subject: [PATCH] #2360 Elm Props: read metadata on project load --- .../RigFemPartResultsCollection.cpp | 10 ++++++- .../ProjectDataModel/RimGeoMechCase.cpp | 30 +++++++++++++------ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp index 1801ece7fa..4722662922 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp @@ -179,7 +179,15 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult(in currentFrames->frameData(0).swap(elem.second); } - return m_femPartResults[partIndex]->findScalarResult(resVarAddr); + frames = m_femPartResults[partIndex]->findScalarResult(resVarAddr); + if (frames) + { + return frames; + } + else + { + return m_femPartResults[partIndex]->createScalarResult(resVarAddr); + } } // We need to read the data as bulk fields, and populate the correct scalar caches diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp index 5048af466c..ec6c3a141f 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -157,19 +157,24 @@ bool RimGeoMechCase::openGeoMechCase(std::string* errorMessage) { // If opening failed, release all data // Also, several places is checked for this data to validate availability of data - m_geoMechCaseData = NULL; + m_geoMechCaseData = nullptr; + return false; + } + + if (activeFormationNames()) + { + m_geoMechCaseData->femPartResults()->setActiveFormationNames(activeFormationNames()->formationNamesData()); } else { - if ( activeFormationNames() ) - { - m_geoMechCaseData->femPartResults()->setActiveFormationNames(activeFormationNames()->formationNamesData()); - } - else - { - m_geoMechCaseData->femPartResults()->setActiveFormationNames(nullptr); - } + m_geoMechCaseData->femPartResults()->setActiveFormationNames(nullptr); } + + if (m_geoMechCaseData.notNull()) + { + geoMechData()->femPartResults()->addElementPropertyFiles(m_elementPropertyFileNames); + } + return fileOpenSuccess; } @@ -184,6 +189,11 @@ void RimGeoMechCase::updateFilePathsFromProjectPath(const QString& newProjectPat // Update filename and folder paths when opening project from a different file location m_caseFileName = RimTools::relocateFile(m_caseFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths); + for (QString& fileName : m_elementPropertyFileNames.v()) + { + fileName = RimTools::relocateFile(fileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths); + } + #if 0 // Output the search path for debugging for (size_t i = 0; i < searchedPaths.size(); ++i) qDebug() << searchedPaths[i]; @@ -326,7 +336,9 @@ void RimGeoMechCase::addElementPropertyFiles(const std::vector& fileNam { m_elementPropertyFileNames.v().push_back(fileName); } + this->updateConnectedEditors(); + if (m_geoMechCaseData.notNull()) { geoMechData()->femPartResults()->addElementPropertyFiles(fileNames);