///////////////////////////////////////////////////////////////////////////////// // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RifFractureModelDeviationFrkExporter.h" #include "RimFractureModel.h" #include "RimFractureModelPlot.h" #include "RimWellPath.h" #include "RigWellPathGeometryExporter.h" #include #include //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- 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 xValues; std::vector yValues; std::vector tvdValues; std::vector 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 << "" << endl << "" << endl; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RifFractureModelDeviationFrkExporter::appendToStream( QTextStream& stream, const QString& label, const std::vector& values ) { stream << "" << endl << "" << endl << label << endl << "" << endl << "" << endl << 1 << endl << "" << endl << "" << endl << values.size() << endl << "" << endl << "" << endl; for ( auto val : values ) { stream << val << endl; } stream << "" << endl << "" << endl; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RifFractureModelDeviationFrkExporter::appendFooterToStream( QTextStream& stream ) { stream << "" << endl; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RifFractureModelDeviationFrkExporter::convertFromMeterToFeet( std::vector& data ) { for ( size_t i = 0; i < data.size(); i++ ) { data[i] = RiaEclipseUnitTools::meterToFeet( data[i] ); } }