2018-02-08 09:43:12 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2019-01-09 08:21:38 -06:00
|
|
|
// Copyright (C) 2018- Equinor ASA
|
2018-02-08 09:43:12 -06:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
2019-09-05 02:43:17 -05:00
|
|
|
|
2018-02-15 03:47:14 -06:00
|
|
|
#include "cvfArray.h"
|
2018-02-08 09:43:12 -06:00
|
|
|
#include "cvfColor3.h"
|
|
|
|
#include "cvfObject.h"
|
|
|
|
#include "cvfVector3.h"
|
|
|
|
|
|
|
|
#include "cafPdmPointer.h"
|
2018-02-15 03:47:14 -06:00
|
|
|
#include "cafTensor3.h"
|
2018-02-09 04:33:27 -06:00
|
|
|
|
2018-02-15 08:45:40 -06:00
|
|
|
#include "RimTensorResults.h"
|
|
|
|
|
2018-02-08 09:43:12 -06:00
|
|
|
#include <array>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace cvf
|
|
|
|
{
|
|
|
|
class ModelBasicList;
|
2018-02-15 08:45:40 -06:00
|
|
|
class Part;
|
2018-02-15 03:47:14 -06:00
|
|
|
class ScalarMapper;
|
2018-02-15 08:45:40 -06:00
|
|
|
class ScalarMapperDiscreteLinear;
|
2018-02-15 03:47:14 -06:00
|
|
|
} // namespace cvf
|
2018-02-08 09:43:12 -06:00
|
|
|
|
|
|
|
class RigFemResultAddress;
|
|
|
|
class RimGeoMechView;
|
2018-02-15 03:47:14 -06:00
|
|
|
class RigFemPartNodes;
|
|
|
|
class RigFemPart;
|
2018-02-08 09:43:12 -06:00
|
|
|
|
|
|
|
class RivTensorResultPartMgr : public cvf::Object
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RivTensorResultPartMgr(RimGeoMechView* reservoirView);
|
2018-10-18 12:45:57 -05:00
|
|
|
~RivTensorResultPartMgr() override;
|
2018-02-08 09:43:12 -06:00
|
|
|
|
|
|
|
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct TensorVisualization
|
|
|
|
{
|
2018-03-22 08:39:00 -05:00
|
|
|
TensorVisualization(cvf::Vec3f vertex, cvf::Vec3f result, cvf::Vec3f faceNormal, bool isPressure, int princial, float principalValue)
|
2018-02-15 03:47:14 -06:00
|
|
|
: vertex(vertex)
|
|
|
|
, result(result)
|
|
|
|
, faceNormal(faceNormal)
|
|
|
|
, isPressure(isPressure)
|
2018-05-03 07:48:06 -05:00
|
|
|
, principalNumber(princial)
|
2018-03-01 09:01:14 -06:00
|
|
|
, principalValue(principalValue) {};
|
2018-02-08 09:43:12 -06:00
|
|
|
|
2018-02-15 03:47:14 -06:00
|
|
|
cvf::Vec3f vertex;
|
|
|
|
cvf::Vec3f result;
|
|
|
|
cvf::Vec3f faceNormal;
|
|
|
|
bool isPressure;
|
2018-05-03 07:48:06 -05:00
|
|
|
int principalNumber;
|
2018-03-01 09:01:14 -06:00
|
|
|
float principalValue;
|
2018-02-08 09:43:12 -06:00
|
|
|
};
|
2018-02-15 03:47:14 -06:00
|
|
|
|
2018-02-08 09:43:12 -06:00
|
|
|
private:
|
2018-02-15 03:47:14 -06:00
|
|
|
static void calculateElementTensors(const RigFemPart& part,
|
|
|
|
const std::vector<caf::Ten3f>& vertexTensors,
|
|
|
|
std::vector<caf::Ten3f>* elmTensors);
|
|
|
|
|
|
|
|
static void calculatePrincipalsAndDirections(const std::vector<caf::Ten3f>& tensors,
|
|
|
|
std::array<std::vector<float>, 3>* principals,
|
|
|
|
std::vector<std::array<cvf::Vec3f, 3>>* principalDirections);
|
|
|
|
|
|
|
|
static cvf::Vec3f calculateFaceNormal(const RigFemPartNodes& nodes,
|
|
|
|
const std::vector<size_t>& quadVerticesToNodeIdxMapping,
|
|
|
|
int quadVertex);
|
|
|
|
|
|
|
|
cvf::ref<cvf::Part> createPart(const std::vector<TensorVisualization>& tensorVisualizations) const;
|
2018-02-08 09:43:12 -06:00
|
|
|
|
2018-02-15 08:45:40 -06:00
|
|
|
static void createOneColorPerPrincipalScalarMapper(const RimTensorResults::TensorColors& colorSet, cvf::ScalarMapperDiscreteLinear* scalarMapper);
|
|
|
|
static void createOneColorPerPrincipalTextureCoords(cvf::Vec2fArray* textureCoords,
|
2018-02-20 06:38:45 -06:00
|
|
|
const std::vector<TensorVisualization>& tensorVisualizations,
|
2018-02-15 08:45:40 -06:00
|
|
|
const cvf::ScalarMapper* mapper);
|
|
|
|
|
2018-02-20 06:38:45 -06:00
|
|
|
static void createResultColorTextureCoords(cvf::Vec2fArray* textureCoords,
|
|
|
|
const std::vector<TensorVisualization>& tensorVisualizations,
|
|
|
|
const cvf::ScalarMapper* mapper);
|
|
|
|
|
2018-02-08 09:43:12 -06:00
|
|
|
static bool isTensorAddress(RigFemResultAddress address);
|
2018-02-09 03:10:09 -06:00
|
|
|
static bool isValid(cvf::Vec3f resultVector);
|
2018-02-09 04:33:27 -06:00
|
|
|
static bool isPressure(float principalValue);
|
|
|
|
bool isDrawable(cvf::Vec3f resultVector, bool showPrincipal) const;
|
2018-02-08 09:43:12 -06:00
|
|
|
|
2018-03-02 01:09:42 -06:00
|
|
|
std::array<cvf::Vec3f, 5> createArrowVertices(const TensorVisualization &tensorVisualization) const;
|
|
|
|
std::array<uint, 8> createArrowIndices(uint startIndex) const;
|
2018-02-15 03:47:14 -06:00
|
|
|
|
2018-02-08 09:43:12 -06:00
|
|
|
private:
|
|
|
|
caf::PdmPointer<RimGeoMechView> m_rimReservoirView;
|
|
|
|
};
|