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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "RigFemResultAddress.h"
|
|
|
|
|
|
|
|
#include "cvfCollection.h"
|
|
|
|
#include "cvfObject.h"
|
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class RifGeoMechReaderInterface;
|
|
|
|
class RigFemScalarResultFrames;
|
|
|
|
class RigFemPartResultsCollection;
|
|
|
|
class RigFemPartResults;
|
2015-06-04 09:10:02 -05:00
|
|
|
class RigStatisticsDataCache;
|
2015-06-15 05:15:00 -05:00
|
|
|
class RigFemPartCollection;
|
2016-09-06 03:27:30 -05:00
|
|
|
class RigFormationNames;
|
2015-06-04 05:35:22 -05:00
|
|
|
|
|
|
|
class RigFemPartResultsCollection: public cvf::Object
|
|
|
|
{
|
|
|
|
public:
|
2015-06-15 05:15:00 -05:00
|
|
|
RigFemPartResultsCollection(RifGeoMechReaderInterface* readerInterface, const RigFemPartCollection * femPartCollection);
|
2015-06-04 05:35:22 -05:00
|
|
|
~RigFemPartResultsCollection();
|
|
|
|
|
2016-09-06 03:27:30 -05:00
|
|
|
void setActiveFormationNames(RigFormationNames* activeFormationNames);
|
|
|
|
RigFormationNames* activeFormationNames();
|
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
std::map<std::string, std::vector<std::string> > scalarFieldAndComponentNames(RigFemResultPosEnum resPos);
|
2015-06-04 09:10:02 -05:00
|
|
|
std::vector<std::string> stepNames();
|
2015-06-09 09:18:11 -05:00
|
|
|
bool assertResultsLoaded(const RigFemResultAddress& resVarAddr);
|
2015-06-04 09:10:02 -05:00
|
|
|
const std::vector<float>& resultValues(const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex);
|
2015-11-06 03:18:55 -06:00
|
|
|
int partCount() const;
|
2015-06-04 09:10:02 -05:00
|
|
|
int frameCount();
|
2015-06-04 05:35:22 -05:00
|
|
|
|
|
|
|
|
2015-06-04 09:10:02 -05:00
|
|
|
void minMaxScalarValues (const RigFemResultAddress& resVarAddr, int frameIndex, double* localMin, double* localMax);
|
|
|
|
void minMaxScalarValues (const RigFemResultAddress& resVarAddr, double* globalMin, double* globalMax);
|
2015-11-04 08:44:09 -06:00
|
|
|
void posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero);
|
2015-06-04 09:10:02 -05:00
|
|
|
void posNegClosestToZero(const RigFemResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero);
|
|
|
|
void meanScalarValue(const RigFemResultAddress& resVarAddr, double* meanValue);
|
2015-11-04 08:44:09 -06:00
|
|
|
void meanScalarValue(const RigFemResultAddress& resVarAddr, int frameIndex, double* meanValue);
|
2015-06-04 09:10:02 -05:00
|
|
|
void p10p90ScalarValues(const RigFemResultAddress& resVarAddr, double* p10, double* p90);
|
2015-11-04 08:44:09 -06:00
|
|
|
void p10p90ScalarValues(const RigFemResultAddress& resVarAddr, int frameIndex, double* p10, double* p90);
|
2016-08-04 07:15:59 -05:00
|
|
|
void sumScalarValue(const RigFemResultAddress& resVarAddr, double* sum);
|
|
|
|
void sumScalarValue(const RigFemResultAddress& resVarAddr, int frameIndex, double* sum);
|
2015-06-04 09:10:02 -05:00
|
|
|
const std::vector<size_t>& scalarValuesHistogram(const RigFemResultAddress& resVarAddr);
|
2015-11-04 08:44:09 -06:00
|
|
|
const std::vector<size_t>& scalarValuesHistogram(const RigFemResultAddress& resVarAddr, int frameIndex);
|
2015-06-09 09:18:11 -05:00
|
|
|
|
2015-06-04 05:35:22 -05:00
|
|
|
private:
|
2015-06-04 09:10:02 -05:00
|
|
|
RigFemScalarResultFrames* findOrLoadScalarResult(int partIndex,
|
|
|
|
const RigFemResultAddress& resVarAddr);
|
|
|
|
|
2015-06-12 11:41:47 -05:00
|
|
|
RigFemScalarResultFrames* calculateDerivedResult(int partIndex, const RigFemResultAddress& resVarAddr);
|
|
|
|
|
2015-09-26 02:38:29 -05:00
|
|
|
RigFemScalarResultFrames* calculateBarConvertedResult(int partIndex, const RigFemResultAddress &convertedResultAddr, const std::string fieldNameToConvert);
|
2015-09-28 00:39:57 -05:00
|
|
|
RigFemScalarResultFrames* calculateEnIpPorBarResult(int partIndex, const RigFemResultAddress &convertedResultAddr);
|
2016-10-10 09:09:54 -05:00
|
|
|
RigFemScalarResultFrames* calculateTimeLapseResult(int partIndex, const RigFemResultAddress& resVarAddr);
|
2016-10-11 06:17:12 -05:00
|
|
|
RigFemScalarResultFrames* calculateMeanStressSMSEM(int partIndex, const RigFemResultAddress& resVarAddr);
|
2016-10-11 07:54:42 -05:00
|
|
|
RigFemScalarResultFrames* calculateDeviatoricStress(int partIndex, const RigFemResultAddress& resVarAddr);
|
2016-10-11 08:38:51 -05:00
|
|
|
RigFemScalarResultFrames* calculateVolumetricStrain(int partIndex, const RigFemResultAddress& resVarAddr);
|
2015-09-26 02:38:29 -05:00
|
|
|
|
2015-06-04 09:10:02 -05:00
|
|
|
cvf::Collection<RigFemPartResults> m_femPartResults;
|
|
|
|
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;
|
2015-06-15 05:15:00 -05:00
|
|
|
cvf::cref<RigFemPartCollection> m_femParts;
|
2016-09-06 03:27:30 -05:00
|
|
|
cvf::ref<RigFormationNames> m_activeFormationNamesData;
|
2015-06-04 05:35:22 -05:00
|
|
|
|
2015-06-04 09:10:02 -05:00
|
|
|
RigStatisticsDataCache* statistics(const RigFemResultAddress& resVarAddr);
|
2015-06-12 11:41:47 -05:00
|
|
|
std::vector< RigFemResultAddress> getResAddrToComponentsToRead(const RigFemResultAddress& resVarAddr);
|
2015-06-04 09:10:02 -05:00
|
|
|
std::map<RigFemResultAddress, cvf::ref<RigStatisticsDataCache> > m_resultStatistics;
|
2015-06-04 05:35:22 -05:00
|
|
|
};
|
|
|
|
|
2016-10-13 05:15:21 -05:00
|
|
|
#include <array>
|
|
|
|
#include "cvfVector3.h"
|
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
// Y - North, X - East, Z - up but depth is negative Z
|
|
|
|
// azi is measured from the Northing (Y) Axis in Clockwise direction looking down
|
|
|
|
// inc is measured from the negative Z (depth) axis
|
|
|
|
|
|
|
|
class OffshoreSphericalCoords
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit OffshoreSphericalCoords(const cvf::Vec3f& vec)
|
|
|
|
{
|
|
|
|
// Azimuth:
|
|
|
|
if (vec[0] == 0.0f && vec[1] == 0.0 ) incAziR[1] = 0.0f;
|
|
|
|
else incAziR[1] = atan2(vec[0], vec[1]); // atan2(Y, X)
|
|
|
|
|
|
|
|
// R
|
|
|
|
incAziR[2] = vec.length();
|
|
|
|
|
|
|
|
// Inclination from vertical down
|
|
|
|
if (incAziR[2] == 0) incAziR[0] = 0.0f;
|
|
|
|
else incAziR[0] = acos(-vec[2]/incAziR[2]);
|
2015-06-04 05:35:22 -05:00
|
|
|
|
2016-10-13 05:15:21 -05:00
|
|
|
}
|
2015-06-04 05:35:22 -05:00
|
|
|
|
2016-10-13 05:15:21 -05:00
|
|
|
float inc() { return incAziR[0];}
|
|
|
|
float azi() { return incAziR[1];}
|
|
|
|
float r() { return incAziR[2];}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::array<float, 3> incAziR;
|
|
|
|
};
|