#6423 Fracture Model: Export "Deviation.frk" file.

This commit is contained in:
Kristian Bendiksen 2020-09-04 14:36:30 +02:00
parent 0c275a6d9c
commit ccd99adb84
4 changed files with 172 additions and 1 deletions

View File

@ -55,6 +55,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RifRoffReader.h
${CMAKE_CURRENT_LIST_DIR}/RifColorLegendData.h
${CMAKE_CURRENT_LIST_DIR}/RifElasticPropertiesReader.h
${CMAKE_CURRENT_LIST_DIR}/RifFractureModelPlotExporter.h
${CMAKE_CURRENT_LIST_DIR}/RifFractureModelGeologicalFrkExporter.h
${CMAKE_CURRENT_LIST_DIR}/RifFractureModelDeviationFrkExporter.h
${CMAKE_CURRENT_LIST_DIR}/RifSurfaceExporter.h
@ -117,6 +119,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RifColorLegendData.cpp
${CMAKE_CURRENT_LIST_DIR}/RifElasticPropertiesReader.cpp
${CMAKE_CURRENT_LIST_DIR}/RifFractureModelPlotExporter.cpp
${CMAKE_CURRENT_LIST_DIR}/RifFractureModelGeologicalFrkExporter.cpp
${CMAKE_CURRENT_LIST_DIR}/RifFractureModelDeviationFrkExporter.cpp
${CMAKE_CURRENT_LIST_DIR}/RifSurfaceExporter.cpp
# HDF5 file reader is directly included in ResInsight main CmakeList.txt

View File

@ -0,0 +1,126 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RifFractureModelDeviationFrkExporter.h"
#include "RimFractureModel.h"
#include "RimFractureModelPlot.h"
#include "RimWellPath.h"
#include "RigWellPathGeometryExporter.h"
#include <QFile>
#include <QTextStream>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifFractureModelDeviationFrkExporter::writeToFile( RimFractureModelPlot* plot, const QString& filepath )
{
RimFractureModel* fractureModel = plot->fractureModel();
if ( !fractureModel )
{
return false;
}
RimWellPath* wellPath = fractureModel->wellPath();
if ( !wellPath )
{
return false;
}
QFile data( filepath );
if ( !data.open( QFile::WriteOnly | QFile::Truncate ) )
{
return false;
}
QTextStream stream( &data );
appendHeaderToStream( stream );
bool useMdRkb = false;
double mdStepSize = 5.0;
std::vector<double> xValues;
std::vector<double> yValues;
std::vector<double> tvdValues;
std::vector<double> mdValues;
RigWellPathGeometryExporter::exportWellPathGeometry( wellPath, mdStepSize, xValues, yValues, tvdValues, mdValues, useMdRkb );
convertFromMeterToFeet( mdValues );
convertFromMeterToFeet( tvdValues );
appendToStream( stream, "mdArray", mdValues );
appendToStream( stream, "tvdArray", tvdValues );
appendFooterToStream( stream );
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifFractureModelDeviationFrkExporter::appendHeaderToStream( QTextStream& stream )
{
stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl << "<deviation>" << endl;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifFractureModelDeviationFrkExporter::appendToStream( QTextStream& stream,
const QString& label,
const std::vector<double>& values )
{
stream << "<cNamedSet>" << endl
<< "<name>" << endl
<< label << endl
<< "</name>" << endl
<< "<dimCount>" << endl
<< 1 << endl
<< "</dimCount>" << endl
<< "<sizes>" << endl
<< values.size() << endl
<< "</sizes>" << endl
<< "<data>" << endl;
for ( auto val : values )
{
stream << val << endl;
}
stream << "</data>" << endl << "</cNamedSet>" << endl;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifFractureModelDeviationFrkExporter::appendFooterToStream( QTextStream& stream )
{
stream << "</deviation>" << endl;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifFractureModelDeviationFrkExporter::convertFromMeterToFeet( std::vector<double>& data )
{
for ( size_t i = 0; i < data.size(); i++ )
{
data[i] = RiaEclipseUnitTools::meterToFeet( data[i] );
}
}

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <vector>
class RimFractureModelPlot;
class QString;
class QTextStream;
//==================================================================================================
//
//==================================================================================================
class RifFractureModelDeviationFrkExporter
{
public:
static bool writeToFile( RimFractureModelPlot* plot, const QString& filepath );
private:
static void appendHeaderToStream( QTextStream& stream );
static void appendToStream( QTextStream& stream, const QString& label, const std::vector<double>& values );
static void appendFooterToStream( QTextStream& stream );
static void convertFromMeterToFeet( std::vector<double>& data );
};

View File

@ -18,6 +18,7 @@
#include "RifFractureModelPlotExporter.h"
#include "RifFractureModelDeviationFrkExporter.h"
#include "RifFractureModelGeologicalFrkExporter.h"
#include "RimFractureModelPlot.h"
@ -29,5 +30,6 @@ bool RifFractureModelPlotExporter::writeToDirectory( RimFractureModelPlot* plot,
bool useDetailedFluidLoss,
const QString& directoryPath )
{
return RifFractureModelGeologicalFrkExporter::writeToFile( plot, useDetailedFluidLoss, directoryPath + "/Geological.frk" );
return RifFractureModelGeologicalFrkExporter::writeToFile( plot, useDetailedFluidLoss, directoryPath + "/Geological.frk" ) &&
RifFractureModelDeviationFrkExporter::writeToFile( plot, directoryPath + "/Deviation.frk" );
}