mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-23 23:13:39 -06:00
#2349 Elm Props: Only add files which are not already added
This commit is contained in:
parent
fe17d0edd4
commit
6aa2d99587
@ -332,16 +332,32 @@ void RimGeoMechCase::setFormationNames(RimFormationNames* formationNames)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechCase::addElementPropertyFiles(const std::vector<QString>& fileNames)
|
||||
{
|
||||
for (const QString& fileName : fileNames)
|
||||
std::vector<QString> newFileNames;
|
||||
|
||||
for (const QString& newFileNameToPossiblyAdd : fileNames)
|
||||
{
|
||||
m_elementPropertyFileNames.v().push_back(fileName);
|
||||
bool fileAlreadyAdded = false;
|
||||
|
||||
for (const QString& existingFileName : m_elementPropertyFileNames.v())
|
||||
{
|
||||
if (existingFileName == newFileNameToPossiblyAdd)
|
||||
{
|
||||
fileAlreadyAdded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!fileAlreadyAdded)
|
||||
{
|
||||
newFileNames.push_back(newFileNameToPossiblyAdd);
|
||||
m_elementPropertyFileNames.v().push_back(newFileNameToPossiblyAdd);
|
||||
}
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
|
||||
if (m_geoMechCaseData.notNull())
|
||||
{
|
||||
geoMechData()->femPartResults()->addElementPropertyFiles(fileNames);
|
||||
geoMechData()->femPartResults()->addElementPropertyFiles(newFileNames);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user