Creating a fem-results caching system

Needed specifically for statistics
Work in progress brakes build
This commit is contained in:
Jacob Støren
2015-05-06 16:07:30 +02:00
parent 746e9d402d
commit 27dcd80bfd
18 changed files with 443 additions and 107 deletions

View File

@@ -43,6 +43,7 @@ public:
cvf::ref<cvf::DrawableGeo> createOutlineMeshDrawable(double creaseAngle);
const std::vector<size_t>& quadVerticesToNodeIdxMapping() const { return m_quadVerticesToNodeIdx;}
const std::vector<size_t>& quadVerticesToGlobalElmNodeIdx() const { return m_quadVerticesToGlobalElmNodeIdx;}
private:
static cvf::ref<cvf::UIntArray>

View File

@@ -47,6 +47,8 @@
#include "cvfStructGrid.h"
#include "cvfUniform.h"
#include "RifGeoMechReaderInterface.h"
#include "RigGeomechCaseData.h"
#include "RigFemScalarResultFrames.h"
//--------------------------------------------------------------------------------------------------
@@ -219,20 +221,33 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechRe
{
const cvf::ScalarMapper* mapper = cellResultSlot->legendConfig()->scalarMapper();
RifGeoMechReaderInterface* reader = cellResultSlot->resultReaderInterface();
std::vector<float> resultValues;
reader->readScalarNodeField(cellResultSlot->resultFieldName().toStdString(),
cellResultSlot->resultComponentName().toStdString(),
m_gridIdx, 0, timeStepIndex, &resultValues);
const std::vector<size_t>& vxToResultMapping = m_surfaceGenerator.quadVerticesToNodeIdxMapping();
m_surfaceFacesTextureCoords->resize(vxToResultMapping.size());
RigGeoMechCaseData* caseData = cellResultSlot->ownerCaseData();
if (!caseData) return;
RigFemScalarResultFrames* scalarResults = caseData->findOrLoadScalarResult(m_gridIdx, 0, cellResultSlot->resultPositionType(), cellResultSlot->resultFieldName().toStdString(), cellResultSlot->resultComponentName().toStdString());
std::vector<float>& resultValues = scalarResults->frameData(timeStepIndex);
const std::vector<size_t>* vxToResultMapping = NULL;
if (cellResultSlot->resultPositionType() == RIG_NODAL)
{
vxToResultMapping = &(m_surfaceGenerator.quadVerticesToNodeIdxMapping());
}
else if ( cellResultSlot->resultPositionType() == RIG_ELEMENT_NODAL
|| cellResultSlot->resultPositionType() == RIG_INTEGRATION_POINT)
{
vxToResultMapping = &(m_surfaceGenerator.quadVerticesToNodeIdxMapping());
}
m_surfaceFacesTextureCoords->resize(vxToResultMapping->size());
cvf::Vec2f* rawPtr = m_surfaceFacesTextureCoords->ptr();
#pragma omp parallel for schedule(dynamic)
for (int vxIdx = 0; vxIdx < vxToResultMapping.size(); ++vxIdx)
for (int vxIdx = 0; vxIdx < vxToResultMapping->size(); ++vxIdx)
{
float resultValue = resultValues[vxToResultMapping[vxIdx]];
float resultValue = resultValues[(*vxToResultMapping)[vxIdx]];
if (resultValue == HUGE_VAL || resultValue != resultValue) // a != a is true for NAN's
{
rawPtr[vxIdx][1] = 1.0f;