mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Unit test to export xyz coordinates for N timesteps for a thermal fracture
This commit is contained in:
parent
b641d6b86f
commit
5dc020ccb7
@ -5,6 +5,9 @@
|
|||||||
#include "RifThermalFractureReader.h"
|
#include "RifThermalFractureReader.h"
|
||||||
#include "RigThermalFractureDefinition.h"
|
#include "RigThermalFractureDefinition.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
static const QString CASE_REAL_TEST_DATA_DIRECTORY_03 = QString( "%1/RifThermalFractureReader/" ).arg( TEST_DATA_DIR );
|
static const QString CASE_REAL_TEST_DATA_DIRECTORY_03 = QString( "%1/RifThermalFractureReader/" ).arg( TEST_DATA_DIR );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -105,3 +108,50 @@ TEST( RifThermalFractureReaderTest, LoadFileNonExistingFiles )
|
|||||||
EXPECT_FALSE( errorMessage.isEmpty() );
|
EXPECT_FALSE( errorMessage.isEmpty() );
|
||||||
EXPECT_FALSE( fractureData.get() );
|
EXPECT_FALSE( fractureData.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
TEST( DISABLED_RifThermalFractureReaderTest, CreateXyzPointCloud )
|
||||||
|
{
|
||||||
|
QString fileName = CASE_REAL_TEST_DATA_DIRECTORY_03 + "fracture_OS_metric_units_final.csv";
|
||||||
|
|
||||||
|
auto [fractureData, errorMessage] = RifThermalFractureReader::readFractureCsvFile( fileName );
|
||||||
|
|
||||||
|
auto numNodes = fractureData->numNodes();
|
||||||
|
auto numTimeSteps = fractureData->numTimeSteps();
|
||||||
|
auto properties = fractureData->getPropertyNamesUnits();
|
||||||
|
|
||||||
|
for ( size_t timeStepIndex = 0; timeStepIndex < numTimeSteps; timeStepIndex++ )
|
||||||
|
{
|
||||||
|
QString exportfileName = QString( CASE_REAL_TEST_DATA_DIRECTORY_03 + "msjtest-%1.xyz" ).arg( timeStepIndex );
|
||||||
|
|
||||||
|
std::vector<double> xs;
|
||||||
|
std::vector<double> ys;
|
||||||
|
std::vector<double> zs;
|
||||||
|
|
||||||
|
for ( int nodeIndex = 0; nodeIndex < static_cast<int>( numNodes ); nodeIndex++ )
|
||||||
|
{
|
||||||
|
xs.push_back(
|
||||||
|
fractureData->getPropertyValue( 0, static_cast<int>( nodeIndex ), static_cast<int>( timeStepIndex ) ) );
|
||||||
|
ys.push_back(
|
||||||
|
fractureData->getPropertyValue( 1, static_cast<int>( nodeIndex ), static_cast<int>( timeStepIndex ) ) );
|
||||||
|
zs.push_back(
|
||||||
|
fractureData->getPropertyValue( 2, static_cast<int>( nodeIndex ), static_cast<int>( timeStepIndex ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile file( exportfileName );
|
||||||
|
if ( file.open( QIODevice::WriteOnly | QIODevice::Text ) )
|
||||||
|
{
|
||||||
|
QTextStream out( &file );
|
||||||
|
|
||||||
|
out.setRealNumberPrecision( 16 );
|
||||||
|
|
||||||
|
for ( size_t i = 0; i < xs.size(); i++ )
|
||||||
|
{
|
||||||
|
out << xs[i] << " " << ys[i] << " " << zs[i] << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user