Commit f8b230e9 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Disabled mesh initializer for Devices::Cuda

parent 79135082
Loading
Loading
Loading
Loading
+21 −5
Original line number Diff line number Diff line
@@ -30,11 +30,31 @@ namespace Meshes {

template< typename MeshConfig > class MeshInitializer;


template< typename MeshConfig, typename Device, typename MeshType >
class MeshInitializableBase
{
   public:
      using MeshTraitsType = MeshTraits< MeshConfig, Device >;

      // The points and cellSeeds arrays will be reset when not needed to save memory.
      bool init( typename MeshTraitsType::PointArrayType& points,
                 typename MeshTraitsType::CellSeedArrayType& cellSeeds );
};

// The mesh cannot be initialized on CUDA GPU, so this specialization is empty.
template< typename MeshConfig, typename MeshType >
class MeshInitializableBase< MeshConfig, Devices::Cuda, MeshType >
{
};


template< typename MeshConfig,
          typename Device = Devices::Host >
class Mesh
   : public Object,
     protected MeshStorageLayers< MeshConfig, Device >
     protected MeshStorageLayers< MeshConfig, Device >,
     public MeshInitializableBase< MeshConfig, Device, Mesh< MeshConfig, Device > >
{
      using StorageBaseType = MeshStorageLayers< MeshConfig, Device >;

@@ -109,10 +129,6 @@ class Mesh

      bool operator==( const Mesh& mesh ) const;

      // The points and cellSeeds arrays will be reset when not needed to save memory.
      bool init( typename MeshTraitsType::PointArrayType& points,
                 typename MeshTraitsType::CellSeedArrayType& cellSeeds );

      void writeProlog( Logger& logger );

   protected:
+13 −12
Original line number Diff line number Diff line
@@ -22,6 +22,19 @@
namespace TNL {
namespace Meshes {

template< typename MeshConfig, typename Device, typename MeshType >
bool
MeshInitializableBase< MeshConfig, Device, MeshType >::
init( typename MeshTraitsType::PointArrayType& points,
      typename MeshTraitsType::CellSeedArrayType& cellSeeds )
{
   MeshInitializer< typename MeshType::Config > meshInitializer;
   if( ! meshInitializer.createMesh( points, cellSeeds, *static_cast<MeshType*>(this) ) )
      return false;
   return true;
}


template< typename MeshConfig, typename Device >
constexpr int
Mesh< MeshConfig, Device >::
@@ -178,18 +191,6 @@ operator==( const Mesh& mesh ) const
   return StorageBaseType::operator==( mesh );
}

template< typename MeshConfig, typename Device >
bool
Mesh< MeshConfig, Device >::
init( typename MeshTraitsType::PointArrayType& points,
      typename MeshTraitsType::CellSeedArrayType& cellSeeds )
{
   MeshInitializer< MeshConfig> meshInitializer;
   if( ! meshInitializer.createMesh( points, cellSeeds, *this ) )
      return false;
   return true;
}

template< typename MeshConfig, typename Device >
void
Mesh< MeshConfig, Device >::