mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Surface Import : import of properties from TS files #5995
This commit is contained in:
committed by
Magne Sjaastad
parent
66037da9d5
commit
e5f3a3b67d
@@ -2,8 +2,10 @@
|
||||
|
||||
#include "RifSurfaceReader.h"
|
||||
|
||||
#include "QDir"
|
||||
#include "RiaTestDataDirectory.h"
|
||||
#include "RigGocadData.h"
|
||||
|
||||
#include "QDir"
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -15,8 +17,10 @@ TEST( RifSurfaceReader, GocadReadValidFile )
|
||||
QString filePath = baseFolder.absoluteFilePath( filename );
|
||||
EXPECT_TRUE( QFile::exists( filePath ) );
|
||||
|
||||
auto surface = RifSurfaceReader::readGocadFile( filePath );
|
||||
RigGocadData gocadData;
|
||||
RifSurfaceReader::readGocadFile( filePath, &gocadData );
|
||||
|
||||
auto surface = gocadData.gocadGeometry();
|
||||
auto vertices = surface.first;
|
||||
auto indices = surface.second;
|
||||
|
||||
@@ -35,8 +39,10 @@ TEST( RifSurfaceReader, GocadReadWrongIndices )
|
||||
QString filePath = baseFolder.absoluteFilePath( filename );
|
||||
EXPECT_TRUE( QFile::exists( filePath ) );
|
||||
|
||||
auto surface = RifSurfaceReader::readGocadFile( filePath );
|
||||
RigGocadData gocadData;
|
||||
RifSurfaceReader::readGocadFile( filePath, &gocadData );
|
||||
|
||||
auto surface = gocadData.gocadGeometry();
|
||||
auto vertices = surface.first;
|
||||
auto indices = surface.second;
|
||||
|
||||
@@ -44,6 +50,47 @@ TEST( RifSurfaceReader, GocadReadWrongIndices )
|
||||
EXPECT_EQ( (size_t)15, indices.size() );
|
||||
}
|
||||
|
||||
TEST( RifSurfaceReader, GocadReadProperties )
|
||||
{
|
||||
QDir baseFolder( TEST_DATA_DIR );
|
||||
|
||||
QString filename( "RifSurfaceReader/geom_with_properties.ts" );
|
||||
QString filePath = baseFolder.absoluteFilePath( filename );
|
||||
EXPECT_TRUE( QFile::exists( filePath ) );
|
||||
|
||||
RigGocadData gocadData;
|
||||
RifSurfaceReader::readGocadFile( filePath, &gocadData );
|
||||
|
||||
auto surface = gocadData.gocadGeometry();
|
||||
auto vertices = surface.first;
|
||||
auto indices = surface.second;
|
||||
|
||||
std::vector<QString> propNames = gocadData.propertyNames();
|
||||
|
||||
EXPECT_TRUE( propNames.size() == 3 );
|
||||
EXPECT_TRUE( propNames[0] == "SX" );
|
||||
|
||||
std::vector<float> propValues_SX = gocadData.propertyValues( propNames[0] );
|
||||
|
||||
float SX_first = propValues_SX[0];
|
||||
float SX_second = propValues_SX[1];
|
||||
float SX_last = propValues_SX[propValues_SX.size() - 1];
|
||||
|
||||
EXPECT_NEAR( 0.000907, SX_first, 1e-4 );
|
||||
EXPECT_NEAR( 0.000972, SX_second, 1e-4 );
|
||||
EXPECT_NEAR( 0.004293, SX_last, 1e-4 );
|
||||
|
||||
std::vector<float> propValues_SY = gocadData.propertyValues( "SY" );
|
||||
|
||||
float SY_first = propValues_SY[0];
|
||||
float SY_second = propValues_SY[1];
|
||||
float SY_last = propValues_SY[propValues_SX.size() - 1];
|
||||
|
||||
EXPECT_NEAR( 0.001550, SY_first, 1e-4 );
|
||||
EXPECT_NEAR( 0.001620, SY_second, 1e-4 );
|
||||
EXPECT_NEAR( 0.010476, SY_last, 1e-4 );
|
||||
}
|
||||
|
||||
TEST( RifSurfaceReader, ReadWrongFileType )
|
||||
{
|
||||
QDir baseFolder( TEST_DATA_DIR );
|
||||
@@ -53,8 +100,10 @@ TEST( RifSurfaceReader, ReadWrongFileType )
|
||||
QString filePath = baseFolder.absoluteFilePath( filename );
|
||||
EXPECT_TRUE( QFile::exists( filePath ) );
|
||||
|
||||
auto surface = RifSurfaceReader::readGocadFile( filePath );
|
||||
RigGocadData gocadData;
|
||||
RifSurfaceReader::readGocadFile( filePath, &gocadData );
|
||||
|
||||
auto surface = gocadData.gocadGeometry();
|
||||
auto vertices = surface.first;
|
||||
auto indices = surface.second;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user