コード例 #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimGeoMechPropertyFilter::computeResultValueRange()
{
    CVF_ASSERT(m_parentContainer);

    double min = 0.0;
    double max = 0.0;

    clearCategories();

    RigFemResultAddress resultAddress = resultDefinition->resultAddress();
    if (resultAddress.isValid() && resultDefinition->ownerCaseData())
    {
        if (resultDefinition->hasCategoryResult())
        {
            std::vector<QString> fnVector;
            if (resultDefinition->ownerCaseData()->femPartResults()->activeFormationNames())
            {
                fnVector = resultDefinition->ownerCaseData()->femPartResults()->activeFormationNames()->formationNames();
            }
            setCategoryNames(fnVector);
        }
        else
        {
            resultDefinition->ownerCaseData()->femPartResults()->minMaxScalarValues(resultAddress, &min, &max);
        }
    }

    m_maximumResultValue = max;
    m_minimumResultValue = min;

    lowerBound.uiCapability()->setUiName(QString("Min (%1)").arg(min));
    upperBound.uiCapability()->setUiName(QString("Max (%1)").arg(max));
}
コード例 #2
0
//--------------------------------------------------------------------------------------------------
/// Returns whether any of the parts actually had any of the requested results
//--------------------------------------------------------------------------------------------------
bool RigFemPartResultsCollection::assertResultsLoaded(const RigFemResultAddress& resVarAddr)
{
    if (!resVarAddr.isValid()) return false;

    bool foundResults = false;

    for (int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx)
    {
        if (m_femPartResults[pIdx].notNull())
        {
             RigFemScalarResultFrames* scalarResults = findOrLoadScalarResult(pIdx, resVarAddr);
             for (int fIdx = 0; fIdx < scalarResults->frameCount(); ++fIdx)
             {
                 foundResults = foundResults || scalarResults->frameData(fIdx).size();
             }
        }
    }

    return foundResults;
}
コード例 #3
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RigGeoMechWellLogExtractor::curveData(const RigFemResultAddress& resAddr, int frameIndex, std::vector<double>* values)
{   
    CVF_TIGHT_ASSERT(values);
    
    if (!resAddr.isValid()) return ;

    RigFemResultAddress convResAddr = resAddr;

    // When showing POR results, always use the element nodal result, 
    // to get correct handling of elements without POR results
     
    if (convResAddr.fieldName == "POR-Bar") convResAddr.resultPosType = RIG_ELEMENT_NODAL;

    const RigFemPart* femPart                 = m_caseData->femParts()->part(0);
    const std::vector<cvf::Vec3f>& nodeCoords = femPart->nodes().coordinates;
    const std::vector<float>& resultValues    = m_caseData->femPartResults()->resultValues(convResAddr, 0, frameIndex);

    if (!resultValues.size()) return;

    values->resize(m_intersections.size());

    for (size_t cpIdx = 0; cpIdx < m_intersections.size(); ++cpIdx)
    {
        size_t elmIdx = m_intersectedCells[cpIdx];
        RigElementType elmType = femPart->elementType(elmIdx);

        if (!(elmType == HEX8  || elmType == HEX8P)) continue;

        cvf::StructGridInterface::FaceType cellFace = m_intersectedCellFaces[cpIdx];

        int faceNodeCount = 0;
        const int* faceLocalIndices = RigFemTypes::localElmNodeIndicesForFace(elmType, cellFace, &faceNodeCount);
        const int* elmNodeIndices = femPart->connectivities(elmIdx);

        cvf::Vec3d v0(nodeCoords[elmNodeIndices[faceLocalIndices[0]]]);
        cvf::Vec3d v1(nodeCoords[elmNodeIndices[faceLocalIndices[1]]]);
        cvf::Vec3d v2(nodeCoords[elmNodeIndices[faceLocalIndices[2]]]);
        cvf::Vec3d v3(nodeCoords[elmNodeIndices[faceLocalIndices[3]]]);

        size_t resIdx0 = cvf::UNDEFINED_SIZE_T;
        size_t resIdx1 = cvf::UNDEFINED_SIZE_T;
        size_t resIdx2 = cvf::UNDEFINED_SIZE_T;
        size_t resIdx3 = cvf::UNDEFINED_SIZE_T;

        if (convResAddr.resultPosType ==  RIG_NODAL)
        {
            resIdx0 = elmNodeIndices[faceLocalIndices[0]];
            resIdx1 = elmNodeIndices[faceLocalIndices[1]];
            resIdx2 = elmNodeIndices[faceLocalIndices[2]];
            resIdx3 = elmNodeIndices[faceLocalIndices[3]];
        }
        else
        {
            resIdx0 = (size_t)femPart->elementNodeResultIdx((int)elmIdx, faceLocalIndices[0]);
            resIdx1 = (size_t)femPart->elementNodeResultIdx((int)elmIdx, faceLocalIndices[1]);
            resIdx2 = (size_t)femPart->elementNodeResultIdx((int)elmIdx, faceLocalIndices[2]);
            resIdx3 = (size_t)femPart->elementNodeResultIdx((int)elmIdx, faceLocalIndices[3]);
        }

        double interpolatedValue = cvf::GeometryTools::interpolateQuad( 
            v0, resultValues[resIdx0],
            v1, resultValues[resIdx1],
            v2, resultValues[resIdx2],
            v3, resultValues[resIdx3],
            m_intersections[cpIdx]
        );  

        (*values)[cpIdx] = interpolatedValue;
    }
  
}