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

Implementing the mesh initializer.

parent b642cc70
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@ class tnlHost;
template< typename Element, typename Device, typename Index >
class tnlArray;

template< int Size, typename Element >
class tnlStaticArray;

template< typename Element,
          typename Device = tnlHost,
          typename Index = int >
@@ -46,6 +49,9 @@ class tnlSharedArray : public tnlObject

   void bind( tnlArray< Element, Device, Index >& array );

   template< int Size >
   void bind( tnlStaticArray< Size, Element >& array );

   void bind( tnlSharedArray< Element, Device, Index >& array );

   void swap( tnlSharedArray< Element, Device, Index >& array );
+39 −0
Original line number Diff line number Diff line
@@ -62,6 +62,16 @@ class tnlStaticArray
#endif
   int getSize() const;

#ifdef HAVE_CUDA
   __host__ __device__
#endif
   Element* getData();

#ifdef HAVE_CUDA
   __host__ __device__
#endif
   const Element* getData() const;

#ifdef HAVE_CUDA
   __host__ __device__
#endif
@@ -130,6 +140,15 @@ class tnlStaticArray< 1, Element >
#endif
   int getSize() const;

#ifdef HAVE_CUDA
   __host__ __device__
#endif
   Element* getData();

#ifdef HAVE_CUDA
   __host__ __device__
#endif
   const Element* getData() const;

#ifdef HAVE_CUDA
   __host__ __device__
@@ -216,6 +235,16 @@ class tnlStaticArray< 2, Element >
#endif
   int getSize() const;

#ifdef HAVE_CUDA
   __host__ __device__
#endif
   Element* getData();

#ifdef HAVE_CUDA
   __host__ __device__
#endif
   const Element* getData() const;

#ifdef HAVE_CUDA
   __host__ __device__
#endif
@@ -313,6 +342,16 @@ class tnlStaticArray< 3, Element >
#endif
   int getSize() const;

#ifdef HAVE_CUDA
   __host__ __device__
#endif
   Element* getData();

#ifdef HAVE_CUDA
   __host__ __device__
#endif
   const Element* getData() const;

#ifdef HAVE_CUDA
   __host__ __device__
#endif
+13 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <iostream>
#include <core/tnlFile.h>
#include <core/arrays/tnlArray.h>
#include <core/arrays/tnlStaticArray.h>
#include <core/arrays/tnlArrayOperations.h>
#include <core/mfuncs.h>
#include <core/param-types.h>
@@ -73,6 +74,16 @@ void tnlSharedArray< Element, Device, Index > :: bind( tnlArray< Element, Device
   this->data = array. getData();
};

template< typename Element,
          typename Device,
          typename Index >
   template< int Size >
void tnlSharedArray< Element, Device, Index >::bind( tnlStaticArray< Size, Element >& array )
{
   this->size = Size;
   this->data = array.getData();
}

template< typename Element,
          typename Device,
          typename Index >
+18 −0
Original line number Diff line number Diff line
@@ -74,6 +74,24 @@ int tnlStaticArray< 1, Element >::getSize() const
   return size;
}

#ifdef HAVE_CUDA
   __host__ __device__
#endif
template< typename Element >
Element* tnlStaticArray< 1, Element >::getData()
{
   return data;
}

#ifdef HAVE_CUDA
   __host__ __device__
#endif
template< typename Element >
const Element* tnlStaticArray< 1, Element >::getData() const
{
   return data;
}

template< typename Element >
#ifdef HAVE_CUDA
__host__ __device__
+18 −0
Original line number Diff line number Diff line
@@ -87,6 +87,24 @@ int tnlStaticArray< 2, Element >::getSize() const
   return size;
}

#ifdef HAVE_CUDA
   __host__ __device__
#endif
template< typename Element >
Element* tnlStaticArray< 2, Element >::getData()
{
   return data;
}

#ifdef HAVE_CUDA
   __host__ __device__
#endif
template< typename Element >
const Element* tnlStaticArray< 2, Element >::getData() const
{
   return data;
}

template< typename Element >
#ifdef HAVE_CUDA
__host__ __device__
Loading