#914 Added calculation of element face aligned stress

This commit is contained in:
Jacob Støren 2016-10-19 12:22:13 +02:00
parent d82eb6a774
commit d8247c2ac6
14 changed files with 286 additions and 71 deletions

View File

@ -22,6 +22,7 @@ include_directories(
${cafPdmCvf_SOURCE_DIR}
${CommonCode_SOURCE_DIR}
${cafVizExtensions_SOURCE_DIR}
${cafTensor_SOURCE_DIR}
${ResInsight_SOURCE_DIR}/ThirdParty
${ResInsight_SOURCE_DIR}/ThirdParty/NRLib/nrlib/well

View File

@ -40,6 +40,7 @@
#include "cafTensor3.h"
#include "cafProgressInfo.h"
#include "RigFemPartGrid.h"
#include "cvfGeometryTools.h"
//--------------------------------------------------------------------------------------------------
@ -289,7 +290,18 @@ std::map<std::string, std::vector<std::string> > RigFemPartResultsCollection::sc
fieldCompNames["NE"].push_back("E13");
fieldCompNames["NE"].push_back("E23");
}
}
else if(resPos == RIG_ELEMENT_NODAL_FACE)
{
fieldCompNames["SE"].push_back("SNorm");
fieldCompNames["SE"].push_back("SHor");
fieldCompNames["SE"].push_back("SVert");
fieldCompNames["ST"].push_back("SNorm");
fieldCompNames["ST"].push_back("SHor");
fieldCompNames["ST"].push_back("SVert");
}
}
return fieldCompNames;
@ -549,6 +561,107 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateVolumetricStrain
return dstDataFrames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSurfaceAlignedStress(int partIndex, const RigFemResultAddress& resVarAddr)
{
CVF_ASSERT(resVarAddr.componentName == "SHor" || resVarAddr.componentName == "SVert" || resVarAddr.componentName == "SNorm");
RigFemScalarResultFrames * s11Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S11"));
RigFemScalarResultFrames * s22Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S22"));
RigFemScalarResultFrames * s33Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S33"));
RigFemScalarResultFrames * s12Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S12"));
RigFemScalarResultFrames * s23Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S23"));
RigFemScalarResultFrames * s13Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S13"));
RigFemScalarResultFrames * sNormFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "SNorm"));
RigFemScalarResultFrames * sHoriFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "SHor"));
RigFemScalarResultFrames * sVertFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "SVert"));
const RigFemPart * femPart = m_femParts->part(partIndex);
const std::vector<cvf::Vec3f>& nodeCoordinates = femPart->nodes().coordinates;
int frameCount = s11Frames->frameCount();
for(int fIdx = 0; fIdx < frameCount; ++fIdx)
{
const std::vector<float>& s11 = s11Frames->frameData(fIdx);
const std::vector<float>& s22 = s22Frames->frameData(fIdx);
const std::vector<float>& s33 = s33Frames->frameData(fIdx);
const std::vector<float>& s12 = s12Frames->frameData(fIdx);
const std::vector<float>& s23 = s23Frames->frameData(fIdx);
const std::vector<float>& s13 = s13Frames->frameData(fIdx);
std::vector<float>& sNorm = sNormFrames->frameData(fIdx);
std::vector<float>& sHori = sHoriFrames->frameData(fIdx);
std::vector<float>& sVert = sVertFrames->frameData(fIdx);
// HACK ! Todo : make it robust against other elements than Hex8
size_t valCount = s11.size() * 3; // Number of Elm Node Face results 24 = 4 * num faces = 3* numElmNodes
sNorm.resize(valCount);
sHori.resize(valCount);
sVert.resize(valCount);
int elementCount = femPart->elementCount();
for(int elmIdx = 0; elmIdx < elementCount; ++elmIdx)
{
RigElementType elmType = femPart->elementType(elmIdx);
int faceCount = RigFemTypes::elmentFaceCount(elmType);
const int* elmNodeIndices = femPart->connectivities(elmIdx);
int elmNodFaceResIdxElmStart = elmIdx * 24; // HACK should get from part
for(int lfIdx = 0; lfIdx < faceCount; ++lfIdx)
{
int faceNodeCount = 0;
const int* localElmNodeIndicesForFace = RigFemTypes::localElmNodeIndicesForFace(elmType, lfIdx, &faceNodeCount);
if(faceNodeCount == 4)
{
int elmNodFaceResIdxFaceStart = elmNodFaceResIdxElmStart + lfIdx*4; // HACK
cvf::Vec3f quadVxs[4];
quadVxs[0] = (nodeCoordinates[elmNodeIndices[localElmNodeIndicesForFace[0]]]);
quadVxs[1] = (nodeCoordinates[elmNodeIndices[localElmNodeIndicesForFace[1]]]);
quadVxs[2] = (nodeCoordinates[elmNodeIndices[localElmNodeIndicesForFace[2]]]);
quadVxs[3] = (nodeCoordinates[elmNodeIndices[localElmNodeIndicesForFace[3]]]);
cvf::Mat3f rotMx = cvf::GeometryTools::computePlaneHorizontalRotationMx(quadVxs[2] -quadVxs[0], quadVxs[3] - quadVxs[1] );
size_t qElmNodeResIdx[4];
qElmNodeResIdx[0] = femPart->elementNodeResultIdx(elmIdx, localElmNodeIndicesForFace[0]);
qElmNodeResIdx[1] = femPart->elementNodeResultIdx(elmIdx, localElmNodeIndicesForFace[1]);
qElmNodeResIdx[2] = femPart->elementNodeResultIdx(elmIdx, localElmNodeIndicesForFace[2]);
qElmNodeResIdx[3] = femPart->elementNodeResultIdx(elmIdx, localElmNodeIndicesForFace[3]);
for (int qIdx = 0; qIdx < 4; ++qIdx)
{
size_t elmNodResIdx = qElmNodeResIdx[qIdx];
float t11 = s11[elmNodResIdx];
float t22 = s22[elmNodResIdx];
float t33 = s33[elmNodResIdx];
float t12 = s12[elmNodResIdx];
float t23 = s23[elmNodResIdx];
float t13 = s13[elmNodResIdx];
caf::Ten3f tensor(t11, t22, t33,
t12, t23, t13);
caf::Ten3f xfTen = tensor.rotated(rotMx);
int elmNodFaceResIdx = elmNodFaceResIdxFaceStart + qIdx;
sHori[elmNodFaceResIdx]= xfTen[caf::Ten3f::SXX];
sVert[elmNodFaceResIdx]= xfTen[caf::Ten3f::SYY];
sNorm[elmNodFaceResIdx]= xfTen[caf::Ten3f::SZZ];
}
}
}
}
}
RigFemScalarResultFrames* requestedSurfStress = this->findOrLoadScalarResult(partIndex,resVarAddr);
return requestedSurfStress;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -559,6 +672,11 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDerivedResult(in
return calculateTimeLapseResult(partIndex, resVarAddr);
}
if(resVarAddr.resultPosType == RIG_ELEMENT_NODAL_FACE )
{
return calculateSurfaceAlignedStress(partIndex, resVarAddr);
}
if(resVarAddr.fieldName == "NE" && resVarAddr.componentName == "EV")
{
return calculateVolumetricStrain(partIndex, resVarAddr);

View File

@ -77,6 +77,7 @@ private:
RigFemScalarResultFrames* calculateMeanStressSTM(int partIndex, const RigFemResultAddress& resVarAddr);
RigFemScalarResultFrames* calculateDeviatoricStress(int partIndex, const RigFemResultAddress& resVarAddr);
RigFemScalarResultFrames* calculateVolumetricStrain(int partIndex, const RigFemResultAddress& resVarAddr);
RigFemScalarResultFrames* calculateSurfaceAlignedStress(int partIndex, const RigFemResultAddress& resVarAddr);
cvf::Collection<RigFemPartResults> m_femPartResults;
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;

View File

@ -60,6 +60,7 @@ RigFemResultAddress(RigFemResultPosEnum resPosType,
bool isTypeValid = resultPosType == RIG_NODAL
|| resultPosType == RIG_ELEMENT_NODAL
|| resultPosType == RIG_INTEGRATION_POINT
|| resultPosType == RIG_ELEMENT_NODAL_FACE
|| resultPosType == RIG_FORMATION_NAMES;
bool isFieldValid = fieldName != "";

View File

@ -4,5 +4,6 @@ enum RigFemResultPosEnum {
RIG_NODAL,
RIG_ELEMENT_NODAL,
RIG_INTEGRATION_POINT,
RIG_ELEMENT_NODAL_FACE,
RIG_FORMATION_NAMES
};

View File

@ -166,40 +166,75 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
// Do a "Hack" to use elm nodal and not nodal POR results
if (resVarAddress.resultPosType == RIG_NODAL && resVarAddress.fieldName == "POR-Bar") resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
#pragma omp parallel for schedule(dynamic)
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
if (resVarAddress.resultPosType != RIG_ELEMENT_NODAL_FACE)
{
if ( (*cellVisibility)[cellIndex] )
#pragma omp parallel for schedule(dynamic)
for (int cellIndex = 0; cellIndex < elementCount; cellIndex++)
{
RigElementType eType = grid->elementType(cellIndex);
int elmNodeCount = RigFemTypes::elmentNodeCount(eType);
const int* elmNodeIndices = grid->connectivities(cellIndex);
for(int enIdx = 0; enIdx < elmNodeCount; ++enIdx)
if ( (*cellVisibility)[cellIndex] )
{
size_t resultValueIndex = cvf::UNDEFINED_SIZE_T;
if (resVarAddress.resultPosType == RIG_NODAL)
{
resultValueIndex = elmNodeIndices[enIdx];
}
else
{
resultValueIndex = grid->elementNodeResultIdx(cellIndex, enIdx);
}
RigElementType eType = grid->elementType(cellIndex);
int elmNodeCount = RigFemTypes::elmentNodeCount(eType);
double scalarValue = resVals[resultValueIndex];
if (lowerBound <= scalarValue && scalarValue <= upperBound)
const int* elmNodeIndices = grid->connectivities(cellIndex);
for(int enIdx = 0; enIdx < elmNodeCount; ++enIdx)
{
if (filterType == RimCellFilter::EXCLUDE)
size_t resultValueIndex = cvf::UNDEFINED_SIZE_T;
if (resVarAddress.resultPosType == RIG_NODAL)
{
(*cellVisibility)[cellIndex] = false;
resultValueIndex = elmNodeIndices[enIdx];
}
else
{
resultValueIndex = grid->elementNodeResultIdx(cellIndex, enIdx);
}
double scalarValue = resVals[resultValueIndex];
if (lowerBound <= scalarValue && scalarValue <= upperBound)
{
if (filterType == RimCellFilter::EXCLUDE)
{
(*cellVisibility)[cellIndex] = false;
}
}
else
{
if (filterType == RimCellFilter::INCLUDE)
{
(*cellVisibility)[cellIndex] = false;
}
}
}
else
}
}
}
else
{
#pragma omp parallel for schedule(dynamic)
for(int cellIndex = 0; cellIndex < elementCount; cellIndex++)
{
if((*cellVisibility)[cellIndex])
{
RigElementType eType = grid->elementType(cellIndex);
int elmNodeCount = RigFemTypes::elmentNodeCount(eType);
const int* elmNodeIndices = grid->connectivities(cellIndex);
for(int fpIdx = 0; fpIdx < 24; ++fpIdx)
{
if (filterType == RimCellFilter::INCLUDE)
double scalarValue = resVals[cellIndex*24 + fpIdx];
if(lowerBound <= scalarValue && scalarValue <= upperBound)
{
(*cellVisibility)[cellIndex] = false;
if(filterType == RimCellFilter::EXCLUDE)
{
(*cellVisibility)[cellIndex] = false;
}
}
else
{
if(filterType == RimCellFilter::INCLUDE)
{
(*cellVisibility)[cellIndex] = false;
}
}
}
}

View File

@ -156,6 +156,7 @@ void RivFemPartGeometryGenerator::computeArrays()
m_quadVerticesToNodeIdx.clear();
m_quadVerticesToGlobalElmNodeIdx.clear();
m_quadVerticesToGlobalElmFaceNodeIdx.clear();
trianglesToElements.clear();
trianglesToElementFaces.clear();
@ -179,6 +180,8 @@ void RivFemPartGeometryGenerator::computeArrays()
int faceCount = RigFemTypes::elmentFaceCount(eType);
const int* elmNodeIndices = m_part->connectivities(elmIdx);
int elmNodFaceResIdxElmStart = elmIdx * 24; // HACK should get from part
for (int lfIdx = 0; lfIdx < faceCount; ++lfIdx)
{
@ -194,8 +197,6 @@ void RivFemPartGeometryGenerator::computeArrays()
if (faceNodeCount == 4)
{
// Todo: Needs to get rid of opposite faces
const cvf::Vec3f* quadVxs[4];
quadVxs[0] = &(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[0]] ]);
@ -232,6 +233,13 @@ void RivFemPartGeometryGenerator::computeArrays()
m_quadVerticesToGlobalElmNodeIdx.push_back(qElmNodeResIdx[2]);
m_quadVerticesToGlobalElmNodeIdx.push_back(qElmNodeResIdx[3]);
int elmNodFaceResIdxFaceStart = elmNodFaceResIdxElmStart + lfIdx*4; // HACK
m_quadVerticesToGlobalElmFaceNodeIdx.push_back(elmNodFaceResIdxFaceStart + 0);
m_quadVerticesToGlobalElmFaceNodeIdx.push_back(elmNodFaceResIdxFaceStart + 1);
m_quadVerticesToGlobalElmFaceNodeIdx.push_back(elmNodFaceResIdxFaceStart + 2);
m_quadVerticesToGlobalElmFaceNodeIdx.push_back(elmNodFaceResIdxFaceStart + 3);
trianglesToElements.push_back(elmIdx);
trianglesToElements.push_back(elmIdx);
trianglesToElementFaces.push_back(lfIdx);

View File

@ -62,6 +62,7 @@ public:
const std::vector<size_t>& quadVerticesToNodeIdxMapping() const { return m_quadVerticesToNodeIdx;}
const std::vector<size_t>& quadVerticesToGlobalElmNodeIdx() const { return m_quadVerticesToGlobalElmNodeIdx;}
const std::vector<size_t>& quadVerticesToGlobalElmFaceNodeIdx() const { return m_quadVerticesToGlobalElmFaceNodeIdx; }
RivFemPartTriangleToElmMapper* triangleToElementMapper() { return m_triangleMapper.p();}
@ -82,6 +83,7 @@ private:
//cvf::ref<cvf::Vec3fArray> m_triangleVertices; // If needed, we will do it like this, I think
std::vector<size_t> m_quadVerticesToNodeIdx;
std::vector<size_t> m_quadVerticesToGlobalElmNodeIdx;
std::vector<size_t> m_quadVerticesToGlobalElmFaceNodeIdx;
// Mappings
cvf::ref<RivFemPartTriangleToElmMapper> m_triangleMapper;

View File

@ -241,6 +241,7 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechCe
const std::vector<float>& resultValues = caseData->femPartResults()->resultValues(resVarAddress, m_gridIdx, (int)timeStepIndex);
const std::vector<size_t>* vxToResultMapping = NULL;
int vxCount = 0;
if (resVarAddress.resultPosType == RIG_NODAL)
{
@ -252,8 +253,13 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechCe
{
vxToResultMapping = &(m_surfaceGenerator.quadVerticesToGlobalElmNodeIdx());
}
else if(resVarAddress.resultPosType == RIG_ELEMENT_NODAL_FACE)
{
vxToResultMapping = &(m_surfaceGenerator.quadVerticesToGlobalElmFaceNodeIdx());
}
m_surfaceFacesTextureCoords->resize(vxToResultMapping->size());
vxCount = static_cast<int>(vxToResultMapping->size());
m_surfaceFacesTextureCoords->resize(vxCount);
if (resultValues.size() == 0)
{
@ -263,12 +269,10 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechCe
{
cvf::Vec2f* rawPtr = m_surfaceFacesTextureCoords->ptr();
int vxCount = static_cast<int>(vxToResultMapping->size());
#pragma omp parallel for schedule(dynamic)
for (int quadStartIdx = 0; quadStartIdx < vxCount; quadStartIdx += 4)
{
float resultValue1 = resultValues[(*vxToResultMapping)[quadStartIdx]];
float resultValue1 = resultValues[(*vxToResultMapping)[quadStartIdx + 0]];
float resultValue2 = resultValues[(*vxToResultMapping)[quadStartIdx + 1]];
float resultValue3 = resultValues[(*vxToResultMapping)[quadStartIdx + 2]];
float resultValue4 = resultValues[(*vxToResultMapping)[quadStartIdx + 3]];

View File

@ -43,6 +43,7 @@ void caf::AppEnum< RigFemResultPosEnum >::setUp()
addItem(RIG_NODAL, "NODAL", "Nodal");
addItem(RIG_ELEMENT_NODAL, "ELEMENT_NODAL", "Element Nodal");
addItem(RIG_INTEGRATION_POINT,"INTEGRATION_POINT","Integration Point");
addItem(RIG_ELEMENT_NODAL_FACE, "ELEMENT_NODAL_FACE", "Element Nodal On Face");
addItem(RIG_FORMATION_NAMES, "FORMATION_NAMES", "Formation Names");
setDefault(RIG_NODAL);
}
@ -293,14 +294,13 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
std::map<std::string, std::vector<std::string> > RimGeoMechResultDefinition::getResultMetaDataForUIFieldSetting()
{
RimGeoMechCase* gmCase = m_geomCase;
std::map<std::string, std::vector<std::string> > fieldWithComponentNames;
if (gmCase && gmCase->geoMechData())
{
return gmCase->geoMechData()->femPartResults()->scalarFieldAndComponentNames(m_resultPositionTypeUiField());
}
else
{
return std::map<std::string, std::vector<std::string> >() ;
fieldWithComponentNames = gmCase->geoMechData()->femPartResults()->scalarFieldAndComponentNames(m_resultPositionTypeUiField());
}
return fieldWithComponentNames;
}
//--------------------------------------------------------------------------------------------------

View File

@ -135,7 +135,7 @@ TEST(TensorRotation, TensorRotation)
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation(cvf::Vec3f(1, 0, 0), cvf::PI_F);
caf::Ten3f rotT = orgT.rotate(rotMx);
caf::Ten3f rotT = orgT.rotated(rotMx);
EXPECT_NEAR(1.0f, rotT[caf::Ten3f::SXX], 1e-4);
EXPECT_NEAR(0.5f, rotT[caf::Ten3f::SYY], 1e-4);
@ -150,7 +150,7 @@ TEST(TensorRotation, TensorRotation)
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation(cvf::Vec3f(1, 0, 0), 0.5*cvf::PI_F);
caf::Ten3f rotT = orgT.rotate(rotMx);
caf::Ten3f rotT = orgT.rotated(rotMx);
EXPECT_NEAR(1.0f, rotT[caf::Ten3f::SXX], 1e-4);
EXPECT_NEAR(0.2f, rotT[caf::Ten3f::SYY], 1e-4);
@ -165,7 +165,7 @@ TEST(TensorRotation, TensorRotation)
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation(cvf::Vec3f(0, 0, 1), 0.5*cvf::PI_F);
caf::Ten3f rotT = orgT.rotate(rotMx);
caf::Ten3f rotT = orgT.rotated(rotMx);
EXPECT_NEAR(0.5f, rotT[caf::Ten3f::SXX], 1e-4);
EXPECT_NEAR(1.0f, rotT[caf::Ten3f::SYY], 1e-4);
@ -180,7 +180,7 @@ TEST(TensorRotation, TensorRotation)
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation(cvf::Vec3f(0, 0, 1), 0.25*cvf::PI_F);
caf::Ten3f rotT = orgT.rotate(rotMx);
caf::Ten3f rotT = orgT.rotated(rotMx);
EXPECT_NEAR(0.75f,rotT[caf::Ten3f::SXX], 1e-4);
EXPECT_NEAR(0.75f,rotT[caf::Ten3f::SYY], 1e-4);
@ -195,7 +195,7 @@ TEST(TensorRotation, TensorRotation)
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation(cvf::Vec3f(0, 0, 1), -0.25*cvf::PI_F);
caf::Ten3f rotT = orgT.rotate(rotMx);
caf::Ten3f rotT = orgT.rotated(rotMx);
EXPECT_NEAR(1.0f, rotT[caf::Ten3f::SXX], 1e-4);
EXPECT_NEAR(0.5f, rotT[caf::Ten3f::SYY], 1e-4);
@ -210,7 +210,7 @@ TEST(TensorRotation, TensorRotation)
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation(cvf::Vec3f(1, 1, 1), 0.2*cvf::PI_F);
caf::Ten3f rotT = orgT.rotate(rotMx);
caf::Ten3f rotT = orgT.rotated(rotMx);
EXPECT_NEAR(0.8320561f, rotT[caf::Ten3f::SXX], 1e-4);
EXPECT_NEAR(0.5584094f, rotT[caf::Ten3f::SYY], 1e-4);
@ -225,7 +225,7 @@ TEST(TensorRotation, TensorRotation)
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation(cvf::Vec3f(1, 1, 1), -0.2*cvf::PI_F);
caf::Ten3f rotT = orgT.rotate(rotMx);
caf::Ten3f rotT = orgT.rotated(rotMx);
EXPECT_NEAR(1.0f, rotT[caf::Ten3f::SXX], 1e-4);
EXPECT_NEAR(0.5f, rotT[caf::Ten3f::SYY], 1e-4);

View File

@ -215,40 +215,84 @@ void RiuFemResultTextBuilder::appendTextFromResultColors(RigGeoMechCaseData* geo
resultInfoText->append(resultDefinition->resultFieldUiName()+ ", ") ;
resultInfoText->append(resultDefinition->resultComponentUiName() + ":\n");
RigFemPart* femPart = geomData->femParts()->part(gridIndex);
RigElementType elmType = femPart->elementType(cellIndex);
const int* elmentConn = femPart->connectivities(cellIndex);
int elmNodeCount = RigFemTypes::elmentNodeCount(elmType);
const int* lElmNodeToIpMap = RigFemTypes::localElmNodeToIntegrationPointMapping(elmType);
for (int lNodeIdx = 0; lNodeIdx < elmNodeCount; ++lNodeIdx)
if (resultDefinition->resultPositionType() != RIG_ELEMENT_NODAL_FACE)
{
float scalarValue = std::numeric_limits<float>::infinity();
int nodeIdx = elmentConn[lNodeIdx];
if (resultDefinition->resultPositionType() == RIG_NODAL)
RigFemPart* femPart = geomData->femParts()->part(gridIndex);
RigElementType elmType = femPart->elementType(cellIndex);
const int* elmentConn = femPart->connectivities(cellIndex);
int elmNodeCount = RigFemTypes::elmentNodeCount(elmType);
const int* lElmNodeToIpMap = RigFemTypes::localElmNodeToIntegrationPointMapping(elmType);
for (int lNodeIdx = 0; lNodeIdx < elmNodeCount; ++lNodeIdx)
{
scalarValue = scalarResults[nodeIdx];
}
else
{
size_t resIdx = femPart->elementNodeResultIdx(cellIndex, lNodeIdx);
scalarValue = scalarResults[resIdx];
}
float scalarValue = std::numeric_limits<float>::infinity();
int nodeIdx = elmentConn[lNodeIdx];
if (resultDefinition->resultPositionType() == RIG_NODAL)
{
scalarValue = scalarResults[nodeIdx];
}
else
{
size_t resIdx = femPart->elementNodeResultIdx(cellIndex, lNodeIdx);
scalarValue = scalarResults[resIdx];
}
if (resultDefinition->resultPositionType() == RIG_INTEGRATION_POINT)
{
resultInfoText->append(QString("\tIP:%1 \t: %2 \tAss. Node: \t%3").arg(lElmNodeToIpMap[lNodeIdx] + 1 ).arg(scalarValue).arg(femPart->nodes().nodeIds[nodeIdx]));
if (resultDefinition->resultPositionType() == RIG_INTEGRATION_POINT)
{
resultInfoText->append(QString("\tIP:%1 \t: %2 \tAss. Node: \t%3").arg(lElmNodeToIpMap[lNodeIdx] + 1 ).arg(scalarValue).arg(femPart->nodes().nodeIds[nodeIdx]));
}
else
{
resultInfoText->append(QString("\tN:%1 \t: %2").arg(femPart->nodes().nodeIds[nodeIdx]).arg(scalarValue));
}
cvf::Vec3f nodeCoord = femPart->nodes().coordinates[nodeIdx];
resultInfoText->append(QString("\t( %3, %4, %5)\n").arg(nodeCoord[0]).arg(nodeCoord[1]).arg(nodeCoord[2]));
}
else
}
else
{
int elmNodeFaceStartResIdx = cellIndex *24;
resultInfoText->append(QString("Pos I Face:\n"));
for (int ptIdx = 0; ptIdx < 4; ++ptIdx)
{
resultInfoText->append(QString("\tN:%1 \t: %2").arg(femPart->nodes().nodeIds[nodeIdx]).arg(scalarValue));
resultInfoText->append(QString("\t%2\n").arg(scalarResults[elmNodeFaceStartResIdx+ptIdx]));
}
resultInfoText->append(QString("Neg I Face:\n"));
for(int ptIdx = 4; ptIdx < 8; ++ptIdx)
{
resultInfoText->append(QString("\t%2\n").arg(scalarResults[elmNodeFaceStartResIdx+ptIdx]));
}
resultInfoText->append(QString("Pos J Face:\n"));
for(int ptIdx = 8; ptIdx < 12; ++ptIdx)
{
resultInfoText->append(QString("\t%2\n").arg(scalarResults[elmNodeFaceStartResIdx+ptIdx]));
}
resultInfoText->append(QString("Neg J Face:\n"));
for(int ptIdx = 12; ptIdx < 16; ++ptIdx)
{
resultInfoText->append(QString("\t%2\n").arg(scalarResults[elmNodeFaceStartResIdx+ptIdx]));
}
resultInfoText->append(QString("Pos K Face:\n"));
for(int ptIdx = 16; ptIdx < 20; ++ptIdx)
{
resultInfoText->append(QString("\t%2\n").arg(scalarResults[elmNodeFaceStartResIdx+ptIdx]));
}
resultInfoText->append(QString("Neg K Face:\n"));
for(int ptIdx = 20; ptIdx < 24; ++ptIdx)
{
resultInfoText->append(QString("\t%2\n").arg(scalarResults[elmNodeFaceStartResIdx+ptIdx]));
}
cvf::Vec3f nodeCoord = femPart->nodes().coordinates[nodeIdx];
resultInfoText->append(QString("\t( %3, %4, %5)\n").arg(nodeCoord[0]).arg(nodeCoord[1]).arg(nodeCoord[2]));
}
}
}

View File

@ -49,7 +49,7 @@ public:
cvf::Vec3f calculatePrincipals(cvf::Vec3f principalDirections[3]) const;
float calculateVonMises() const;
Tensor3 rotate(const cvf::Matrix3<S>& rotMx) const;
Tensor3 rotated(const cvf::Matrix3<S>& rotMx) const;
};
typedef Tensor3<float> Ten3f;

View File

@ -325,7 +325,7 @@ float caf::Tensor3<S>::calculateVonMises() const
/// Calculates Trot = rotMx*T*transpose(rotMx)
//--------------------------------------------------------------------------------------------------
template< typename S>
Tensor3<S> caf::Tensor3<S>::rotate(const cvf::Matrix3<S>& rotMx) const
Tensor3<S> caf::Tensor3<S>::rotated(const cvf::Matrix3<S>& rotMx) const
{
cvf::Matrix3<S> tensor(m_tensor[SXX], m_tensor[SXY], m_tensor[SZX],
m_tensor[SXY], m_tensor[SYY], m_tensor[SYZ],