///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "RivReservoirPartMgr.h" #include "cvfTransform.h" #include "cafFixedArray.h" #include "cvfArray.h" #include "cafPdmObject.h" class RimReservoirView; class RigGridBase; class RimCellRangeFilterCollection; class RimCellPropertyFilterCollection; class RigActiveCellInfo; class RivReservoirViewPartMgr: public cvf::Object { public: RivReservoirViewPartMgr(RimReservoirView * resv); cvf::Transform* scaleTransform() { return m_scaleTransform.p();} void setScaleTransform(cvf::Mat4d scale) { m_scaleTransform->setLocalTransform(scale);} enum ReservoirGeometryCacheType { ACTIVE, ///< All Active cells without ALL_WELL_CELLS ALL_WELL_CELLS, ///< All cells ever having a connection to a well (Might be inactive cells as well. Wellhead cells typically) VISIBLE_WELL_CELLS, ///< ALL_WELL_CELLS && visible well cells including Fence VISIBLE_WELL_FENCE_CELLS, ///< (! ALL_WELL_CELLS) && visible well cells including Fence INACTIVE, ///< All inactive cells, but invalid cells might or might not be included RANGE_FILTERED, ///< ACTIVE Filtered by the set of range filters RANGE_FILTERED_INACTIVE, ///< INACTIVE Filtered by the set of range filters RANGE_FILTERED_WELL_CELLS, ///< ALL_WELL_CELLS Filtered by the set of range filters VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER, ///< VISIBLE_WELL_CELLS && !RANGE_FILTERED_WELL_CELLS VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER, ///< VISIBLE_WELL_FENCE_CELLS && !RANGE_FILTERED PROPERTY_FILTERED, ///< (RANGE_FILTERED || VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER) && !ExcludedByPropFilter && IncludedByPropFilter PROPERTY_FILTERED_WELL_CELLS ///< (!(hasActiveRangeFilters || visibleWellCells) && (*ALL_WELL_CELLS)) || RANGE_FILTERED_WELL_CELLS || VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER }; void clearGeometryCache(); void scheduleGeometryRegen(ReservoirGeometryCacheType geometryType); cvf::cref cellVisibility(ReservoirGeometryCacheType geometryType, size_t gridIndex, size_t frameIndex) const; void appendStaticGeometryPartsToModel (cvf::ModelBasicList* model, ReservoirGeometryCacheType geometryType, const std::vector& gridIndices); void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, ReservoirGeometryCacheType geometryType, size_t frameIndex, const std::vector& gridIndices); void updateCellColor (ReservoirGeometryCacheType geometryType, cvf::Color4f color); void updateCellColor (ReservoirGeometryCacheType geometryType, size_t timeStepIndex, cvf::Color4f color); void updateCellResultColor (ReservoirGeometryCacheType geometryType, size_t timeStepIndex, RimResultSlot* cellResultSlot); void updateCellEdgeResultColor(ReservoirGeometryCacheType geometryType, size_t timeStepIndex, RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot); // Faults void appendFaultsStaticGeometryPartsToModel(cvf::ModelBasicList* model, ReservoirGeometryCacheType geometryType); void appendFaultsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, ReservoirGeometryCacheType geometryType, size_t frameIndex); void updateFaultsCellResultColor(ReservoirGeometryCacheType geometryType, size_t timeStepIndex, RimResultSlot* cellResultSlot); private: void createGeometry(ReservoirGeometryCacheType geometryType); void computeVisibility(cvf::UByteArray* cellVisibility, ReservoirGeometryCacheType geometryType, RigGridBase* grid, size_t gridIdx); void createPropertyFilteredNoneWellCellGeometry(size_t frameIndex); void createPropertyFilteredWellGeometry(size_t frameIndex); void clearGeometryCache(ReservoirGeometryCacheType geomType); static void computeNativeVisibility (cvf::UByteArray* cellVisibilities, const RigGridBase* grid, const RigActiveCellInfo* activeCellInfo, const cvf::UByteArray* cellIsInWellStatuses, bool invalidCellsIsVisible, bool inactiveCellsIsVisible, bool activeCellsIsVisible, bool mainGridIsVisible); void computeRangeVisibility (ReservoirGeometryCacheType geometryType, cvf::UByteArray* cellVisibilities, const RigGridBase* grid, const cvf::UByteArray* nativeVisibility, const RimCellRangeFilterCollection* rangeFilterColl); static void computePropertyVisibility(cvf::UByteArray* cellVisibilities, const RigGridBase* grid, size_t timeStepIndex, const cvf::UByteArray* rangeFilterVisibility, RimCellPropertyFilterCollection* propFilterColl); static void copyByteArray(cvf::UByteArray* cellVisibilities, const cvf::UByteArray* cellIsWellStatuses ); RivReservoirPartMgr * reservoirPartManager(ReservoirGeometryCacheType geometryType, size_t timeStepIndex ); private: caf::FixedArray m_geometries; caf::FixedArray m_geometriesNeedsRegen; cvf::Collection m_propFilteredGeometryFrames; std::vector m_propFilteredGeometryFramesNeedsRegen; cvf::Collection m_propFilteredWellGeometryFrames; std::vector m_propFilteredWellGeometryFramesNeedsRegen; cvf::ref m_scaleTransform; caf::PdmPointer m_reservoirView; };