Commit 2c8bed08 authored by Douglas Serson's avatar Douglas Serson

Simplify RawType

parent 623a8b06
......@@ -37,122 +37,44 @@
#ifndef NEKTAR_LIB_UTILITIES_BASICUTILS_RAW_TYPE_HPP
#define NEKTAR_LIB_UTILITIES_BASICUTILS_RAW_TYPE_HPP
#include <type_traits>
#include <memory>
namespace Nektar
{
template<typename T>
struct RawType { typedef T type; };
template<typename T>
struct RawType<const T> { typedef T type; };
template<typename T>
struct RawType<volatile T> { typedef T type; };
template<typename T>
struct RawType<const volatile T> { typedef T type; };
template<typename T>
struct RawType<T*> { typedef T type; };
template<typename T>
struct RawType<const T*> { typedef T type; };
template<typename T>
struct RawType<volatile T*> { typedef T type; };
template<typename T>
struct RawType<const volatile T*> { typedef T type; };
template<typename T>
struct RawType<T* const> { typedef T type; };
template<typename T>
struct RawType<const T* const> { typedef T type; };
template<typename T>
struct RawType<volatile T* const> { typedef T type; };
template<typename T>
struct RawType<const volatile T* const> { typedef T type; };
template<typename T>
struct RawType<T* volatile> { typedef T type; };
template<typename T>
struct RawType<const T* volatile> { typedef T type; };
template<typename T>
struct RawType<volatile T* volatile> { typedef T type; };
template<typename T>
struct RawType<const volatile T* volatile> { typedef T type; };
template<typename T>
struct RawType<T* const volatile> { typedef T type; };
template<typename T>
struct RawType<const T* const volatile> { typedef T type; };
template<typename T>
struct RawType<volatile T* const volatile> { typedef T type; };
template<typename T>
struct RawType<const volatile T* const volatile> { typedef T type; };
template<typename T>
struct RawType<std::shared_ptr<T> > { typedef T type; };
template<typename T>
struct RawType<const std::shared_ptr<T> > { typedef T type; };
template<typename T>
struct RawType<volatile std::shared_ptr<T> > { typedef T type; };
template<typename T>
struct RawType<const volatile std::shared_ptr<T> > { typedef T type; };
template<typename T>
struct RawType<std::shared_ptr<const T> > { typedef T type; };
template<typename T>
struct RawType<const std::shared_ptr<const T> > { typedef T type; };
struct RawType
{
typedef typename
std::decay<typename std::remove_pointer<T>::type >::type type;
};
template<typename T>
struct RawType<volatile std::shared_ptr<const T> > { typedef T type; };
struct RawType<std::shared_ptr<T>>
{
typedef typename RawType<T>::type type;
};
template<typename T>
struct RawType<const volatile std::shared_ptr<const T> > { typedef T type; };
template<typename T>
struct RawType<std::shared_ptr<volatile T> > { typedef T type; };
template<typename T>
struct RawType<const std::shared_ptr<volatile T> > { typedef T type; };
template<typename T>
struct RawType<volatile std::shared_ptr<volatile T> > { typedef T type; };
template<typename T>
struct RawType<const volatile std::shared_ptr<volatile T> > { typedef T type; };
template<typename T>
struct RawType<std::shared_ptr<const volatile T> > { typedef T type; };
struct RawType<const std::shared_ptr<T>>
{
typedef typename RawType<T>::type type;
};
template<typename T>
struct RawType<const std::shared_ptr<const volatile T> > { typedef T type; };
struct RawType<volatile std::shared_ptr<T>>
{
typedef typename RawType<T>::type type;
};
template<typename T>
struct RawType<volatile std::shared_ptr<const volatile T> > { typedef T type; };
struct RawType<const volatile std::shared_ptr<T>>
{
typedef typename RawType<T>::type type;
};
template<typename T>
struct RawType<const volatile std::shared_ptr<const volatile T> > { typedef T type; };
using RawType_t = typename RawType<T>::type;
}
#endif //NEKTAR_LIB_UTILITIES_BASICUTILS_RAW_TYPE_HPP
......@@ -178,8 +178,8 @@ void MultiplyEqual(
NekMatrix<double, StandardMatrixTag> &result,
const NekMatrix<RhsInnerType, RhsMatrixType> &rhs,
typename std::enable_if<
std::is_same<typename RawType<typename NekMatrix<
RhsInnerType, RhsMatrixType>::NumberType>::type,
std::is_same<RawType_t<typename NekMatrix<
RhsInnerType, RhsMatrixType>::NumberType>,
double>::value &&
CanGetRawPtr<NekMatrix<RhsInnerType, RhsMatrixType>>::value>::type *t =
0)
......@@ -215,8 +215,8 @@ void MultiplyEqual(
NekMatrix<DataType, StandardMatrixTag> &result,
const NekMatrix<RhsInnerType, RhsMatrixType> &rhs,
typename std::enable_if<
!std::is_same<typename RawType<typename NekMatrix<
RhsInnerType, RhsMatrixType>::NumberType>::type,
!std::is_same<RawType_t<typename NekMatrix<
RhsInnerType, RhsMatrixType>::NumberType>,
double>::value ||
!CanGetRawPtr<NekMatrix<RhsInnerType, RhsMatrixType>>::value>::type *t =
0)
......
......@@ -39,7 +39,6 @@
#include <LibUtilities/LinearAlgebra/NekTypeDefs.hpp>
#include <LibUtilities/BasicUtils/ErrorUtil.hpp>
#include <LibUtilities/BasicUtils/RawType.hpp>
#include <LibUtilities/LinearAlgebra/Blas.hpp>
#include <LibUtilities/LinearAlgebra/CanGetRawPtr.hpp>
......
......@@ -398,9 +398,9 @@ namespace Nektar
// In the following calls to Solve, VectorType must be a NekVector.
// Anything else won't compile.
template<typename VectorType>
typename RawType<VectorType>::type Solve(const VectorType& b)
RawType_t<VectorType> Solve(const VectorType& b)
{
typename RawType<VectorType>::type x(ConsistentObjectAccess<VectorType>::const_reference(b).GetRows());
RawType_t<VectorType> x(ConsistentObjectAccess<VectorType>::const_reference(b).GetRows());
LinearSystemSolver::Solve(ConsistentObjectAccess<VectorType>::const_reference(b), x, m_matrixType,
m_ipivot, n, A, m_transposeFlag, m_numberOfSubDiagonals, m_numberOfSuperDiagonals);
return x;
......@@ -416,9 +416,9 @@ namespace Nektar
// Transpose variant of solve
template<typename VectorType>
typename RawType<VectorType>::type SolveTranspose(const VectorType& b)
RawType_t<VectorType> SolveTranspose(const VectorType& b)
{
typename RawType<VectorType>::type x(ConsistentObjectAccess<VectorType>::const_reference(b).GetRows());
RawType_t<VectorType> x(ConsistentObjectAccess<VectorType>::const_reference(b).GetRows());
LinearSystemSolver::SolveTranspose(ConsistentObjectAccess<VectorType>::const_reference(b), x, m_matrixType,
m_ipivot, n, A, m_transposeFlag, m_numberOfSubDiagonals, m_numberOfSuperDiagonals);
return x;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment