2015-06-04 05:35:22 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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 "RigFemPartResultsCollection.h"
|
|
|
|
|
2018-01-10 03:43:33 -06:00
|
|
|
#include "RifElementPropertyReader.h"
|
2015-06-04 05:35:22 -05:00
|
|
|
#include "RifGeoMechReaderInterface.h"
|
|
|
|
|
|
|
|
#ifdef USE_ODB_API
|
|
|
|
#include "RifOdbReader.h"
|
|
|
|
#endif
|
2017-12-01 03:26:32 -06:00
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
#include "RigFemNativeStatCalc.h"
|
2015-06-15 05:15:00 -05:00
|
|
|
#include "RigFemPartCollection.h"
|
2017-12-01 03:26:32 -06:00
|
|
|
#include "RigFemPartGrid.h"
|
|
|
|
#include "RigFemPartResults.h"
|
|
|
|
#include "RigFemScalarResultFrames.h"
|
2016-09-06 03:27:30 -05:00
|
|
|
#include "RigFormationNames.h"
|
2018-02-20 06:38:45 -06:00
|
|
|
#include "RigHexIntersectionTools.h"
|
2017-12-01 03:26:32 -06:00
|
|
|
#include "RigStatisticsDataCache.h"
|
|
|
|
|
|
|
|
#include "RimMainPlotCollection.h"
|
|
|
|
#include "RimProject.h"
|
|
|
|
#include "RimWellLogPlot.h"
|
|
|
|
#include "RimWellLogPlotCollection.h"
|
2015-06-04 05:35:22 -05:00
|
|
|
|
|
|
|
#include "cafProgressInfo.h"
|
|
|
|
#include "cvfBoundingBox.h"
|
|
|
|
|
2015-06-26 08:43:43 -05:00
|
|
|
#include "cafProgressInfo.h"
|
2017-12-01 03:26:32 -06:00
|
|
|
#include "cafTensor3.h"
|
2016-10-19 05:22:13 -05:00
|
|
|
#include "cvfGeometryTools.h"
|
2016-10-27 08:01:21 -05:00
|
|
|
#include "cvfMath.h"
|
2015-06-04 05:35:22 -05:00
|
|
|
|
2017-12-01 03:26:32 -06:00
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <cmath>
|
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
|
2018-02-15 03:58:13 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
const std::string RigFemPartResultsCollection::FIELD_NAME_COMPACTION = "COMPACTION";
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Internal definitions
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
class RefElement
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
size_t elementIdx;
|
|
|
|
float intersectionPointToCurrentNodeDistance;
|
|
|
|
cvf::Vec3f intersectionPoint;
|
|
|
|
std::vector<size_t> elementFaceNodeIdxs;
|
|
|
|
};
|
|
|
|
|
|
|
|
static std::vector<cvf::Vec3d> coordsFromNodeIndices(const RigFemPart& part, const std::vector<size_t>& nodeIdxs);
|
|
|
|
static std::vector<size_t> nodesForElement(const RigFemPart& part, size_t elementIdx);
|
|
|
|
static float horizontalDistance(const cvf::Vec3f& p1, const cvf::Vec3f& p2);
|
|
|
|
static void findReferenceElementForNode(const RigFemPart& part, size_t nodeIdx, size_t kRefLayer, RefElement *refElement);
|
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-10 03:43:33 -06:00
|
|
|
RigFemPartResultsCollection::RigFemPartResultsCollection(RifGeoMechReaderInterface* readerInterface, RifElementPropertyReader* elementPropertyReader, const RigFemPartCollection* femPartCollection)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
|
|
|
CVF_ASSERT(readerInterface);
|
2018-01-10 03:43:33 -06:00
|
|
|
CVF_ASSERT(elementPropertyReader);
|
2015-06-04 05:35:22 -05:00
|
|
|
m_readerInterface = readerInterface;
|
2018-01-10 03:43:33 -06:00
|
|
|
m_elementPropertyReader = elementPropertyReader;
|
2015-06-15 05:15:00 -05:00
|
|
|
m_femParts = femPartCollection;
|
|
|
|
|
|
|
|
m_femPartResults.resize(m_femParts->partCount());
|
2015-06-04 05:35:22 -05:00
|
|
|
std::vector<std::string> stepNames = m_readerInterface->stepNames();
|
|
|
|
for (int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx)
|
|
|
|
{
|
|
|
|
m_femPartResults[pIdx] = new RigFemPartResults;
|
|
|
|
m_femPartResults[pIdx]->initResultSteps(stepNames);
|
|
|
|
}
|
2016-10-27 08:01:21 -05:00
|
|
|
|
|
|
|
m_cohesion = 10.0;
|
|
|
|
m_frictionAngleRad = cvf::Math::toRadians(30.0);
|
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemPartResultsCollection::~RigFemPartResultsCollection()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-09-06 03:27:30 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::setActiveFormationNames(RigFormationNames* activeFormationNames)
|
|
|
|
{
|
|
|
|
m_activeFormationNamesData = activeFormationNames;
|
2017-12-01 03:26:32 -06:00
|
|
|
|
|
|
|
RimProject* project = RiaApplication::instance()->project();
|
|
|
|
if (project)
|
|
|
|
{
|
|
|
|
if (project->mainPlotCollection())
|
|
|
|
{
|
|
|
|
RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection();
|
|
|
|
if (plotCollection)
|
|
|
|
{
|
|
|
|
for (RimWellLogPlot* wellLogPlot : plotCollection->wellLogPlots)
|
|
|
|
{
|
|
|
|
wellLogPlot->loadDataAndUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-21 07:30:45 -05:00
|
|
|
this->deleteResult(RigFemResultAddress(RIG_FORMATION_NAMES, "Active Formation Names", ""));
|
2016-09-06 03:27:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFormationNames* RigFemPartResultsCollection::activeFormationNames()
|
|
|
|
{
|
|
|
|
return m_activeFormationNamesData.p();
|
|
|
|
}
|
2015-06-04 05:35:22 -05:00
|
|
|
|
2018-01-10 03:43:33 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::addElementPropertyFiles(const std::vector<QString>& filenames)
|
|
|
|
{
|
|
|
|
for (const QString filename : filenames)
|
|
|
|
{
|
|
|
|
m_elementPropertyReader->addFile(filename.toStdString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-12 09:18:54 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-15 09:09:52 -06:00
|
|
|
std::vector<RigFemResultAddress> RigFemPartResultsCollection::removeElementPropertyFiles(const std::vector<QString>& filenames)
|
2018-01-12 09:18:54 -06:00
|
|
|
{
|
2018-01-13 05:38:08 -06:00
|
|
|
std::vector<RigFemResultAddress> addressesToRemove;
|
|
|
|
|
2018-01-12 09:18:54 -06:00
|
|
|
for (const QString filename : filenames)
|
|
|
|
{
|
2018-01-13 05:38:08 -06:00
|
|
|
std::vector<std::string> fields = m_elementPropertyReader->fieldsInFile(filename.toStdString());
|
|
|
|
|
|
|
|
for (std::string field : fields)
|
|
|
|
{
|
|
|
|
addressesToRemove.push_back(RigFemResultAddress(RIG_ELEMENT, field, ""));
|
|
|
|
}
|
|
|
|
|
2018-01-12 09:18:54 -06:00
|
|
|
m_elementPropertyReader->removeFile(filename.toStdString());
|
|
|
|
}
|
2018-01-13 05:38:08 -06:00
|
|
|
|
|
|
|
for (const RigFemResultAddress& address : addressesToRemove)
|
|
|
|
{
|
|
|
|
this->deleteResult(address);
|
|
|
|
}
|
2018-01-15 09:09:52 -06:00
|
|
|
|
|
|
|
return addressesToRemove;
|
2018-01-12 09:18:54 -06:00
|
|
|
}
|
|
|
|
|
2016-10-27 08:01:21 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::setCalculationParameters(double cohesion, double frictionAngleRad)
|
|
|
|
{
|
|
|
|
m_cohesion = cohesion;
|
|
|
|
m_frictionAngleRad = frictionAngleRad;
|
|
|
|
|
|
|
|
// Todo, delete all dependent results
|
2016-10-31 05:15:07 -05:00
|
|
|
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "SFI", RigFemResultAddress::ALL_TIME_LAPSES));
|
2016-10-27 08:01:21 -05:00
|
|
|
this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "SFI", RigFemResultAddress::ALL_TIME_LAPSES));
|
2016-10-31 05:15:07 -05:00
|
|
|
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "DSM", RigFemResultAddress::ALL_TIME_LAPSES));
|
|
|
|
this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "DSM", RigFemResultAddress::ALL_TIME_LAPSES));
|
|
|
|
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "FOS", RigFemResultAddress::ALL_TIME_LAPSES));
|
|
|
|
this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "FOS", RigFemResultAddress::ALL_TIME_LAPSES));
|
2016-10-27 08:01:21 -05:00
|
|
|
}
|
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-12 11:41:47 -05:00
|
|
|
/// Will always return a valid object, but it can be empty
|
2015-06-04 05:35:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult(int partIndex,
|
2015-06-04 09:10:02 -05:00
|
|
|
const RigFemResultAddress& resVarAddr)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-04 09:46:33 -05:00
|
|
|
CVF_ASSERT(partIndex < (int)(m_femPartResults.size()));
|
2015-06-04 05:35:22 -05:00
|
|
|
CVF_ASSERT(m_readerInterface.notNull());
|
2015-06-09 09:18:11 -05:00
|
|
|
CVF_ASSERT(resVarAddr.isValid());
|
2015-06-04 05:35:22 -05:00
|
|
|
|
2015-06-12 04:34:03 -05:00
|
|
|
// If we have it in the cache, return it
|
2015-06-04 05:35:22 -05:00
|
|
|
RigFemScalarResultFrames* frames = m_femPartResults[partIndex]->findScalarResult(resVarAddr);
|
|
|
|
if (frames) return frames;
|
|
|
|
|
2015-06-12 04:34:03 -05:00
|
|
|
// Check whether a derived result is requested
|
|
|
|
|
2015-06-12 11:41:47 -05:00
|
|
|
frames = calculateDerivedResult(partIndex, resVarAddr);
|
|
|
|
if (frames) return frames;
|
2015-06-12 04:34:03 -05:00
|
|
|
|
2018-01-10 03:43:33 -06:00
|
|
|
if (resVarAddr.resultPosType == RIG_ELEMENT)
|
|
|
|
{
|
|
|
|
std::map<std::string, std::vector<float>> elementProperties = m_elementPropertyReader->readAllElementPropertiesInFileContainingField(resVarAddr.fieldName);
|
|
|
|
|
|
|
|
std::vector<RigFemScalarResultFrames*> resultsForEachComponent;
|
2018-01-12 05:43:36 -06:00
|
|
|
for (std::pair< std::string, std::vector<float>> elem : elementProperties)
|
2018-01-10 03:43:33 -06:00
|
|
|
{
|
2018-01-10 07:14:36 -06:00
|
|
|
RigFemResultAddress addressForElement(RIG_ELEMENT, elem.first, "");
|
|
|
|
RigFemScalarResultFrames* currentFrames = m_femPartResults[partIndex]->createScalarResult(addressForElement);
|
|
|
|
currentFrames->enableAsSingleFrameResult();
|
2018-01-10 03:43:33 -06:00
|
|
|
currentFrames->frameData(0).swap(elem.second);
|
|
|
|
}
|
|
|
|
|
2018-01-10 05:55:36 -06:00
|
|
|
frames = m_femPartResults[partIndex]->findScalarResult(resVarAddr);
|
|
|
|
if (frames)
|
|
|
|
{
|
|
|
|
return frames;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
}
|
2018-01-10 03:43:33 -06:00
|
|
|
}
|
|
|
|
|
2015-06-12 04:34:03 -05:00
|
|
|
// We need to read the data as bulk fields, and populate the correct scalar caches
|
|
|
|
|
2015-06-12 11:41:47 -05:00
|
|
|
std::vector< RigFemResultAddress> resultAddressOfComponents = this->getResAddrToComponentsToRead(resVarAddr);
|
2015-06-26 08:43:43 -05:00
|
|
|
|
2015-06-29 05:17:30 -05:00
|
|
|
if (resultAddressOfComponents.size())
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-29 05:17:30 -05:00
|
|
|
std::vector<RigFemScalarResultFrames*> resultsForEachComponent;
|
|
|
|
for (size_t cIdx = 0; cIdx < resultAddressOfComponents.size(); ++cIdx)
|
|
|
|
{
|
|
|
|
resultsForEachComponent.push_back(m_femPartResults[partIndex]->createScalarResult(resultAddressOfComponents[cIdx]));
|
|
|
|
}
|
|
|
|
|
|
|
|
int frameCount = this->frameCount();
|
|
|
|
caf::ProgressInfo progress(frameCount, "");
|
2016-10-31 02:44:40 -05:00
|
|
|
progress.setProgressDescription(QString("Loading Native Result %1 %2").arg(resVarAddr.fieldName.c_str(), resVarAddr.componentName.c_str()));
|
2015-06-04 05:35:22 -05:00
|
|
|
|
2015-06-29 05:17:30 -05:00
|
|
|
for (int stepIndex = 0; stepIndex < frameCount; ++stepIndex)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-29 05:17:30 -05:00
|
|
|
std::vector<double > frameTimes = m_readerInterface->frameTimes(stepIndex);
|
2015-06-12 11:41:47 -05:00
|
|
|
|
2015-06-29 05:17:30 -05:00
|
|
|
for (int fIdx = 1; (size_t)fIdx < frameTimes.size() && fIdx < 2 ; ++fIdx) // Read only the second frame
|
2015-06-04 09:10:02 -05:00
|
|
|
{
|
2015-06-29 05:17:30 -05:00
|
|
|
std::vector<std::vector<float>*> componentDataVectors;
|
|
|
|
for (size_t cIdx = 0; cIdx < resultsForEachComponent.size(); ++cIdx)
|
|
|
|
{
|
|
|
|
componentDataVectors.push_back(&(resultsForEachComponent[cIdx]->frameData(stepIndex)));
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (resVarAddr.resultPosType)
|
|
|
|
{
|
|
|
|
case RIG_NODAL:
|
|
|
|
m_readerInterface->readNodeField(resVarAddr.fieldName, partIndex, stepIndex, fIdx, &componentDataVectors);
|
|
|
|
break;
|
|
|
|
case RIG_ELEMENT_NODAL:
|
|
|
|
m_readerInterface->readElementNodeField(resVarAddr.fieldName, partIndex, stepIndex, fIdx, &componentDataVectors);
|
|
|
|
break;
|
|
|
|
case RIG_INTEGRATION_POINT:
|
|
|
|
m_readerInterface->readIntegrationPointField(resVarAddr.fieldName, partIndex, stepIndex, fIdx, &componentDataVectors);
|
|
|
|
break;
|
2018-02-23 14:30:24 -06:00
|
|
|
default:
|
|
|
|
break;
|
2015-06-29 05:17:30 -05:00
|
|
|
}
|
2015-06-04 09:10:02 -05:00
|
|
|
}
|
2015-06-29 05:17:30 -05:00
|
|
|
|
|
|
|
progress.incrementProgress();
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
2015-06-26 08:43:43 -05:00
|
|
|
|
2015-06-29 05:17:30 -05:00
|
|
|
// Now fetch the particular component requested, which should now exist and be read.
|
|
|
|
frames = m_femPartResults[partIndex]->findScalarResult(resVarAddr);
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
2015-06-12 11:41:47 -05:00
|
|
|
|
|
|
|
if (!frames)
|
|
|
|
{
|
|
|
|
frames = m_femPartResults[partIndex]->createScalarResult(resVarAddr); // Create a dummy empty result, if the request did not specify the component.
|
|
|
|
}
|
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
return frames;
|
|
|
|
}
|
|
|
|
|
2015-06-12 11:41:47 -05:00
|
|
|
|
2015-06-15 05:15:00 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::map<std::string, std::vector<std::string> > RigFemPartResultsCollection::scalarFieldAndComponentNames(RigFemResultPosEnum resPos)
|
|
|
|
{
|
|
|
|
std::map<std::string, std::vector<std::string> > fieldCompNames;
|
|
|
|
|
2016-09-06 03:27:30 -05:00
|
|
|
if (resPos == RIG_FORMATION_NAMES)
|
|
|
|
{
|
|
|
|
if (activeFormationNames()) fieldCompNames["Active Formation Names"];
|
|
|
|
}
|
|
|
|
|
2015-06-15 05:15:00 -05:00
|
|
|
if (m_readerInterface.notNull())
|
|
|
|
{
|
|
|
|
if (resPos == RIG_NODAL)
|
|
|
|
{
|
|
|
|
fieldCompNames = m_readerInterface->scalarNodeFieldAndComponentNames();
|
2015-09-26 02:38:29 -05:00
|
|
|
fieldCompNames["POR-Bar"];
|
2018-02-15 03:58:13 -06:00
|
|
|
fieldCompNames[FIELD_NAME_COMPACTION];
|
2015-06-15 05:15:00 -05:00
|
|
|
}
|
|
|
|
else if (resPos == RIG_ELEMENT_NODAL)
|
|
|
|
{
|
|
|
|
fieldCompNames = m_readerInterface->scalarElementNodeFieldAndComponentNames();
|
2016-10-11 06:17:12 -05:00
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
fieldCompNames["SE"].push_back("SEM");
|
2016-10-27 08:01:21 -05:00
|
|
|
fieldCompNames["SE"].push_back("SFI");
|
2016-10-31 05:15:07 -05:00
|
|
|
fieldCompNames["SE"].push_back("DSM");
|
|
|
|
fieldCompNames["SE"].push_back("FOS");
|
2016-10-11 06:17:12 -05:00
|
|
|
|
2015-07-01 04:35:17 -05:00
|
|
|
fieldCompNames["SE"].push_back("S11");
|
|
|
|
fieldCompNames["SE"].push_back("S22");
|
|
|
|
fieldCompNames["SE"].push_back("S33");
|
|
|
|
fieldCompNames["SE"].push_back("S12");
|
|
|
|
fieldCompNames["SE"].push_back("S13");
|
|
|
|
fieldCompNames["SE"].push_back("S23");
|
|
|
|
fieldCompNames["SE"].push_back("S1");
|
|
|
|
fieldCompNames["SE"].push_back("S2");
|
|
|
|
fieldCompNames["SE"].push_back("S3");
|
2016-10-13 06:28:52 -05:00
|
|
|
|
2016-10-13 05:15:21 -05:00
|
|
|
fieldCompNames["SE"].push_back("S1inc");
|
|
|
|
fieldCompNames["SE"].push_back("S1azi");
|
2016-10-31 03:53:38 -05:00
|
|
|
fieldCompNames["SE"].push_back("S2inc");
|
|
|
|
fieldCompNames["SE"].push_back("S2azi");
|
2016-10-13 05:15:21 -05:00
|
|
|
fieldCompNames["SE"].push_back("S3inc");
|
|
|
|
fieldCompNames["SE"].push_back("S3azi");
|
2015-06-15 05:15:00 -05:00
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
fieldCompNames["ST"].push_back("STM");
|
|
|
|
fieldCompNames["ST"].push_back("Q");
|
|
|
|
|
2015-06-15 05:15:00 -05:00
|
|
|
fieldCompNames["ST"].push_back("S11");
|
|
|
|
fieldCompNames["ST"].push_back("S22");
|
|
|
|
fieldCompNames["ST"].push_back("S33");
|
2015-06-17 07:22:14 -05:00
|
|
|
fieldCompNames["ST"].push_back("S12");
|
|
|
|
fieldCompNames["ST"].push_back("S13");
|
|
|
|
fieldCompNames["ST"].push_back("S23");
|
|
|
|
fieldCompNames["ST"].push_back("S1");
|
|
|
|
fieldCompNames["ST"].push_back("S2");
|
|
|
|
fieldCompNames["ST"].push_back("S3");
|
2015-06-17 09:00:59 -05:00
|
|
|
|
2016-10-13 05:15:21 -05:00
|
|
|
fieldCompNames["ST"].push_back("S1inc");
|
|
|
|
fieldCompNames["ST"].push_back("S1azi");
|
2016-10-31 03:53:38 -05:00
|
|
|
fieldCompNames["ST"].push_back("S2inc");
|
|
|
|
fieldCompNames["ST"].push_back("S2azi");
|
2016-10-13 05:15:21 -05:00
|
|
|
fieldCompNames["ST"].push_back("S3inc");
|
|
|
|
fieldCompNames["ST"].push_back("S3azi");
|
|
|
|
|
2015-06-17 09:00:59 -05:00
|
|
|
fieldCompNames["Gamma"].push_back("Gamma1");
|
|
|
|
fieldCompNames["Gamma"].push_back("Gamma2");
|
|
|
|
fieldCompNames["Gamma"].push_back("Gamma3");
|
2015-06-19 07:05:33 -05:00
|
|
|
fieldCompNames["Gamma"].push_back("Gamma11");
|
|
|
|
fieldCompNames["Gamma"].push_back("Gamma22");
|
|
|
|
fieldCompNames["Gamma"].push_back("Gamma33");
|
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
fieldCompNames["NE"].push_back("EV");
|
2016-10-31 04:34:51 -05:00
|
|
|
fieldCompNames["NE"].push_back("ED");
|
2015-06-19 07:05:33 -05:00
|
|
|
fieldCompNames["NE"].push_back("E11");
|
|
|
|
fieldCompNames["NE"].push_back("E22");
|
|
|
|
fieldCompNames["NE"].push_back("E33");
|
|
|
|
fieldCompNames["NE"].push_back("E12");
|
|
|
|
fieldCompNames["NE"].push_back("E13");
|
|
|
|
fieldCompNames["NE"].push_back("E23");
|
2016-10-31 04:24:17 -05:00
|
|
|
fieldCompNames["NE"].push_back("E1");
|
|
|
|
fieldCompNames["NE"].push_back("E2");
|
|
|
|
fieldCompNames["NE"].push_back("E3");
|
2015-09-26 02:38:29 -05:00
|
|
|
|
2015-06-19 07:05:33 -05:00
|
|
|
}
|
2015-06-15 05:15:00 -05:00
|
|
|
else if (resPos == RIG_INTEGRATION_POINT)
|
|
|
|
{
|
|
|
|
fieldCompNames = m_readerInterface->scalarIntegrationPointFieldAndComponentNames();
|
2016-10-13 06:28:52 -05:00
|
|
|
|
|
|
|
fieldCompNames["SE"].push_back("SEM");
|
2016-10-27 08:01:21 -05:00
|
|
|
fieldCompNames["SE"].push_back("SFI");
|
2016-10-31 05:15:07 -05:00
|
|
|
fieldCompNames["SE"].push_back("DSM");
|
|
|
|
fieldCompNames["SE"].push_back("FOS");
|
2016-10-11 06:17:12 -05:00
|
|
|
|
2015-07-01 04:35:17 -05:00
|
|
|
fieldCompNames["SE"].push_back("S11");
|
|
|
|
fieldCompNames["SE"].push_back("S22");
|
|
|
|
fieldCompNames["SE"].push_back("S33");
|
|
|
|
fieldCompNames["SE"].push_back("S12");
|
|
|
|
fieldCompNames["SE"].push_back("S13");
|
|
|
|
fieldCompNames["SE"].push_back("S23");
|
|
|
|
fieldCompNames["SE"].push_back("S1");
|
|
|
|
fieldCompNames["SE"].push_back("S2");
|
|
|
|
fieldCompNames["SE"].push_back("S3");
|
2016-10-13 05:15:21 -05:00
|
|
|
|
|
|
|
fieldCompNames["SE"].push_back("S1inc");
|
|
|
|
fieldCompNames["SE"].push_back("S1azi");
|
2016-10-31 03:53:38 -05:00
|
|
|
fieldCompNames["SE"].push_back("S2inc");
|
|
|
|
fieldCompNames["SE"].push_back("S2azi");
|
2016-10-13 05:15:21 -05:00
|
|
|
fieldCompNames["SE"].push_back("S3inc");
|
|
|
|
fieldCompNames["SE"].push_back("S3azi");
|
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
fieldCompNames["ST"].push_back("STM");
|
|
|
|
fieldCompNames["ST"].push_back("Q");
|
|
|
|
|
2015-06-15 05:15:00 -05:00
|
|
|
fieldCompNames["ST"].push_back("S11");
|
|
|
|
fieldCompNames["ST"].push_back("S22");
|
|
|
|
fieldCompNames["ST"].push_back("S33");
|
2015-06-17 07:22:14 -05:00
|
|
|
fieldCompNames["ST"].push_back("S12");
|
|
|
|
fieldCompNames["ST"].push_back("S13");
|
|
|
|
fieldCompNames["ST"].push_back("S23");
|
|
|
|
fieldCompNames["ST"].push_back("S1");
|
|
|
|
fieldCompNames["ST"].push_back("S2");
|
|
|
|
fieldCompNames["ST"].push_back("S3");
|
2015-06-17 09:00:59 -05:00
|
|
|
|
2016-10-13 05:15:21 -05:00
|
|
|
fieldCompNames["ST"].push_back("S1inc");
|
|
|
|
fieldCompNames["ST"].push_back("S1azi");
|
2016-10-31 03:53:38 -05:00
|
|
|
fieldCompNames["ST"].push_back("S2inc");
|
|
|
|
fieldCompNames["ST"].push_back("S2azi");
|
2016-10-13 05:15:21 -05:00
|
|
|
fieldCompNames["ST"].push_back("S3inc");
|
|
|
|
fieldCompNames["ST"].push_back("S3azi");
|
|
|
|
|
2015-06-17 09:00:59 -05:00
|
|
|
fieldCompNames["Gamma"].push_back("Gamma1");
|
|
|
|
fieldCompNames["Gamma"].push_back("Gamma2");
|
|
|
|
fieldCompNames["Gamma"].push_back("Gamma3");
|
2015-06-19 07:05:33 -05:00
|
|
|
fieldCompNames["Gamma"].push_back("Gamma11");
|
|
|
|
fieldCompNames["Gamma"].push_back("Gamma22");
|
|
|
|
fieldCompNames["Gamma"].push_back("Gamma33");
|
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
fieldCompNames["NE"].push_back("EV");
|
2016-10-31 04:34:51 -05:00
|
|
|
fieldCompNames["NE"].push_back("ED");
|
2015-06-19 07:05:33 -05:00
|
|
|
fieldCompNames["NE"].push_back("E11");
|
|
|
|
fieldCompNames["NE"].push_back("E22");
|
|
|
|
fieldCompNames["NE"].push_back("E33");
|
|
|
|
fieldCompNames["NE"].push_back("E12");
|
|
|
|
fieldCompNames["NE"].push_back("E13");
|
|
|
|
fieldCompNames["NE"].push_back("E23");
|
2016-10-31 04:24:17 -05:00
|
|
|
fieldCompNames["NE"].push_back("E1");
|
|
|
|
fieldCompNames["NE"].push_back("E2");
|
|
|
|
fieldCompNames["NE"].push_back("E3");
|
2015-09-26 02:38:29 -05:00
|
|
|
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
|
|
|
else if(resPos == RIG_ELEMENT_NODAL_FACE)
|
|
|
|
{
|
2016-11-01 06:04:56 -05:00
|
|
|
fieldCompNames["Plane"].push_back("Pinc");
|
|
|
|
fieldCompNames["Plane"].push_back("Pazi");
|
2016-10-19 05:22:13 -05:00
|
|
|
|
2016-10-20 09:46:30 -05:00
|
|
|
fieldCompNames["SE"].push_back("SN");
|
2016-11-01 03:29:52 -05:00
|
|
|
fieldCompNames["SE"].push_back("TP");
|
|
|
|
fieldCompNames["SE"].push_back("TPinc");
|
2016-11-04 09:27:24 -05:00
|
|
|
fieldCompNames["SE"].push_back("TPH" );
|
|
|
|
fieldCompNames["SE"].push_back("TPQV");
|
2016-11-01 03:29:52 -05:00
|
|
|
fieldCompNames["SE"].push_back("FAULTMOB");
|
|
|
|
fieldCompNames["SE"].push_back("PCRIT");
|
2016-10-19 05:22:13 -05:00
|
|
|
|
2016-10-20 09:46:30 -05:00
|
|
|
fieldCompNames["ST"].push_back("SN");
|
2016-11-01 03:29:52 -05:00
|
|
|
fieldCompNames["ST"].push_back("TP");
|
|
|
|
fieldCompNames["ST"].push_back("TPinc");
|
2016-11-04 09:27:24 -05:00
|
|
|
fieldCompNames["ST"].push_back("TPH");
|
|
|
|
fieldCompNames["ST"].push_back("TPQV");
|
2016-11-01 03:29:52 -05:00
|
|
|
fieldCompNames["ST"].push_back("FAULTMOB");
|
|
|
|
fieldCompNames["ST"].push_back("PCRIT");
|
2018-01-10 03:43:33 -06:00
|
|
|
}
|
|
|
|
else if (resPos == RIG_ELEMENT)
|
|
|
|
{
|
2018-01-15 10:40:39 -06:00
|
|
|
for (const std::string& field : m_elementPropertyReader->scalarElementFields())
|
|
|
|
{
|
|
|
|
fieldCompNames[field];
|
|
|
|
}
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
2015-06-15 05:15:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return fieldCompNames;
|
|
|
|
}
|
|
|
|
|
2015-09-26 02:38:29 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-03-03 09:23:20 -06:00
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateBarConvertedResult(int partIndex, const RigFemResultAddress &convertedResultAddr, const std::string& fieldNameToConvert)
|
2015-09-26 02:38:29 -05:00
|
|
|
{
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 2, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(convertedResultAddr.fieldName + ": " + convertedResultAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2015-09-26 02:38:29 -05:00
|
|
|
RigFemScalarResultFrames * srcDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(convertedResultAddr.resultPosType, fieldNameToConvert, convertedResultAddr.componentName));
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(convertedResultAddr);
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2015-09-26 02:38:29 -05:00
|
|
|
int frameCount = srcDataFrames->frameCount();
|
|
|
|
for (int fIdx = 0; fIdx < frameCount; ++fIdx)
|
|
|
|
{
|
|
|
|
const std::vector<float>& srcFrameData = srcDataFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
size_t valCount = srcFrameData.size();
|
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
for (size_t vIdx = 0; vIdx < valCount; ++vIdx)
|
|
|
|
{
|
|
|
|
dstFrameData[vIdx] = 1.0e-5*srcFrameData[vIdx];
|
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2015-09-26 02:38:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
|
|
|
|
2015-09-28 00:39:57 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Convert POR NODAL result to POR-Bar Elment Nodal result
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateEnIpPorBarResult(int partIndex, const RigFemResultAddress &convertedResultAddr)
|
|
|
|
{
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 2, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(convertedResultAddr.fieldName + ": " + convertedResultAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2015-09-28 00:39:57 -05:00
|
|
|
RigFemScalarResultFrames * srcDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_NODAL, "POR", ""));
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(convertedResultAddr);
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2015-09-28 00:39:57 -05:00
|
|
|
const RigFemPart * femPart = m_femParts->part(partIndex);
|
|
|
|
float inf = std::numeric_limits<float>::infinity();
|
|
|
|
|
|
|
|
int frameCount = srcDataFrames->frameCount();
|
|
|
|
for (int fIdx = 0; fIdx < frameCount; ++fIdx)
|
|
|
|
{
|
|
|
|
const std::vector<float>& srcFrameData = srcDataFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
|
|
|
|
if (!srcFrameData.size()) continue; // Create empty results if we have no POR result.
|
|
|
|
|
|
|
|
size_t valCount = femPart->elementNodeResultCount();
|
|
|
|
dstFrameData.resize(valCount, inf);
|
|
|
|
|
|
|
|
int elementCount = femPart->elementCount();
|
|
|
|
for (int elmIdx = 0; elmIdx < elementCount; ++elmIdx)
|
|
|
|
{
|
|
|
|
RigElementType elmType = femPart->elementType(elmIdx);
|
|
|
|
|
|
|
|
int elmNodeCount = RigFemTypes::elmentNodeCount(elmType);
|
|
|
|
|
|
|
|
if (elmType == HEX8P)
|
|
|
|
{
|
|
|
|
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
|
|
|
{
|
|
|
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
|
|
|
int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx(elmNodResIdx);
|
|
|
|
dstFrameData[elmNodResIdx] = 1.0e-5*srcFrameData[nodeIdx];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2015-09-28 00:39:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
|
|
|
|
2016-10-10 09:09:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateTimeLapseResult(int partIndex, const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(resVarAddr.isTimeLapse());
|
|
|
|
|
2016-10-27 04:13:05 -05:00
|
|
|
if (resVarAddr.fieldName != "Gamma")
|
|
|
|
{
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 2, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2018-02-15 03:58:13 -06:00
|
|
|
RigFemResultAddress resVarNative(resVarAddr.resultPosType, resVarAddr.fieldName, resVarAddr.componentName, RigFemResultAddress::NO_TIME_LAPSE, resVarAddr.refKLayerIndex);
|
2016-10-27 04:13:05 -05:00
|
|
|
RigFemScalarResultFrames * srcDataFrames = this->findOrLoadScalarResult(partIndex, resVarNative);
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
2016-10-10 09:09:54 -05:00
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2016-10-27 04:13:05 -05:00
|
|
|
int frameCount = srcDataFrames->frameCount();
|
|
|
|
int baseFrameIdx = resVarAddr.timeLapseBaseFrameIdx;
|
|
|
|
if ( baseFrameIdx >= frameCount ) return dstDataFrames;
|
|
|
|
const std::vector<float>& baseFrameData = srcDataFrames->frameData(baseFrameIdx);
|
2016-10-10 09:09:54 -05:00
|
|
|
|
2016-10-27 04:13:05 -05:00
|
|
|
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
2016-10-10 09:09:54 -05:00
|
|
|
{
|
2016-10-27 04:13:05 -05:00
|
|
|
const std::vector<float>& srcFrameData = srcDataFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
size_t valCount = srcFrameData.size();
|
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
for ( size_t vIdx = 0; vIdx < valCount; ++vIdx )
|
|
|
|
{
|
|
|
|
dstFrameData[vIdx] = srcFrameData[vIdx] - baseFrameData[vIdx];
|
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2016-10-10 09:09:54 -05:00
|
|
|
}
|
2016-10-27 04:13:05 -05:00
|
|
|
|
|
|
|
return dstDataFrames;
|
2016-10-10 09:09:54 -05:00
|
|
|
}
|
2016-10-27 04:13:05 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Gamma time lapse needs to be calculated as ST_dt / POR_dt and not Gamma - Gamma_baseFrame see github issue #937
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 3, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-10 09:09:54 -05:00
|
|
|
|
2016-10-27 04:13:05 -05:00
|
|
|
RigFemResultAddress totStressCompAddr(resVarAddr.resultPosType, "ST", "", resVarAddr.timeLapseBaseFrameIdx);
|
|
|
|
{
|
|
|
|
std::string scomp;
|
|
|
|
std::string gcomp = resVarAddr.componentName;
|
|
|
|
if ( gcomp == "Gamma1" ) scomp = "S1";
|
|
|
|
else if ( gcomp == "Gamma2" ) scomp = "S2";
|
|
|
|
else if ( gcomp == "Gamma3" ) scomp = "S3";
|
|
|
|
else if ( gcomp == "Gamma11" ) scomp = "S11";
|
|
|
|
else if ( gcomp == "Gamma22" ) scomp = "S22";
|
|
|
|
else if ( gcomp == "Gamma33" ) scomp = "S33";
|
|
|
|
totStressCompAddr.componentName = scomp;
|
|
|
|
}
|
|
|
|
|
|
|
|
RigFemScalarResultFrames * srcDataFrames = this->findOrLoadScalarResult(partIndex, totStressCompAddr);
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-27 04:13:05 -05:00
|
|
|
RigFemScalarResultFrames * srcPORDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_NODAL, "POR-Bar", "", resVarAddr.timeLapseBaseFrameIdx));
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
|
|
|
calculateGammaFromFrames(partIndex, srcDataFrames, srcPORDataFrames, dstDataFrames, &frameCountProgress);
|
2016-10-27 04:13:05 -05:00
|
|
|
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
2016-10-10 09:09:54 -05:00
|
|
|
}
|
|
|
|
|
2016-10-11 05:12:10 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-10-13 05:43:31 -05:00
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateMeanStressSEM(int partIndex, const RigFemResultAddress& resVarAddr)
|
2016-10-11 05:12:10 -05:00
|
|
|
{
|
2016-10-13 06:28:52 -05:00
|
|
|
CVF_ASSERT(resVarAddr.fieldName == "SE" && resVarAddr.componentName == "SEM");
|
2016-10-13 05:43:31 -05:00
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 4, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2017-03-06 04:18:12 -06:00
|
|
|
RigFemScalarResultFrames * sa11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S11"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2017-03-06 04:18:12 -06:00
|
|
|
RigFemScalarResultFrames * sa22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S22"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2017-03-06 04:18:12 -06:00
|
|
|
RigFemScalarResultFrames * sa33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S33"));
|
2016-10-13 05:43:31 -05:00
|
|
|
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2016-10-13 05:43:31 -05:00
|
|
|
int frameCount = sa11->frameCount();
|
|
|
|
for(int fIdx = 0; fIdx < frameCount; ++fIdx)
|
2016-10-11 06:17:12 -05:00
|
|
|
{
|
2016-10-13 05:43:31 -05:00
|
|
|
const std::vector<float>& sa11Data = sa11->frameData(fIdx);
|
|
|
|
const std::vector<float>& sa22Data = sa22->frameData(fIdx);
|
|
|
|
const std::vector<float>& sa33Data = sa33->frameData(fIdx);
|
|
|
|
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
size_t valCount = sa11Data.size();
|
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
for(size_t vIdx = 0; vIdx < valCount; ++vIdx)
|
|
|
|
{
|
|
|
|
dstFrameData[vIdx] = (sa11Data[vIdx] + sa22Data[vIdx] + sa33Data[vIdx])/3.0f;
|
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2016-10-11 06:17:12 -05:00
|
|
|
}
|
2016-10-11 05:12:10 -05:00
|
|
|
|
2016-10-13 05:43:31 -05:00
|
|
|
return dstDataFrames;
|
|
|
|
}
|
2016-10-27 08:01:21 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSFI(int partIndex, const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(resVarAddr.fieldName == "SE" && resVarAddr.componentName == "SFI");
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 3, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-27 08:01:21 -05:00
|
|
|
|
2017-03-06 04:18:12 -06:00
|
|
|
RigFemScalarResultFrames * se1Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S1"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2017-03-06 04:18:12 -06:00
|
|
|
RigFemScalarResultFrames * se3Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S3"));
|
2016-10-27 08:01:21 -05:00
|
|
|
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2016-10-27 08:01:21 -05:00
|
|
|
float cohPrFricAngle = (float)(m_cohesion/tan(m_frictionAngleRad));
|
|
|
|
float sinFricAng = sin(m_frictionAngleRad);
|
|
|
|
|
|
|
|
int frameCount = se1Frames->frameCount();
|
|
|
|
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
|
|
|
{
|
|
|
|
const std::vector<float>& se1Data = se1Frames->frameData(fIdx);
|
|
|
|
const std::vector<float>& se3Data = se3Frames->frameData(fIdx);
|
|
|
|
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
size_t valCount = se1Data.size();
|
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
for ( size_t vIdx = 0; vIdx < valCount; ++vIdx )
|
|
|
|
{
|
|
|
|
float se1 = se1Data[vIdx];
|
|
|
|
float se3 = se3Data[vIdx];
|
|
|
|
float se1Se3Diff = se1-se3;
|
|
|
|
|
|
|
|
if ( fabs(se1Se3Diff) < 1e-7 )
|
|
|
|
{
|
|
|
|
dstFrameData[vIdx] = std::numeric_limits<float>::infinity();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-03-06 04:18:12 -06:00
|
|
|
dstFrameData[vIdx] = ((cohPrFricAngle + 0.5*(se1Data[vIdx] + se3Data[vIdx])) * sinFricAng ) / (0.5*(se1Data[vIdx] - se3Data[vIdx]));
|
2016-10-27 08:01:21 -05:00
|
|
|
}
|
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2016-10-27 08:01:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
|
|
|
|
2016-10-31 05:15:07 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDSM(int partIndex, const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(resVarAddr.fieldName == "SE" && resVarAddr.componentName == "DSM");
|
|
|
|
|
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 3, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2017-03-06 04:18:12 -06:00
|
|
|
RigFemScalarResultFrames * se1Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S1"));
|
2016-10-31 05:15:07 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2017-03-06 04:18:12 -06:00
|
|
|
RigFemScalarResultFrames * se3Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S3"));
|
2016-10-31 05:15:07 -05:00
|
|
|
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
|
|
|
float tanFricAng = tan(m_frictionAngleRad);
|
2016-11-01 03:29:52 -05:00
|
|
|
float cohPrTanFricAngle = (float)(m_cohesion/tanFricAng);
|
2016-10-31 05:15:07 -05:00
|
|
|
int frameCount = se1Frames->frameCount();
|
|
|
|
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
|
|
|
{
|
|
|
|
const std::vector<float>& se1Data = se1Frames->frameData(fIdx);
|
|
|
|
const std::vector<float>& se3Data = se3Frames->frameData(fIdx);
|
|
|
|
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
size_t valCount = se1Data.size();
|
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
for ( size_t vIdx = 0; vIdx < valCount; ++vIdx )
|
|
|
|
{
|
2018-03-06 03:29:04 -06:00
|
|
|
dstFrameData[vIdx] = dsm(se1Data[vIdx], se3Data[vIdx], tanFricAng, cohPrTanFricAngle);
|
2016-10-31 05:15:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
}
|
|
|
|
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateFOS(int partIndex, const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(resVarAddr.fieldName == "SE" && resVarAddr.componentName == "FOS");
|
|
|
|
|
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 2, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2017-03-06 04:18:12 -06:00
|
|
|
RigFemScalarResultFrames * dsmFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "DSM"));
|
2016-10-31 05:15:07 -05:00
|
|
|
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
|
|
|
int frameCount = dsmFrames->frameCount();
|
|
|
|
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
|
|
|
{
|
|
|
|
const std::vector<float>& dsmData = dsmFrames->frameData(fIdx);
|
|
|
|
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
size_t valCount = dsmData.size();
|
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
for ( size_t vIdx = 0; vIdx < valCount; ++vIdx )
|
|
|
|
{
|
|
|
|
float dsm = dsmData[vIdx];
|
|
|
|
dstFrameData[vIdx] = 1.0f/dsm;
|
|
|
|
}
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
}
|
|
|
|
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
|
|
|
|
2016-10-13 05:43:31 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-10-13 06:28:52 -05:00
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateMeanStressSTM(int partIndex, const RigFemResultAddress& resVarAddr)
|
2016-10-13 05:43:31 -05:00
|
|
|
{
|
2016-10-13 06:28:52 -05:00
|
|
|
CVF_ASSERT(resVarAddr.fieldName == "ST" && resVarAddr.componentName == "STM");
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 4, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2017-03-06 04:18:12 -06:00
|
|
|
RigFemScalarResultFrames * st11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S11"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2017-03-06 04:18:12 -06:00
|
|
|
RigFemScalarResultFrames * st22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S22"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2017-03-06 04:18:12 -06:00
|
|
|
RigFemScalarResultFrames * st33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S33"));
|
2016-10-13 05:43:31 -05:00
|
|
|
|
2016-10-11 05:12:10 -05:00
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
int frameCount = st11->frameCount();
|
2016-10-11 05:12:10 -05:00
|
|
|
for(int fIdx = 0; fIdx < frameCount; ++fIdx)
|
|
|
|
{
|
2016-10-13 06:28:52 -05:00
|
|
|
const std::vector<float>& st11Data = st11->frameData(fIdx);
|
|
|
|
const std::vector<float>& st22Data = st22->frameData(fIdx);
|
|
|
|
const std::vector<float>& st33Data = st33->frameData(fIdx);
|
2016-10-11 05:12:10 -05:00
|
|
|
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
2016-10-13 06:28:52 -05:00
|
|
|
size_t valCount = st11Data.size();
|
2016-10-11 05:12:10 -05:00
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
for(size_t vIdx = 0; vIdx < valCount; ++vIdx)
|
|
|
|
{
|
2016-10-13 06:28:52 -05:00
|
|
|
dstFrameData[vIdx] = (st11Data[vIdx] + st22Data[vIdx] + st33Data[vIdx])/3.0f;
|
2016-10-11 05:12:10 -05:00
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2016-10-11 05:12:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
|
|
|
|
2016-10-11 07:54:42 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDeviatoricStress(int partIndex, const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
2016-10-13 06:28:52 -05:00
|
|
|
CVF_ASSERT(resVarAddr.fieldName == "ST" && resVarAddr.componentName == "Q");
|
2016-10-11 07:54:42 -05:00
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 5, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2016-10-31 03:36:40 -05:00
|
|
|
RigFemScalarResultFrames * st11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S1"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-31 03:36:40 -05:00
|
|
|
RigFemScalarResultFrames * st22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S2"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-31 03:36:40 -05:00
|
|
|
RigFemScalarResultFrames * st33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S3"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-11 07:54:42 -05:00
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
RigFemScalarResultFrames * stm = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "STM"));
|
2016-10-11 07:54:42 -05:00
|
|
|
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
int frameCount = st11->frameCount();
|
2016-10-11 07:54:42 -05:00
|
|
|
for(int fIdx = 0; fIdx < frameCount; ++fIdx)
|
|
|
|
{
|
2016-10-13 06:28:52 -05:00
|
|
|
const std::vector<float>& st11Data = st11->frameData(fIdx);
|
|
|
|
const std::vector<float>& st22Data = st22->frameData(fIdx);
|
|
|
|
const std::vector<float>& st33Data = st33->frameData(fIdx);
|
2016-10-11 07:54:42 -05:00
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
const std::vector<float>& stmData = stm->frameData(fIdx);
|
2016-10-11 07:54:42 -05:00
|
|
|
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
2016-10-13 06:28:52 -05:00
|
|
|
size_t valCount = st11Data.size();
|
2016-10-11 07:54:42 -05:00
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
for(size_t vIdx = 0; vIdx < valCount; ++vIdx)
|
|
|
|
{
|
2016-10-13 06:28:52 -05:00
|
|
|
float stmVal = stmData[vIdx];
|
|
|
|
float st11Corr = st11Data[vIdx] - stmVal;
|
|
|
|
float st22Corr = st22Data[vIdx] - stmVal;
|
|
|
|
float st33Corr = st33Data[vIdx] - stmVal;
|
2016-10-11 07:54:42 -05:00
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
dstFrameData[vIdx] = sqrt (1.5*(st11Corr*st11Corr + st22Corr*st22Corr + st33Corr*st33Corr));
|
2016-10-11 07:54:42 -05:00
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2016-10-11 07:54:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
|
|
|
|
2016-10-11 08:38:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateVolumetricStrain(int partIndex, const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
2016-10-13 06:28:52 -05:00
|
|
|
CVF_ASSERT(resVarAddr.fieldName == "NE" && resVarAddr.componentName == "EV");
|
2016-10-11 08:38:51 -05:00
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 4, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2016-10-31 04:34:51 -05:00
|
|
|
RigFemScalarResultFrames * ea11 = nullptr;
|
|
|
|
RigFemScalarResultFrames * ea22 = nullptr;
|
|
|
|
RigFemScalarResultFrames * ea33 = nullptr;
|
|
|
|
|
2016-10-11 08:38:51 -05:00
|
|
|
{
|
|
|
|
ea11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "NE", "E11"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-11 08:38:51 -05:00
|
|
|
ea22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "NE", "E22"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-11 08:38:51 -05:00
|
|
|
ea33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "NE", "E33"));
|
|
|
|
}
|
|
|
|
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2016-10-11 08:38:51 -05:00
|
|
|
int frameCount = ea11->frameCount();
|
|
|
|
for(int fIdx = 0; fIdx < frameCount; ++fIdx)
|
|
|
|
{
|
|
|
|
const std::vector<float>& ea11Data = ea11->frameData(fIdx);
|
|
|
|
const std::vector<float>& ea22Data = ea22->frameData(fIdx);
|
|
|
|
const std::vector<float>& ea33Data = ea33->frameData(fIdx);
|
|
|
|
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
size_t valCount = ea11Data.size();
|
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
for(size_t vIdx = 0; vIdx < valCount; ++vIdx)
|
|
|
|
{
|
|
|
|
dstFrameData[vIdx] = (ea11Data[vIdx] + ea22Data[vIdx] + ea33Data[vIdx]);
|
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2016-10-11 08:38:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
|
|
|
|
2016-10-31 04:34:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDeviatoricStrain(int partIndex, const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(resVarAddr.fieldName == "NE" && resVarAddr.componentName == "ED");
|
|
|
|
|
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 3, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
|
|
|
RigFemScalarResultFrames * ea11 = nullptr;
|
|
|
|
RigFemScalarResultFrames * ea33 = nullptr;
|
|
|
|
{
|
|
|
|
ea11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "NE", "E1"));
|
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
ea33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "NE", "E3"));
|
|
|
|
}
|
|
|
|
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
|
|
|
int frameCount = ea11->frameCount();
|
|
|
|
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
|
|
|
{
|
|
|
|
const std::vector<float>& ea11Data = ea11->frameData(fIdx);
|
|
|
|
const std::vector<float>& ea33Data = ea33->frameData(fIdx);
|
|
|
|
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
size_t valCount = ea11Data.size();
|
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
for ( size_t vIdx = 0; vIdx < valCount; ++vIdx )
|
|
|
|
{
|
|
|
|
dstFrameData[vIdx] = 0.666666666666667f*(ea11Data[vIdx] - ea33Data[vIdx]);
|
|
|
|
}
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
}
|
|
|
|
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
|
|
|
|
2016-10-19 05:22:13 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSurfaceAlignedStress(int partIndex, const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
2016-10-21 07:30:45 -05:00
|
|
|
CVF_ASSERT( resVarAddr.componentName == "STH" || resVarAddr.componentName == "STQV" || resVarAddr.componentName == "SN"
|
2016-11-04 09:27:24 -05:00
|
|
|
|| resVarAddr.componentName == "TPH" || resVarAddr.componentName == "TPQV" || resVarAddr.componentName == "THQV"
|
2016-11-01 03:29:52 -05:00
|
|
|
|| resVarAddr.componentName == "TP" || resVarAddr.componentName == "TPinc"
|
|
|
|
|| resVarAddr.componentName == "FAULTMOB" || resVarAddr.componentName == "PCRIT");
|
2016-10-19 05:22:13 -05:00
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 7, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2016-10-19 05:22:13 -05:00
|
|
|
RigFemScalarResultFrames * s11Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S11"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-19 05:22:13 -05:00
|
|
|
RigFemScalarResultFrames * s22Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S22"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-19 05:22:13 -05:00
|
|
|
RigFemScalarResultFrames * s33Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S33"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-19 05:22:13 -05:00
|
|
|
RigFemScalarResultFrames * s12Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S12"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-19 05:22:13 -05:00
|
|
|
RigFemScalarResultFrames * s23Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S23"));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2016-10-19 05:22:13 -05:00
|
|
|
RigFemScalarResultFrames * s13Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_ELEMENT_NODAL, resVarAddr.fieldName, "S13"));
|
|
|
|
|
2016-11-01 03:29:52 -05:00
|
|
|
RigFemScalarResultFrames * SNFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "SN"));
|
|
|
|
RigFemScalarResultFrames * STHFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "STH"));
|
|
|
|
RigFemScalarResultFrames * STQVFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "STQV"));
|
2016-11-04 09:27:24 -05:00
|
|
|
RigFemScalarResultFrames * TNHFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "TPH" ));
|
|
|
|
RigFemScalarResultFrames * TNQVFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "TPQV"));
|
2016-11-01 03:29:52 -05:00
|
|
|
RigFemScalarResultFrames * THQVFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "THQV"));
|
|
|
|
RigFemScalarResultFrames * TPFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "TP"));
|
|
|
|
RigFemScalarResultFrames * TPincFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "TPinc"));
|
|
|
|
RigFemScalarResultFrames * FAULTMOBFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "FAULTMOB"));
|
|
|
|
RigFemScalarResultFrames * PCRITFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "PCRIT"));
|
2016-10-21 07:30:45 -05:00
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2016-10-19 05:22:13 -05:00
|
|
|
const RigFemPart * femPart = m_femParts->part(partIndex);
|
|
|
|
const std::vector<cvf::Vec3f>& nodeCoordinates = femPart->nodes().coordinates;
|
|
|
|
|
2016-11-01 03:29:52 -05:00
|
|
|
float tanFricAng = tan(m_frictionAngleRad);
|
|
|
|
float cohPrTanFricAngle = (float)(m_cohesion/tanFricAng);
|
|
|
|
|
2016-10-19 05:22:13 -05:00
|
|
|
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);
|
|
|
|
|
2016-11-01 03:29:52 -05:00
|
|
|
std::vector<float>& SNDat = SNFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& STHDat = STHFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& STQVDat = STQVFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& TNHDat = TNHFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& TNQVDat = TNQVFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& THQVDat = THQVFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& TPDat = TPFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& TincDat = TPincFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& FAULTMOBDat = FAULTMOBFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& PCRITDat = PCRITFrames->frameData(fIdx);
|
2016-10-19 05:22:13 -05:00
|
|
|
|
|
|
|
// 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
|
2016-11-01 03:29:52 -05:00
|
|
|
|
|
|
|
SNDat.resize(valCount);
|
|
|
|
STHDat.resize(valCount);
|
|
|
|
STQVDat.resize(valCount);
|
|
|
|
TNHDat.resize(valCount);
|
|
|
|
TNQVDat.resize(valCount);
|
|
|
|
THQVDat.resize(valCount);
|
|
|
|
TPDat.resize(valCount);
|
|
|
|
TincDat.resize(valCount);
|
|
|
|
FAULTMOBDat.resize(valCount);
|
|
|
|
PCRITDat.resize(valCount);
|
2016-10-19 05:22:13 -05:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2016-11-01 03:29:52 -05:00
|
|
|
float szx = xfTen[caf::Ten3f::SZX];
|
|
|
|
float syz = xfTen[caf::Ten3f::SYZ];
|
|
|
|
float szz = xfTen[caf::Ten3f::SZZ];
|
|
|
|
|
|
|
|
STHDat[elmNodFaceResIdx] = xfTen[caf::Ten3f::SXX];
|
|
|
|
STQVDat[elmNodFaceResIdx] = xfTen[caf::Ten3f::SYY];
|
|
|
|
SNDat[elmNodFaceResIdx] = xfTen[caf::Ten3f::SZZ];
|
2016-11-04 07:24:38 -05:00
|
|
|
|
2016-11-01 03:29:52 -05:00
|
|
|
TNHDat[elmNodFaceResIdx] = xfTen[caf::Ten3f::SZX];
|
2016-11-04 07:24:38 -05:00
|
|
|
TNQVDat[elmNodFaceResIdx] = xfTen[caf::Ten3f::SYZ];
|
|
|
|
THQVDat[elmNodFaceResIdx] = xfTen[caf::Ten3f::SXY];
|
2016-11-01 03:29:52 -05:00
|
|
|
|
|
|
|
float TP = sqrt(szx*szx + syz*syz);
|
|
|
|
TPDat[elmNodFaceResIdx] = TP;
|
|
|
|
|
|
|
|
if (TP > 1e-5)
|
|
|
|
{
|
|
|
|
TincDat[elmNodFaceResIdx] = cvf::Math::toDegrees( acos(syz/TP) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TincDat[elmNodFaceResIdx] = std::numeric_limits<float>::infinity();
|
|
|
|
}
|
|
|
|
|
|
|
|
FAULTMOBDat[elmNodFaceResIdx] = TP/(tanFricAng * (szz + cohPrTanFricAngle));
|
|
|
|
PCRITDat[elmNodFaceResIdx] = szz - TP/tanFricAng;
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
RigFemScalarResultFrames* requestedSurfStress = this->findOrLoadScalarResult(partIndex,resVarAddr);
|
|
|
|
return requestedSurfStress;
|
|
|
|
}
|
|
|
|
|
2016-11-01 06:04:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSurfaceAngles(int partIndex, const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(resVarAddr.componentName == "Pazi" || resVarAddr.componentName == "Pinc");
|
|
|
|
|
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 1, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
|
|
|
|
RigFemScalarResultFrames * PaziFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "Pazi"));
|
|
|
|
RigFemScalarResultFrames * PincFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "Pinc"));
|
|
|
|
|
|
|
|
const RigFemPart * femPart = m_femParts->part(partIndex);
|
|
|
|
const std::vector<cvf::Vec3f>& nodeCoordinates = femPart->nodes().coordinates;
|
|
|
|
int frameCount = this->frameCount();
|
|
|
|
|
|
|
|
// HACK ! Todo : make it robust against other elements than Hex8
|
|
|
|
size_t valCount = femPart->elementCount() * 24; // Number of Elm Node Face results 24 = 4 * num faces = 3* numElmNodes
|
|
|
|
|
|
|
|
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
|
|
|
{
|
|
|
|
std::vector<float>& Pazi = PaziFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& Pinc = PincFrames->frameData(fIdx);
|
|
|
|
|
|
|
|
Pazi.resize(valCount);
|
|
|
|
Pinc.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]);
|
|
|
|
OffshoreSphericalCoords sphCoord(cvf::Vec3f(rotMx.rowCol(0,2), rotMx.rowCol(1,2), rotMx.rowCol(2,2))); // Use Ez from the matrix as plane normal
|
|
|
|
|
|
|
|
for ( int qIdx = 0; qIdx < 4; ++qIdx )
|
|
|
|
{
|
|
|
|
int elmNodFaceResIdx = elmNodFaceResIdxFaceStart + qIdx;
|
|
|
|
Pazi[elmNodFaceResIdx] = cvf::Math::toDegrees( sphCoord.azi() );
|
|
|
|
Pinc[elmNodFaceResIdx] = cvf::Math::toDegrees( sphCoord.inc() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
}
|
|
|
|
|
|
|
|
RigFemScalarResultFrames* requestedPlaneAngle = this->findOrLoadScalarResult(partIndex, resVarAddr);
|
|
|
|
return requestedPlaneAngle;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-10-31 04:24:17 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculatePrincipalStressValues(int partIndex, const RigFemResultAddress &resVarAddr )
|
|
|
|
{
|
|
|
|
CVF_ASSERT(resVarAddr.componentName == "S1" || resVarAddr.componentName == "S2" || resVarAddr.componentName == "S3"
|
|
|
|
|| resVarAddr.componentName == "S1inc"
|
|
|
|
|| resVarAddr.componentName == "S1azi"
|
|
|
|
|| resVarAddr.componentName == "S2inc"
|
|
|
|
|| resVarAddr.componentName == "S2azi"
|
|
|
|
|| resVarAddr.componentName == "S3inc"
|
|
|
|
|| resVarAddr.componentName == "S3azi");
|
|
|
|
|
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 7, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
|
|
|
|
|
|
|
RigFemScalarResultFrames * s11Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S11"));
|
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
RigFemScalarResultFrames * s22Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S22"));
|
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
RigFemScalarResultFrames * s33Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S33"));
|
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
RigFemScalarResultFrames * s12Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S12"));
|
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
RigFemScalarResultFrames * s13Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S13"));
|
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
RigFemScalarResultFrames * s23Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S23"));
|
|
|
|
|
|
|
|
RigFemScalarResultFrames * s1Frames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S1"));
|
|
|
|
RigFemScalarResultFrames * s2Frames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S2"));
|
|
|
|
RigFemScalarResultFrames * s3Frames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S3"));
|
|
|
|
|
|
|
|
RigFemScalarResultFrames * s1IncFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S1inc"));
|
|
|
|
RigFemScalarResultFrames * s1AziFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S1azi"));
|
|
|
|
RigFemScalarResultFrames * s2IncFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S2inc"));
|
|
|
|
RigFemScalarResultFrames * s2AziFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S2azi"));
|
|
|
|
RigFemScalarResultFrames * s3IncFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S3inc"));
|
|
|
|
RigFemScalarResultFrames * s3AziFrames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "S3azi"));
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
|
|
|
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>& s13 = s13Frames->frameData(fIdx);
|
|
|
|
const std::vector<float>& s23 = s23Frames->frameData(fIdx);
|
|
|
|
|
|
|
|
std::vector<float>& s1 = s1Frames->frameData(fIdx);
|
|
|
|
std::vector<float>& s2 = s2Frames->frameData(fIdx);
|
|
|
|
std::vector<float>& s3 = s3Frames->frameData(fIdx);
|
|
|
|
|
|
|
|
std::vector<float>& s1inc = s1IncFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& s1azi = s1AziFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& s2inc = s2IncFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& s2azi = s2AziFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& s3inc = s3IncFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& s3azi = s3AziFrames->frameData(fIdx);
|
|
|
|
|
|
|
|
size_t valCount = s11.size();
|
|
|
|
|
|
|
|
s1.resize(valCount);
|
|
|
|
s2.resize(valCount);
|
|
|
|
s3.resize(valCount);
|
|
|
|
s1inc.resize(valCount);
|
|
|
|
s1azi.resize(valCount);
|
|
|
|
s2inc.resize(valCount);
|
|
|
|
s2azi.resize(valCount);
|
|
|
|
s3inc.resize(valCount);
|
|
|
|
s3azi.resize(valCount);
|
|
|
|
|
|
|
|
for ( size_t vIdx = 0; vIdx < valCount; ++vIdx )
|
|
|
|
{
|
|
|
|
caf::Ten3f T(s11[vIdx], s22[vIdx], s33[vIdx], s12[vIdx], s23[vIdx], s13[vIdx]);
|
|
|
|
cvf::Vec3f principalDirs[3];
|
|
|
|
cvf::Vec3f principals = T.calculatePrincipals(principalDirs);
|
|
|
|
s1[vIdx] = principals[0];
|
|
|
|
s2[vIdx] = principals[1];
|
|
|
|
s3[vIdx] = principals[2];
|
|
|
|
|
|
|
|
if ( principals[0] != std::numeric_limits<float>::infinity() )
|
|
|
|
{
|
|
|
|
OffshoreSphericalCoords sphCoord1(principalDirs[0]);
|
|
|
|
s1inc[vIdx] = cvf::Math::toDegrees(sphCoord1.inc());
|
|
|
|
s1azi[vIdx] = cvf::Math::toDegrees(sphCoord1.azi());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s1inc[vIdx] = std::numeric_limits<float>::infinity();
|
|
|
|
s1azi[vIdx] = std::numeric_limits<float>::infinity();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( principals[1] != std::numeric_limits<float>::infinity() )
|
|
|
|
{
|
|
|
|
OffshoreSphericalCoords sphCoord2(principalDirs[1]);
|
|
|
|
s2inc[vIdx] = cvf::Math::toDegrees(sphCoord2.inc());
|
|
|
|
s2azi[vIdx] = cvf::Math::toDegrees(sphCoord2.azi());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s2inc[vIdx] = std::numeric_limits<float>::infinity();
|
|
|
|
s2azi[vIdx] = std::numeric_limits<float>::infinity();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( principals[2] != std::numeric_limits<float>::infinity() )
|
|
|
|
{
|
|
|
|
OffshoreSphericalCoords sphCoord3(principalDirs[2]);
|
|
|
|
s3inc[vIdx] = cvf::Math::toDegrees(sphCoord3.inc());
|
|
|
|
s3azi[vIdx] = cvf::Math::toDegrees(sphCoord3.azi());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s3inc[vIdx] = std::numeric_limits<float>::infinity();
|
|
|
|
s3azi[vIdx] = std::numeric_limits<float>::infinity();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
}
|
|
|
|
|
|
|
|
RigFemScalarResultFrames* requestedPrincipal = this->findOrLoadScalarResult(partIndex, resVarAddr);
|
|
|
|
|
|
|
|
return requestedPrincipal;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculatePrincipalStrainValues(int partIndex, const RigFemResultAddress &resVarAddr)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(resVarAddr.componentName == "E1" || resVarAddr.componentName == "E2" || resVarAddr.componentName == "E3");
|
|
|
|
|
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 7, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
|
|
|
|
|
|
|
RigFemScalarResultFrames * s11Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "E11"));
|
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
RigFemScalarResultFrames * s22Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "E22"));
|
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
RigFemScalarResultFrames * s33Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "E33"));
|
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
RigFemScalarResultFrames * s12Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "E12"));
|
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
RigFemScalarResultFrames * s13Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "E13"));
|
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
RigFemScalarResultFrames * s23Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "E23"));
|
|
|
|
|
|
|
|
RigFemScalarResultFrames * s1Frames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "E1"));
|
|
|
|
RigFemScalarResultFrames * s2Frames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "E2"));
|
|
|
|
RigFemScalarResultFrames * s3Frames = m_femPartResults[partIndex]->createScalarResult(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, "E3"));
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
|
|
|
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>& s13 = s13Frames->frameData(fIdx);
|
|
|
|
const std::vector<float>& s23 = s23Frames->frameData(fIdx);
|
|
|
|
|
|
|
|
std::vector<float>& s1 = s1Frames->frameData(fIdx);
|
|
|
|
std::vector<float>& s2 = s2Frames->frameData(fIdx);
|
|
|
|
std::vector<float>& s3 = s3Frames->frameData(fIdx);
|
|
|
|
|
|
|
|
size_t valCount = s11.size();
|
|
|
|
|
|
|
|
s1.resize(valCount);
|
|
|
|
s2.resize(valCount);
|
|
|
|
s3.resize(valCount);
|
|
|
|
|
|
|
|
for ( size_t vIdx = 0; vIdx < valCount; ++vIdx )
|
|
|
|
{
|
|
|
|
caf::Ten3f T(s11[vIdx], s22[vIdx], s33[vIdx], s12[vIdx], s23[vIdx], s13[vIdx]);
|
|
|
|
cvf::Vec3f principalDirs[3];
|
|
|
|
cvf::Vec3f principals = T.calculatePrincipals(principalDirs);
|
|
|
|
s1[vIdx] = principals[0];
|
|
|
|
s2[vIdx] = principals[1];
|
|
|
|
s3[vIdx] = principals[2];
|
|
|
|
}
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
}
|
|
|
|
|
|
|
|
RigFemScalarResultFrames* requestedPrincipal = this->findOrLoadScalarResult(partIndex, resVarAddr);
|
|
|
|
|
|
|
|
return requestedPrincipal;
|
|
|
|
}
|
|
|
|
|
2018-02-15 03:58:13 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateCompactionValues(int partIndex, const RigFemResultAddress &resVarAddr)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(resVarAddr.fieldName == FIELD_NAME_COMPACTION);
|
|
|
|
|
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() + 1, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName));
|
|
|
|
|
|
|
|
RigFemScalarResultFrames * u3Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "U", "U3"));
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
|
|
|
RigFemScalarResultFrames* compactionFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
|
|
|
const RigFemPart* part = m_femParts->part(partIndex);
|
|
|
|
for (int t = 0; t < u3Frames->frameCount(); t++)
|
|
|
|
{
|
|
|
|
std::vector<float>& compactionFrame = compactionFrames->frameData(t);
|
|
|
|
size_t nodeCount = part->nodes().nodeIds.size();
|
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
|
|
|
compactionFrame.resize(nodeCount);
|
2018-02-18 12:01:38 -06:00
|
|
|
for (size_t n = 0; n < nodeCount; n++)
|
2018-02-15 03:58:13 -06:00
|
|
|
{
|
|
|
|
RefElement refElement;
|
|
|
|
findReferenceElementForNode(*part, n, resVarAddr.refKLayerIndex, &refElement);
|
|
|
|
|
|
|
|
if (refElement.elementIdx != cvf::UNDEFINED_SIZE_T)
|
|
|
|
{
|
|
|
|
float shortestDist = HUGE_VALF;
|
2018-03-06 03:01:47 -06:00
|
|
|
size_t closestRefNodeIdx = cvf::UNDEFINED_SIZE_T;
|
2018-02-15 03:58:13 -06:00
|
|
|
|
|
|
|
for (size_t nodeIdx : refElement.elementFaceNodeIdxs)
|
|
|
|
{
|
|
|
|
float dist = horizontalDistance(refElement.intersectionPoint, part->nodes().coordinates[nodeIdx]);
|
|
|
|
if (dist < shortestDist)
|
|
|
|
{
|
|
|
|
shortestDist = dist;
|
2018-03-06 03:01:47 -06:00
|
|
|
closestRefNodeIdx = nodeIdx;
|
2018-02-15 03:58:13 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-06 03:01:47 -06:00
|
|
|
compactionFrame[n] = u3Frames->frameData(t)[closestRefNodeIdx] - u3Frames->frameData(t)[n];
|
2018-02-15 03:58:13 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
compactionFrame[n] = HUGE_VAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RigFemScalarResultFrames* requestedPrincipal = this->findOrLoadScalarResult(partIndex, resVarAddr);
|
|
|
|
return requestedPrincipal;
|
|
|
|
}
|
|
|
|
|
2015-06-12 11:41:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDerivedResult(int partIndex, const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
2016-10-10 09:09:54 -05:00
|
|
|
if (resVarAddr.isTimeLapse())
|
|
|
|
{
|
|
|
|
return calculateTimeLapseResult(partIndex, resVarAddr);
|
|
|
|
}
|
|
|
|
|
2016-10-19 05:22:13 -05:00
|
|
|
if(resVarAddr.resultPosType == RIG_ELEMENT_NODAL_FACE )
|
|
|
|
{
|
2018-01-08 09:34:41 -06:00
|
|
|
if (resVarAddr.componentName == "Pazi" || resVarAddr.componentName == "Pinc")
|
|
|
|
{
|
2016-11-01 06:04:56 -05:00
|
|
|
return calculateSurfaceAngles(partIndex, resVarAddr);
|
2018-01-08 09:34:41 -06:00
|
|
|
}
|
|
|
|
else if (resVarAddr.componentName.empty())
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-11-01 06:04:56 -05:00
|
|
|
return calculateSurfaceAlignedStress(partIndex, resVarAddr);
|
2018-01-08 09:34:41 -06:00
|
|
|
}
|
2016-10-19 05:22:13 -05:00
|
|
|
}
|
|
|
|
|
2018-02-15 03:58:13 -06:00
|
|
|
if (resVarAddr.fieldName == FIELD_NAME_COMPACTION)
|
|
|
|
{
|
|
|
|
return calculateCompactionValues(partIndex, resVarAddr);
|
|
|
|
}
|
|
|
|
|
2016-10-27 08:01:21 -05:00
|
|
|
if (resVarAddr.fieldName == "SE" && resVarAddr.componentName == "SFI")
|
|
|
|
{
|
|
|
|
return calculateSFI(partIndex, resVarAddr);
|
|
|
|
}
|
|
|
|
|
2016-10-31 05:15:07 -05:00
|
|
|
if ( resVarAddr.fieldName == "SE" && resVarAddr.componentName == "DSM" )
|
|
|
|
{
|
|
|
|
return calculateDSM(partIndex, resVarAddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( resVarAddr.fieldName == "SE" && resVarAddr.componentName == "FOS" )
|
|
|
|
{
|
|
|
|
return calculateFOS(partIndex, resVarAddr);
|
|
|
|
}
|
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
if(resVarAddr.fieldName == "NE" && resVarAddr.componentName == "EV")
|
2016-10-11 08:38:51 -05:00
|
|
|
{
|
|
|
|
return calculateVolumetricStrain(partIndex, resVarAddr);
|
|
|
|
}
|
|
|
|
|
2016-10-31 04:34:51 -05:00
|
|
|
if ( resVarAddr.fieldName == "NE" && resVarAddr.componentName == "ED" )
|
|
|
|
{
|
|
|
|
return calculateDeviatoricStrain(partIndex, resVarAddr);
|
|
|
|
}
|
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
if(resVarAddr.fieldName == "ST" && resVarAddr.componentName == "Q" )
|
2016-10-11 07:54:42 -05:00
|
|
|
{
|
|
|
|
return calculateDeviatoricStress(partIndex, resVarAddr);
|
|
|
|
}
|
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
if(resVarAddr.fieldName == "ST" && resVarAddr.componentName == "STM")
|
2016-10-13 05:43:31 -05:00
|
|
|
{
|
2016-10-13 06:28:52 -05:00
|
|
|
return calculateMeanStressSTM(partIndex, resVarAddr);
|
2016-10-13 05:43:31 -05:00
|
|
|
}
|
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
if(resVarAddr.fieldName == "SE" && resVarAddr.componentName == "SEM")
|
2016-10-11 05:12:10 -05:00
|
|
|
{
|
2016-10-13 05:43:31 -05:00
|
|
|
return calculateMeanStressSEM(partIndex, resVarAddr);
|
2016-10-11 05:12:10 -05:00
|
|
|
}
|
|
|
|
|
2015-09-26 02:38:29 -05:00
|
|
|
if (resVarAddr.fieldName == "S-Bar")
|
|
|
|
{
|
|
|
|
return calculateBarConvertedResult(partIndex, resVarAddr, "S");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resVarAddr.fieldName == "POR-Bar")
|
|
|
|
{
|
2015-09-28 00:39:57 -05:00
|
|
|
if (resVarAddr.resultPosType == RIG_NODAL)
|
|
|
|
return calculateBarConvertedResult(partIndex, resVarAddr, "POR");
|
|
|
|
else
|
|
|
|
return calculateEnIpPorBarResult(partIndex, resVarAddr);
|
2015-09-26 02:38:29 -05:00
|
|
|
}
|
|
|
|
|
2016-10-13 06:28:52 -05:00
|
|
|
if((resVarAddr.fieldName == "NE")
|
|
|
|
&& ( resVarAddr.componentName == "E11"
|
|
|
|
|| resVarAddr.componentName == "E22"
|
|
|
|
|| resVarAddr.componentName == "E33"
|
|
|
|
|| resVarAddr.componentName == "E12"
|
|
|
|
|| resVarAddr.componentName == "E13"
|
|
|
|
|| resVarAddr.componentName == "E23"))
|
2015-07-01 04:35:17 -05:00
|
|
|
{
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 2, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2015-07-01 04:35:17 -05:00
|
|
|
RigFemScalarResultFrames * srcDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "E", resVarAddr.componentName));
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2015-07-01 04:35:17 -05:00
|
|
|
int frameCount = srcDataFrames->frameCount();
|
|
|
|
for (int fIdx = 0; fIdx < frameCount; ++fIdx)
|
|
|
|
{
|
|
|
|
const std::vector<float>& srcFrameData = srcDataFrames->frameData(fIdx);
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
size_t valCount = srcFrameData.size();
|
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
for (size_t vIdx = 0; vIdx < valCount; ++vIdx)
|
|
|
|
{
|
|
|
|
dstFrameData[vIdx] = -srcFrameData[vIdx];
|
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2015-07-01 04:35:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
2015-06-12 11:41:47 -05:00
|
|
|
|
2016-10-31 04:24:17 -05:00
|
|
|
if ( (resVarAddr.fieldName == "NE")
|
|
|
|
&& ( resVarAddr.componentName == "E1"
|
|
|
|
|| resVarAddr.componentName == "E2"
|
|
|
|
|| resVarAddr.componentName == "E3") )
|
|
|
|
{
|
|
|
|
return calculatePrincipalStrainValues(partIndex, resVarAddr);
|
|
|
|
}
|
2016-10-13 05:15:21 -05:00
|
|
|
|
2015-07-01 04:35:17 -05:00
|
|
|
if ((resVarAddr.fieldName == "SE")
|
2016-10-13 05:15:21 -05:00
|
|
|
&& ( resVarAddr.componentName == "S11"
|
|
|
|
|| resVarAddr.componentName == "S22"
|
|
|
|
|| resVarAddr.componentName == "S33"
|
|
|
|
|| resVarAddr.componentName == "S12"
|
|
|
|
|| resVarAddr.componentName == "S13"
|
|
|
|
|| resVarAddr.componentName == "S23" ))
|
2015-06-12 11:41:47 -05:00
|
|
|
{
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 3, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2015-09-26 02:38:29 -05:00
|
|
|
RigFemScalarResultFrames * srcDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "S-Bar", resVarAddr.componentName));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2015-09-26 02:38:29 -05:00
|
|
|
RigFemScalarResultFrames * srcPORDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_NODAL, "POR-Bar", ""));
|
2015-07-01 04:35:17 -05:00
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2015-07-01 04:35:17 -05:00
|
|
|
const RigFemPart * femPart = m_femParts->part(partIndex);
|
|
|
|
float inf = std::numeric_limits<float>::infinity();
|
2015-06-26 08:43:43 -05:00
|
|
|
|
2015-06-15 03:33:28 -05:00
|
|
|
int frameCount = srcDataFrames->frameCount();
|
|
|
|
for (int fIdx = 0; fIdx < frameCount; ++fIdx)
|
|
|
|
{
|
2015-09-25 13:20:46 -05:00
|
|
|
const std::vector<float>& srcSFrameData = srcDataFrames->frameData(fIdx);
|
2015-06-15 03:33:28 -05:00
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
2015-09-25 13:20:46 -05:00
|
|
|
size_t valCount = srcSFrameData.size();
|
2015-06-15 03:33:28 -05:00
|
|
|
dstFrameData.resize(valCount);
|
2015-07-01 04:35:17 -05:00
|
|
|
|
|
|
|
const std::vector<float>& srcPORFrameData = srcPORDataFrames->frameData(fIdx);
|
|
|
|
|
2015-09-25 13:20:46 -05:00
|
|
|
int elementCount = femPart->elementCount();
|
|
|
|
for (int elmIdx = 0; elmIdx < elementCount; ++elmIdx)
|
2015-06-15 03:33:28 -05:00
|
|
|
{
|
2015-09-25 13:20:46 -05:00
|
|
|
RigElementType elmType = femPart->elementType(elmIdx);
|
|
|
|
|
|
|
|
int elmNodeCount = RigFemTypes::elmentNodeCount(femPart->elementType(elmIdx));
|
|
|
|
|
|
|
|
if (elmType == HEX8P)
|
|
|
|
{
|
|
|
|
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
|
|
|
{
|
|
|
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
|
|
|
dstFrameData[elmNodResIdx] = -srcSFrameData[elmNodResIdx];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
|
|
|
{
|
|
|
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
2015-07-01 04:35:17 -05:00
|
|
|
|
2015-09-25 13:20:46 -05:00
|
|
|
dstFrameData[elmNodResIdx] = inf;
|
|
|
|
}
|
|
|
|
}
|
2015-06-15 03:33:28 -05:00
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2015-06-15 03:33:28 -05:00
|
|
|
}
|
2015-06-26 08:43:43 -05:00
|
|
|
|
2015-06-15 03:33:28 -05:00
|
|
|
return dstDataFrames;
|
2015-06-12 11:41:47 -05:00
|
|
|
}
|
2015-06-15 03:33:28 -05:00
|
|
|
|
2015-07-01 04:35:17 -05:00
|
|
|
if ( (resVarAddr.fieldName == "SE" || resVarAddr.fieldName == "ST" )
|
2016-10-13 05:15:21 -05:00
|
|
|
&& ( resVarAddr.componentName == "S1"
|
|
|
|
|| resVarAddr.componentName == "S2"
|
|
|
|
|| resVarAddr.componentName == "S3"
|
|
|
|
|| resVarAddr.componentName == "S1inc"
|
|
|
|
|| resVarAddr.componentName == "S1azi"
|
2016-10-31 03:53:38 -05:00
|
|
|
|| resVarAddr.componentName == "S2inc"
|
|
|
|
|| resVarAddr.componentName == "S2azi"
|
2016-10-13 05:15:21 -05:00
|
|
|
|| resVarAddr.componentName == "S3inc"
|
|
|
|
|| resVarAddr.componentName == "S3azi" )
|
|
|
|
)
|
2015-06-17 05:55:08 -05:00
|
|
|
{
|
2016-10-31 04:24:17 -05:00
|
|
|
return calculatePrincipalStressValues(partIndex, resVarAddr);
|
2015-06-17 05:55:08 -05:00
|
|
|
}
|
|
|
|
|
2015-06-17 07:22:14 -05:00
|
|
|
if ( resVarAddr.fieldName == "ST"
|
2015-06-17 05:55:08 -05:00
|
|
|
&& ( resVarAddr.componentName == "S11"
|
2015-06-15 05:15:00 -05:00
|
|
|
|| resVarAddr.componentName == "S22"
|
|
|
|
|| resVarAddr.componentName == "S33" ))
|
|
|
|
{
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 3, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2015-09-26 02:38:29 -05:00
|
|
|
RigFemScalarResultFrames * srcSDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "S-Bar", resVarAddr.componentName));
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2015-09-26 02:38:29 -05:00
|
|
|
RigFemScalarResultFrames * srcPORDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_NODAL, "POR-Bar", ""));
|
2015-06-15 05:15:00 -05:00
|
|
|
|
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
const RigFemPart * femPart = m_femParts->part(partIndex);
|
2015-09-24 15:37:57 -05:00
|
|
|
int frameCount = srcSDataFrames->frameCount();
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2015-09-24 15:37:57 -05:00
|
|
|
const float inf = std::numeric_limits<float>::infinity();
|
|
|
|
|
2015-06-15 05:15:00 -05:00
|
|
|
for (int fIdx = 0; fIdx < frameCount; ++fIdx)
|
|
|
|
{
|
2015-09-24 15:37:57 -05:00
|
|
|
const std::vector<float>& srcSFrameData = srcSDataFrames->frameData(fIdx);
|
2015-06-15 05:15:00 -05:00
|
|
|
const std::vector<float>& srcPORFrameData = srcPORDataFrames->frameData(fIdx);
|
|
|
|
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
|
2015-09-24 15:37:57 -05:00
|
|
|
size_t valCount = srcSFrameData.size();
|
2015-06-15 05:15:00 -05:00
|
|
|
dstFrameData.resize(valCount);
|
2015-09-24 15:37:57 -05:00
|
|
|
|
|
|
|
int elementCount = femPart->elementCount();
|
|
|
|
for (int elmIdx = 0; elmIdx < elementCount; ++elmIdx)
|
2015-06-15 05:15:00 -05:00
|
|
|
{
|
2015-09-25 13:20:46 -05:00
|
|
|
RigElementType elmType = femPart->elementType(elmIdx);
|
|
|
|
|
2015-09-24 15:37:57 -05:00
|
|
|
int elmNodeCount = RigFemTypes::elmentNodeCount(femPart->elementType(elmIdx));
|
|
|
|
|
2015-09-25 13:20:46 -05:00
|
|
|
if (elmType == HEX8P)
|
2015-09-24 15:37:57 -05:00
|
|
|
{
|
2015-09-25 13:20:46 -05:00
|
|
|
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
2015-09-24 15:37:57 -05:00
|
|
|
{
|
2015-09-25 13:20:46 -05:00
|
|
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
|
|
|
int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx(elmNodResIdx);
|
|
|
|
|
|
|
|
float por = srcPORFrameData[nodeIdx];
|
|
|
|
if (por == inf) por = 0.0f;
|
|
|
|
|
|
|
|
dstFrameData[elmNodResIdx] = -srcSFrameData[elmNodResIdx] + por;
|
2015-09-24 15:37:57 -05:00
|
|
|
}
|
|
|
|
}
|
2015-09-25 13:20:46 -05:00
|
|
|
else
|
|
|
|
{
|
2015-09-24 15:37:57 -05:00
|
|
|
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
|
|
|
{
|
|
|
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
|
|
|
dstFrameData[elmNodResIdx] = -srcSFrameData[elmNodResIdx];
|
|
|
|
}
|
|
|
|
}
|
2015-06-15 05:15:00 -05:00
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2015-06-15 05:15:00 -05:00
|
|
|
}
|
|
|
|
return dstDataFrames;
|
|
|
|
}
|
|
|
|
|
2015-06-17 07:22:14 -05:00
|
|
|
if ( resVarAddr.fieldName == "ST"
|
|
|
|
&& ( resVarAddr.componentName == "S12"
|
|
|
|
|| resVarAddr.componentName == "S13"
|
|
|
|
|| resVarAddr.componentName == "S23" ))
|
|
|
|
{
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 2, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
2015-07-01 04:35:17 -05:00
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
RigFemScalarResultFrames * srcSDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "S-Bar", resVarAddr.componentName));
|
2015-07-01 04:35:17 -05:00
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2015-07-01 04:35:17 -05:00
|
|
|
int frameCount = srcSDataFrames->frameCount();
|
|
|
|
for (int fIdx = 0; fIdx < frameCount; ++fIdx)
|
|
|
|
{
|
2015-09-25 02:16:14 -05:00
|
|
|
const std::vector<float>& srcSFrameData = srcSDataFrames->frameData(fIdx);
|
2015-07-01 04:35:17 -05:00
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
|
2015-09-25 02:16:14 -05:00
|
|
|
size_t valCount = srcSFrameData.size();
|
2015-07-01 04:35:17 -05:00
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
for (size_t vIdx = 0; vIdx < valCount; ++vIdx)
|
|
|
|
{
|
2015-09-25 02:16:14 -05:00
|
|
|
dstFrameData[vIdx] = -srcSFrameData[vIdx];
|
2015-07-01 04:35:17 -05:00
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
2015-07-01 04:35:17 -05:00
|
|
|
}
|
|
|
|
return dstDataFrames;
|
2015-06-17 07:22:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (resVarAddr.fieldName == "ST" && resVarAddr.componentName == "")
|
|
|
|
{
|
|
|
|
// Create and return an empty result
|
|
|
|
return m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
}
|
|
|
|
|
2015-06-17 09:00:59 -05:00
|
|
|
|
|
|
|
if (resVarAddr.fieldName == "Gamma"
|
|
|
|
&& ( resVarAddr.componentName == "Gamma1"
|
|
|
|
|| resVarAddr.componentName == "Gamma2"
|
2015-06-19 07:05:33 -05:00
|
|
|
|| resVarAddr.componentName == "Gamma3"
|
|
|
|
|| resVarAddr.componentName == "Gamma11"
|
|
|
|
|| resVarAddr.componentName == "Gamma22"
|
|
|
|
|| resVarAddr.componentName == "Gamma33"
|
|
|
|
))
|
2015-06-17 09:00:59 -05:00
|
|
|
{
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(this->frameCount() * 3, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2016-10-27 04:13:05 -05:00
|
|
|
RigFemResultAddress totStressCompAddr(resVarAddr.resultPosType, "ST", "");
|
|
|
|
{
|
|
|
|
std::string scomp;
|
|
|
|
std::string gcomp = resVarAddr.componentName;
|
|
|
|
if ( gcomp == "Gamma1" ) scomp = "S1";
|
|
|
|
else if ( gcomp == "Gamma2" ) scomp = "S2";
|
|
|
|
else if ( gcomp == "Gamma3" ) scomp = "S3";
|
|
|
|
else if ( gcomp == "Gamma11" ) scomp = "S11";
|
|
|
|
else if ( gcomp == "Gamma22" ) scomp = "S22";
|
|
|
|
else if ( gcomp == "Gamma33" ) scomp = "S33";
|
|
|
|
totStressCompAddr.componentName = scomp;
|
2015-06-17 09:00:59 -05:00
|
|
|
}
|
|
|
|
|
2016-10-27 04:13:05 -05:00
|
|
|
RigFemScalarResultFrames * srcDataFrames = this->findOrLoadScalarResult(partIndex, totStressCompAddr);
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
frameCountProgress.setNextProgressIncrement(this->frameCount());
|
|
|
|
|
2015-09-26 02:38:29 -05:00
|
|
|
RigFemScalarResultFrames * srcPORDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_NODAL, "POR-Bar", ""));
|
2015-06-17 09:00:59 -05:00
|
|
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
|
|
|
calculateGammaFromFrames(partIndex, srcDataFrames, srcPORDataFrames, dstDataFrames, &frameCountProgress);
|
2015-09-25 13:20:46 -05:00
|
|
|
|
2015-06-17 09:00:59 -05:00
|
|
|
return dstDataFrames;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resVarAddr.fieldName == "Gamma" && resVarAddr.componentName == "")
|
|
|
|
{
|
|
|
|
// Create and return an empty result
|
|
|
|
return m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
|
|
|
}
|
|
|
|
|
2016-09-06 03:27:30 -05:00
|
|
|
if (resVarAddr.resultPosType == RIG_FORMATION_NAMES)
|
|
|
|
{
|
2016-10-31 02:44:40 -05:00
|
|
|
caf::ProgressInfo frameCountProgress(2, "");
|
|
|
|
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
|
|
|
|
|
2016-09-06 03:27:30 -05:00
|
|
|
RigFemScalarResultFrames* resFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
2016-09-08 03:43:26 -05:00
|
|
|
resFrames->enableAsSingleFrameResult();
|
2016-09-06 03:27:30 -05:00
|
|
|
|
|
|
|
const RigFemPart * femPart = m_femParts->part(partIndex);
|
|
|
|
std::vector<float>& dstFrameData = resFrames->frameData(0);
|
|
|
|
|
|
|
|
size_t valCount = femPart->elementNodeResultCount();
|
|
|
|
float inf = std::numeric_limits<float>::infinity();
|
|
|
|
dstFrameData.resize(valCount, inf);
|
|
|
|
|
|
|
|
RigFormationNames* activeFormNames = m_activeFormationNamesData.p();
|
|
|
|
|
2016-10-31 02:44:40 -05:00
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
|
2016-09-06 03:27:30 -05:00
|
|
|
int elementCount = femPart->elementCount();
|
|
|
|
for(int elmIdx = 0; elmIdx < elementCount; ++elmIdx)
|
|
|
|
{
|
|
|
|
RigElementType elmType = femPart->elementType(elmIdx);
|
|
|
|
int elmNodeCount = RigFemTypes::elmentNodeCount(elmType);
|
|
|
|
|
|
|
|
size_t i, j, k;
|
|
|
|
femPart->structGrid()->ijkFromCellIndex(elmIdx, &i, &j, &k);
|
2016-11-04 04:09:33 -05:00
|
|
|
int formNameIdx = -1;
|
|
|
|
if (activeFormNames)
|
|
|
|
{
|
|
|
|
formNameIdx = activeFormNames->formationIndexFromKLayerIdx(k);
|
|
|
|
}
|
2016-09-06 03:27:30 -05:00
|
|
|
|
|
|
|
for(int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
|
|
|
{
|
|
|
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
2016-09-07 06:31:49 -05:00
|
|
|
|
|
|
|
if (formNameIdx != -1)
|
|
|
|
{
|
|
|
|
dstFrameData[elmNodResIdx] = formNameIdx;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dstFrameData[elmNodResIdx] = HUGE_VAL;
|
|
|
|
}
|
2016-09-06 03:27:30 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return resFrames;
|
|
|
|
}
|
2018-02-18 11:22:23 -06:00
|
|
|
return nullptr;
|
2015-06-12 11:41:47 -05:00
|
|
|
}
|
|
|
|
|
2016-10-27 04:13:05 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::calculateGammaFromFrames(int partIndex,
|
|
|
|
const RigFemScalarResultFrames * totalStressComponentDataFrames,
|
|
|
|
const RigFemScalarResultFrames * srcPORDataFrames,
|
2016-10-31 02:44:40 -05:00
|
|
|
RigFemScalarResultFrames * dstDataFrames,
|
|
|
|
caf::ProgressInfo* frameCountProgress)
|
2016-10-27 04:13:05 -05:00
|
|
|
{
|
|
|
|
const RigFemPart * femPart = m_femParts->part(partIndex);
|
|
|
|
int frameCount = totalStressComponentDataFrames->frameCount();
|
|
|
|
float inf = std::numeric_limits<float>::infinity();
|
|
|
|
|
|
|
|
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
|
|
|
{
|
|
|
|
const std::vector<float>& srcSTFrameData = totalStressComponentDataFrames->frameData(fIdx);
|
|
|
|
const std::vector<float>& srcPORFrameData = srcPORDataFrames->frameData(fIdx);
|
|
|
|
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
|
|
|
|
|
|
|
size_t valCount = srcSTFrameData.size();
|
|
|
|
dstFrameData.resize(valCount);
|
|
|
|
|
|
|
|
int elementCount = femPart->elementCount();
|
|
|
|
for ( int elmIdx = 0; elmIdx < elementCount; ++elmIdx )
|
|
|
|
{
|
|
|
|
RigElementType elmType = femPart->elementType(elmIdx);
|
|
|
|
|
|
|
|
int elmNodeCount = RigFemTypes::elmentNodeCount(femPart->elementType(elmIdx));
|
|
|
|
|
|
|
|
if ( elmType == HEX8P )
|
|
|
|
{
|
|
|
|
for ( int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx )
|
|
|
|
{
|
|
|
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
|
|
|
int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx(elmNodResIdx);
|
|
|
|
|
|
|
|
float por = srcPORFrameData[nodeIdx];
|
|
|
|
|
2018-01-05 02:29:53 -06:00
|
|
|
if ( por == inf || fabs(por) < 0.01e6*1.0e-5 )
|
2016-10-27 04:13:05 -05:00
|
|
|
dstFrameData[elmNodResIdx] = inf;
|
|
|
|
else
|
|
|
|
dstFrameData[elmNodResIdx] = srcSTFrameData[elmNodResIdx]/por;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for ( int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx )
|
|
|
|
{
|
|
|
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
|
|
|
dstFrameData[elmNodResIdx] = inf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-31 02:44:40 -05:00
|
|
|
|
|
|
|
frameCountProgress->incrementProgress();
|
2016-10-27 04:13:05 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-12 11:41:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector< RigFemResultAddress> RigFemPartResultsCollection::getResAddrToComponentsToRead(const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
|
|
|
std::map<std::string, std::vector<std::string> > fieldAndComponentNames;
|
|
|
|
switch (resVarAddr.resultPosType)
|
|
|
|
{
|
|
|
|
case RIG_NODAL:
|
|
|
|
fieldAndComponentNames = m_readerInterface->scalarNodeFieldAndComponentNames();
|
|
|
|
break;
|
|
|
|
case RIG_ELEMENT_NODAL:
|
|
|
|
fieldAndComponentNames = m_readerInterface->scalarElementNodeFieldAndComponentNames();
|
|
|
|
break;
|
|
|
|
case RIG_INTEGRATION_POINT:
|
|
|
|
fieldAndComponentNames = m_readerInterface->scalarIntegrationPointFieldAndComponentNames();
|
|
|
|
break;
|
2018-02-23 14:30:24 -06:00
|
|
|
default:
|
|
|
|
break;
|
2015-06-12 11:41:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
std::vector< RigFemResultAddress> resAddressToComponents;
|
|
|
|
|
|
|
|
std::map<std::string, std::vector<std::string> >::iterator fcIt = fieldAndComponentNames.find(resVarAddr.fieldName);
|
|
|
|
|
|
|
|
if (fcIt != fieldAndComponentNames.end())
|
|
|
|
{
|
|
|
|
std::vector<std::string> compNames = fcIt->second;
|
2015-06-29 05:17:30 -05:00
|
|
|
if (resVarAddr.componentName != "") // If we did not request a particular component, do not add the components
|
2015-06-12 11:41:47 -05:00
|
|
|
{
|
2015-06-29 05:17:30 -05:00
|
|
|
for (size_t cIdx = 0; cIdx < compNames.size(); ++cIdx)
|
|
|
|
{
|
|
|
|
resAddressToComponents.push_back(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, compNames[cIdx]));
|
|
|
|
}
|
2015-06-12 11:41:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (compNames.size() == 0) // This is a scalar field. Add one component named ""
|
|
|
|
{
|
|
|
|
CVF_ASSERT(resVarAddr.componentName == "");
|
|
|
|
resAddressToComponents.push_back(resVarAddr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return resAddressToComponents;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-06-16 09:29:16 -05:00
|
|
|
std::vector<std::string> RigFemPartResultsCollection::stepNames() const
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
|
|
|
CVF_ASSERT(m_readerInterface.notNull());
|
|
|
|
return m_readerInterface->stepNames();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-04 09:10:02 -05:00
|
|
|
int RigFemPartResultsCollection::frameCount()
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-04 09:10:02 -05:00
|
|
|
return static_cast<int>(stepNames().size());
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
2018-03-06 03:29:04 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
float RigFemPartResultsCollection::dsm(float p1, float p3, float tanFricAng, float cohPrTanFricAngle)
|
|
|
|
{
|
|
|
|
if (p1 == HUGE_VAL || p3 == HUGE_VAL)
|
|
|
|
{
|
|
|
|
return std::nan("");
|
|
|
|
}
|
|
|
|
|
|
|
|
CVF_ASSERT(p1 > p3);
|
|
|
|
|
|
|
|
float pi_4 = 0.785398163397448309616f;
|
|
|
|
float rho = 2.0f * (atan(sqrt((p1 + cohPrTanFricAngle) / (p3 + cohPrTanFricAngle))) - pi_4);
|
|
|
|
|
|
|
|
return tan(rho) / tanFricAng;
|
|
|
|
}
|
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-09 09:18:11 -05:00
|
|
|
/// Returns whether any of the parts actually had any of the requested results
|
2015-06-04 05:35:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-09 09:18:11 -05:00
|
|
|
bool RigFemPartResultsCollection::assertResultsLoaded(const RigFemResultAddress& resVarAddr)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-09 09:18:11 -05:00
|
|
|
if (!resVarAddr.isValid()) return false;
|
|
|
|
|
|
|
|
bool foundResults = false;
|
|
|
|
|
2015-06-04 09:10:02 -05:00
|
|
|
for (int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx)
|
|
|
|
{
|
|
|
|
if (m_femPartResults[pIdx].notNull())
|
|
|
|
{
|
2015-06-09 09:18:11 -05:00
|
|
|
RigFemScalarResultFrames* scalarResults = findOrLoadScalarResult(pIdx, resVarAddr);
|
|
|
|
for (int fIdx = 0; fIdx < scalarResults->frameCount(); ++fIdx)
|
|
|
|
{
|
|
|
|
foundResults = foundResults || scalarResults->frameData(fIdx).size();
|
|
|
|
}
|
2015-06-04 09:10:02 -05:00
|
|
|
}
|
|
|
|
}
|
2015-06-09 09:18:11 -05:00
|
|
|
|
|
|
|
return foundResults;
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
2016-10-21 07:30:45 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::deleteResult(const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
|
|
|
CVF_ASSERT ( resVarAddr.isValid() );
|
|
|
|
|
|
|
|
for ( int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx )
|
|
|
|
{
|
|
|
|
if ( m_femPartResults[pIdx].notNull() )
|
|
|
|
{
|
|
|
|
m_femPartResults[pIdx]->deleteScalarResult(resVarAddr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_resultStatistics.erase(resVarAddr);
|
2016-10-27 08:01:21 -05:00
|
|
|
|
|
|
|
if ( resVarAddr.representsAllTimeLapses() )
|
|
|
|
{
|
|
|
|
std::vector<RigFemResultAddress> addressesToDelete;
|
|
|
|
for ( auto it : m_resultStatistics )
|
|
|
|
{
|
|
|
|
if ( it.first.resultPosType == resVarAddr.resultPosType
|
|
|
|
&& it.first.fieldName == resVarAddr.fieldName
|
|
|
|
&& it.first.componentName == resVarAddr.componentName )
|
|
|
|
{
|
|
|
|
addressesToDelete.push_back(it.first);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( RigFemResultAddress& addr: addressesToDelete )
|
|
|
|
{
|
|
|
|
m_resultStatistics.erase(addr);
|
|
|
|
}
|
|
|
|
}
|
2016-10-21 07:30:45 -05:00
|
|
|
}
|
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-04 09:10:02 -05:00
|
|
|
const std::vector<float>& RigFemPartResultsCollection::resultValues(const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-09 09:18:11 -05:00
|
|
|
CVF_ASSERT(resVarAddr.isValid());
|
|
|
|
|
2015-06-04 09:10:02 -05:00
|
|
|
RigFemScalarResultFrames* scalarResults = findOrLoadScalarResult(partIndex, resVarAddr);
|
|
|
|
return scalarResults->frameData(frameIndex);
|
|
|
|
}
|
2015-06-04 05:35:22 -05:00
|
|
|
|
2018-02-08 09:43:12 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<caf::Ten3f> RigFemPartResultsCollection::tensors(const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(resVarAddr.resultPosType == RIG_ELEMENT_NODAL || resVarAddr.resultPosType == RIG_INTEGRATION_POINT);
|
|
|
|
|
|
|
|
std::vector<caf::Ten3f> outputTensors;
|
|
|
|
|
|
|
|
RigFemResultAddress address11(resVarAddr.resultPosType, resVarAddr.fieldName, "");
|
|
|
|
RigFemResultAddress address22(resVarAddr.resultPosType, resVarAddr.fieldName, "");
|
|
|
|
RigFemResultAddress address33(resVarAddr.resultPosType, resVarAddr.fieldName, "");
|
|
|
|
RigFemResultAddress address12(resVarAddr.resultPosType, resVarAddr.fieldName, "");
|
|
|
|
RigFemResultAddress address13(resVarAddr.resultPosType, resVarAddr.fieldName, "");
|
|
|
|
RigFemResultAddress address23(resVarAddr.resultPosType, resVarAddr.fieldName, "");
|
|
|
|
|
|
|
|
if (resVarAddr.fieldName == "SE" || resVarAddr.fieldName == "ST")
|
|
|
|
{
|
|
|
|
address11.componentName = "S11";
|
|
|
|
address22.componentName = "S22";
|
|
|
|
address33.componentName = "S33";
|
|
|
|
address12.componentName = "S12";
|
|
|
|
address13.componentName = "S13";
|
|
|
|
address23.componentName = "S23";
|
|
|
|
}
|
2018-02-26 03:59:47 -06:00
|
|
|
else if (resVarAddr.fieldName == "NE")
|
2018-02-08 09:43:12 -06:00
|
|
|
{
|
|
|
|
address11.componentName = "E11";
|
|
|
|
address22.componentName = "E22";
|
|
|
|
address33.componentName = "E33";
|
|
|
|
address12.componentName = "E12";
|
|
|
|
address13.componentName = "E13";
|
|
|
|
address23.componentName = "E23";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return outputTensors;
|
|
|
|
|
|
|
|
const std::vector<float>& v11 = resultValues(address11, partIndex, frameIndex);
|
|
|
|
const std::vector<float>& v22 = resultValues(address22, partIndex, frameIndex);
|
|
|
|
const std::vector<float>& v33 = resultValues(address33, partIndex, frameIndex);
|
|
|
|
const std::vector<float>& v12 = resultValues(address12, partIndex, frameIndex);
|
|
|
|
const std::vector<float>& v13 = resultValues(address13, partIndex, frameIndex);
|
|
|
|
const std::vector<float>& v23 = resultValues(address23, partIndex, frameIndex);
|
|
|
|
|
|
|
|
size_t valCount = v11.size();
|
|
|
|
outputTensors.resize(valCount);
|
|
|
|
|
|
|
|
for (size_t vIdx = 0; vIdx < valCount; ++vIdx)
|
|
|
|
{
|
|
|
|
caf::Ten3f tensor(v11[vIdx], v22[vIdx], v33[vIdx], v12[vIdx], v23[vIdx], v13[vIdx]);
|
|
|
|
outputTensors[vIdx] = tensor;
|
|
|
|
}
|
|
|
|
|
|
|
|
return outputTensors;
|
|
|
|
}
|
|
|
|
|
2015-06-04 09:10:02 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigStatisticsDataCache* RigFemPartResultsCollection::statistics(const RigFemResultAddress& resVarAddr)
|
|
|
|
{
|
|
|
|
RigStatisticsDataCache* statCache = m_resultStatistics[resVarAddr].p();
|
|
|
|
if (!statCache)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-04 09:10:02 -05:00
|
|
|
RigFemNativeStatCalc* calculator = new RigFemNativeStatCalc(this, resVarAddr);
|
|
|
|
statCache = new RigStatisticsDataCache(calculator);
|
|
|
|
m_resultStatistics[resVarAddr] = statCache;
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
2015-06-04 09:10:02 -05:00
|
|
|
return statCache;
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-04 09:10:02 -05:00
|
|
|
void RigFemPartResultsCollection::minMaxScalarValues(const RigFemResultAddress& resVarAddr, int frameIndex,
|
|
|
|
double* localMin, double* localMax)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-04 09:10:02 -05:00
|
|
|
this->statistics(resVarAddr)->minMaxCellScalarValues(frameIndex, *localMin, *localMax);
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-04 09:10:02 -05:00
|
|
|
void RigFemPartResultsCollection::minMaxScalarValues(const RigFemResultAddress& resVarAddr,
|
|
|
|
double* globalMin, double* globalMax)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-04 09:10:02 -05:00
|
|
|
this->statistics(resVarAddr)->minMaxCellScalarValues(*globalMin, *globalMax);
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-04 09:10:02 -05:00
|
|
|
void RigFemPartResultsCollection::posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-04 09:10:02 -05:00
|
|
|
this->statistics(resVarAddr)->posNegClosestToZero(frameIndex, *localPosClosestToZero, *localNegClosestToZero);
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-04 09:10:02 -05:00
|
|
|
void RigFemPartResultsCollection::posNegClosestToZero(const RigFemResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-04 09:10:02 -05:00
|
|
|
this->statistics(resVarAddr)->posNegClosestToZero(*globalPosClosestToZero, *globalNegClosestToZero);
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-04 09:10:02 -05:00
|
|
|
void RigFemPartResultsCollection::meanScalarValue(const RigFemResultAddress& resVarAddr, double* meanValue)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-04 09:10:02 -05:00
|
|
|
CVF_ASSERT(meanValue);
|
|
|
|
|
|
|
|
this->statistics(resVarAddr)->meanCellScalarValues(*meanValue);
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
2015-11-04 08:44:09 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::meanScalarValue(const RigFemResultAddress& resVarAddr, int frameIndex, double* meanValue)
|
|
|
|
{
|
|
|
|
this->statistics(resVarAddr)->meanCellScalarValues(frameIndex, *meanValue);
|
|
|
|
}
|
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-04 09:10:02 -05:00
|
|
|
void RigFemPartResultsCollection::p10p90ScalarValues(const RigFemResultAddress& resVarAddr, double* p10, double* p90)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-04 09:10:02 -05:00
|
|
|
this->statistics(resVarAddr)->p10p90CellScalarValues(*p10, *p90);
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
2015-11-04 08:44:09 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::p10p90ScalarValues(const RigFemResultAddress& resVarAddr, int frameIndex, double* p10, double* p90)
|
|
|
|
{
|
|
|
|
this->statistics(resVarAddr)->p10p90CellScalarValues(frameIndex, *p10, *p90);
|
|
|
|
}
|
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-08-04 07:15:59 -05:00
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::sumScalarValue(const RigFemResultAddress& resVarAddr, double* sum)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(sum);
|
|
|
|
|
|
|
|
this->statistics(resVarAddr)->sumCellScalarValues(*sum);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::sumScalarValue(const RigFemResultAddress& resVarAddr, int frameIndex, double* sum)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(sum);
|
|
|
|
|
|
|
|
this->statistics(resVarAddr)->sumCellScalarValues(frameIndex, *sum);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-04 05:35:22 -05:00
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-04 09:10:02 -05:00
|
|
|
const std::vector<size_t>& RigFemPartResultsCollection::scalarValuesHistogram(const RigFemResultAddress& resVarAddr)
|
2015-06-04 05:35:22 -05:00
|
|
|
{
|
2015-06-04 09:10:02 -05:00
|
|
|
return this->statistics(resVarAddr)->cellScalarValuesHistogram();
|
2015-06-04 05:35:22 -05:00
|
|
|
}
|
|
|
|
|
2015-11-04 08:44:09 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
const std::vector<size_t>& RigFemPartResultsCollection::scalarValuesHistogram(const RigFemResultAddress& resVarAddr, int frameIndex)
|
|
|
|
{
|
|
|
|
return this->statistics(resVarAddr)->cellScalarValuesHistogram(frameIndex);
|
|
|
|
}
|
|
|
|
|
2018-02-20 06:38:45 -06:00
|
|
|
std::vector<RigFemResultAddress> RigFemPartResultsCollection::tensorPrincipalComponentAdresses(const RigFemResultAddress& resVarAddr)
|
2018-02-08 09:43:12 -06:00
|
|
|
{
|
|
|
|
std::vector<RigFemResultAddress> addresses;
|
|
|
|
|
2018-02-20 06:38:45 -06:00
|
|
|
for (size_t i = 0; i < 3; ++i)
|
2018-02-08 09:43:12 -06:00
|
|
|
{
|
|
|
|
addresses.push_back(RigFemResultAddress(resVarAddr.resultPosType, resVarAddr.fieldName, ""));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resVarAddr.fieldName == "SE" || resVarAddr.fieldName == "ST")
|
|
|
|
{
|
2018-02-20 06:38:45 -06:00
|
|
|
addresses[0].componentName = "S1";
|
|
|
|
addresses[1].componentName = "S2";
|
|
|
|
addresses[2].componentName = "S3";
|
2018-02-08 09:43:12 -06:00
|
|
|
}
|
2018-02-26 03:59:47 -06:00
|
|
|
else if (resVarAddr.fieldName == "NE")
|
2018-02-08 09:43:12 -06:00
|
|
|
{
|
2018-02-20 06:38:45 -06:00
|
|
|
addresses[0].componentName = "E1";
|
|
|
|
addresses[1].componentName = "E2";
|
|
|
|
addresses[2].componentName = "E3";
|
2018-02-08 09:43:12 -06:00
|
|
|
}
|
2018-02-20 06:38:45 -06:00
|
|
|
else
|
|
|
|
{
|
|
|
|
addresses.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
return addresses;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::minMaxScalarValuesOverAllTensorComponents(const RigFemResultAddress& resVarAddr, int frameIndex, double* localMin, double* localMax)
|
|
|
|
{
|
|
|
|
double currentMin = HUGE_VAL;
|
|
|
|
double currentMax = -HUGE_VAL;
|
|
|
|
|
|
|
|
double min, max;
|
|
|
|
|
|
|
|
for (auto address : tensorPrincipalComponentAdresses(resVarAddr))
|
2018-02-08 09:43:12 -06:00
|
|
|
{
|
|
|
|
this->statistics(address)->minMaxCellScalarValues(frameIndex, min, max);
|
|
|
|
if (min < currentMin)
|
|
|
|
{
|
|
|
|
currentMin = min;
|
|
|
|
}
|
|
|
|
if (max > currentMax)
|
|
|
|
{
|
|
|
|
currentMax = max;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*localMin = currentMin;
|
|
|
|
*localMax = currentMax;
|
|
|
|
}
|
|
|
|
|
2018-02-20 06:38:45 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::minMaxScalarValuesOverAllTensorComponents(const RigFemResultAddress& resVarAddr, double* globalMin, double* globalMax)
|
|
|
|
{
|
|
|
|
double currentMin = HUGE_VAL;
|
|
|
|
double currentMax = -HUGE_VAL;
|
|
|
|
|
|
|
|
double min, max;
|
|
|
|
|
|
|
|
for (auto address : tensorPrincipalComponentAdresses(resVarAddr))
|
|
|
|
{
|
|
|
|
this->statistics(address)->minMaxCellScalarValues(min, max);
|
|
|
|
if (min < currentMin)
|
|
|
|
{
|
|
|
|
currentMin = min;
|
|
|
|
}
|
|
|
|
if (max > currentMax)
|
|
|
|
{
|
|
|
|
currentMax = max;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*globalMin = currentMin;
|
|
|
|
*globalMax = currentMax;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::posNegClosestToZeroOverAllTensorComponents(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero)
|
|
|
|
{
|
|
|
|
double currentPosClosestToZero = HUGE_VAL;
|
|
|
|
double currentNegClosestToZero = -HUGE_VAL;
|
|
|
|
|
|
|
|
double pos, neg;
|
|
|
|
|
|
|
|
for (auto address : tensorPrincipalComponentAdresses(resVarAddr))
|
|
|
|
{
|
|
|
|
this->statistics(address)->posNegClosestToZero(frameIndex, pos, neg);
|
|
|
|
if (pos < currentPosClosestToZero)
|
|
|
|
{
|
|
|
|
currentPosClosestToZero = pos;
|
|
|
|
}
|
|
|
|
if (neg > currentNegClosestToZero)
|
|
|
|
{
|
|
|
|
currentNegClosestToZero = neg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*localPosClosestToZero = currentPosClosestToZero;
|
|
|
|
*localNegClosestToZero = currentNegClosestToZero;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFemPartResultsCollection::posNegClosestToZeroOverAllTensorComponents(const RigFemResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero)
|
|
|
|
{
|
|
|
|
double currentPosClosestToZero = HUGE_VAL;
|
|
|
|
double currentNegClosestToZero = -HUGE_VAL;
|
|
|
|
|
|
|
|
double pos, neg;
|
|
|
|
|
|
|
|
for (auto address : tensorPrincipalComponentAdresses(resVarAddr))
|
|
|
|
{
|
|
|
|
this->statistics(address)->posNegClosestToZero(pos, neg);
|
|
|
|
if (pos < currentPosClosestToZero)
|
|
|
|
{
|
|
|
|
currentPosClosestToZero = pos;
|
|
|
|
}
|
|
|
|
if (neg > currentNegClosestToZero)
|
|
|
|
{
|
|
|
|
currentNegClosestToZero = neg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*globalPosClosestToZero = currentPosClosestToZero;
|
|
|
|
*globalNegClosestToZero = currentNegClosestToZero;
|
|
|
|
}
|
|
|
|
|
2015-11-06 03:18:55 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
int RigFemPartResultsCollection::partCount() const
|
|
|
|
{
|
|
|
|
return m_femParts->partCount();
|
|
|
|
}
|
|
|
|
|
2016-10-25 06:42:40 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFemClosestResultIndexCalculator::RigFemClosestResultIndexCalculator(RigFemPart* femPart,
|
|
|
|
RigFemResultPosEnum resultPosition,
|
|
|
|
int elementIndex,
|
|
|
|
int m_face,
|
|
|
|
const cvf::Vec3d& m_intersectionPoint)
|
|
|
|
{
|
|
|
|
m_resultIndexToClosestResult = -1;
|
|
|
|
m_closestNodeId = -1;
|
2016-10-26 10:05:39 -05:00
|
|
|
m_closestElementNodeResIdx = -1;
|
2016-10-25 06:42:40 -05:00
|
|
|
|
2016-10-26 10:05:39 -05:00
|
|
|
if ( resultPosition != RIG_ELEMENT_NODAL_FACE || m_face == -1 )
|
2016-10-25 06:42:40 -05:00
|
|
|
{
|
|
|
|
RigElementType elmType = femPart->elementType(elementIndex);
|
|
|
|
const int* elmentConn = femPart->connectivities(elementIndex);
|
|
|
|
int elmNodeCount = RigFemTypes::elmentNodeCount(elmType);
|
|
|
|
|
|
|
|
// Find the closest node
|
|
|
|
int closestLocalNode = -1;
|
|
|
|
float minDist = std::numeric_limits<float>::infinity();
|
|
|
|
for ( int lNodeIdx = 0; lNodeIdx < elmNodeCount; ++lNodeIdx )
|
|
|
|
{
|
|
|
|
int nodeIdx = elmentConn[lNodeIdx];
|
|
|
|
cvf::Vec3f nodePos = femPart->nodes().coordinates[nodeIdx];
|
|
|
|
float dist = (nodePos - cvf::Vec3f(m_intersectionPoint)).lengthSquared();
|
|
|
|
if ( dist < minDist )
|
|
|
|
{
|
|
|
|
closestLocalNode = lNodeIdx;
|
|
|
|
minDist = dist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( closestLocalNode >= 0 )
|
|
|
|
{
|
|
|
|
int nodeIdx = elmentConn[closestLocalNode];
|
2016-10-26 10:05:39 -05:00
|
|
|
m_closestElementNodeResIdx = static_cast<int>(femPart->elementNodeResultIdx(elementIndex, closestLocalNode));
|
|
|
|
|
2016-10-25 06:42:40 -05:00
|
|
|
if ( resultPosition == RIG_NODAL )
|
|
|
|
{
|
|
|
|
m_resultIndexToClosestResult = nodeIdx;
|
|
|
|
}
|
2016-10-26 10:05:39 -05:00
|
|
|
else if (resultPosition == RIG_ELEMENT_NODAL_FACE)
|
|
|
|
{
|
|
|
|
m_resultIndexToClosestResult = -1;
|
|
|
|
}
|
2018-01-10 07:14:36 -06:00
|
|
|
else if (resultPosition == RIG_ELEMENT)
|
|
|
|
{
|
|
|
|
m_resultIndexToClosestResult = elementIndex;
|
|
|
|
}
|
2016-10-25 06:42:40 -05:00
|
|
|
else
|
|
|
|
{
|
2016-10-26 10:05:39 -05:00
|
|
|
m_resultIndexToClosestResult = m_closestElementNodeResIdx;
|
2016-10-25 06:42:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
m_closestNodeId = femPart->nodes().nodeIds[nodeIdx];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( m_face != -1 )
|
|
|
|
{
|
|
|
|
int elmNodFaceResIdx = -1;
|
|
|
|
int closestNodeIdx = -1;
|
|
|
|
{
|
|
|
|
int closestLocFaceNode = -1;
|
2016-10-26 10:05:39 -05:00
|
|
|
int closestLocalElmNode = -1;
|
2016-10-25 06:42:40 -05:00
|
|
|
{
|
|
|
|
RigElementType elmType = femPart->elementType(elementIndex);
|
|
|
|
const int* elmNodeIndices = femPart->connectivities(elementIndex);
|
|
|
|
int faceNodeCount = 0;
|
|
|
|
const int* localElmNodeIndicesForFace = RigFemTypes::localElmNodeIndicesForFace(elmType, m_face, &faceNodeCount);
|
|
|
|
|
|
|
|
float minDist = std::numeric_limits<float>::infinity();
|
|
|
|
for ( int faceNodIdx = 0; faceNodIdx < faceNodeCount; ++faceNodIdx )
|
|
|
|
{
|
|
|
|
int nodeIdx = elmNodeIndices[localElmNodeIndicesForFace[faceNodIdx]];
|
|
|
|
cvf::Vec3f nodePos = femPart->nodes().coordinates[nodeIdx];
|
|
|
|
float dist = (nodePos - cvf::Vec3f(m_intersectionPoint)).lengthSquared();
|
|
|
|
if ( dist < minDist )
|
|
|
|
{
|
|
|
|
closestLocFaceNode = faceNodIdx;
|
|
|
|
closestNodeIdx = nodeIdx;
|
2016-10-26 10:05:39 -05:00
|
|
|
closestLocalElmNode = localElmNodeIndicesForFace[faceNodIdx];
|
2016-10-25 06:42:40 -05:00
|
|
|
minDist = dist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int elmNodFaceResIdxElmStart = elementIndex * 24; // HACK should get from part
|
|
|
|
int elmNodFaceResIdxFaceStart = elmNodFaceResIdxElmStart + 4*m_face;
|
|
|
|
|
2016-10-26 10:05:39 -05:00
|
|
|
if ( closestLocFaceNode >= 0 )
|
|
|
|
{
|
|
|
|
elmNodFaceResIdx = elmNodFaceResIdxFaceStart + closestLocFaceNode;
|
|
|
|
m_closestElementNodeResIdx = static_cast<int>(femPart->elementNodeResultIdx(elementIndex, closestLocalElmNode));
|
|
|
|
}
|
2016-10-25 06:42:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
m_resultIndexToClosestResult = elmNodFaceResIdx;
|
|
|
|
m_closestNodeId = femPart->nodes().nodeIds[closestNodeIdx];
|
|
|
|
}
|
2018-02-15 03:58:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Internal functions
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<cvf::Vec3d> coordsFromNodeIndices(const RigFemPart& part, const std::vector<size_t>& nodeIdxs)
|
|
|
|
{
|
|
|
|
std::vector<cvf::Vec3d> out;
|
|
|
|
for (const auto& nodeIdx : nodeIdxs) out.push_back(cvf::Vec3d(part.nodes().coordinates[nodeIdx]));
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<size_t> nodesForElement(const RigFemPart& part, size_t elementIdx)
|
|
|
|
{
|
|
|
|
std::vector<size_t> nodeIdxs;
|
|
|
|
const int* nodeConn = part.connectivities(elementIdx);
|
|
|
|
for (int n = 0; n < 8; n++) nodeIdxs.push_back(nodeConn[n]);
|
|
|
|
return nodeIdxs;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
float horizontalDistance(const cvf::Vec3f& p1, const cvf::Vec3f& p2)
|
|
|
|
{
|
|
|
|
cvf::Vec3f p1_ = p1;
|
|
|
|
cvf::Vec3f p2_ = p2;
|
|
|
|
p1_.z() = p2_.z() = 0;
|
|
|
|
return p1_.pointDistance(p2_);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void findReferenceElementForNode(const RigFemPart& part, size_t nodeIdx, size_t kRefLayer, RefElement *refElement)
|
|
|
|
{
|
|
|
|
static const double zMin = -1e6, zMax = 1e6;
|
|
|
|
|
|
|
|
cvf::BoundingBox bb;
|
|
|
|
cvf::Vec3f currentNodeCoord = part.nodes().coordinates[nodeIdx];
|
|
|
|
cvf::Vec3f p1 = cvf::Vec3f(currentNodeCoord.x(), currentNodeCoord.y(), zMin);
|
|
|
|
cvf::Vec3f p2 = cvf::Vec3f(currentNodeCoord.x(), currentNodeCoord.y(), zMax);
|
|
|
|
bb.add(p1);
|
|
|
|
bb.add(p2);
|
|
|
|
|
|
|
|
std::vector<size_t> refElementCandidates;
|
|
|
|
part.findIntersectingCells(bb, &refElementCandidates);
|
|
|
|
|
|
|
|
const RigFemPartGrid* grid = part.structGrid();
|
|
|
|
const std::vector<cvf::Vec3f>& nodeCoords = part.nodes().coordinates;
|
|
|
|
|
|
|
|
refElement->elementIdx = cvf::UNDEFINED_SIZE_T;
|
|
|
|
refElement->intersectionPointToCurrentNodeDistance = HUGE_VALF;
|
|
|
|
size_t i, j, k;
|
|
|
|
for (const size_t elemIdx : refElementCandidates)
|
|
|
|
{
|
|
|
|
grid->ijkFromCellIndex(elemIdx, &i, &j, &k);
|
|
|
|
if (k == kRefLayer)
|
|
|
|
{
|
|
|
|
const std::vector<size_t> nodeIndices = nodesForElement(part, elemIdx);
|
|
|
|
CVF_ASSERT(nodeIndices.size() == 8);
|
|
|
|
|
|
|
|
std::vector<HexIntersectionInfo> intersections;
|
|
|
|
RigHexIntersectionTools::lineHexCellIntersection(cvf::Vec3d(p1), cvf::Vec3d(p2), coordsFromNodeIndices(part, nodeIndices).data(), elemIdx, &intersections);
|
|
|
|
|
|
|
|
for (const auto& intersection : intersections)
|
|
|
|
{
|
|
|
|
cvf::Vec3f intersectionPoint = cvf::Vec3f(intersection.m_intersectionPoint);
|
|
|
|
|
|
|
|
float nodeToIntersectionDistance = currentNodeCoord.pointDistance(intersectionPoint);
|
|
|
|
if (nodeToIntersectionDistance < refElement->intersectionPointToCurrentNodeDistance)
|
|
|
|
{
|
|
|
|
cvf::ubyte faceNodes[4];
|
|
|
|
grid->cellFaceVertexIndices(intersection.m_face, faceNodes);
|
|
|
|
std::vector<size_t> topFaceCoords({ nodeIndices[faceNodes[0]], nodeIndices[faceNodes[1]], nodeIndices[faceNodes[2]], nodeIndices[faceNodes[3]] });
|
|
|
|
|
|
|
|
refElement->elementIdx = elemIdx;
|
|
|
|
refElement->intersectionPointToCurrentNodeDistance = nodeToIntersectionDistance;
|
|
|
|
refElement->intersectionPoint = intersectionPoint;
|
|
|
|
refElement->elementFaceNodeIdxs = topFaceCoords;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|