Removed fvector and replaced with FixedArray.

Needs replacing with std::array when we get to c++11
This commit is contained in:
Jacob Støren 2014-08-07 15:53:05 +02:00 committed by Magne Sjaastad
parent 0f26b6e22f
commit 7a3d90daa4
4 changed files with 10 additions and 25 deletions

View File

@ -144,7 +144,7 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeResultSlot::calculateValueOptions(const
QList<caf::PdmOptionItemInfo> optionList;
std::map<QString, caf::fvector<QString, 6> > varBaseNameToVarsMap;
std::map<QString, caf::FixedArray<QString, 6> > varBaseNameToVarsMap;
int i;
for (i = 0; i < varList.size(); ++i)
@ -164,7 +164,7 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeResultSlot::calculateValueOptions(const
}
}
std::map<QString, caf::fvector<QString, 6> >::iterator it;
std::map<QString, caf::FixedArray<QString, 6> >::iterator it;
for (it = varBaseNameToVarsMap.begin(); it != varBaseNameToVarsMap.end(); ++it)
{
@ -174,16 +174,16 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeResultSlot::calculateValueOptions(const
bool firstText = true;
for (cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
{
if (!it->second.v[cubeFaceIdx].isEmpty())
if (!it->second[cubeFaceIdx].isEmpty())
{
if (firstText)
{
optionUiName += it->second.v[cubeFaceIdx];
optionUiName += it->second[cubeFaceIdx];
firstText = false;
}
else
{
optionUiName += QString(", ") + it->second.v[cubeFaceIdx];
optionUiName += QString(", ") + it->second[cubeFaceIdx];
}
}
}

View File

@ -22,23 +22,12 @@
#include "cafPdmField.h"
#include "cafAppEnum.h"
#include "RimDefines.h"
#include "cafFixedArray.h"
class RigCaseCellResultsData;
class RimLegendConfig;
class RimReservoirView;
namespace caf
{
template <typename T, size_t vectorSize>
class fvector
{
public:
T v[vectorSize];
T& operator[] (size_t idx) { return v[idx]; }
const T& operator[] (size_t idx) const { return v[idx]; }
};
}
//==================================================================================================
///
@ -86,7 +75,7 @@ private:
void resetResultIndices();
void updateIgnoredScalarValue();
protected:
caf::fvector<std::pair<QString, size_t>, 6 > m_resultNameToIndexPairs;
caf::FixedArray<std::pair<QString, size_t>, 6 > m_resultNameToIndexPairs;
caf::PdmPointer<RimReservoirView> m_reservoirView;
double m_ignoredResultScalar;
};

View File

@ -65,10 +65,6 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createNativeResultAccessor
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(scalarSetIndex);
// A generated result with a generated results for a subset of time steps, will end up with a result container with less entries than time steps
// See RiaSetGridProperty command in RiaPropertyDataCommands
//
// Some functions requires a valid data access object to be present, these might be rewritten to avoid this dummy object always returning HUGE_VAL
if (timeStepIndex >= scalarSetResults.size())
{
return NULL;

View File

@ -55,8 +55,8 @@ public:
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) { CVF_TIGHT_ASSERT(static_cast<size_t>(index) < size); return m_array[index]; }
template<typename IndexType> const T& operator[](const IndexType& index) const { CVF_TIGHT_ASSERT(static_cast<size_t>(index) < size); return m_array[index]; }
template<typename IndexType> T& operator[](const IndexType& index) { return m_array[index]; }
template<typename IndexType> const T& operator[](const IndexType& index) const { return m_array[index]; }
};
typedef FixedArray<int, 3> IntArray3;