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

Fixing the convergence issue by introducing a method boundLoad.

parent d1d1ee44
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
add_subdirectory( heat-equation )
add_subdirectory( navier-stokes )
add_subdirectory( mean-curvature-flow )
#add_subdirectory( mean-curvature-flow )
+11 −0
Original line number Diff line number Diff line
@@ -139,6 +139,17 @@ class tnlArray : public virtual tnlObject
      //! Method for loading the object from a file as a binary data.
      bool load( tnlFile& file );
      
      //! This method loads data without reallocation. 
      /****
       * This is useful for loading data into shared arrays.
       * If the array was not initialize yet, common load is
       * performed. Otherwise, the array size must fit with
       * the size of array being loaded.
       */
      bool boundLoad( tnlFile& file );
      
      bool boundLoad( const tnlString& fileName );
      
      using tnlObject::load;

      using tnlObject::save;
+0 −15
Original line number Diff line number Diff line
@@ -157,21 +157,6 @@ class tnlArrayOperations< tnlHost, tnlCuda >
                              const Index size );
};

template< typename Type1, typename Type2 >
struct tnlFastArrayOperations
{
   enum{ enabled = false };
};

template<> struct tnlFastArrayOperations< char,              char >{ enum{ enabled = true }; };
template<> struct tnlFastArrayOperations< int,               int  >{ enum{ enabled = true }; };
template<> struct tnlFastArrayOperations< unsigned int,      unsigned int  >{ enum{ enabled = true }; };
template<> struct tnlFastArrayOperations< long int,          long int  >{ enum{ enabled = true }; };
template<> struct tnlFastArrayOperations< long unsigned int, long unsigned int  >{ enum{ enabled = true }; };
template<> struct tnlFastArrayOperations< float,             float  >{ enum{ enabled = true }; };
template<> struct tnlFastArrayOperations< double,            double  >{ enum{ enabled = true }; };


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

+3 −3
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ bool tnlArrayOperations< tnlCuda >::copyMemory( DestinationElement* destination,
   tnlAssert( destination, );
   tnlAssert( source, );
   #ifdef HAVE_CUDA
      if( tnlFastArrayOperations< DestinationElement, SourceElement >::enabled )
      if( std::is_same< DestinationElement, SourceElement >::value )
      {
         if( cudaMemcpy( destination,
                         source,
@@ -201,7 +201,7 @@ bool tnlArrayOperations< tnlHost, tnlCuda >::copyMemory( DestinationElement* des
   tnlAssert( destination, );
   tnlAssert( source, );
   #ifdef HAVE_CUDA
   if( tnlFastArrayOperations< DestinationElement, SourceElement >::enabled )
   if( std::is_same< DestinationElement, SourceElement >::value )
   {
      cudaMemcpy( destination,
                  source,
@@ -312,7 +312,7 @@ bool tnlArrayOperations< tnlCuda, tnlHost >::copyMemory( DestinationElement* des
   tnlAssert( source, );
   tnlAssert( size >= 0, cerr << "size = " << size );
   #ifdef HAVE_CUDA
   if( tnlFastArrayOperations< DestinationElement, SourceElement >::enabled )
   if( std::is_same< DestinationElement, SourceElement >::value )
   {
      cudaMemcpy( destination,
                  source,
+4 −2
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@

#ifndef TNLARRAYOPERATIONSHOST_IMPL_H_
#define TNLARRAYOPERATIONSHOST_IMPL_H_

#include <type_traits>
#include <tnlConfig.h>
#include <string.h>

@@ -79,7 +81,7 @@ bool tnlArrayOperations< tnlHost >::copyMemory( DestinationElement* destination,
                                                const SourceElement* source,
                                                const Index size )
{
   if( tnlFastArrayOperations< DestinationElement, SourceElement >::enabled )
   if( std::is_same< DestinationElement, SourceElement >::value )
      memcpy( destination, source, size * sizeof( DestinationElement ) );
   else
      for( Index i = 0; i < size; i ++ )
@@ -94,7 +96,7 @@ bool tnlArrayOperations< tnlHost >::compareMemory( const DestinationElement* des
                                                   const SourceElement* source,
                                                   const Index size )
{
   if( tnlFastArrayOperations< DestinationElement, SourceElement >::enabled )
   if( std::is_same< DestinationElement, SourceElement >::value )
   {
      if( memcmp( destination, source, size * sizeof( DestinationElement ) ) != 0 )
         return false;
Loading