Commit 765d8992 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Merge remote-tracking branch 'origin/lbm' into mpi-explosive

parents e7280379 11dfa47a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -81,10 +81,12 @@ class ArrayOperations< Devices::Cuda >
   static void freeMemory( Element* data );

   template< typename Element >
   __cuda_callable__
   static void setMemoryElement( Element* data,
                                 const Element& value );

   template< typename Element >
   __cuda_callable__
   static Element getMemoryElement( const Element* data );

   // TODO: does not make sense for CUDA - remove?
+10 −2
Original line number Diff line number Diff line
@@ -60,24 +60,32 @@ freeMemory( Element* data )
}

template< typename Element >
void
__cuda_callable__ void
ArrayOperations< Devices::Cuda >::
setMemoryElement( Element* data,
                  const Element& value )
{
   TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
#ifdef __CUDAARCH__
   *data = value;
#else   
   ArrayOperations< Devices::Cuda >::setMemory( data, value, 1 );
#endif   
}

template< typename Element >
Element
__cuda_callable__ Element
ArrayOperations< Devices::Cuda >::
getMemoryElement( const Element* data )
{
   TNL_ASSERT_TRUE( data, "Attempted to get data through a nullptr." );
#ifdef __CUDAARCH__
   return *data;
#else   
   Element result;
   ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory< Element, Element, int >( &result, data, 1 );
   return result;
#endif   
}

template< typename Element, typename Index >
+18 −1
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@ class StaticVector : public StaticArray< Size, Real >
   __cuda_callable__
   StaticVector& operator *= ( const Real& c );
   
   //! Division by number
   __cuda_callable__
   StaticVector& operator /= ( const Real& c );
   
   //! Addition operator
   __cuda_callable__
   StaticVector operator + ( const StaticVector& u ) const;
@@ -156,6 +160,10 @@ class StaticVector< 1, Real > : public StaticArray< 1, Real >
   __cuda_callable__
   StaticVector& operator *= ( const Real& c );
   
   //! Division by number
   __cuda_callable__
   StaticVector& operator /= ( const Real& c );   

   //! Addition operator
   __cuda_callable__
   StaticVector operator + ( const StaticVector& u ) const;
@@ -257,6 +265,10 @@ class StaticVector< 2, Real > : public StaticArray< 2, Real >
   __cuda_callable__
   StaticVector& operator *= ( const Real& c );

   //! Division by number
   __cuda_callable__
   StaticVector& operator /= ( const Real& c );   

   //! Adding operator
   __cuda_callable__
   StaticVector operator + ( const StaticVector& u ) const;
@@ -358,6 +370,11 @@ class StaticVector< 3, Real > : public StaticArray< 3, Real >
   __cuda_callable__
   StaticVector& operator *= ( const Real& c );
   
   //! Division by number
   __cuda_callable__
   StaticVector& operator /= ( const Real& c );
   

   //! Addition operator
   __cuda_callable__
   StaticVector operator + ( const StaticVector& u ) const;
+8 −0
Original line number Diff line number Diff line
@@ -86,6 +86,14 @@ StaticVector< 1, Real >& StaticVector< 1, Real >::operator *= ( const Real& c )
   return *this;
}

template< typename Real >
__cuda_callable__
StaticVector< 1, Real >& StaticVector< 1, Real >::operator /= ( const Real& c )
{
   this->data[ 0 ] /= c;
   return *this;
}

template< typename Real >
__cuda_callable__
StaticVector< 1, Real > StaticVector< 1, Real >::operator + ( const StaticVector& u ) const
+10 −0
Original line number Diff line number Diff line
@@ -97,6 +97,16 @@ StaticVector< 2, Real >& StaticVector< 2, Real >::operator *= ( const Real& c )
   return *this;
}

template< typename Real >
__cuda_callable__
StaticVector< 2, Real >& StaticVector< 2, Real >::operator /= ( const Real& c )
{
   const RealType d = 1.0 /c;
   this->data[ 0 ] *= d;
   this->data[ 1 ] *= d;
   return *this;
}

template< typename Real >
__cuda_callable__
StaticVector< 2, Real > StaticVector< 2, Real >::operator + ( const StaticVector& u ) const
Loading