Loading CMakeLists.txt +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug") set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/bin ) set( debugExt -dbg ) AddCompilerFlag( "-std=gnu++0x -DTEMPLATE_EXPLICIT_INSTANTIATION" ) #AddCompilerFlag( "-DHAVE_NOT_CXX11 -DTEMPLATE_EXPLICIT_INSTANTIATION" ) else() set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Release/src ) set( PROJECT_TESTS_PATH ${PROJECT_SOURCE_DIR}/Release/tests ) Loading @@ -26,6 +27,7 @@ else() #set( CXX_OPTIMIZE_FLAGS "-O3") OptimizeForArchitecture() AddCompilerFlag( "-std=gnu++0x -O3 -DNDEBUG -DTEMPLATE_EXPLICIT_INSTANTIATION" ) #AddCompilerFlag( "-DHAVE_NOT_CXX11 -O3 -DNDEBUG -DTEMPLATE_EXPLICIT_INSTANTIATION" ) endif() ##### Loading src/core/tnlArray.h +5 −0 Original line number Diff line number Diff line Loading @@ -90,8 +90,13 @@ class tnlArray : public tnlObject * Every time one touches this grid touches * size * sizeof( Real ) bytes are added * to transfered bytes in tnlStatistics. */ #ifdef HAVE_NOT_CXX11 template< typename IndexType2 > void touch( IndexType2 touches = 1 ) const; #else template< typename IndexType2 = Index > void touch( IndexType2 touches = 1 ) const; #endif //! Method for saving the object to a file as a binary data. bool save( tnlFile& file ) const; Loading src/core/tnlFile.h +16 −15 Original line number Diff line number Diff line Loading @@ -104,34 +104,35 @@ class tnlFile } // TODO: this does not work for constant types #ifdef HAVE_CXX11 template< typename Type, typename Device = tnlHost, typename Index = int > #ifdef HAVE_NOT_CXX11 template< typename Type, typename Device, typename Index > bool read( Type* buffer, const Index& elements ); template< typename Type, typename Device = tnlHost > template< typename Type, typename Device > bool read( Type* buffer ); template< typename Type, typename Device = tnlHost, typename Index = int > template< typename Type, typename Device, typename Index > bool write( const Type* buffer, const Index elements ); template< typename Type, typename Device = tnlHost > template< typename Type, typename Device > bool write( Type* buffer ); #else template< typename Type, typename Device, typename Index > template< typename Type, typename Device = tnlHost, typename Index = int > bool read( Type* buffer, const Index& elements ); template< typename Type, typename Device > template< typename Type, typename Device = tnlHost > bool read( Type* buffer ); template< typename Type, typename Device, typename Index > template< typename Type, typename Device = tnlHost, typename Index = int > bool write( const Type* buffer, const Index elements ); template< typename Type, typename Device > template< typename Type, typename Device = tnlHost > bool write( Type* buffer ); #endif bool close(); Loading src/core/tnlList.h +32 −13 Original line number Diff line number Diff line Loading @@ -301,31 +301,32 @@ template< class T > class tnlList //! Save the list in binary format bool Save( tnlFile& file ) const { #ifdef HAVE_CXX11 file. write( &size ); #ifdef HAVE_NOT_CXX11 file. write< const int, tnlHost >( &size ); for( int i = 0; i < size; i ++ ) if( ! file. write( &operator[]( i ), 1 ) ) if( ! file. write< int, tnlHost, int >( &operator[]( i ), 1 ) ) return false; return true; #else file. write< const int, tnlHost >( &size ); file. write( &size ); for( int i = 0; i < size; i ++ ) if( ! file. write< int, tnlHost, int >( &operator[]( i ), 1 ) ) if( ! file. write( &operator[]( i ), 1 ) ) return false; return true; #endif } //! Save the list in binary format using method save of type T bool DeepSave( tnlFile& file ) const { #ifdef HAVE_CXX11 file. write( &size ); #ifdef HAVE_NOT_CXX11 file. write< const int, tnlHost >( &size ); for( int i = 0; i < size; i ++ ) if( ! operator[]( i ). save( file ) ) return false; return true; #else file. write< const int, tnlHost >( &size ); file. write( &size ); for( int i = 0; i < size; i ++ ) if( ! operator[]( i ). save( file ) ) return false; return true; Loading @@ -335,10 +336,10 @@ template< class T > class tnlList //! Load the list bool Load( tnlFile& file ) { #ifdef HAVE_CXX11 #ifdef HAVE_NOT_CXX11 EraseAll(); int _size; file. read( &_size, 1 ); file. read< int, tnlHost >( &_size ); if( _size < 0 ) { cerr << "The curve size is negative." << endl; Loading @@ -347,7 +348,7 @@ template< class T > class tnlList T t; for( int i = 0; i < _size; i ++ ) { if( ! file. read( &t, 1 ) ) if( ! file. read< T, tnlHost >( &t ) ) return false; Append( t ); } Loading @@ -355,7 +356,7 @@ template< class T > class tnlList #else EraseAll(); int _size; file. read< int, tnlHost >( &_size ); file. read( &_size, 1 ); if( _size < 0 ) { cerr << "The curve size is negative." << endl; Loading @@ -364,7 +365,7 @@ template< class T > class tnlList T t; for( int i = 0; i < _size; i ++ ) { if( ! file. read< T, tnlHost >( &t ) ) if( ! file. read( &t, 1 ) ) return false; Append( t ); } Loading @@ -375,6 +376,23 @@ template< class T > class tnlList //! Load the list using method Load of the type T bool DeepLoad( tnlFile& file ) { #ifdef HAVE_NOT_CXX11 EraseAll(); int _size; file. read< int, tnlHost >( &_size ); if( _size < 0 ) { cerr << "The list size is negative." << endl; return false; } for( int i = 0; i < _size; i ++ ) { T t; if( ! t. load( file ) ) return false; Append( t ); } return true; #else EraseAll(); int _size; file. read( &_size ); Loading @@ -390,6 +408,7 @@ template< class T > class tnlList Append( t ); } return true; #endif }; }; Loading src/core/tnlSharedArray.h +5 −0 Original line number Diff line number Diff line Loading @@ -89,8 +89,13 @@ class tnlSharedArray : public tnlObject * Every time one touches this grid touches * size * sizeof( Real ) bytes are added * to transfered bytes in tnlStatistics. */ #ifdef HAVE_NOT_CXX11 template< typename IndexType2 > void touch( IndexType2 touches = 1 ) const; #else template< typename IndexType2 = Index > void touch( IndexType2 touches = 1 ) const; #endif //! Method for saving the object to a file as a binary data. bool save( tnlFile& file ) const; Loading Loading
CMakeLists.txt +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug") set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/bin ) set( debugExt -dbg ) AddCompilerFlag( "-std=gnu++0x -DTEMPLATE_EXPLICIT_INSTANTIATION" ) #AddCompilerFlag( "-DHAVE_NOT_CXX11 -DTEMPLATE_EXPLICIT_INSTANTIATION" ) else() set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Release/src ) set( PROJECT_TESTS_PATH ${PROJECT_SOURCE_DIR}/Release/tests ) Loading @@ -26,6 +27,7 @@ else() #set( CXX_OPTIMIZE_FLAGS "-O3") OptimizeForArchitecture() AddCompilerFlag( "-std=gnu++0x -O3 -DNDEBUG -DTEMPLATE_EXPLICIT_INSTANTIATION" ) #AddCompilerFlag( "-DHAVE_NOT_CXX11 -O3 -DNDEBUG -DTEMPLATE_EXPLICIT_INSTANTIATION" ) endif() ##### Loading
src/core/tnlArray.h +5 −0 Original line number Diff line number Diff line Loading @@ -90,8 +90,13 @@ class tnlArray : public tnlObject * Every time one touches this grid touches * size * sizeof( Real ) bytes are added * to transfered bytes in tnlStatistics. */ #ifdef HAVE_NOT_CXX11 template< typename IndexType2 > void touch( IndexType2 touches = 1 ) const; #else template< typename IndexType2 = Index > void touch( IndexType2 touches = 1 ) const; #endif //! Method for saving the object to a file as a binary data. bool save( tnlFile& file ) const; Loading
src/core/tnlFile.h +16 −15 Original line number Diff line number Diff line Loading @@ -104,34 +104,35 @@ class tnlFile } // TODO: this does not work for constant types #ifdef HAVE_CXX11 template< typename Type, typename Device = tnlHost, typename Index = int > #ifdef HAVE_NOT_CXX11 template< typename Type, typename Device, typename Index > bool read( Type* buffer, const Index& elements ); template< typename Type, typename Device = tnlHost > template< typename Type, typename Device > bool read( Type* buffer ); template< typename Type, typename Device = tnlHost, typename Index = int > template< typename Type, typename Device, typename Index > bool write( const Type* buffer, const Index elements ); template< typename Type, typename Device = tnlHost > template< typename Type, typename Device > bool write( Type* buffer ); #else template< typename Type, typename Device, typename Index > template< typename Type, typename Device = tnlHost, typename Index = int > bool read( Type* buffer, const Index& elements ); template< typename Type, typename Device > template< typename Type, typename Device = tnlHost > bool read( Type* buffer ); template< typename Type, typename Device, typename Index > template< typename Type, typename Device = tnlHost, typename Index = int > bool write( const Type* buffer, const Index elements ); template< typename Type, typename Device > template< typename Type, typename Device = tnlHost > bool write( Type* buffer ); #endif bool close(); Loading
src/core/tnlList.h +32 −13 Original line number Diff line number Diff line Loading @@ -301,31 +301,32 @@ template< class T > class tnlList //! Save the list in binary format bool Save( tnlFile& file ) const { #ifdef HAVE_CXX11 file. write( &size ); #ifdef HAVE_NOT_CXX11 file. write< const int, tnlHost >( &size ); for( int i = 0; i < size; i ++ ) if( ! file. write( &operator[]( i ), 1 ) ) if( ! file. write< int, tnlHost, int >( &operator[]( i ), 1 ) ) return false; return true; #else file. write< const int, tnlHost >( &size ); file. write( &size ); for( int i = 0; i < size; i ++ ) if( ! file. write< int, tnlHost, int >( &operator[]( i ), 1 ) ) if( ! file. write( &operator[]( i ), 1 ) ) return false; return true; #endif } //! Save the list in binary format using method save of type T bool DeepSave( tnlFile& file ) const { #ifdef HAVE_CXX11 file. write( &size ); #ifdef HAVE_NOT_CXX11 file. write< const int, tnlHost >( &size ); for( int i = 0; i < size; i ++ ) if( ! operator[]( i ). save( file ) ) return false; return true; #else file. write< const int, tnlHost >( &size ); file. write( &size ); for( int i = 0; i < size; i ++ ) if( ! operator[]( i ). save( file ) ) return false; return true; Loading @@ -335,10 +336,10 @@ template< class T > class tnlList //! Load the list bool Load( tnlFile& file ) { #ifdef HAVE_CXX11 #ifdef HAVE_NOT_CXX11 EraseAll(); int _size; file. read( &_size, 1 ); file. read< int, tnlHost >( &_size ); if( _size < 0 ) { cerr << "The curve size is negative." << endl; Loading @@ -347,7 +348,7 @@ template< class T > class tnlList T t; for( int i = 0; i < _size; i ++ ) { if( ! file. read( &t, 1 ) ) if( ! file. read< T, tnlHost >( &t ) ) return false; Append( t ); } Loading @@ -355,7 +356,7 @@ template< class T > class tnlList #else EraseAll(); int _size; file. read< int, tnlHost >( &_size ); file. read( &_size, 1 ); if( _size < 0 ) { cerr << "The curve size is negative." << endl; Loading @@ -364,7 +365,7 @@ template< class T > class tnlList T t; for( int i = 0; i < _size; i ++ ) { if( ! file. read< T, tnlHost >( &t ) ) if( ! file. read( &t, 1 ) ) return false; Append( t ); } Loading @@ -375,6 +376,23 @@ template< class T > class tnlList //! Load the list using method Load of the type T bool DeepLoad( tnlFile& file ) { #ifdef HAVE_NOT_CXX11 EraseAll(); int _size; file. read< int, tnlHost >( &_size ); if( _size < 0 ) { cerr << "The list size is negative." << endl; return false; } for( int i = 0; i < _size; i ++ ) { T t; if( ! t. load( file ) ) return false; Append( t ); } return true; #else EraseAll(); int _size; file. read( &_size ); Loading @@ -390,6 +408,7 @@ template< class T > class tnlList Append( t ); } return true; #endif }; }; Loading
src/core/tnlSharedArray.h +5 −0 Original line number Diff line number Diff line Loading @@ -89,8 +89,13 @@ class tnlSharedArray : public tnlObject * Every time one touches this grid touches * size * sizeof( Real ) bytes are added * to transfered bytes in tnlStatistics. */ #ifdef HAVE_NOT_CXX11 template< typename IndexType2 > void touch( IndexType2 touches = 1 ) const; #else template< typename IndexType2 = Index > void touch( IndexType2 touches = 1 ) const; #endif //! Method for saving the object to a file as a binary data. bool save( tnlFile& file ) const; Loading