#3185 Remove FixedArray

This commit is contained in:
Magne Sjaastad
2018-08-07 10:37:52 +02:00
parent aeae19c748
commit 8425ea96ad
17 changed files with 45 additions and 129 deletions

View File

@@ -23,13 +23,14 @@
#include "RivCellSetEnum.h"
#include "RivReservoirPartMgr.h" // Must include here because of caf::FixedArray<RivReservoirPartMgr, PROPERTY_FILTERED>
#include "cafFixedArray.h"
#include "cvfArray.h"
#include "cvfBase.h"
#include "cvfTransform.h"
#include "cafPdmObject.h"
#include <array>
class RimEclipseView;
class RigGridBase;
class RimCellRangeFilterCollection;
@@ -143,8 +144,8 @@ private:
private:
caf::FixedArray<RivReservoirPartMgr, PROPERTY_FILTERED> m_geometries;
caf::FixedArray<bool, PROPERTY_FILTERED> m_geometriesNeedsRegen;
std::array<RivReservoirPartMgr, PROPERTY_FILTERED> m_geometries;
std::array<bool, PROPERTY_FILTERED> m_geometriesNeedsRegen;
cvf::Collection<RivReservoirPartMgr> m_propFilteredGeometryFrames;
std::vector<uchar> m_propFilteredGeometryFramesNeedsRegen;

View File

@@ -32,6 +32,7 @@
#include "cafPdmUiTreeOrdering.h"
#include "cvfMath.h"
#include <array>
namespace caf
{
@@ -193,7 +194,7 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf
QList<caf::PdmOptionItemInfo> options;
std::map<QString, caf::FixedArray<QString, 6> > varBaseNameToVarsMap;
std::map<QString, std::array<QString, 6> > varBaseNameToVarsMap;
int i;
for (i = 0; i < varList.size(); ++i)
@@ -213,7 +214,7 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf
}
}
std::map<QString, caf::FixedArray<QString, 6> >::iterator it;
std::map<QString, std::array<QString, 6> >::iterator it;
for (it = varBaseNameToVarsMap.begin(); it != varBaseNameToVarsMap.end(); ++it)
{

View File

@@ -21,11 +21,12 @@
#pragma once
#include "cafAppEnum.h"
#include "cafFixedArray.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include <array>
class RigCaseCellResultsData;
class RimEclipseCase;
class RimEclipseCellColors;
@@ -117,7 +118,7 @@ private:
caf::PdmField<bool> useYVariable;
caf::PdmField<bool> useZVariable;
caf::FixedArray<std::pair<QString, size_t>, 6 > m_resultNameToIndexPairs;
std::array<std::pair<QString, size_t>, 6 > m_resultNameToIndexPairs;
caf::PdmPointer<RimEclipseView> m_reservoirView;
double m_ignoredResultScalar;

View File

@@ -1590,8 +1590,8 @@ void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2, const std
std::vector<size_t> polygon;
std::vector<cvf::Vec3d> intersections;
caf::SizeTArray4 face1;
caf::SizeTArray4 face2;
std::array<size_t, 4> face1;
std::array<size_t, 4> face2;
c1.faceIndices(faceId, &face1);
c2.faceIndices(cvf::StructGridInterface::oppositeFace(faceId), &face2);

View File

@@ -355,7 +355,7 @@ int RigCell::firstIntersectionPoint(const cvf::Ray& ray, cvf::Vec3d* intersectio
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCell::faceIndices(cvf::StructGridInterface::FaceType face, caf::SizeTArray4* indices) const
void RigCell::faceIndices(cvf::StructGridInterface::FaceType face, std::array<size_t, 4>* indices) const
{
cvf::ubyte faceVertexIndices[4];
cvf::StructGridInterface::cellFaceVertexIndices(face, faceVertexIndices);

View File

@@ -41,7 +41,7 @@ public:
std::array<size_t, 8>& cornerIndices() { return m_cornerIndices;}
const std::array<size_t, 8>& cornerIndices() const { return m_cornerIndices;}
void faceIndices(cvf::StructGridInterface::FaceType face, caf::SizeTArray4 * faceIndices) const ;
void faceIndices(cvf::StructGridInterface::FaceType face, std::array<size_t, 4>* faceIndices) const ;
bool isInvalid() const { return m_isInvalid; }
void setInvalid( bool val ) { m_isInvalid = val; }

View File

@@ -21,7 +21,7 @@
#include "RigResultAccessor.h"
#include "cafFixedArray.h"
#include <array>
//==================================================================================================
@@ -41,5 +41,5 @@ public:
virtual double cellFaceScalarGlobIdx(size_t globCellIndex, cvf::StructGridInterface::FaceType faceId) const;
private:
caf::FixedArray<cvf::ref<RigResultAccessor>, 6> m_resultAccessObjects;
std::array<cvf::ref<RigResultAccessor>, 6> m_resultAccessObjects;
};

View File

@@ -25,12 +25,12 @@
#include "cvfBoundingBox.h"
#include "cvfStructGrid.h"
#include "cvfCellRange.h"
#include "cafFixedArray.h"
#include <vector>
#include <QString>
#include <vector>
#include <array>
class RigMainGrid;
//--------------------------------------------------------------------------------------------------
@@ -44,10 +44,8 @@ public:
public:
explicit RigFaultsPrCellAccumulator(size_t reservoirCellCount)
{
const int initVals[6] = { NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT};
caf::IntArray6 initVal;
initVal = initVals;
m_faultIdxForCellFace.resize(reservoirCellCount, initVal);
std::array<int, 6> initVals = { NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT};
m_faultIdxForCellFace.resize(reservoirCellCount, initVals);
}
inline int faultIdx(size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face) const
@@ -61,7 +59,7 @@ public:
}
private:
std::vector< caf::IntArray6 > m_faultIdxForCellFace;
std::vector<std::array<int, 6>> m_faultIdxForCellFace;
};
@@ -106,7 +104,7 @@ public:
private:
QString m_name;
caf::FixedArray<std::vector<cvf::CellRange>, 6> m_cellRangesForFaces;
std::array<std::vector<cvf::CellRange>, 6> m_cellRangesForFaces;
std::vector<FaultFace> m_faultFaces;
std::vector<size_t> m_connectionIndices;

View File

@@ -379,7 +379,7 @@ size_t RigGridBase::reservoirCellIndex(size_t gridLocalCellIndex) const
//--------------------------------------------------------------------------------------------------
size_t RigGridBase::addCoarseningBox(size_t i1, size_t i2, size_t j1, size_t j2, size_t k1, size_t k2)
{
caf::SizeTArray6 box;
std::array<size_t, 6> box;
box[0] = i1;
box[1] = i2;
box[2] = j1;
@@ -419,7 +419,7 @@ void RigGridBase::coarseningBox(size_t coarseningBoxIndex, size_t* i1, size_t* i
CVF_ASSERT(i1 && i2 && j1 && j2 && k1 && k2);
caf::SizeTArray6 box = m_coarseningBoxInfo[coarseningBoxIndex];
const std::array<size_t, 6>& box = m_coarseningBoxInfo[coarseningBoxIndex];
*i1 = box[0];
*i2 = box[1];
*j1 = box[2];

View File

@@ -20,6 +20,9 @@
#pragma once
#include "RifReaderInterface.h"
#include "RigFault.h"
#include "cvfBase.h"
#include "cvfVector3.h"
@@ -27,14 +30,9 @@
#include "cvfStructGrid.h"
#include "cvfStructGridGeometryGenerator.h"
#include "cafFixedArray.h"
#include <vector>
#include <string>
#include "RifReaderInterface.h"
#include "RigFault.h"
class RigMainGrid;
class RigCell;
@@ -117,7 +115,7 @@ private:
RigMainGrid* m_mainGrid;
cvf::BoundingBox m_boundingBox;
std::vector<caf::SizeTArray6> m_coarseningBoxInfo;
std::vector<std::array<size_t, 6>> m_coarseningBoxInfo;
};

View File

@@ -393,9 +393,9 @@ void RigMainGrid::calculateFaults(const RigActiveCellInfo* activeCellInfo)
double tolerance = 1e-6;
caf::SizeTArray4 faceIdxs;
std::array<size_t, 4> faceIdxs;
m_cells[gcIdx].faceIndices(face, &faceIdxs);
caf::SizeTArray4 nbFaceIdxs;
std::array<size_t, 4> nbFaceIdxs;
m_cells[neighborReservoirCellIdx].faceIndices(StructGridInterface::oppositeFace(face), &nbFaceIdxs);

View File

@@ -161,8 +161,8 @@ cvf::StructGridInterface::FaceType RigNNCData::calculateCellFaceOverlap(const Ri
std::vector<size_t> polygon;
std::vector<cvf::Vec3d> intersections;
caf::SizeTArray4 face1;
caf::SizeTArray4 face2;
std::array<size_t, 4> face1;
std::array<size_t, 4> face2;
c1.faceIndices((cvf::StructGridInterface::FaceType)(fIdx), &face1);
c2.faceIndices(cvf::StructGridInterface::oppositeFace((cvf::StructGridInterface::FaceType)(fIdx)), &face2);

View File

@@ -24,8 +24,6 @@
#include "cvfVector3.h"
#include "cvfStructGrid.h"
#include "cafFixedArray.h"
#include <cmath> // Needed for HUGE_VAL on Linux
#include <map>
#include <vector>

View File

@@ -50,6 +50,8 @@
#include <QTcpSocket>
#include <array>
@@ -116,7 +118,7 @@ public:
// Write data back to octave: columnCount, bytesPrTimestep, GridNr I J K ParentGridNr PI PJ PK CoarseBoxIdx
caf::FixedArray<std::vector<qint32>, 9> activeCellInfo;
std::array<std::vector<qint32>, 9> activeCellInfo;
if (!(rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid()) )
{
// No data available

View File

@@ -23,7 +23,6 @@
#include "cvfLibViewing.h"
#include "cvfLibRender.h"
#include "cvfLibGeometry.h"
#include "cafFixedArray.h"
#include "cvfArrayWrapperToEdit.h"
#include "cvfArrayWrapperConst.h"
@@ -31,6 +30,8 @@
#include "cvfGeometryTools.h"
#include "cvfBoundingBoxTree.h"
#include <array>
using namespace cvf;
#if 0
@@ -122,22 +123,15 @@ std::vector<cvf::Vec3d> createVertices()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::UintArray4> getCubeFaces()
std::vector<std::array<cvf::uint, 4>> getCubeFaces()
{
std::vector<caf::UintArray4 > cubeFaces;
cvf::uint faces[4*4] = {
0, 1, 2, 3,
4, 5, 6, 7,
5, 8, 9, 6,
10, 11, 12, 13
};
std::vector<std::array<cvf::uint, 4>> cubeFaces;
cubeFaces.resize(4);
cubeFaces[0] = &faces[0];
cubeFaces[1] = &faces[4];
cubeFaces[2] = &faces[8];
cubeFaces[3] = &faces[12];
cubeFaces[0] = { 0, 1, 2, 3 };
cubeFaces[1] = { 4, 5, 6, 7 };
cubeFaces[2] = { 5, 8, 9, 6 };
cubeFaces[3] = { 10, 11, 12, 13 };
return cubeFaces;
}
@@ -161,7 +155,7 @@ TEST(CellFaceIntersectionTst, Intersection1)
std::vector<cvf::Vec3d> additionalVertices;
std::vector< std::vector<cvf::uint> > overlapPolygons;
std::vector<caf::UintArray4> faces = getCubeFaces();
auto faces = getCubeFaces();
EdgeIntersectStorage<cvf::uint> edgeIntersectionStorage;
edgeIntersectionStorage.setVertexCount(nodes.size());

View File

@@ -8,7 +8,6 @@ include (${QT_USE_FILE})
set( PROJECT_FILES
cafFactory.h
cafFixedArray.h
cafOmpMutex.h
cafPdmDocument.cpp
cafPdmDocument.h

View File

@@ -1,76 +0,0 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2011-2013 Ceetron AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library 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.
//
// This library 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.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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 Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#pragma once
#include "cafAssert.h"
namespace caf
{
//==================================================================================================
/// A fixed array class. Used to create small fixed size index arrays typically
//==================================================================================================
template < typename T, size_t size >
class FixedArray
{
T m_array[size];
public:
const T* data() const { return m_array; }
T* data() { return m_array; }
FixedArray<T, size>& operator=(const T* ptr) { for (size_t i = 0; i < size ; ++i) m_array[i] = ptr[i]; return *this;}
template<typename IndexType> T& operator[](const IndexType& index) { CAF_ASSERT(static_cast<size_t>(index) < size); return m_array[index]; }
template<typename IndexType> const T& operator[](const IndexType& index) const { CAF_ASSERT(static_cast<size_t>(index) < size); return m_array[index]; }
};
typedef FixedArray<int, 3> IntArray3;
typedef FixedArray<int, 6> IntArray6;
typedef FixedArray<int, 4> IntArray4;
typedef FixedArray<int, 8> IntArray8;
typedef FixedArray<unsigned int, 4> UintArray4;
typedef FixedArray<unsigned int, 8> UintArray8;
typedef FixedArray<size_t, 3> SizeTArray3;
typedef FixedArray<size_t, 4> SizeTArray4;
typedef FixedArray<size_t, 6> SizeTArray6;
typedef FixedArray<size_t, 8> SizeTArray8;
}