///////////////////////////////////////////////////////////////////////////////// // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "cvfBase.h" #include "cvfObject.h" #include "cvfArray.h" #include "RigFemPart.h" #include "cvfStructGrid.h" namespace cvf { class DrawableGeo; class ScalarMapper; } class RigFemPartScalarDataAccess; //================================================================================================== // // // //================================================================================================== class RivFemPartTriangleToElmMapper : public cvf::Object { public: size_t triangleCount() const { return m_trianglesToElementIndex.size();} int elementIndex(size_t triangleIdx) const { return m_trianglesToElementIndex[triangleIdx]; } char elementFace(size_t triangleIdx) const { return m_trianglesToElmFace[triangleIdx]; } // Interface for building the mappings std::vector& triangleToElmIndexMap() { return m_trianglesToElementIndex; } std::vector& triangleToElmFaceMap() { return m_trianglesToElmFace; } private: std::vector m_trianglesToElementIndex; std::vector m_trianglesToElmFace; }; //================================================================================================== // // // //================================================================================================== class RivFemPartGeometryGenerator : public cvf::Object { public: explicit RivFemPartGeometryGenerator(const RigFemPart* part); ~RivFemPartGeometryGenerator(); // Setup methods void setElementVisibility(const cvf::UByteArray* cellVisibility); // Access, valid after generation is done const RigFemPart* activePart() { return m_part.p(); } // Generated geometry cvf::ref generateSurface(); cvf::ref createMeshDrawable(); cvf::ref createOutlineMeshDrawable(double creaseAngle); const std::vector& quadVerticesToNodeIdxMapping() const { return m_quadVerticesToNodeIdx;} const std::vector& quadVerticesToGlobalElmNodeIdx() const { return m_quadVerticesToGlobalElmNodeIdx;} const std::vector& quadVerticesToGlobalElmFaceNodeIdx() const { return m_quadVerticesToGlobalElmFaceNodeIdx; } const std::vector& quadVerticesToGlobalElmIdx() const { return m_quadVerticesToGlobalElmIdx; } RivFemPartTriangleToElmMapper* triangleToElementMapper() { return m_triangleMapper.p();} static cvf::ref createMeshDrawableFromSingleElement(const RigFemPart* grid, size_t elementIndex); private: static cvf::ref lineIndicesFromQuadVertexArray(const cvf::Vec3fArray* vertexArray); void computeArrays(); private: // Input cvf::cref m_part; // The part being processed cvf::cref m_elmVisibility; // Created arrays cvf::ref m_quadVertices; //cvf::ref m_triangleVertices; // If needed, we will do it like this, I think std::vector m_quadVerticesToNodeIdx; std::vector m_quadVerticesToGlobalElmNodeIdx; std::vector m_quadVerticesToGlobalElmFaceNodeIdx; std::vector m_quadVerticesToGlobalElmIdx; // Mappings cvf::ref m_triangleMapper; };