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

Refactoring the array operations.

parent b226f877
Loading
Loading
Loading
Loading
+54 −28
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@
#include <core/tnlHost.h>
#include <core/tnlCuda.h>

template< typename Device >
template< typename DestinationDevice,
          typename SourceDevice = DestinationDevice >
class tnlArrayOperations{};

template<>
@@ -56,34 +57,18 @@ class tnlArrayOperations< tnlHost >
                          const Index size );

   template< typename DestinationElement,
             typename DestinationDevice,
             typename SourceElement,
             typename Index >
   static bool copyMemory( DestinationElement* destination,
                           const SourceElement* source,
                           const Index size );

   template< typename Element,
             typename DestinationDevice,
             typename Index >
   static bool copyMemory( Element* destination,
                           const Element* source,
                           const Index size );

   template< typename Element1,
             typename DestinationDevice,
             typename Element2,
             typename Index >
   static bool compareMemory( const Element1* destination,
                              const Element2* source,
                              const Index size );

   /*template< typename Element,
             typename DestinationDevice,
             typename Index >
   static bool compareMemory( const Element* destination,
                              const Element* source,
                              const Index size );*/
};

template<>
@@ -117,29 +102,53 @@ class tnlArrayOperations< tnlCuda >
                          const Index size );

   template< typename DestinationElement,
             typename DestinationDevice,
             typename SourceElement,
             typename Index >
   static bool copyMemory( DestinationElement* destination,
                           const SourceElement* source,
                           const Index size );

   /*template< typename Element,
             typename DestinationDevice,
   template< typename Element1,
             typename Element2,
             typename Index >
   static bool compareMemory( const Element1* destination,
                              const Element2* source,
                              const Index size );
};

template<>
class tnlArrayOperations< tnlCuda, tnlHost >
{
   public:

   template< typename DestinationElement,
             typename SourceElement,
             typename Index >
   static bool copyMemory( DestinationElement* destination,
                           const SourceElement* source,
                           const Index size );

   template< typename DestinationElement,
             typename SourceElement,
             typename Index >
   static bool copyMemory( Element* destination,
                           const Element* source,
   static bool compareMemory( const DestinationElement* destination,
                              const SourceElement* source,
                              const Index size );
};

template<>
class tnlArrayOperations< tnlHost, tnlCuda >
{
   public:

   template< typename Element,
             typename DestinationDevice,
   template< typename DestinationElement,
             typename SourceElement,
             typename Index >
   static bool compareMemory( const Element* destination,
                              const Element* source,
                              const Index size );*/
   static bool copyMemory( DestinationElement* destination,
                           const SourceElement* source,
                           const Index size );

   template< typename Element1,
             typename DestinationDevice,
             typename Element2,
             typename Index >
   static bool compareMemory( const Element1* destination,
@@ -147,6 +156,23 @@ class tnlArrayOperations< tnlCuda >
                              const Index size );
};

template< typename Type1, typename Type2 >
class tnlFastArrayOperations
{
   public:

      enum{ enabled = false };
};

template< typename Type >
class tnlFastArrayOperations< Type, Type >
{
   public:

      enum{ enabled = true };
};


#include <implementation/core/arrays/tnlArrayOperationsHost_impl.h>
#include <implementation/core/arrays/tnlArrayOperationsCuda_impl.h>

+74 −49

File changed.

Preview size limit exceeded, changes collapsed.

+74 −49

File changed.

Preview size limit exceeded, changes collapsed.

+272 −209

File changed.

Preview size limit exceeded, changes collapsed.

+25 −49

File changed.

Preview size limit exceeded, changes collapsed.

Loading