From 9856038524530c70ab8640a4f65221d9e0881023 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 25 Apr 2018 07:46:04 +0200 Subject: [PATCH] #2715 Geo Mech : Show element type in Result Info --- .../GeoMech/GeoMechDataModel/RigFemTypes.cpp | 74 +++++++++++++------ .../GeoMech/GeoMechDataModel/RigFemTypes.h | 18 +++-- .../UserInterface/RiuFemResultTextBuilder.cpp | 6 +- 3 files changed, 65 insertions(+), 33 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.cpp index 566d09f74c..e3233be517 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.cpp @@ -2,63 +2,64 @@ // // Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Ceetron Solutions AS -// +// // 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 +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RigFemTypes.h" +#include - +#include //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- int RigFemTypes::elmentNodeCount(RigElementType elmType) { - static int elementTypeCounts[3] ={ 8, 8, 4 }; + static int elementTypeCounts[3] = {8, 8, 4}; return elementTypeCounts[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]; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- // HEX8 // 7---------6 Increased k -> Increased depth : 4 5 6 7 is the deepest quad -// /| /| |k -// / | / | | /j -// 4---------5 | |/ -// | 3------|--2 *---i -// | / | / -// |/ |/ -// 0---------1 +// /| /| |k +// / | / | | /j +// 4---------5 | |/ +// | 3------|--2 *---i +// | / | / +// |/ |/ +// 0---------1 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 CAX4_Faces[4] ={ 0, 1, 2, 3 }; + 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}; switch (elmType) { @@ -81,8 +82,8 @@ const int* RigFemTypes::localElmNodeIndicesForFace(RigElementType elmType, int f 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) { case HEX8: @@ -101,12 +102,12 @@ int RigFemTypes::oppositeFace(RigElementType elmType, int faceIdx) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- 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) { @@ -124,3 +125,30 @@ const int* RigFemTypes::localElmNodeToIntegrationPointMapping(RigElementType elm 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; +} diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.h index eb9a70dfcb..723685fd68 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.h @@ -2,23 +2,24 @@ // // Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Ceetron Solutions AS -// +// // 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 +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once -#include + +class QString; enum RigElementType { @@ -31,9 +32,10 @@ enum RigElementType class RigFemTypes { public: - static int elmentNodeCount(RigElementType elmType); - static int elmentFaceCount(RigElementType elmType); + static int elmentNodeCount(RigElementType elmType); + static int elmentFaceCount(RigElementType elmType); 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 QString elementTypeText(RigElementType elemType); }; diff --git a/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp b/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp index 204860b147..926377aaeb 100644 --- a/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp +++ b/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp @@ -129,7 +129,9 @@ QString RiuFemResultTextBuilder::geometrySelectionText(QString itemSeparator) RigFemPart* femPart = geomData->femParts()->part(m_gridIndex); 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 j = 0; @@ -141,7 +143,7 @@ QString RiuFemResultTextBuilder::geometrySelectionText(QString itemSeparator) j++; k++; - cvf::Vec3d domainCoord = m_intersectionPoint; // + geomCase->femParts()->displayModelOffset(); + cvf::Vec3d domainCoord = m_intersectionPoint; //cvf::StructGridInterface::FaceEnum faceEnum(m_face);