2015-06-11 04:38:51 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) Statoil ASA
|
|
|
|
// Copyright (C) Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-06-11 04:38:51 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-06-11 04:38:51 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2015-06-11 04:38:51 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RiuFemResultTextBuilder.h"
|
|
|
|
|
2023-08-23 06:29:54 -05:00
|
|
|
#include "RigFemAddressDefines.h"
|
Split fem part results collection 5785 (#5871)
* #5785 Extract RigFemClosestResultIndexCalculator class to separate file.
* #5785 Move method implementation of RigFemClosestResutIndexCalculator to cpp file.
Also improve const correctness.
* #5785 Extract method for calculating normal SE, ie. SE:11/22/33.
* #5785 Extract method for calculating shear SE, ie. SE:12/13/23.
* #5785 Create a list of result calculators.
* #5785 Extract method for calculating timelapse, normalized, and gamma results.
* #5785 Extract method for calculating normal ST, ie. ST:11/22/33.
* #5785 Extract method for calculating shear ST, ie. ST:12/13/23.
* #5785 Extract method for calculating surface angles and aligned stress.
* #5785 Extract method for calculating principal strain and stress.
* #5785 Extract method for calculating FOS, SFI and DSM for SE.
* #5785 Extract method for calculating NE.EV, NE.ED, ST.Q and ST.STM.
* #5785 Extract method for calculating compaction.
* #5785 Extract method for calculating stress gradients.
* #5785 Extract method for calculating SE.SEM.
* #5785 Extract method for calculating NE.
* #5785 Extract method for calculating formation indices.
* #5785 Extract method for calculating nodal graidents, bar conversions, and EnIpPorBar.
* #5785 Use std::unique_ptr to calculators.
* Use std::vector<unique_ptr>
Co-authored-by: Magne Sjaastad <magne.sjaastad@ceetronsolutions.com>
2020-05-09 01:57:07 -05:00
|
|
|
#include "RigFemClosestResultIndexCalculator.h"
|
2015-06-11 04:38:51 -05:00
|
|
|
#include "RigFemPart.h"
|
2016-10-18 00:31:02 -05:00
|
|
|
#include "RigFemPartCollection.h"
|
2015-06-11 04:38:51 -05:00
|
|
|
#include "RigFemPartGrid.h"
|
|
|
|
#include "RigFemPartResultsCollection.h"
|
2016-09-06 03:27:30 -05:00
|
|
|
#include "RigFormationNames.h"
|
2016-10-18 00:31:02 -05:00
|
|
|
#include "RigGeoMechCaseData.h"
|
2018-05-18 07:04:36 -05:00
|
|
|
|
|
|
|
#include "Rim2dIntersectionView.h"
|
2016-10-18 00:31:02 -05:00
|
|
|
#include "RimFormationNames.h"
|
|
|
|
#include "RimGeoMechCase.h"
|
|
|
|
#include "RimGeoMechResultDefinition.h"
|
|
|
|
#include "RimGeoMechView.h"
|
2018-05-18 07:04:36 -05:00
|
|
|
|
2016-10-26 10:05:39 -05:00
|
|
|
#include "RiuGeoMechXfTensorResultAccessor.h"
|
2018-05-18 07:04:36 -05:00
|
|
|
|
2019-11-26 04:51:54 -06:00
|
|
|
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2018-05-18 07:04:36 -05:00
|
|
|
#include "cafDisplayCoordTransform.h"
|
|
|
|
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-28 02:18:19 -06:00
|
|
|
RiuFemResultTextBuilder::RiuFemResultTextBuilder( RimGridView* displayCoordView,
|
|
|
|
RimGeoMechResultDefinition* geomResDef,
|
|
|
|
int gridIndex,
|
|
|
|
int cellIndex,
|
2023-01-18 07:42:33 -06:00
|
|
|
int timeStepIndex,
|
|
|
|
int frameIndex )
|
2019-09-06 03:40:57 -05:00
|
|
|
: m_isIntersectionTriangleSet( false )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-11-28 02:18:19 -06:00
|
|
|
m_displayCoordView = displayCoordView;
|
|
|
|
m_geomResDef = geomResDef;
|
|
|
|
m_gridIndex = gridIndex;
|
|
|
|
m_cellIndex = cellIndex;
|
|
|
|
m_timeStepIndex = timeStepIndex;
|
2023-01-18 07:42:33 -06:00
|
|
|
m_frameIndex = frameIndex;
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2018-09-27 07:47:15 -05:00
|
|
|
m_intersectionPointInDisplay = cvf::Vec3d::UNDEFINED;
|
2019-09-06 03:40:57 -05:00
|
|
|
m_face = cvf::StructGridInterface::NO_FACE;
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RiuFemResultTextBuilder::setIntersectionPointInDisplay( cvf::Vec3d intersectionPointInDisplay )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2018-09-27 07:47:15 -05:00
|
|
|
m_intersectionPointInDisplay = intersectionPointInDisplay;
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
|
|
|
|
2016-10-26 10:05:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-10-26 10:05:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RiuFemResultTextBuilder::setIntersectionTriangle( const std::array<cvf::Vec3f, 3>& triangle )
|
2016-10-26 10:05:39 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_intersectionTriangle = triangle;
|
2016-10-26 10:05:39 -05:00
|
|
|
m_isIntersectionTriangleSet = true;
|
|
|
|
}
|
|
|
|
|
2018-02-16 07:37:59 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-02-16 07:37:59 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RiuFemResultTextBuilder::set2dIntersectionView( Rim2dIntersectionView* intersectionView )
|
2018-02-16 07:37:59 -06:00
|
|
|
{
|
|
|
|
m_2dIntersectionView = intersectionView;
|
|
|
|
}
|
|
|
|
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RiuFemResultTextBuilder::setFace( int face )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
|
|
|
m_face = face;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RiuFemResultTextBuilder::mainResultText()
|
|
|
|
{
|
|
|
|
QString text;
|
|
|
|
|
2019-11-28 02:18:19 -06:00
|
|
|
text = closestNodeResultText( m_geomResDef );
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !text.isEmpty() ) text += "\n";
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2023-08-04 02:04:14 -05:00
|
|
|
QString topoText = geometrySelectionText( "\n" );
|
2015-06-11 04:38:51 -05:00
|
|
|
text += topoText;
|
2019-09-06 03:40:57 -05:00
|
|
|
appendDetails( text, formationDetails() );
|
2015-06-11 04:38:51 -05:00
|
|
|
text += "\n";
|
|
|
|
|
2019-11-28 02:18:19 -06:00
|
|
|
if ( m_geomResDef->resultPositionType() != RIG_ELEMENT )
|
2018-01-19 06:36:51 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
appendDetails( text, gridResultDetails() );
|
2018-01-19 06:36:51 -06:00
|
|
|
}
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2015-10-23 08:46:25 -05:00
|
|
|
return text;
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
QString RiuFemResultTextBuilder::geometrySelectionText( QString itemSeparator )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
|
|
|
QString text;
|
|
|
|
|
2019-11-28 02:18:19 -06:00
|
|
|
if ( m_geomResDef->geoMechCase() )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-11-28 02:18:19 -06:00
|
|
|
RigGeoMechCaseData* geomData = m_geomResDef->geoMechCase()->geoMechData();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( geomData )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RigFemPart* femPart = geomData->femParts()->part( m_gridIndex );
|
|
|
|
int elementId = femPart->elmId( m_cellIndex );
|
|
|
|
auto elementType = femPart->elementType( m_cellIndex );
|
2018-04-25 00:46:04 -05:00
|
|
|
|
2023-12-14 01:46:41 -06:00
|
|
|
text +=
|
|
|
|
QString( "Element : Id[%1], Type[%2]" ).arg( elementId ).arg( QString::fromStdString( RigFemTypes::elementTypeText( elementType ) ) );
|
2015-06-11 04:38:51 -05:00
|
|
|
|
|
|
|
size_t i = 0;
|
|
|
|
size_t j = 0;
|
|
|
|
size_t k = 0;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( geomData->femParts()->part( m_gridIndex )->getOrCreateStructGrid()->ijkFromCellIndex( m_cellIndex, &i, &j, &k ) )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
|
|
|
// Adjust to 1-based Eclipse indexing
|
|
|
|
i++;
|
|
|
|
j++;
|
|
|
|
k++;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
text += QString( ", ijk[%1, %2, %3]" ).arg( i ).arg( j ).arg( k ) + itemSeparator;
|
2015-06-11 04:38:51 -05:00
|
|
|
|
|
|
|
QString formattedText;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_2dIntersectionView )
|
2018-02-16 07:37:59 -06:00
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
formattedText = QString( "Horizontal length from well start: %1" ).arg( m_intersectionPointInDisplay.x(), 5, 'f', 2 );
|
2018-02-16 07:37:59 -06:00
|
|
|
text += formattedText + itemSeparator;
|
|
|
|
|
2023-02-26 03:48:40 -06:00
|
|
|
cvf::Mat4d t = m_2dIntersectionView->flatIntersectionPartMgr()->unflattenTransformMatrix( m_intersectionPointInDisplay );
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !t.isZero() )
|
2018-02-16 07:37:59 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
cvf::Vec3d intPt = m_intersectionPointInDisplay.getTransformedPoint( t );
|
2020-09-07 02:20:55 -05:00
|
|
|
formattedText = QString( "Intersection point : [E: %1, N: %2, Depth: %3]" )
|
|
|
|
.arg( intPt.x(), 5, 'f', 2 )
|
|
|
|
.arg( intPt.y(), 5, 'f', 2 )
|
|
|
|
.arg( -intPt.z(), 5, 'f', 2 );
|
2018-02-16 07:37:59 -06:00
|
|
|
text += formattedText;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-28 02:18:19 -06:00
|
|
|
if ( m_displayCoordView )
|
|
|
|
{
|
|
|
|
cvf::ref<caf::DisplayCoordTransform> transForm = m_displayCoordView->displayCoordTransform();
|
2023-02-26 03:48:40 -06:00
|
|
|
cvf::Vec3d domainCoord = transForm->translateToDomainCoord( m_intersectionPointInDisplay );
|
2019-11-28 02:18:19 -06:00
|
|
|
|
2020-09-07 02:20:55 -05:00
|
|
|
formattedText = QString( "Intersection point : [E: %1, N: %2, Depth: %3]" )
|
|
|
|
.arg( domainCoord.x(), 5, 'f', 2 )
|
|
|
|
.arg( domainCoord.y(), 5, 'f', 2 )
|
|
|
|
.arg( -domainCoord.z(), 5, 'f', 2 );
|
2019-11-28 02:18:19 -06:00
|
|
|
text += formattedText;
|
|
|
|
}
|
2018-02-16 07:37:59 -06:00
|
|
|
}
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
2023-12-04 01:36:03 -06:00
|
|
|
std::array<cvf::Vec3d, 8> cornerCoords;
|
|
|
|
if ( femPart->fillElementCoordinates( m_cellIndex, cornerCoords ) )
|
|
|
|
{
|
|
|
|
text += "\n\nElement corners:\n";
|
|
|
|
|
|
|
|
for ( auto p : cornerCoords )
|
|
|
|
{
|
|
|
|
text +=
|
|
|
|
QString( " [E: %1, N: %2, Depth: %3]\n" ).arg( p.x(), 5, 'f', 2 ).arg( p.y(), 5, 'f', 2 ).arg( -p.z(), 5, 'f', 2 );
|
|
|
|
}
|
|
|
|
}
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RiuFemResultTextBuilder::gridResultDetails()
|
|
|
|
{
|
2015-10-23 08:46:25 -05:00
|
|
|
QString text;
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2019-11-28 02:18:19 -06:00
|
|
|
if ( m_geomResDef->geoMechCase() && m_geomResDef->geoMechCase()->geoMechData() )
|
2015-10-23 08:46:25 -05:00
|
|
|
{
|
2019-11-28 02:18:19 -06:00
|
|
|
RigGeoMechCaseData* eclipseCaseData = m_geomResDef->geoMechCase()->geoMechData();
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2023-08-04 02:04:14 -05:00
|
|
|
appendTextFromResultColors( eclipseCaseData, m_gridIndex, m_cellIndex, m_timeStepIndex, m_frameIndex, m_geomResDef, &text );
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !text.isEmpty() )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
text.prepend( "-- Element result details --\n" );
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
2015-10-23 08:46:25 -05:00
|
|
|
}
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2015-10-23 08:46:25 -05:00
|
|
|
return text;
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
|
|
|
|
2016-08-24 08:19:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-08-24 08:19:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RiuFemResultTextBuilder::formationDetails()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString text;
|
2019-11-28 02:18:19 -06:00
|
|
|
RimCase* rimCase = m_geomResDef->geoMechCase();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( rimCase )
|
2016-08-24 08:19:39 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( rimCase->activeFormationNames() && rimCase->activeFormationNames()->formationNamesData() )
|
2016-08-24 08:19:39 -05:00
|
|
|
{
|
|
|
|
RigFormationNames* formNames = rimCase->activeFormationNames()->formationNamesData();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
size_t k = cvf::UNDEFINED_SIZE_T;
|
2016-08-24 08:19:39 -05:00
|
|
|
{
|
2019-11-28 02:18:19 -06:00
|
|
|
if ( m_geomResDef->geoMechCase() )
|
2016-08-24 08:19:39 -05:00
|
|
|
{
|
2019-11-28 02:18:19 -06:00
|
|
|
RigGeoMechCaseData* geomData = m_geomResDef->geoMechCase()->geoMechData();
|
2018-04-23 09:35:19 -05:00
|
|
|
if ( geomData )
|
|
|
|
{
|
|
|
|
size_t i = 0;
|
|
|
|
size_t j = 0;
|
2023-02-26 03:48:40 -06:00
|
|
|
geomData->femParts()->part( m_gridIndex )->getOrCreateStructGrid()->ijkFromCellIndex( m_cellIndex, &i, &j, &k );
|
2018-04-23 09:35:19 -05:00
|
|
|
}
|
2016-08-24 08:19:39 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( k != cvf::UNDEFINED_SIZE_T )
|
2016-08-24 08:19:39 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString formName = formNames->formationNameFromKLayerIdx( k );
|
|
|
|
if ( !formName.isEmpty() )
|
2016-08-24 08:19:39 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
// text += "-- Formation details --\n";
|
2016-08-24 08:19:39 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
text += QString( "Formation Name: %1\n" ).arg( formName );
|
2016-08-24 08:19:39 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RiuFemResultTextBuilder::appendTextFromResultColors( RigGeoMechCaseData* geomData,
|
|
|
|
int gridIndex,
|
|
|
|
int cellIndex,
|
|
|
|
int timeStepIndex,
|
2023-01-18 07:42:33 -06:00
|
|
|
int frameIndex,
|
2019-09-06 03:40:57 -05:00
|
|
|
RimGeoMechResultDefinition* resultDefinition,
|
|
|
|
QString* resultInfoText )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !resultDefinition )
|
2015-10-23 08:46:25 -05:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( resultDefinition->hasResult() )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2024-02-19 08:29:43 -06:00
|
|
|
auto address = RigFemAddressDefines::getResultLookupAddress( resultDefinition->resultAddress() );
|
|
|
|
const std::vector<float>& scalarResults = geomData->femPartResults()->resultValues( address, gridIndex, timeStepIndex, frameIndex );
|
2023-09-27 01:07:49 -05:00
|
|
|
if ( !scalarResults.empty() )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2024-02-19 08:29:43 -06:00
|
|
|
caf::AppEnum<RigFemResultPosEnum> resPosAppEnum = address.resultPosType;
|
2019-09-06 03:40:57 -05:00
|
|
|
resultInfoText->append( resPosAppEnum.uiText() + ", " );
|
|
|
|
resultInfoText->append( resultDefinition->resultFieldUiName() + ", " );
|
|
|
|
resultInfoText->append( resultDefinition->resultComponentUiName() + ":\n" );
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2024-02-19 08:29:43 -06:00
|
|
|
if ( address.resultPosType != RIG_ELEMENT_NODAL_FACE )
|
2016-10-19 05:22:13 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RigFemPart* femPart = geomData->femParts()->part( gridIndex );
|
|
|
|
RigElementType elmType = femPart->elementType( cellIndex );
|
2020-06-08 04:09:11 -05:00
|
|
|
const int* elementConn = femPart->connectivities( cellIndex );
|
2020-06-03 15:31:58 -05:00
|
|
|
int elmNodeCount = RigFemTypes::elementNodeCount( elmType );
|
2019-09-06 03:40:57 -05:00
|
|
|
const int* lElmNodeToIpMap = RigFemTypes::localElmNodeToIntegrationPointMapping( elmType );
|
2016-10-19 05:22:13 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( int lNodeIdx = 0; lNodeIdx < elmNodeCount; ++lNodeIdx )
|
2016-10-19 05:22:13 -05:00
|
|
|
{
|
|
|
|
float scalarValue = std::numeric_limits<float>::infinity();
|
2020-06-03 15:31:58 -05:00
|
|
|
int nodeIdx = elementConn[lNodeIdx];
|
2024-02-19 08:29:43 -06:00
|
|
|
if ( address.resultPosType == RIG_NODAL ||
|
|
|
|
( address.resultPosType == RIG_DIFFERENTIALS &&
|
2023-08-23 06:29:54 -05:00
|
|
|
resultDefinition->resultFieldName() == QString::fromStdString( RigFemAddressDefines::porBar() ) ) )
|
2016-10-19 05:22:13 -05:00
|
|
|
{
|
|
|
|
scalarValue = scalarResults[nodeIdx];
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( resultDefinition->resultPositionType() == RIG_ELEMENT )
|
2018-01-10 09:32:59 -06:00
|
|
|
{
|
2018-01-11 03:58:52 -06:00
|
|
|
scalarValue = scalarResults[cellIndex];
|
2018-01-10 09:32:59 -06:00
|
|
|
}
|
2016-10-19 05:22:13 -05:00
|
|
|
else
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
size_t resIdx = femPart->elementNodeResultIdx( cellIndex, lNodeIdx );
|
|
|
|
scalarValue = scalarResults[resIdx];
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( resultDefinition->resultPositionType() == RIG_INTEGRATION_POINT )
|
2016-10-19 05:22:13 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
resultInfoText->append( QString( "\tIP:%1 \t: %2 \tAss. Node: \t%3" )
|
|
|
|
.arg( lElmNodeToIpMap[lNodeIdx] + 1 )
|
|
|
|
.arg( scalarValue )
|
|
|
|
.arg( femPart->nodes().nodeIds[nodeIdx] ) );
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
resultInfoText->append( QString( "\tN:%1 \t: %2" ).arg( femPart->nodes().nodeIds[nodeIdx] ).arg( scalarValue ) );
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
cvf::Vec3f nodeCoord = femPart->nodes().coordinates[nodeIdx];
|
2023-02-26 03:48:40 -06:00
|
|
|
resultInfoText->append( QString( "\t( %3, %4, %5)\n" ).arg( nodeCoord[0] ).arg( nodeCoord[1] ).arg( nodeCoord[2] ) );
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
int elmNodeFaceStartResIdx = cellIndex * 24;
|
|
|
|
|
|
|
|
resultInfoText->append( QString( "Pos I Face:\n" ) );
|
|
|
|
for ( int ptIdx = 0; ptIdx < 4; ++ptIdx )
|
2016-10-19 05:22:13 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
resultInfoText->append( QString( "\t%2\n" ).arg( scalarResults[elmNodeFaceStartResIdx + ptIdx] ) );
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
resultInfoText->append( QString( "Neg I Face:\n" ) );
|
|
|
|
for ( int ptIdx = 4; ptIdx < 8; ++ptIdx )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
resultInfoText->append( QString( "\t%2\n" ).arg( scalarResults[elmNodeFaceStartResIdx + ptIdx] ) );
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
resultInfoText->append( QString( "Pos J Face:\n" ) );
|
|
|
|
for ( int ptIdx = 8; ptIdx < 12; ++ptIdx )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
resultInfoText->append( QString( "\t%2\n" ).arg( scalarResults[elmNodeFaceStartResIdx + ptIdx] ) );
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
resultInfoText->append( QString( "Neg J Face:\n" ) );
|
|
|
|
for ( int ptIdx = 12; ptIdx < 16; ++ptIdx )
|
2016-10-19 05:22:13 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
resultInfoText->append( QString( "\t%2\n" ).arg( scalarResults[elmNodeFaceStartResIdx + ptIdx] ) );
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
resultInfoText->append( QString( "Pos K Face:\n" ) );
|
|
|
|
for ( int ptIdx = 16; ptIdx < 20; ++ptIdx )
|
2015-11-02 00:57:33 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
resultInfoText->append( QString( "\t%2\n" ).arg( scalarResults[elmNodeFaceStartResIdx + ptIdx] ) );
|
2015-11-02 00:57:33 -06:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
resultInfoText->append( QString( "Neg K Face:\n" ) );
|
|
|
|
for ( int ptIdx = 20; ptIdx < 24; ++ptIdx )
|
2015-11-02 00:57:33 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
resultInfoText->append( QString( "\t%2\n" ).arg( scalarResults[elmNodeFaceStartResIdx + ptIdx] ) );
|
2015-11-02 00:57:33 -06:00
|
|
|
}
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RiuFemResultTextBuilder::appendDetails( QString& text, const QString& details )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !details.isEmpty() )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
|
|
|
text += "\n";
|
|
|
|
text += details;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-06-11 04:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
QString RiuFemResultTextBuilder::closestNodeResultText( RimGeoMechResultDefinition* resultColors )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
|
|
|
QString text;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !resultColors )
|
2015-10-23 08:46:25 -05:00
|
|
|
{
|
|
|
|
return text;
|
|
|
|
}
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( resultColors->hasResult() )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-11-28 02:18:19 -06:00
|
|
|
if ( !( m_geomResDef->geoMechCase() && m_geomResDef->geoMechCase()->geoMechData() ) ) return text;
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2019-11-28 02:18:19 -06:00
|
|
|
RigGeoMechCaseData* geomData = m_geomResDef->geoMechCase()->geoMechData();
|
2015-06-11 04:38:51 -05:00
|
|
|
|
2024-02-19 08:29:43 -06:00
|
|
|
auto address = RigFemAddressDefines::getResultLookupAddress( resultColors->resultAddress() );
|
|
|
|
|
2023-02-26 03:48:40 -06:00
|
|
|
const std::vector<float>& scalarResults =
|
2024-02-19 08:29:43 -06:00
|
|
|
geomData->femPartResults()->resultValues( address, m_gridIndex, m_timeStepIndex, m_frameIndex );
|
2016-10-25 06:42:40 -05:00
|
|
|
|
2023-09-27 01:07:49 -05:00
|
|
|
if ( !scalarResults.empty() && m_displayCoordView )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RigFemPart* femPart = geomData->femParts()->part( m_gridIndex );
|
2024-02-19 08:29:43 -06:00
|
|
|
RigFemResultPosEnum activeResultPosition = address.resultPosType;
|
2016-10-25 06:42:40 -05:00
|
|
|
|
2020-02-12 04:43:15 -06:00
|
|
|
cvf::Vec3d intersectionPointInDomain =
|
|
|
|
m_displayCoordView->displayCoordTransform()->translateToDomainCoord( m_intersectionPointInDisplay );
|
2019-11-28 02:18:19 -06:00
|
|
|
|
2023-02-26 03:48:40 -06:00
|
|
|
RigFemClosestResultIndexCalculator closestIndexCalc( femPart, activeResultPosition, m_cellIndex, m_face, intersectionPointInDomain );
|
2019-11-28 02:18:19 -06:00
|
|
|
|
|
|
|
int resultIndex = closestIndexCalc.resultIndexToClosestResult();
|
|
|
|
int closestNodeId = closestIndexCalc.closestNodeId();
|
|
|
|
int closestElmNodResIdx = closestIndexCalc.closestElementNodeResIdx();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2020-02-12 04:43:15 -06:00
|
|
|
float scalarValue = ( resultIndex >= 0 ) ? scalarResults[resultIndex] : std::numeric_limits<float>::infinity();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
if ( activeResultPosition == RIG_ELEMENT )
|
2018-01-19 06:36:51 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
text.append( QString( "Element result: %1\n" ).arg( scalarValue ) );
|
2018-01-19 06:36:51 -06:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( activeResultPosition != RIG_ELEMENT_NODAL_FACE )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
text.append( QString( "Closest result: N[%1], %2\n" ).arg( closestNodeId ).arg( scalarValue ) );
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
2016-10-25 06:42:40 -05:00
|
|
|
else if ( m_face != -1 )
|
2015-06-11 04:38:51 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
text.append( QString( "Closest result: N[%1], on face: %2, %3\n" )
|
|
|
|
.arg( closestNodeId )
|
|
|
|
.arg( caf::AppEnum<cvf::StructGridInterface::FaceType>::textFromIndex( m_face ) )
|
|
|
|
.arg( scalarValue ) );
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( m_isIntersectionTriangleSet && activeResultPosition == RIG_ELEMENT_NODAL_FACE )
|
2016-10-26 10:05:39 -05:00
|
|
|
{
|
2024-02-19 08:29:43 -06:00
|
|
|
RiuGeoMechXfTensorResultAccessor tensAccessor( geomData->femPartResults(), address, m_gridIndex, m_timeStepIndex, m_frameIndex );
|
2019-09-06 03:40:57 -05:00
|
|
|
float tensValue = tensAccessor.calculateElmNodeValue( m_intersectionTriangle, closestElmNodResIdx );
|
|
|
|
|
|
|
|
text.append( QString( "Closest result: N[%1], in Element[%2] transformed onto intersection: %3 \n" )
|
|
|
|
.arg( closestNodeId )
|
|
|
|
.arg( femPart->elmId( m_cellIndex ) )
|
|
|
|
.arg( tensValue ) );
|
2016-10-26 10:05:39 -05:00
|
|
|
}
|
2015-06-11 04:38:51 -05:00
|
|
|
}
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2015-06-11 04:38:51 -05:00
|
|
|
return text;
|
|
|
|
}
|