mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Thermal Fracture: add python script for exporting template as surface.
This commit is contained in:
@@ -59,6 +59,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelDeviationFrkExporter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelPerfsFrkExporter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelAsymmetricFrkExporter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifThermalFractureTemplateSurfaceExporter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSurfaceExporter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFaultRAXmlWriter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFaultRAJsonWriter.h
|
||||
@@ -135,6 +136,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelDeviationFrkExporter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelPerfsFrkExporter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelAsymmetricFrkExporter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifThermalFractureTemplateSurfaceExporter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSurfaceExporter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFaultRAXmlWriter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFaultRAJsonWriter.cpp
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2022- 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 "RifThermalFractureTemplateSurfaceExporter.h"
|
||||
|
||||
#include "RigThermalFractureDefinition.h"
|
||||
#include "RimThermalFractureTemplate.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifThermalFractureTemplateSurfaceExporter::writeToFile( RimThermalFractureTemplate* fractureTemplate,
|
||||
int timeStepIndex,
|
||||
const QString& filePath )
|
||||
{
|
||||
auto fractureData = fractureTemplate->fractureDefinition();
|
||||
auto numNodes = fractureData->numNodes();
|
||||
auto numTimeSteps = fractureData->numTimeSteps();
|
||||
auto properties = fractureData->getPropertyNamesUnits();
|
||||
|
||||
if ( timeStepIndex < 0 || timeStepIndex >= static_cast<int>( numTimeSteps ) ) return false;
|
||||
|
||||
QFile file( filePath );
|
||||
if ( file.open( QIODevice::WriteOnly | QIODevice::Text ) )
|
||||
{
|
||||
QTextStream out( &file );
|
||||
|
||||
out.setRealNumberPrecision( 16 );
|
||||
|
||||
auto nameAndUnits = fractureData->getPropertyNamesUnits();
|
||||
int numProperties = nameAndUnits.size();
|
||||
|
||||
for ( auto [name, unit] : nameAndUnits )
|
||||
{
|
||||
out << name << " ";
|
||||
}
|
||||
|
||||
out << "\n";
|
||||
|
||||
for ( int nodeIndex = 0; nodeIndex < static_cast<int>( numNodes ); nodeIndex++ )
|
||||
{
|
||||
for ( int propertyIndex = 0; propertyIndex < numProperties; propertyIndex++ )
|
||||
{
|
||||
double value = fractureData->getPropertyValue( propertyIndex, nodeIndex, timeStepIndex );
|
||||
out << value;
|
||||
if ( propertyIndex < numProperties - 1 ) out << " ";
|
||||
}
|
||||
|
||||
out << "\n";
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2022- 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
|
||||
|
||||
class RimThermalFractureTemplate;
|
||||
class QString;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RifThermalFractureTemplateSurfaceExporter
|
||||
{
|
||||
public:
|
||||
static bool writeToFile( RimThermalFractureTemplate* stimPlanModel, int timeStep, const QString& filePath );
|
||||
};
|
||||
Reference in New Issue
Block a user