///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2020- Equinor ASA // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "cvfArray.h" #include "cvfObject.h" #include "cvfTransform.h" #include "cvfVector3.h" #include "cafPdmPointer.h" #include "cafTensor3.h" #include "RimTensorResults.h" #include #include namespace cvf { class ModelBasicList; class Part; class ScalarMapper; class ScalarMapperDiscreteLinear; } // namespace cvf class RimEclipseView; class RimElementVectorResult; class RivElementVectorResultPartMgr : public cvf::Object { public: RivElementVectorResultPartMgr( RimEclipseView* reservoirView ); ~RivElementVectorResultPartMgr() override; void appendDynamicGeometryPartsToModel( cvf::ModelBasicList* model, size_t timeStepIndex ); void setTransform( cvf::Transform* scaleTransform ); private: struct ElementVectorResultVisualization { ElementVectorResultVisualization( cvf::Vec3d faceCenter, cvf::Vec3d faceNormal, double result, double approximateCellLength, bool centerArrow ) : faceCenter( faceCenter ) , faceNormal( faceNormal ) , result( result ) , approximateCellLength( approximateCellLength ) , centerArrow( centerArrow ) { } cvf::Vec3f faceCenter; cvf::Vec3f faceNormal; double result; double approximateCellLength; bool centerArrow; }; private: cvf::ref createPart( const RimElementVectorResult& result, const std::vector& tensorVisualizations ) const; static void createResultColorTextureCoords( cvf::Vec2fArray* textureCoords, const std::vector& elementVectorResultVisualizations, const cvf::ScalarMapper* mapper ); std::array createArrowVertices( const ElementVectorResultVisualization& tensorVisualization ) const; std::array createArrowShaftIndices( uint startIndex ) const; std::array createArrowHeadIndices( uint startIndex ) const; double scaleLogarithmically( double value ) const; private: caf::PdmPointer m_rimReservoirView; cvf::ref m_scaleTransform; };