mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6007 Rename Facies Properties to Elastic Properties.
This commit is contained in:
committed by
Magne Sjaastad
parent
466827e7d0
commit
5ddfd4f9da
189
ApplicationCode/ProjectDataModel/RimElasticProperties.cpp
Normal file
189
ApplicationCode/ProjectDataModel/RimElasticProperties.cpp
Normal file
@@ -0,0 +1,189 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimElasticProperties.h"
|
||||
|
||||
#include "RimFractureModel.h"
|
||||
|
||||
#include "RicElasticPropertiesImportTools.h"
|
||||
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiTextEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimElasticProperties, "ElasticProperties" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimElasticProperties::RimElasticProperties()
|
||||
{
|
||||
CAF_PDM_InitObject( "RimElasticProperties", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path", "", "", "" );
|
||||
m_filePath.uiCapability()->setUiReadOnly( true );
|
||||
m_filePath.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_propertiesTable, "PropertiesTable", "Properties Table", "", "", "" );
|
||||
m_propertiesTable.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() );
|
||||
m_propertiesTable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
m_propertiesTable.uiCapability()->setUiReadOnly( true );
|
||||
m_propertiesTable.xmlCapability()->disableIO();
|
||||
|
||||
setUiName( "Elastic Properties" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimElasticProperties::~RimElasticProperties()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimElasticProperties::filePath() const
|
||||
{
|
||||
return m_filePath.v().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimElasticProperties::setFilePath( const QString& filePath )
|
||||
{
|
||||
m_filePath = filePath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimElasticProperties::setPropertiesForFacies( FaciesKey& key, const RigElasticProperties& properties )
|
||||
{
|
||||
m_properties.insert( std::pair<FaciesKey, RigElasticProperties>( key, properties ) );
|
||||
m_propertiesTable = generatePropertiesTable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimElasticProperties::hasPropertiesForFacies( FaciesKey& key ) const
|
||||
{
|
||||
return m_properties.find( key ) != m_properties.end();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigElasticProperties& RimElasticProperties::propertiesForFacies( FaciesKey& key ) const
|
||||
{
|
||||
assert( hasPropertiesForFacies( key ) );
|
||||
return m_properties.find( key )->second;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimElasticProperties::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_propertiesTable )
|
||||
{
|
||||
auto myAttr = dynamic_cast<caf::PdmUiTextEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
{
|
||||
myAttr->wrapMode = caf::PdmUiTextEditorAttribute::NoWrap;
|
||||
myAttr->textMode = caf::PdmUiTextEditorAttribute::HTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimElasticProperties::generatePropertiesTable()
|
||||
{
|
||||
QString header( "<table border=1>"
|
||||
" <thead>"
|
||||
" <tr bgcolor=lightblue>"
|
||||
" <th>Field</th>"
|
||||
" <th>Formation</th>"
|
||||
" <th>Facies</th>"
|
||||
" <th>Porosity</th>"
|
||||
" <th>Young's<br>Modulus</th>"
|
||||
" <th>Poisson's<br>Ratio</th>"
|
||||
" <th>K-Ic</th>"
|
||||
" <th>Proppant<br>Embedment</th>"
|
||||
" </tr>"
|
||||
" </thead>"
|
||||
" <tbody>" );
|
||||
|
||||
QString body;
|
||||
for ( auto prop : m_properties )
|
||||
{
|
||||
const QString& fieldName = prop.second.fieldName();
|
||||
const std::vector<double>& porosity = prop.second.porosity();
|
||||
const std::vector<double>& youngsModulus = prop.second.youngsModulus();
|
||||
const std::vector<double>& poissonsRatio = prop.second.poissonsRatio();
|
||||
const std::vector<double>& K_Ic = prop.second.K_Ic();
|
||||
const std::vector<double>& proppantEmbedment = prop.second.proppantEmbedment();
|
||||
|
||||
for ( size_t i = 0; i < porosity.size(); i++ )
|
||||
{
|
||||
QString format( "<tr>"
|
||||
" <td>%1</td>"
|
||||
" <td>%2</td>"
|
||||
" <td>%3</td>"
|
||||
" <td align=right>%4</td>"
|
||||
" <td align=right>%5</td>"
|
||||
" <td align=right>%6</td>"
|
||||
" <td align=right>%7</td>"
|
||||
" <td align=right>%8</td>"
|
||||
"</tr>" );
|
||||
|
||||
QString line = format.arg( fieldName )
|
||||
.arg( prop.second.formationName() )
|
||||
.arg( prop.second.faciesName() )
|
||||
.arg( porosity[i] )
|
||||
.arg( youngsModulus[i] )
|
||||
.arg( poissonsRatio[i] )
|
||||
.arg( K_Ic[i] )
|
||||
.arg( proppantEmbedment[i] );
|
||||
|
||||
body.append( line );
|
||||
}
|
||||
}
|
||||
|
||||
QString footer( "</tbody></table>" );
|
||||
|
||||
return header + body + footer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimElasticProperties::loadDataAndUpdate()
|
||||
{
|
||||
if ( !m_filePath().path().isEmpty() )
|
||||
{
|
||||
RimFractureModel* fractureModel;
|
||||
firstAncestorOrThisOfType( fractureModel );
|
||||
RicElasticPropertiesImportTools::importElasticPropertiesFromFile( m_filePath().path(), fractureModel );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user