You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#include "nmPebiStaticPropertyValues.h"
|
|
|
|
#include <float.h>
|
|
#include <math.h>
|
|
|
|
#if !defined(_MSC_VER)
|
|
#include <cmath>
|
|
#endif
|
|
|
|
namespace {
|
|
|
|
bool isFinitePropertyValue(double dValue)
|
|
{
|
|
#if defined(_MSC_VER)
|
|
return _finite(dValue) != 0;
|
|
#else
|
|
return std::isfinite(dValue);
|
|
#endif
|
|
}
|
|
|
|
bool containsOnlyFiniteValues(const QVector<double>& vecValues)
|
|
{
|
|
for(int nIndex = 0; nIndex < vecValues.size(); ++nIndex) {
|
|
if(!isFinitePropertyValue(vecValues[nIndex])) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}
|
|
|
|
void nmPebiStaticPropertyValues::clear()
|
|
{
|
|
m_vecPermeabilityMilliDarcy.clear();
|
|
m_vecPorosity.clear();
|
|
m_vecThicknessMeters.clear();
|
|
}
|
|
|
|
bool nmPebiStaticPropertyValues::isValidForCellCount(
|
|
int nOriginalCellCount) const
|
|
{
|
|
if(nOriginalCellCount <= 0 ||
|
|
m_vecPermeabilityMilliDarcy.size() != nOriginalCellCount ||
|
|
m_vecPorosity.size() != nOriginalCellCount ||
|
|
m_vecThicknessMeters.size() != nOriginalCellCount) {
|
|
return false;
|
|
}
|
|
|
|
return containsOnlyFiniteValues(m_vecPermeabilityMilliDarcy) &&
|
|
containsOnlyFiniteValues(m_vecPorosity) &&
|
|
containsOnlyFiniteValues(m_vecThicknessMeters);
|
|
}
|