Preparing for result visualization

Calculated mapping vx to node nad elmnode reults
This commit is contained in:
Jacob Støren
2015-04-30 14:19:43 +02:00
parent 1f51eb92b3
commit 791a25e6e9
7 changed files with 50 additions and 18 deletions

View File

@@ -50,7 +50,7 @@ public:
int elmId(size_t elementIdx) const { return m_elementId[elementIdx]; } int elmId(size_t elementIdx) const { return m_elementId[elementIdx]; }
RigElementType elementType(size_t elementIdx) const { return m_elementTypes[elementIdx]; } RigElementType elementType(size_t elementIdx) const { return m_elementTypes[elementIdx]; }
const int* connectivities(size_t elementIdx) const { return &m_allAlementConnectivities[m_elementConnectivityStartIndices[elementIdx]];} const int* connectivities(size_t elementIdx) const { return &m_allAlementConnectivities[m_elementConnectivityStartIndices[elementIdx]];}
int elementNodeResultIdx(int elementIdx, int elmLocalNodeIdx) const { return m_elementConnectivityStartIndices[elementIdx];} size_t elementNodeResultIdx(int elementIdx, int elmLocalNodeIdx) const { return m_elementConnectivityStartIndices[elementIdx] + elmLocalNodeIdx;}
RigFemPartNodes& nodes() {return m_nodes;} RigFemPartNodes& nodes() {return m_nodes;}
const RigFemPartNodes& nodes() const {return m_nodes;} const RigFemPartNodes& nodes() const {return m_nodes;}

View File

@@ -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 = RigFemTypes::elementLocalFaceIndices(eType, lfIdx, &faceNodeCount); const int* localElmNodeIndicesForFace = RigFemTypes::localElmNodeIndicesForFace(eType, lfIdx, &faceNodeCount);
if (faceNodeCount == 4) if (faceNodeCount == 4)
{ {
#if 0 #if 0
@@ -183,10 +183,20 @@ void RivFemPartGeometryGenerator::computeArrays()
#endif #endif
// Needs to get rid of opposite faces // Needs to get rid of opposite faces
vertices.push_back(nodeCoordinates[ elmNodeIndices[elmLocalFaceIndices[0]] ]); vertices.push_back(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[0]] ]);
vertices.push_back(nodeCoordinates[ elmNodeIndices[elmLocalFaceIndices[1]] ]); vertices.push_back(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[1]] ]);
vertices.push_back(nodeCoordinates[ elmNodeIndices[elmLocalFaceIndices[2]] ]); vertices.push_back(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[2]] ]);
vertices.push_back(nodeCoordinates[ elmNodeIndices[elmLocalFaceIndices[3]] ]); vertices.push_back(nodeCoordinates[ elmNodeIndices[localElmNodeIndicesForFace[3]] ]);
m_quadVerticesToNodeIdx.push_back(elmNodeIndices[localElmNodeIndicesForFace[0]]);
m_quadVerticesToNodeIdx.push_back(elmNodeIndices[localElmNodeIndicesForFace[1]]);
m_quadVerticesToNodeIdx.push_back(elmNodeIndices[localElmNodeIndicesForFace[2]]);
m_quadVerticesToNodeIdx.push_back(elmNodeIndices[localElmNodeIndicesForFace[3]]);
m_quadVerticesToGlobalElmNodeIdx.push_back(m_part->elementNodeResultIdx(elmIdx, localElmNodeIndicesForFace[0]));
m_quadVerticesToGlobalElmNodeIdx.push_back(m_part->elementNodeResultIdx(elmIdx, localElmNodeIndicesForFace[1]));
m_quadVerticesToGlobalElmNodeIdx.push_back(m_part->elementNodeResultIdx(elmIdx, localElmNodeIndicesForFace[2]));
m_quadVerticesToGlobalElmNodeIdx.push_back(m_part->elementNodeResultIdx(elmIdx, localElmNodeIndicesForFace[3]));
} }
else else
{ {
@@ -204,15 +214,6 @@ void RivFemPartGeometryGenerator::computeArrays()
//--------------------------------------------------------------------------------------------------
/// Calculates the texture coordinates in a "nearly" one dimentional texture.
/// Undefined values are coded with a y-texturecoordinate value of 1.0 instead of the normal 0.5
//--------------------------------------------------------------------------------------------------
void RivFemPartGeometryGenerator::textureCoordinates(Vec2fArray* textureCoords, const RigFemPartScalarDataAccess* resultAccessor, const ScalarMapper* mapper) const
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -37,8 +37,6 @@ public:
const RigFemPart* activePart() { return m_part.p(); } const RigFemPart* activePart() { return m_part.p(); }
void textureCoordinates(cvf::Vec2fArray* textureCoords, const RigFemPartScalarDataAccess* resultAccessor, const cvf::ScalarMapper* mapper) const;
// Generated geometry // Generated geometry
cvf::ref<cvf::DrawableGeo> generateSurface(); cvf::ref<cvf::DrawableGeo> generateSurface();
cvf::ref<cvf::DrawableGeo> createMeshDrawable(); cvf::ref<cvf::DrawableGeo> createMeshDrawable();
@@ -57,6 +55,8 @@ private:
// Created arrays // Created arrays
cvf::ref<cvf::Vec3fArray> m_quadVertices; cvf::ref<cvf::Vec3fArray> m_quadVertices;
//cvf::ref<cvf::Vec3fArray> m_triangleVertices; // If needed, we will do it like this, I think //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;
}; };

View File

@@ -18,7 +18,7 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "RimGeoMechResultSlot.h" #include "RimGeoMechResultSlot.h"
#include "RimReservoirView.h" #include "RimGeoMechView.h"
#include "RimLegendConfig.h" #include "RimLegendConfig.h"
#include "RimDefines.h" #include "RimDefines.h"
@@ -58,6 +58,12 @@ QList<caf::PdmOptionItemInfo> RimGeoMechResultSlot::calculateValueOptions(const
{ {
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
if (m_reservoirView)
{
// RimGeoMechCase* gmCase = m_reservoirView->geoMechCase();
}
if (&m_resultVariable == fieldNeedingOptions) if (&m_resultVariable == fieldNeedingOptions)
{ {
options.push_back(caf::PdmOptionItemInfo("Von Mises", QString("VonMises")) ); options.push_back(caf::PdmOptionItemInfo("Von Mises", QString("VonMises")) );
@@ -67,3 +73,11 @@ QList<caf::PdmOptionItemInfo> RimGeoMechResultSlot::calculateValueOptions(const
} }
return options; return options;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechResultSlot::setReservoirView(RimGeoMechView* ownerReservoirView)
{
m_reservoirView = ownerReservoirView;
}

View File

@@ -24,6 +24,7 @@
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
class RimLegendConfig; class RimLegendConfig;
class RimGeoMechView;
//================================================================================================== //==================================================================================================
/// ///
@@ -37,11 +38,17 @@ public:
RimGeoMechResultSlot(void); RimGeoMechResultSlot(void);
virtual ~RimGeoMechResultSlot(void); virtual ~RimGeoMechResultSlot(void);
void setReservoirView(RimGeoMechView* ownerReservoirView);
caf::PdmField<RimLegendConfig*> legendConfig; caf::PdmField<RimLegendConfig*> legendConfig;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly); virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
private: private:
caf::PdmField<QString> m_resultType;
caf::PdmField<QString> m_resultVariable; caf::PdmField<QString> m_resultVariable;
caf::PdmField<QString> m_componentName;
caf::PdmPointer<RimGeoMechView> m_reservoirView;
}; };

View File

@@ -219,6 +219,14 @@ void RimGeoMechView::updateLegends()
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechCase* RimGeoMechView::geoMechCase()
{
return m_geomechCase;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -64,6 +64,8 @@ public:
}; };
void setGeoMechCase(RimGeoMechCase* gmCase); void setGeoMechCase(RimGeoMechCase* gmCase);
RimGeoMechCase* geoMechCase();
void loadDataAndUpdate(); void loadDataAndUpdate();
virtual void setCurrentTimeStep(int frameIdx){} virtual void setCurrentTimeStep(int frameIdx){}