#2715 Geo Mech : Show element type in Result Info

This commit is contained in:
Magne Sjaastad 2018-04-25 07:46:04 +02:00
parent bc26fa697c
commit 9856038524
3 changed files with 65 additions and 33 deletions

View File

@ -19,15 +19,16 @@
#include "RigFemTypes.h" #include "RigFemTypes.h"
#include <QString>
#include <assert.h>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
int RigFemTypes::elmentNodeCount(RigElementType elmType) int RigFemTypes::elmentNodeCount(RigElementType elmType)
{ {
static int elementTypeCounts[3] ={ 8, 8, 4 }; static int elementTypeCounts[3] = {8, 8, 4};
return elementTypeCounts[elmType]; return elementTypeCounts[elmType];
} }
@ -37,7 +38,7 @@ int RigFemTypes::elmentNodeCount(RigElementType elmType)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
int RigFemTypes::elmentFaceCount(RigElementType elmType) int RigFemTypes::elmentFaceCount(RigElementType elmType)
{ {
const static int elementFaceCounts[3] ={ 6, 6, 1 }; const static int elementFaceCounts[3] = {6, 6, 1};
return elementFaceCounts[elmType]; return elementFaceCounts[elmType];
} }
@ -57,8 +58,8 @@ int RigFemTypes::elmentFaceCount(RigElementType elmType)
const int* RigFemTypes::localElmNodeIndicesForFace(RigElementType elmType, int faceIdx, int* faceNodeCount) const int* RigFemTypes::localElmNodeIndicesForFace(RigElementType elmType, int faceIdx, int* faceNodeCount)
{ {
static const int HEX8_Faces[6][4] ={ { 1, 2, 6, 5 }, { 0, 4, 7, 3 }, { 3, 7, 6, 2 }, { 0, 1, 5, 4 }, { 4, 5, 6, 7 }, { 0, 3, 2, 1 } }; static const int HEX8_Faces[6][4] = {{1, 2, 6, 5}, {0, 4, 7, 3}, {3, 7, 6, 2}, {0, 1, 5, 4}, {4, 5, 6, 7}, {0, 3, 2, 1}};
static const int CAX4_Faces[4] ={ 0, 1, 2, 3 }; static const int CAX4_Faces[4] = {0, 1, 2, 3};
switch (elmType) switch (elmType)
{ {
@ -81,7 +82,7 @@ const int* RigFemTypes::localElmNodeIndicesForFace(RigElementType elmType, int f
int RigFemTypes::oppositeFace(RigElementType elmType, int faceIdx) int RigFemTypes::oppositeFace(RigElementType elmType, int faceIdx)
{ {
static const int HEX8_OppositeFaces[6]={ 1, 0, 3, 2, 5, 4}; static const int HEX8_OppositeFaces[6] = {1, 0, 3, 2, 5, 4};
switch (elmType) switch (elmType)
{ {
@ -106,7 +107,7 @@ int RigFemTypes::oppositeFace(RigElementType elmType, int faceIdx)
const int* RigFemTypes::localElmNodeToIntegrationPointMapping(RigElementType elmType) const int* RigFemTypes::localElmNodeToIntegrationPointMapping(RigElementType elmType)
{ {
static const int HEX8_Mapping[8] ={ 0, 1, 3, 2, 4, 5, 7, 6 }; static const int HEX8_Mapping[8] = {0, 1, 3, 2, 4, 5, 7, 6};
switch (elmType) switch (elmType)
{ {
@ -124,3 +125,30 @@ const int* RigFemTypes::localElmNodeToIntegrationPointMapping(RigElementType elm
return HEX8_Mapping; return HEX8_Mapping;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RigFemTypes::elementTypeText(RigElementType elemType)
{
QString txt = "UNKNOWN_ELM_TYPE";
switch (elemType)
{
case HEX8:
txt = "HEX8";
break;
case HEX8P:
txt = "HEX8P";
break;
case CAX4:
txt = "CAX4";
break;
case UNKNOWN_ELM_TYPE:
break;
default:
break;
}
return txt;
}

View File

@ -18,7 +18,8 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once
#include <assert.h>
class QString;
enum RigElementType enum RigElementType
{ {
@ -36,4 +37,5 @@ public:
static const int* localElmNodeIndicesForFace(RigElementType elmType, int faceIdx, int* faceNodeCount); static const int* localElmNodeIndicesForFace(RigElementType elmType, int faceIdx, int* faceNodeCount);
static int oppositeFace(RigElementType elmType, int faceIdx); static int oppositeFace(RigElementType elmType, int faceIdx);
static const int* localElmNodeToIntegrationPointMapping(RigElementType elmType); static const int* localElmNodeToIntegrationPointMapping(RigElementType elmType);
static QString elementTypeText(RigElementType elemType);
}; };

View File

@ -129,7 +129,9 @@ QString RiuFemResultTextBuilder::geometrySelectionText(QString itemSeparator)
RigFemPart* femPart = geomData->femParts()->part(m_gridIndex); RigFemPart* femPart = geomData->femParts()->part(m_gridIndex);
int elementId = femPart->elmId(m_cellIndex); int elementId = femPart->elmId(m_cellIndex);
text += QString("Element : Id[%1]").arg(elementId); auto elementType = femPart->elementType(m_cellIndex);
text += QString("Element : Id[%1], Type[%2]").arg(elementId).arg(RigFemTypes::elementTypeText(elementType));
size_t i = 0; size_t i = 0;
size_t j = 0; size_t j = 0;
@ -141,7 +143,7 @@ QString RiuFemResultTextBuilder::geometrySelectionText(QString itemSeparator)
j++; j++;
k++; k++;
cvf::Vec3d domainCoord = m_intersectionPoint; // + geomCase->femParts()->displayModelOffset(); cvf::Vec3d domainCoord = m_intersectionPoint;
//cvf::StructGridInterface::FaceEnum faceEnum(m_face); //cvf::StructGridInterface::FaceEnum faceEnum(m_face);