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

Refactoring the code.

parent b4f7bf50
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -6,19 +6,19 @@ set( tnl_inviscid_flow_SOURCES
     euler.cu )
               
IF( BUILD_CUDA )
   CUDA_ADD_EXECUTABLE(tnl-euler-2d${debugExt} euler.cu)
   target_link_libraries (tnl-euler-2d${debugExt} tnl${debugExt}-${tnlVersion}  ${CUSPARSE_LIBRARY} )
   CUDA_ADD_EXECUTABLE(tnl-euler${debugExt} euler.cu)
   target_link_libraries (tnl-euler${debugExt} tnl${debugExt}-${tnlVersion}  ${CUSPARSE_LIBRARY} )
ELSE(  BUILD_CUDA )               
   ADD_EXECUTABLE(tnl-euler-2d${debugExt} euler.cpp)     
   target_link_libraries (tnl-euler-2d${debugExt} tnl${debugExt}-${tnlVersion} )
   ADD_EXECUTABLE(tnl-euler${debugExt} euler.cpp)     
   target_link_libraries (tnl-euler${debugExt} tnl${debugExt}-${tnlVersion} )
ENDIF( BUILD_CUDA )


INSTALL( TARGETS tnl-euler-2d${debugExt}
INSTALL( TARGETS tnl-euler${debugExt}
         RUNTIME DESTINATION bin
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
        
INSTALL( FILES run-euler
               ${tnl_inviscid_flow_SOURCES}
         DESTINATION share/tnl-${tnlVersion}/examples/inviscid-flow-2d )
         DESTINATION share/tnl-${tnlVersion}/examples/inviscid-flow )
+9 −2
Original line number Diff line number Diff line
@@ -354,7 +354,9 @@ Array< Element, Device, Index >&
Array< Element, Device, Index >::
operator = ( const Array< Element, Device, Index >& array )
{
   TNL_ASSERT_EQ( array.getSize(), this->getSize(), "Array sizes must be the same." );
   //TNL_ASSERT_EQ( array.getSize(), this->getSize(), "Array sizes must be the same." );
   if( this->getSize() != array.getSize() )
      this->setLike( array );
   if( this->getSize() > 0 )
      Algorithms::ArrayOperations< Device >::
         template copyMemory< Element,
@@ -374,7 +376,9 @@ Array< Element, Device, Index >&
Array< Element, Device, Index >::
operator = ( const ArrayT& array )
{
   TNL_ASSERT_EQ( array.getSize(), this->getSize(), "Array sizes must be the same." );
   //TNL_ASSERT_EQ( array.getSize(), this->getSize(), "Array sizes must be the same." );
   if( this->getSize() != array.getSize() )
      this->setLike( array );   
   if( this->getSize() > 0 )
      Algorithms::ArrayOperations< Device, typename ArrayT::DeviceType >::
         template copyMemory< Element,
@@ -491,7 +495,10 @@ load( File& file )
      return false;
   Index _size;
   if( ! file.read( &_size ) )
   {
      std::cerr << "Unable to read the array size." << std::endl;
      return false;
   }
   if( _size < 0 )
   {
      std::cerr << "Error: The size " << _size << " of the file is not a positive number or zero." << std::endl;
+10 −2
Original line number Diff line number Diff line
@@ -121,8 +121,16 @@ bool getObjectType( File& file, String& type )
      return false;
   }
   if( strncmp( mn, magic_number, 5 ) != 0 &&
       strncmp( mn, "SIM33", 5 ) != 0 ) return false;
   if( ! type. load( file ) ) return false;
       strncmp( mn, "SIM33", 5 ) != 0 )
   {
       std::cout << "Not a TNL file (wrong magic number)." << std::endl;
       return false;
   }
   if( ! type. load( file ) )
   {
       std::cerr << "Cannot load the object type." << std::endl;
       return false;
   }
   return true;
}

+5 −0
Original line number Diff line number Diff line
@@ -133,6 +133,11 @@ bool Merson< Problem > :: solve( DofVectorPointer& u )
      std::cerr << "No problem was set for the Merson ODE solver." << std::endl;
      return false;
   }
   if( this->getTau() == 0.0 )
   {
      std::cerr << "The time step for the Merson ODE solver is zero." << std::endl;
      return false;
   }
   /****
    * First setup the supporting meshes k1...k5 and kAux.
    */
+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ void String::setSize( int size )
{
   TNL_ASSERT_GE( size, 0, "string size must be non-negative" );
   const int _length = STRING_PAGE * ( size / STRING_PAGE + 1 );
   TNL_ASSERT_GE( _length, 0, "_length size must be non-negative" );
   if( length != _length ) {
      if( string ) {
         delete[] string;