mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix regression test issues
* Fix eternal loop causing the application to hang * Revert changes related to file well path introduced in 70bb22 * Use some iterations to find representative cells for computation of cell sizes
This commit is contained in:
@@ -49,6 +49,7 @@
|
|||||||
#include "RimEclipseCase.h"
|
#include "RimEclipseCase.h"
|
||||||
#include "RimEclipseCaseCollection.h"
|
#include "RimEclipseCaseCollection.h"
|
||||||
#include "RimEnsembleWellLogsCollection.h"
|
#include "RimEnsembleWellLogsCollection.h"
|
||||||
|
#include "RimFileWellPath.h"
|
||||||
#include "RimFlowPlotCollection.h"
|
#include "RimFlowPlotCollection.h"
|
||||||
#include "RimFormationNamesCollection.h"
|
#include "RimFormationNamesCollection.h"
|
||||||
#include "RimFractureTemplate.h"
|
#include "RimFractureTemplate.h"
|
||||||
@@ -486,6 +487,17 @@ void RimProject::setProjectFileNameAndUpdateDependencies( const QString& project
|
|||||||
}
|
}
|
||||||
|
|
||||||
wellPathImport->updateFilePaths();
|
wellPathImport->updateFilePaths();
|
||||||
|
auto* wellPathColl = RimTools::wellPathCollection();
|
||||||
|
if ( wellPathColl )
|
||||||
|
{
|
||||||
|
for ( auto wellPath : wellPathColl->allWellPaths() )
|
||||||
|
{
|
||||||
|
if ( auto fileWellPath = dynamic_cast<RimFileWellPath*>( wellPath ) )
|
||||||
|
{
|
||||||
|
fileWellPath->updateFilePathsFromProjectPath( oldProjectPath, newProjectPath );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1526,8 +1538,9 @@ void RimProject::transferPathsToGlobalPathList()
|
|||||||
{
|
{
|
||||||
if ( summaryCase->displayNameType() == RimCaseDisplayNameTools::DisplayName::CUSTOM )
|
if ( summaryCase->displayNameType() == RimCaseDisplayNameTools::DisplayName::CUSTOM )
|
||||||
{
|
{
|
||||||
// At this point, after the replace of variables into caf::FilePath objects, the variable name is stored in
|
// At this point, after the replace of variables into caf::FilePath objects, the variable name is
|
||||||
// the summary case object. Read out the variable name and append "_name" for custom summary variables.
|
// stored in the summary case object. Read out the variable name and append "_name" for custom
|
||||||
|
// summary variables.
|
||||||
|
|
||||||
QString variableName = summaryCase->summaryHeaderFilename();
|
QString variableName = summaryCase->summaryHeaderFilename();
|
||||||
variableName = variableName.remove( RiaVariableMapper::variableToken() );
|
variableName = variableName.remove( RiaVariableMapper::variableToken() );
|
||||||
@@ -1546,8 +1559,9 @@ void RimProject::transferPathsToGlobalPathList()
|
|||||||
{
|
{
|
||||||
if ( gridCase->displayNameType() == RimCaseDisplayNameTools::DisplayName::CUSTOM )
|
if ( gridCase->displayNameType() == RimCaseDisplayNameTools::DisplayName::CUSTOM )
|
||||||
{
|
{
|
||||||
// At this point, after the replace of variables into caf::FilePath objects, the variable name is stored in
|
// At this point, after the replace of variables into caf::FilePath objects, the variable name is
|
||||||
// the summary case object. Read out the variable name and append "_name" for custom summary variables.
|
// stored in the summary case object. Read out the variable name and append "_name" for custom
|
||||||
|
// summary variables.
|
||||||
|
|
||||||
QString variableName = gridCase->gridFileName();
|
QString variableName = gridCase->gridFileName();
|
||||||
variableName = variableName.remove( RiaVariableMapper::variableToken() );
|
variableName = variableName.remove( RiaVariableMapper::variableToken() );
|
||||||
@@ -1606,8 +1620,8 @@ void RimProject::distributePathsFromGlobalPathList()
|
|||||||
}
|
}
|
||||||
else if ( variableName.contains( RiaVariableMapper::postfixName() + RiaVariableMapper::variableToken() ) )
|
else if ( variableName.contains( RiaVariableMapper::postfixName() + RiaVariableMapper::variableToken() ) )
|
||||||
{
|
{
|
||||||
// The variable name is not found in the variable list, but the name indicates a variable. Reset to full
|
// The variable name is not found in the variable list, but the name indicates a variable. Reset
|
||||||
// case name.
|
// to full case name.
|
||||||
summaryCase->setDisplayNameOption( RimCaseDisplayNameTools::DisplayName::FULL_CASE_NAME );
|
summaryCase->setDisplayNameOption( RimCaseDisplayNameTools::DisplayName::FULL_CASE_NAME );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1627,8 +1641,8 @@ void RimProject::distributePathsFromGlobalPathList()
|
|||||||
}
|
}
|
||||||
else if ( variableName.contains( RiaVariableMapper::postfixName() + RiaVariableMapper::variableToken() ) )
|
else if ( variableName.contains( RiaVariableMapper::postfixName() + RiaVariableMapper::variableToken() ) )
|
||||||
{
|
{
|
||||||
// The variable name is not found in the variable list, but the name indicates a variable. Reset to full
|
// The variable name is not found in the variable list, but the name indicates a variable. Reset
|
||||||
// case name.
|
// to full case name.
|
||||||
gridCase->setDisplayNameType( RimCaseDisplayNameTools::DisplayName::FULL_CASE_NAME );
|
gridCase->setDisplayNameType( RimCaseDisplayNameTools::DisplayName::FULL_CASE_NAME );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,6 +279,19 @@ bool RimFileWellPath::isStoredInCache() const
|
|||||||
return !id().isEmpty();
|
return !id().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimFileWellPath::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||||
|
{
|
||||||
|
QString newCacheFileName = getCacheFileName();
|
||||||
|
|
||||||
|
if ( caf::Utils::fileExists( newCacheFileName ) )
|
||||||
|
{
|
||||||
|
m_filePathInCache = newCacheFileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -336,16 +349,3 @@ void RimFileWellPath::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimFileWellPath::initAfterRead()
|
|
||||||
{
|
|
||||||
QString newCacheFileName = getCacheFileName();
|
|
||||||
|
|
||||||
if ( caf::Utils::fileExists( newCacheFileName ) )
|
|
||||||
{
|
|
||||||
m_filePathInCache = newCacheFileName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public:
|
|||||||
void setFilepath( const QString& path );
|
void setFilepath( const QString& path );
|
||||||
bool readWellPathFile( QString* errorMessage, RifWellPathImporter* wellPathImporter, bool setWellNameForExport );
|
bool readWellPathFile( QString* errorMessage, RifWellPathImporter* wellPathImporter, bool setWellNameForExport );
|
||||||
int wellPathIndexInFile() const; // -1 means none.
|
int wellPathIndexInFile() const; // -1 means none.
|
||||||
|
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath );
|
||||||
void setWellPathIndexInFile( int index );
|
void setWellPathIndexInFile( int index );
|
||||||
static QString getCacheDirectoryPath();
|
static QString getCacheDirectoryPath();
|
||||||
|
|
||||||
@@ -42,7 +43,6 @@ private:
|
|||||||
bool isStoredInCache() const;
|
bool isStoredInCache() const;
|
||||||
QString getCacheFileName();
|
QString getCacheFileName();
|
||||||
|
|
||||||
void initAfterRead() override;
|
|
||||||
void setupBeforeSave() override;
|
void setupBeforeSave() override;
|
||||||
|
|
||||||
void ensureWellPathStartAtSeaLevel( RigWellPath* wellPath );
|
void ensureWellPathStartAtSeaLevel( RigWellPath* wellPath );
|
||||||
|
|||||||
@@ -370,6 +370,17 @@ void StructGridInterface::computeCharacteristicCellSize( const std::vector<size_
|
|||||||
ubyte faceConnNegK[4];
|
ubyte faceConnNegK[4];
|
||||||
cellFaceVertexIndices( StructGridInterface::NEG_K, faceConnNegK );
|
cellFaceVertexIndices( StructGridInterface::NEG_K, faceConnNegK );
|
||||||
|
|
||||||
|
double tolerance = 0.2;
|
||||||
|
int iterationIndex = 0;
|
||||||
|
const int iterationMaxCount = 3;
|
||||||
|
while ( iterationIndex < iterationMaxCount )
|
||||||
|
{
|
||||||
|
if ( iterationIndex > 0 )
|
||||||
|
{
|
||||||
|
// Divide tolerance by a factor for each iteration
|
||||||
|
tolerance = tolerance / 10.0;
|
||||||
|
}
|
||||||
|
|
||||||
double iLengthAccumulated = 0.0;
|
double iLengthAccumulated = 0.0;
|
||||||
double jLengthAccumulated = 0.0;
|
double jLengthAccumulated = 0.0;
|
||||||
double kLengthAccumulated = 0.0;
|
double kLengthAccumulated = 0.0;
|
||||||
@@ -397,9 +408,8 @@ void StructGridInterface::computeCharacteristicCellSize( const std::vector<size_
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Exclude cells with very small volumes
|
// Exclude cells with very small volumes
|
||||||
const double tolerance = 0.2;
|
if ( bb.extent().z() > tolerance )
|
||||||
if ( bb.extent().z() < tolerance ) continue;
|
{
|
||||||
|
|
||||||
iLengthAccumulated += ( cornerVerts[faceConnPosI[0]] - cornerVerts[faceConnNegI[0]] ).lengthSquared();
|
iLengthAccumulated += ( cornerVerts[faceConnPosI[0]] - cornerVerts[faceConnNegI[0]] ).lengthSquared();
|
||||||
iLengthAccumulated += ( cornerVerts[faceConnPosI[1]] - cornerVerts[faceConnNegI[3]] ).lengthSquared();
|
iLengthAccumulated += ( cornerVerts[faceConnPosI[1]] - cornerVerts[faceConnNegI[3]] ).lengthSquared();
|
||||||
iLengthAccumulated += ( cornerVerts[faceConnPosI[2]] - cornerVerts[faceConnNegI[2]] ).lengthSquared();
|
iLengthAccumulated += ( cornerVerts[faceConnPosI[2]] - cornerVerts[faceConnNegI[2]] ).lengthSquared();
|
||||||
@@ -417,10 +427,15 @@ void StructGridInterface::computeCharacteristicCellSize( const std::vector<size_
|
|||||||
|
|
||||||
evaluatedCellCount++;
|
evaluatedCellCount++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
index += stride;
|
index += stride;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iterationIndex++;
|
||||||
|
|
||||||
|
if ( evaluatedCellCount > 10 || iterationIndex == iterationMaxCount )
|
||||||
|
{
|
||||||
double divisor = evaluatedCellCount * 4.0;
|
double divisor = evaluatedCellCount * 4.0;
|
||||||
|
|
||||||
if ( divisor > 0.0 )
|
if ( divisor > 0.0 )
|
||||||
@@ -428,6 +443,10 @@ void StructGridInterface::computeCharacteristicCellSize( const std::vector<size_
|
|||||||
m_characteristicCellSizeI = cvf::Math::sqrt( iLengthAccumulated / divisor );
|
m_characteristicCellSizeI = cvf::Math::sqrt( iLengthAccumulated / divisor );
|
||||||
m_characteristicCellSizeJ = cvf::Math::sqrt( jLengthAccumulated / divisor );
|
m_characteristicCellSizeJ = cvf::Math::sqrt( jLengthAccumulated / divisor );
|
||||||
m_characteristicCellSizeK = cvf::Math::sqrt( kLengthAccumulated / divisor );
|
m_characteristicCellSizeK = cvf::Math::sqrt( kLengthAccumulated / divisor );
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user