mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Moved the element type functions into a static class
This commit is contained in:
parent
c0217a68a4
commit
8be93ae448
@ -11,6 +11,7 @@ add_library( ${PROJECT_NAME}
|
|||||||
RigFemPart.h
|
RigFemPart.h
|
||||||
RigFemPart.cpp
|
RigFemPart.cpp
|
||||||
RigFemTypes.h
|
RigFemTypes.h
|
||||||
|
RigFemTypes.cpp
|
||||||
RigGeoMechCaseData.cpp
|
RigGeoMechCaseData.cpp
|
||||||
RigGeoMechCaseData.h
|
RigGeoMechCaseData.h
|
||||||
RigFemPartCollection.cpp
|
RigFemPartCollection.cpp
|
||||||
|
@ -58,7 +58,7 @@ void RigFemPart::appendElement(RigElementType elmType, int id, const int* connec
|
|||||||
m_elementTypes.push_back(elmType);
|
m_elementTypes.push_back(elmType);
|
||||||
m_elementConnectivityStartIndices.push_back(m_allAlementConnectivities.size());
|
m_elementConnectivityStartIndices.push_back(m_allAlementConnectivities.size());
|
||||||
|
|
||||||
int nodeCount = elmentNodeCount(elmType);
|
int nodeCount = RigFemTypes::elmentNodeCount(elmType);
|
||||||
for (int lnIdx = 0; lnIdx < nodeCount; ++lnIdx)
|
for (int lnIdx = 0; lnIdx < nodeCount; ++lnIdx)
|
||||||
{
|
{
|
||||||
m_allAlementConnectivities.push_back(connectivities[lnIdx]);
|
m_allAlementConnectivities.push_back(connectivities[lnIdx]);
|
||||||
|
79
ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.cpp
Normal file
79
ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.cpp
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RigFemTypes.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const int RigFemTypes::elmentNodeCount(RigElementType elmType)
|
||||||
|
{
|
||||||
|
static int elementTypeCounts[2] ={ 8, 4 };
|
||||||
|
|
||||||
|
return elementTypeCounts[elmType];
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const int RigFemTypes::elmentFaceCount(RigElementType elmType)
|
||||||
|
{
|
||||||
|
const static int elementFaceCounts[2] ={ 6, 1 };
|
||||||
|
|
||||||
|
return elementFaceCounts[elmType];
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
// HEX8
|
||||||
|
// 7---------6
|
||||||
|
// /| /| |k
|
||||||
|
// / | / | | /j
|
||||||
|
// 4---------5 | |/
|
||||||
|
// | 3------|--2 *---i
|
||||||
|
// | / | /
|
||||||
|
// |/ |/
|
||||||
|
// 0---------1
|
||||||
|
|
||||||
|
const int* RigFemTypes::elementLocalFaceIndices(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 };
|
||||||
|
|
||||||
|
switch (elmType)
|
||||||
|
{
|
||||||
|
case HEX8:
|
||||||
|
(*faceNodeCount) = 4;
|
||||||
|
return HEX8_Faces[faceIdx];
|
||||||
|
break;
|
||||||
|
case CAX4:
|
||||||
|
(*faceNodeCount) = 4;
|
||||||
|
return CAX4_Faces;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(false); // Element type not supported
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CAX4_Faces;
|
||||||
|
}
|
@ -26,49 +26,11 @@ enum RigElementType
|
|||||||
CAX4
|
CAX4
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int elmentNodeCount(RigElementType elmType)
|
class RigFemTypes
|
||||||
{
|
{
|
||||||
static int elementTypeCounts[2] = {8,4};
|
public:
|
||||||
|
static const int elmentNodeCount(RigElementType elmType);
|
||||||
|
static const int elmentFaceCount(RigElementType elmType);
|
||||||
|
static const int* elementLocalFaceIndices(RigElementType elmType, int faceIdx, int* faceNodeCount);
|
||||||
|
|
||||||
return elementTypeCounts[elmType];
|
};
|
||||||
}
|
|
||||||
|
|
||||||
static const int elmentFaceCount(RigElementType elmType)
|
|
||||||
{
|
|
||||||
const static int elementFaceCounts[2] = {6, 1};
|
|
||||||
|
|
||||||
return elementFaceCounts[elmType];
|
|
||||||
}
|
|
||||||
|
|
||||||
// HEX8
|
|
||||||
// 7---------6
|
|
||||||
// /| /| |k
|
|
||||||
// / | / | | /j
|
|
||||||
// 4---------5 | |/
|
|
||||||
// | 3------|--2 *---i
|
|
||||||
// | / | /
|
|
||||||
// |/ |/
|
|
||||||
// 0---------1
|
|
||||||
|
|
||||||
static const int* elementLocalFaceIndices(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 };
|
|
||||||
|
|
||||||
switch (elmType)
|
|
||||||
{
|
|
||||||
case HEX8:
|
|
||||||
(*faceNodeCount) = 4;
|
|
||||||
return HEX8_Faces[faceIdx];
|
|
||||||
break;
|
|
||||||
case CAX4:
|
|
||||||
(*faceNodeCount) = 4;
|
|
||||||
return CAX4_Faces;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert(false); // Element type not supported
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CAX4_Faces;
|
|
||||||
}
|
|
||||||
|
@ -162,7 +162,7 @@ void RivFemPartGeometryGenerator::computeArrays()
|
|||||||
if (m_elmVisibility.isNull() || (*m_elmVisibility)[elmIdx])
|
if (m_elmVisibility.isNull() || (*m_elmVisibility)[elmIdx])
|
||||||
{
|
{
|
||||||
RigElementType eType = m_part->elementType(elmIdx);
|
RigElementType eType = m_part->elementType(elmIdx);
|
||||||
int faceCount = elmentFaceCount(eType);
|
int faceCount = RigFemTypes::elmentFaceCount(eType);
|
||||||
int elmQuadCount = 0;
|
int elmQuadCount = 0;
|
||||||
|
|
||||||
const int* elmNodeIndices = m_part->connectivities(elmIdx);
|
const int* elmNodeIndices = m_part->connectivities(elmIdx);
|
||||||
@ -170,7 +170,7 @@ void RivFemPartGeometryGenerator::computeArrays()
|
|||||||
for (int lfIdx = 0; lfIdx < faceCount; ++lfIdx)
|
for (int lfIdx = 0; lfIdx < faceCount; ++lfIdx)
|
||||||
{
|
{
|
||||||
int faceNodeCount = 0;
|
int faceNodeCount = 0;
|
||||||
const int* elmLocalFaceIndices = elementLocalFaceIndices(eType, lfIdx, &faceNodeCount);
|
const int* elmLocalFaceIndices = RigFemTypes::elementLocalFaceIndices(eType, lfIdx, &faceNodeCount);
|
||||||
if (faceNodeCount == 4)
|
if (faceNodeCount == 4)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -111,7 +111,7 @@ void readOdbFile(const std::string& fileName, RigFemPartCollection* femParts)
|
|||||||
|
|
||||||
int nodeCount = 0;
|
int nodeCount = 0;
|
||||||
const int* idBasedConnectivities = odbElm.connectivity(nodeCount);
|
const int* idBasedConnectivities = odbElm.connectivity(nodeCount);
|
||||||
CVF_TIGHT_ASSERT(nodeCount == elmentNodeCount(elmType));
|
CVF_TIGHT_ASSERT(nodeCount == RigFemTypes::elmentNodeCount(elmType));
|
||||||
|
|
||||||
indexBasedConnectivities.resize(nodeCount);
|
indexBasedConnectivities.resize(nodeCount);
|
||||||
for (int lnIdx = 0; lnIdx < nodeCount; ++lnIdx)
|
for (int lnIdx = 0; lnIdx < nodeCount; ++lnIdx)
|
||||||
|
Loading…
Reference in New Issue
Block a user