mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
* Formation names format changed to allow no space around k-layer numbers. Also added possibility to use one number as k-layer count for the name. Based on previous names last layer * Deleted geomech cache of formation name result when updating the formation names * Added TNH TNQV THQV to plane transformed stresses.
This commit is contained in:
parent
bc82a0e45c
commit
593fe93244
@ -23,6 +23,7 @@
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include "QMessageBox"
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicReloadFormationNamesFeature, "RicReloadFormationNamesFeature");
|
||||
|
||||
@ -62,7 +63,13 @@ void RicReloadFormationNamesFeature::onActionTriggered(bool isChecked)
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedFormationNamesObjs);
|
||||
for (RimFormationNames* fnames: selectedFormationNamesObjs)
|
||||
{
|
||||
fnames->readFormationNamesFile(nullptr);
|
||||
QString errorMessage;
|
||||
fnames->readFormationNamesFile(&errorMessage);
|
||||
if ( !errorMessage.isEmpty() )
|
||||
{
|
||||
QMessageBox::warning(nullptr, "Reload Formation Names", errorMessage);
|
||||
}
|
||||
|
||||
fnames->updateConnectedViews();
|
||||
}
|
||||
}
|
||||
|
@ -65,3 +65,11 @@ RigFemScalarResultFrames* RigFemPartResults::findScalarResult(const RigFemResult
|
||||
{
|
||||
return resultSets[resVarAddr].p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResults::deleteScalarResult(const RigFemResultAddress& resVarAddr)
|
||||
{
|
||||
resultSets.erase(resVarAddr); // Refcounting is supposed to destroy the data.
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
|
||||
RigFemScalarResultFrames* createScalarResult(const RigFemResultAddress& resVarAddr);
|
||||
RigFemScalarResultFrames* findScalarResult(const RigFemResultAddress& resVarAddr);
|
||||
void deleteScalarResult(const RigFemResultAddress& resVarAddr);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -75,6 +75,7 @@ RigFemPartResultsCollection::~RigFemPartResultsCollection()
|
||||
void RigFemPartResultsCollection::setActiveFormationNames(RigFormationNames* activeFormationNames)
|
||||
{
|
||||
m_activeFormationNamesData = activeFormationNames;
|
||||
this->deleteResult(RigFemResultAddress(RIG_FORMATION_NAMES, "Active Formation Names", ""));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -297,10 +298,16 @@ std::map<std::string, std::vector<std::string> > RigFemPartResultsCollection::sc
|
||||
fieldCompNames["SE"].push_back("SN");
|
||||
fieldCompNames["SE"].push_back("STH");
|
||||
fieldCompNames["SE"].push_back("STQV");
|
||||
fieldCompNames["SE"].push_back("TNH" );
|
||||
fieldCompNames["SE"].push_back("TNQV");
|
||||
fieldCompNames["SE"].push_back("THQV");
|
||||
|
||||
fieldCompNames["ST"].push_back("SN");
|
||||
fieldCompNames["ST"].push_back("STH");
|
||||
fieldCompNames["ST"].push_back("STQV");
|
||||
fieldCompNames["ST"].push_back("TNH");
|
||||
fieldCompNames["ST"].push_back("TNQV");
|
||||
fieldCompNames["ST"].push_back("THQV");
|
||||
}
|
||||
}
|
||||
|
||||
@ -566,7 +573,8 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateVolumetricStrain
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSurfaceAlignedStress(int partIndex, const RigFemResultAddress& resVarAddr)
|
||||
{
|
||||
CVF_ASSERT(resVarAddr.componentName == "STH" || resVarAddr.componentName == "STQV" || resVarAddr.componentName == "SN");
|
||||
CVF_ASSERT( resVarAddr.componentName == "STH" || resVarAddr.componentName == "STQV" || resVarAddr.componentName == "SN"
|
||||
|| resVarAddr.componentName == "TNH" || resVarAddr.componentName == "TNQV" || resVarAddr.componentName == "THQV");
|
||||
|
||||
RigFemScalarResultFrames * s11Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S11"));
|
||||
RigFemScalarResultFrames * s22Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S22"));
|
||||
@ -578,6 +586,9 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSurfaceAlignedSt
|
||||
RigFemScalarResultFrames * sNormFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "SN"));
|
||||
RigFemScalarResultFrames * sHoriFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "STH"));
|
||||
RigFemScalarResultFrames * sVertFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "STQV"));
|
||||
RigFemScalarResultFrames * sNHFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "TNH" ));
|
||||
RigFemScalarResultFrames * sNVFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "TNQV"));
|
||||
RigFemScalarResultFrames * sHVFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "THQV"));
|
||||
|
||||
const RigFemPart * femPart = m_femParts->part(partIndex);
|
||||
const std::vector<cvf::Vec3f>& nodeCoordinates = femPart->nodes().coordinates;
|
||||
@ -595,12 +606,18 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSurfaceAlignedSt
|
||||
std::vector<float>& sNorm = sNormFrames->frameData(fIdx);
|
||||
std::vector<float>& sHori = sHoriFrames->frameData(fIdx);
|
||||
std::vector<float>& sVert = sVertFrames->frameData(fIdx);
|
||||
std::vector<float>& sNH = sNHFrames->frameData(fIdx);
|
||||
std::vector<float>& sHV = sNVFrames->frameData(fIdx);
|
||||
std::vector<float>& sNV = sHVFrames->frameData(fIdx);
|
||||
|
||||
// HACK ! Todo : make it robust against other elements than Hex8
|
||||
size_t valCount = s11.size() * 3; // Number of Elm Node Face results 24 = 4 * num faces = 3* numElmNodes
|
||||
sNorm.resize(valCount);
|
||||
sHori.resize(valCount);
|
||||
sVert.resize(valCount);
|
||||
sNH.resize(valCount);
|
||||
sHV.resize(valCount);
|
||||
sNV.resize(valCount);
|
||||
|
||||
int elementCount = femPart->elementCount();
|
||||
for(int elmIdx = 0; elmIdx < elementCount; ++elmIdx)
|
||||
@ -651,7 +668,9 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSurfaceAlignedSt
|
||||
sHori[elmNodFaceResIdx]= xfTen[caf::Ten3f::SXX];
|
||||
sVert[elmNodFaceResIdx]= xfTen[caf::Ten3f::SYY];
|
||||
sNorm[elmNodFaceResIdx]= xfTen[caf::Ten3f::SZZ];
|
||||
|
||||
sNH[elmNodFaceResIdx]= xfTen[caf::Ten3f::SZX];
|
||||
sHV[elmNodFaceResIdx]= xfTen[caf::Ten3f::SXY];
|
||||
sNV[elmNodFaceResIdx]= xfTen[caf::Ten3f::SYZ];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1192,6 +1211,24 @@ bool RigFemPartResultsCollection::assertResultsLoaded(const RigFemResultAddress&
|
||||
return foundResults;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::deleteResult(const RigFemResultAddress& resVarAddr)
|
||||
{
|
||||
CVF_ASSERT ( resVarAddr.isValid() );
|
||||
|
||||
for ( int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx )
|
||||
{
|
||||
if ( m_femPartResults[pIdx].notNull() )
|
||||
{
|
||||
m_femPartResults[pIdx]->deleteScalarResult(resVarAddr);
|
||||
}
|
||||
}
|
||||
|
||||
m_resultStatistics.erase(resVarAddr);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
std::map<std::string, std::vector<std::string> > scalarFieldAndComponentNames(RigFemResultPosEnum resPos);
|
||||
std::vector<std::string> stepNames();
|
||||
bool assertResultsLoaded(const RigFemResultAddress& resVarAddr);
|
||||
void deleteResult(const RigFemResultAddress& resVarAddr);
|
||||
|
||||
const std::vector<float>& resultValues(const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex);
|
||||
int partCount() const;
|
||||
int frameCount();
|
||||
|
@ -285,9 +285,12 @@ void RivIntersectionPartMgr::calculateGeoMechTensorXfTextureCoords(cvf::Vec2fArr
|
||||
|
||||
caf::Ten3f::TensorComponentEnum resultComponent = caf::Ten3f::SZZ;
|
||||
|
||||
if (resVarAddress.componentName == "SN") resultComponent = caf::Ten3f::SZZ;
|
||||
if (resVarAddress.componentName == "STH") resultComponent = caf::Ten3f::SXX;
|
||||
if (resVarAddress.componentName == "STQV") resultComponent = caf::Ten3f::SYY;
|
||||
if ( resVarAddress.componentName == "SN" ) resultComponent = caf::Ten3f::SZZ;
|
||||
if ( resVarAddress.componentName == "STH" ) resultComponent = caf::Ten3f::SXX;
|
||||
if ( resVarAddress.componentName == "STQV" ) resultComponent = caf::Ten3f::SYY;
|
||||
if ( resVarAddress.componentName == "TNH" ) resultComponent = caf::Ten3f::SZX;
|
||||
if ( resVarAddress.componentName == "TNQV" ) resultComponent = caf::Ten3f::SYZ;
|
||||
if ( resVarAddress.componentName == "THQV" ) resultComponent = caf::Ten3f::SXY;
|
||||
|
||||
if(tens11.size() == 0)
|
||||
{
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include "QMessageBox"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimFormationNames, "FormationNames");
|
||||
|
||||
@ -60,8 +61,12 @@ void RimFormationNames::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|
||||
if (&m_formationNamesFileName == changedField)
|
||||
{
|
||||
updateUiTreeName();
|
||||
|
||||
readFormationNamesFile(nullptr);
|
||||
QString errorMessage;
|
||||
readFormationNamesFile(&errorMessage);
|
||||
if (!errorMessage.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(nullptr, "Formation Names", errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,7 +136,12 @@ void RimFormationNames::updateConnectedViews()
|
||||
void RimFormationNames::readFormationNamesFile(QString * errorMessage)
|
||||
{
|
||||
QFile dataFile(m_formationNamesFileName());
|
||||
if (!dataFile.open(QFile::ReadOnly)){ if (errorMessage) (*errorMessage) += "Could not open the File: " + (m_formationNamesFileName()) + "\n"; return;}
|
||||
|
||||
if (!dataFile.open(QFile::ReadOnly))
|
||||
{
|
||||
if (errorMessage) (*errorMessage) += "Could not open the File: " + (m_formationNamesFileName()) + "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
m_formationNamesData = new RigFormationNames;
|
||||
|
||||
@ -158,13 +168,13 @@ void RimFormationNames::readFormationNamesFile(QString * errorMessage)
|
||||
QString numberString = lineSegs[2];
|
||||
if (commentMarkPos >= 0) numberString.truncate(commentMarkPos);
|
||||
|
||||
QStringList numberWords = numberString.split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
||||
if (numberWords.size() == 3)
|
||||
QStringList numberWords = numberString.split(QRegExp("-"), QString::SkipEmptyParts);
|
||||
if (numberWords.size() == 2)
|
||||
{
|
||||
bool isNumber1 = false;
|
||||
bool isNumber2 = false;
|
||||
int startK = numberWords[0].toInt(&isNumber1);
|
||||
int endK = numberWords[2].toInt(&isNumber2);
|
||||
int endK = numberWords[1].toInt(&isNumber2);
|
||||
|
||||
if (!(isNumber2 && isNumber1))
|
||||
{
|
||||
@ -177,6 +187,19 @@ void RimFormationNames::readFormationNamesFile(QString * errorMessage)
|
||||
|
||||
m_formationNamesData->appendFormationRange(formationName, startK-1, endK-1);
|
||||
}
|
||||
else if (numberWords.size() == 1)
|
||||
{
|
||||
bool isNumber1 = false;
|
||||
int kLayerCount = numberWords[0].toInt(&isNumber1);
|
||||
|
||||
if ( !isNumber1 )
|
||||
{
|
||||
if ( errorMessage ) (*errorMessage) += "Format error on line: " + QString::number(lineNumber) + "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
m_formationNamesData->appendFormationRangeHeight(formationName, kLayerCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (errorMessage) (*errorMessage) += "Format error on line: " + QString::number(lineNumber) + "\n";
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "RimFormationNamesCollection.h"
|
||||
|
||||
#include "RimFormationNames.h"
|
||||
#include "QMessageBox"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimFormationNamesCollection, "FormationNamesCollectionObject");
|
||||
|
||||
@ -87,9 +88,23 @@ void RimFormationNamesCollection::importFiles(const QStringList& fileNames)
|
||||
formNamesObjsToReload.push_back(newFNs);
|
||||
}
|
||||
|
||||
QString totalErrorMessage;
|
||||
|
||||
for (RimFormationNames* fmNames: formNamesObjsToReload)
|
||||
{
|
||||
fmNames->readFormationNamesFile(nullptr);
|
||||
QString errormessage;
|
||||
|
||||
fmNames->readFormationNamesFile(&errormessage);
|
||||
if (!errormessage.isEmpty())
|
||||
{
|
||||
totalErrorMessage += "\nError in: " + fmNames->fileName()
|
||||
+ "\n\t" + errormessage;
|
||||
}
|
||||
}
|
||||
|
||||
if (!totalErrorMessage.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(nullptr, "Import Formation Names", totalErrorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,13 +52,40 @@ QString RigFormationNames::formationNameFromKLayerIdx(size_t Kidx)
|
||||
void RigFormationNames::appendFormationRange(const QString& name, int kStartIdx, int kEndIdx)
|
||||
{
|
||||
CVF_ASSERT(kStartIdx <= kEndIdx);
|
||||
int nameIdx = static_cast<int>(m_formationNames.size());
|
||||
m_formationNames.push_back(name);
|
||||
if(kEndIdx >= static_cast<int>(m_nameIndexPrKLayer.size())) m_nameIndexPrKLayer.resize(kEndIdx + 1, -1);
|
||||
|
||||
for(int kIdx = kStartIdx; kIdx <= kEndIdx; ++kIdx)
|
||||
int nameIdx = static_cast<int>(m_formationNames.size());
|
||||
|
||||
m_formationNames.push_back(name);
|
||||
|
||||
if ( kEndIdx >= static_cast<int>(m_nameIndexPrKLayer.size()) )
|
||||
{
|
||||
m_nameIndexPrKLayer.resize(kEndIdx + 1, -1);
|
||||
}
|
||||
|
||||
for ( int kIdx = kStartIdx; kIdx <= kEndIdx; ++kIdx )
|
||||
{
|
||||
m_nameIndexPrKLayer[kIdx] = nameIdx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFormationNames::appendFormationRangeHeight(const QString& name, int kLayerCount)
|
||||
{
|
||||
if (kLayerCount < 1) return;
|
||||
|
||||
int nameIdx = static_cast<int>(m_formationNames.size());
|
||||
|
||||
m_formationNames.push_back(name);
|
||||
|
||||
int kStartIdx = static_cast<int>(m_nameIndexPrKLayer.size());
|
||||
|
||||
m_nameIndexPrKLayer.resize(kStartIdx + kLayerCount, -1);
|
||||
|
||||
for ( int kIdx = kStartIdx; kIdx < kStartIdx + kLayerCount; ++kIdx )
|
||||
{
|
||||
m_nameIndexPrKLayer[kIdx] = nameIdx;
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
const std::vector<QString>& formationNames() const { return m_formationNames;}
|
||||
|
||||
void appendFormationRange(const QString& name, int kStartIdx, int kEndIdx);
|
||||
void appendFormationRangeHeight(const QString& name, int kLayerCount);
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user