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

Implementing unique pointer.

parent 9441cc09
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

#pragma once

#include <utility>
#include <core/tnlHost.h>
#include <core/tnlCuda.h>

@@ -25,11 +26,11 @@ class tnlUniquePointer
{  
};

template< typename Object, typename Device, typename... Args >
tnlUniquePointer< Object, Device >& makeUniquePointer( Args&& args )
/*template< typename Object, typename Device, typename... Args >
tnlUniquePointer< Object, Device >& tnlUniquePointer( Args&& args )
{
   return
}
}*/

template< typename Object >
class tnlUniquePointer< Object, tnlHost >
@@ -41,14 +42,14 @@ class tnlUniquePointer< Object, tnlHost >
      typedef tnlUniquePointer< Object, tnlHost > ThisType;
         
      tnlUniquePointer()
      : pointer( 0 )
      {
         this->pointer = new Object();
      }
      
      template< typename... Args >
      void create( const Args&& args )
      {
         this->pointer = new Object( args );
         this->pointer = new Object( std::forward< Args >( args ) );
      }
      
      const Object& operator->() const
@@ -85,6 +86,8 @@ class tnlUniquePointer< Object, tnlHost >
      {
         if( this-> pointer )
            delete this->pointer;
         this->pointer = ptr.pointer;
         ptr.pointer= NULL;
      }
      
      ~tnlUniquePointer()
+6 −1
Original line number Diff line number Diff line
@@ -20,8 +20,13 @@ ENDIF()
INSTALL( TARGETS 
            tnl-benchmark-heat-equation${debugExt}
            tnl-benchmark-simple-heat-equation${debugExt}
         RUNTIME DESTINATION bin )

if( BUILD_CUDA )
    INSTALL( TARGETS 
                tnl-benchmark-simple-heat-equation-bug${debugExt}
             RUNTIME DESTINATION bin )
endif()


                                            
+1 −1
Original line number Diff line number Diff line
@@ -438,6 +438,7 @@ getExplicitRHS( const RealType& time,
   }
   if( std::is_same< DeviceType, tnlCuda >::value )
   {
      #ifdef HAVE_CUDA         
      if( this->cudaKernelType == "pure-c" )
      {
         const IndexType gridXSize = mesh.getDimensions().x();
@@ -471,7 +472,6 @@ getExplicitRHS( const RealType& time,
      }
      if( this->cudaKernelType == "templated-compact" )
      {
#ifdef HAVE_CUDA         
         typedef typename MeshType::Cell CellType;
         typedef typename CellType::CoordinatesType CoordinatesType;         
         MeshFunctionType u( mesh, uDofs );
+6 −2
Original line number Diff line number Diff line
@@ -6,12 +6,18 @@ ADD_SUBDIRECTORY( multimaps )
set( headers tnlFileTester.h
             tnlStringTester.h
             tnlObjectTester.h
             tnlUniquePointerTester.h
             tnlRealTester.h
             tnlListTester.h
             tnlGridOldTester.h
             tnlSharedMemoryTester.h
             tnlCommunicatorTester.h )

ADD_EXECUTABLE( tnlUniquePointerTest${mpiExt}${debugExt} ${headers} tnlUniquePointerTest.cpp )
SET_TARGET_PROPERTIES( tnlUniquePointerTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TEST_FLAGS}" )
TARGET_LINK_LIBRARIES( tnlUniquePointerTest${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES} ${LD_TEST_FLAGS}
                                                           tnl${mpiExt}${debugExt}-0.1 )

ADD_EXECUTABLE( tnlObjectTest${mpiExt}${debugExt} ${headers} tnlObjectTest.cpp )
SET_TARGET_PROPERTIES( tnlObjectTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TEST_FLAGS}" )
TARGET_LINK_LIBRARIES( tnlObjectTest${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES} ${LD_TEST_FLAGS}
@@ -24,5 +30,3 @@ TARGET_LINK_LIBRARIES( tnlStringTest${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES}
ADD_EXECUTABLE( tnlListTest${mpiExt}${debugExt} ${headers} tnlListTest.cpp )
TARGET_LINK_LIBRARIES( tnlListTest${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES}
                                                           tnl${mpiExt}${debugExt}-0.1 )
                                                           
                                                                       
 No newline at end of file
+2 −4
Original line number Diff line number Diff line
/***************************************************************************
                          tnlStringTester.h -  description
                          tnlObjectTester.h -  description
                             -------------------
    begin                : Oct 4, 2012
    copyright            : (C) 2012 by Tomas Oberhuber
@@ -15,8 +15,7 @@
 *                                                                         *
 ***************************************************************************/

#ifndef TNLOBJECTTESTER_H_
#define TNLOBJECTTESTER_H_
#pragma once

#ifdef HAVE_CPPUNIT
#include <cppunit/TestSuite.h>
@@ -60,4 +59,3 @@ class tnlObjectTester : public CppUnit :: TestCase
class tnlObjectTester{};
#endif  /* HAVE_CPPUNIT */
#endif /* TNLOBJECTTESTER_H_ */
Loading