This commit introduces non-trivial changes as GridProperty no longer is stored as a shared pointer. This file needs a thorough read-through, and it would be nice with some documentation.

This commit is contained in:
Pål Grønås Drange
2016-04-08 16:41:41 +02:00
parent 9dbae15cc9
commit 1e0356d392

View File

@@ -169,19 +169,19 @@ namespace Opm {
* \return Data values for property \c kw.
*/
template <class PropertyContainer>
static std::shared_ptr<const GridProperty<int> >
static const GridProperty<int>*
value(PropertyContainer& ecl,
const std::string& kw);
};
template <class PropertyContainer>
std::shared_ptr<const GridProperty<int> >
const GridProperty<int>*
GetProperty<int>::value(PropertyContainer& ecl,
const std::string& kw)
{
assert (HasProperty<int>::p(ecl, kw));
return ecl->getIntGridProperty(kw);
return &ecl->getEclipseProperties().getIntGridProperty(kw);
}
/**
@@ -205,19 +205,19 @@ namespace Opm {
* \return Data values for property \c kw.
*/
template <class PropertyContainer>
static std::shared_ptr<const GridProperty<double> >
static const GridProperty<double>*
value(PropertyContainer& ecl,
const std::string& kw);
};
template <class PropertyContainer>
std::shared_ptr<const GridProperty<double> >
const GridProperty<double>*
GetProperty<double>::value(PropertyContainer& ecl,
const std::string& kw)
{
assert (HasProperty<double>::p(ecl, kw));
return ecl->getDoubleGridProperty(kw);
return &ecl->getEclipseProperties().getDoubleGridProperty(kw);
}
} // namespace EclPropImpl
@@ -245,24 +245,21 @@ namespace Opm {
* an empty \code shared_ptr<> \endcode if not.
*/
template <class PropertyContainer>
static std::shared_ptr<const GridProperty<T> >
static const GridProperty<T>*
value(PropertyContainer& ecl,
const std::string& kw);
};
template <typename T>
template <class PropertyContainer>
std::shared_ptr<const GridProperty<T> >
const GridProperty<T>*
EclipsePropertyArray<T>::value(PropertyContainer& ecl,
const std::string& kw)
{
std::shared_ptr<const GridProperty<T> > x;
if (EclPropImpl::HasProperty<T>::p(ecl, kw)) {
x = EclPropImpl::GetProperty<T>::value(ecl, kw);
if (! EclPropImpl::HasProperty<T>::p(ecl, kw)) {
return nullptr;
}
return x;
return EclPropImpl::GetProperty<T>::value(ecl, kw);
}
} // namespace Details
@@ -349,7 +346,7 @@ namespace Opm {
*
* Null if data not defined.
*/
std::shared_ptr<const GridProperty<T> > x_;
const GridProperty<T>* x_ = nullptr;
/**
* Fall-back data element value if data not defined.