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

Fixing the heat equation.

parent b4c0d19a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -40,3 +40,4 @@

# /tools/src/
/tools/src/Makefile.in
/Testing
+2 −0
Original line number Diff line number Diff line
@@ -218,6 +218,8 @@ endif( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" )

ENABLE_TESTING()
INCLUDE( Dart )
set( CXX_TEST_FLAGS "-fprofile-arcs -ftest-coverage" )
set( LD_TEST_FLAGS "-lgcov -coverage" )

set( configDirectory \"${CMAKE_INSTALL_PREFIX}/share/tnl-${tnlVersion}/\")
set( sourceDirectory \"${PROJECT_SOURCE_DIR}/\" )
+28 −26
Original line number Diff line number Diff line
@@ -30,21 +30,23 @@ class tnlLogger
   tnlLogger( int _width,
              ostream& _stream );

   void WriteHeader( const tnlString& title );
   void writeHeader( const tnlString& title );

   void WriteSeparator();
   void writeSeparator();

   bool writeSystemInformation();

   void writeCurrentTime( const char* label );

   // TODO: add units
   template< typename T > void WriteParameter( const char* label,
                                               const char* parameterName,
   template< typename T >
   void writeParameter( const tnlString& label,
                        const tnlString& parameterName,
                        const tnlParameterContainer& parameters,
                        int parameterLevel = 0 );

   template< typename T > void WriteParameter( const char* label,
   template< typename T >
   void writeParameter( const tnlString& label,
                        const T& value,
                        int parameterLevel = 0 );

@@ -58,16 +60,16 @@ class tnlLogger
#include <implementation/core/tnlLogger_impl.h>

#ifdef TEMPLATE_EXPLICIT_INSTANTIATION
extern template void tnlLogger :: WriteParameter< char* >( const char*,
                                                           const char*,
extern template void tnlLogger::writeParameter< char* >( const tnlString&,
                                                         const tnlString&,
                                                         const tnlParameterContainer&,
                                                         int );
extern template void tnlLogger :: WriteParameter< double >( const char*,
                                                            const char*,
extern template void tnlLogger::writeParameter< double >( const tnlString&,
                                                          const tnlString&,
                                                          const tnlParameterContainer&,
                                                          int );
extern template void tnlLogger :: WriteParameter< int >( const char*,
                                                         const char*,
extern template void tnlLogger::writeParameter< int >( const tnlString&,
                                                       const tnlString&,
                                                       const tnlParameterContainer&,
                                                       int );

@@ -75,10 +77,10 @@ extern template void tnlLogger :: WriteParameter< int >( const char*,
//extern template void tnlLogger :: WriteParameter< char* >( const char*,
//                                                           const char*&,
//                                                           int );
extern template void tnlLogger :: WriteParameter< double >( const char*,
extern template void tnlLogger::writeParameter< double >( const tnlString&,
                                                          const double&,
                                                          int );
extern template void tnlLogger :: WriteParameter< int >( const char*,
extern template void tnlLogger::writeParameter< int >( const tnlString&,
                                                       const int&,
                                                       int );
#endif
+35 −28
Original line number Diff line number Diff line
@@ -23,7 +23,14 @@
#include <core/tnlLogger.h>
#include <tnlConfig.h>

void tnlLogger :: WriteHeader( const tnlString& title )
tnlLogger :: tnlLogger( int _width,
                        ostream& _stream )
: width( _width ),
  stream( _stream )
{
}

void tnlLogger :: writeHeader( const tnlString& title )
{
   int fill = stream. fill(); 
   int titleLength = title. getLength();
@@ -36,7 +43,7 @@ void tnlLogger :: WriteHeader( const tnlString& title )
   stream. fill( fill );
}

void tnlLogger :: WriteSeparator()
void tnlLogger :: writeSeparator()
{
   int fill = stream. fill(); 
   stream << "+" << setfill( '-' ) << setw( width ) << "+" << endl;
@@ -49,8 +56,8 @@ bool tnlLogger :: writeSystemInformation()
   struct utsname uts;
   gethostname( host_name, 255 );
   uname( &uts );
   WriteParameter< char* >( "Host name:", host_name );
   WriteParameter< char* >( "Architecture:", uts. machine );
   writeParameter< char* >( "Host name:", host_name );
   writeParameter< char* >( "Architecture:", uts. machine );
   fstream file;
   file. open( "/proc/cpuinfo", ios :: in );
   if( file )
@@ -69,7 +76,7 @@ bool tnlLogger :: writeSystemInformation()
            i = strlen( "processor" );
            while( line[ i ] != ':' && line[ i ] ) i ++;
            cpu_id = &line[ i + 1 ];
            WriteParameter< char * >( "CPU Id.:", cpu_id );
            writeParameter< char * >( "CPU Id.:", cpu_id );
            continue;
         }
         if( strncmp( line, "model name", strlen( "model name" ) ) == 0 )
@@ -77,7 +84,7 @@ bool tnlLogger :: writeSystemInformation()
            i = strlen( "model name" );
            while( line[ i ] != ':' && line[ i ] ) i ++;
            cpu_model_name = &line[ i + 1 ];
            WriteParameter< char * >( "Model name:", cpu_model_name );
            writeParameter< char * >( "Model name:", cpu_model_name );
            continue;
         }
         if( strncmp( line, "cpu MHz", strlen( "cpu MHz" ) ) == 0 )
@@ -85,7 +92,7 @@ bool tnlLogger :: writeSystemInformation()
            i = strlen( "cpu MHz" );
            while( line[ i ] != ':' && line[ i ] ) i ++;
            cpu_mhz = &line[ i + 1 ];
            WriteParameter< char * >( "CPU MHz:", cpu_mhz );
            writeParameter< char * >( "CPU MHz:", cpu_mhz );
            continue;
         }
         if( strncmp( line, "cache size", strlen( "cache size" ) ) == 0 )
@@ -93,7 +100,7 @@ bool tnlLogger :: writeSystemInformation()
            i = strlen( "cache size" );
            while( line[ i ] != ':' && line[ i ] ) i ++;
            cpu_cache = &line[ i + 1 ];
            WriteParameter< char * >( "CPU cache:", cpu_cache );
            writeParameter< char * >( "CPU cache:", cpu_cache );
            continue;
         }
      }
@@ -104,9 +111,9 @@ bool tnlLogger :: writeSystemInformation()
      return false;
   }
   file. close();
   WriteParameter< char* >( "System:", uts. sysname );
   WriteParameter< char* >( "Release:", uts. release );
   WriteParameter< char* >( "TNL Compiler:", ( char* ) TNL_CPP_COMPILER_NAME );
   writeParameter< char* >( "System:", uts. sysname );
   writeParameter< char* >( "Release:", uts. release );
   writeParameter< char* >( "TNL Compiler:", ( char* ) TNL_CPP_COMPILER_NAME );
   return true;
}

@@ -117,20 +124,20 @@ void tnlLogger :: writeCurrentTime( const char* label )
   tm *tm_ptr = localtime( &timeval );
   char buf[ 256 ];
   strftime( buf, 256, "%a %b %d %H:%M:%S\0", tm_ptr );
   WriteParameter< char* >( label, buf );
   writeParameter< char* >( label, buf );
}

#ifdef TEMPLATE_EXPLICIT_INSTANTIATION
template void tnlLogger :: WriteParameter< char* >( const char*,
                                                    const char*,
template void tnlLogger::writeParameter< char* >( const tnlString&,
                                                  const tnlString&,
                                                  const tnlParameterContainer&,
                                                  int );
template void tnlLogger :: WriteParameter< double >( const char*,
                                                     const char*,
template void tnlLogger::writeParameter< double >( const tnlString&,
                                                   const tnlString&,
                                                   const tnlParameterContainer&,
                                                   int );
template void tnlLogger :: WriteParameter< int >( const char*,
                                                  const char*,
template void tnlLogger::writeParameter< int >( const tnlString&,
                                                const tnlString&,
                                                const tnlParameterContainer&,
                                                int );

@@ -138,10 +145,10 @@ template void tnlLogger :: WriteParameter< int >( const char*,
//template void tnlLogger :: WriteParameter< char* >( const char*,
//                                                    const char*&,
//                                                    int );
template void tnlLogger :: WriteParameter< double >( const char*,
template void tnlLogger::writeParameter< double >( const tnlString&,
                                                   const double&,
                                                   int );
template void tnlLogger :: WriteParameter< int >( const char*,
template void tnlLogger::writeParameter< int >( const tnlString&,
                                                const int&,
                                                int );

+14 −16
Original line number Diff line number Diff line
@@ -18,16 +18,11 @@
#ifndef TNLLOGGER_IMPL_H_
#define TNLLOGGER_IMPL_H_

tnlLogger :: tnlLogger( int _width,
                       ostream& _stream )
: width( _width ),
  stream( _stream )
{
}
#include <sstream>

template< typename T >
void tnlLogger :: WriteParameter( const char* label,
                                  const char* parameterName,
void tnlLogger::writeParameter( const tnlString& label,
                                const tnlString& parameterName,
                                const tnlParameterContainer& parameters,
                                int parameterLevel )
{
@@ -35,13 +30,15 @@ void tnlLogger :: WriteParameter( const char* label,
   int i;
   for( i = 0; i < parameterLevel; i ++ )
      stream << " ";
   std::stringstream str;
   str << parameters.GetParameter< T >( parameterName );
   stream  << label
           << setw( width - strlen( label ) - 3 - parameterLevel )
           << parameters. GetParameter< T >( parameterName ) << " |" << endl;
           << setw( width - label.getLength() - parameterLevel - 3 )
           << str.str() << " |" << endl;
}

template< typename T >
void tnlLogger :: WriteParameter( const char* label,
void tnlLogger :: writeParameter( const tnlString& label,
                                  const T& value,
                                  int parameterLevel )
{
@@ -49,10 +46,11 @@ void tnlLogger :: WriteParameter( const char* label,
   int i;
   for( i = 0; i < parameterLevel; i ++ )
      stream << " ";
   std::stringstream str;
   str << value;
   stream  << label
           << setw( width - strlen( label ) - 3 - parameterLevel )
           << value << " |" << endl;
           << setw( width - label.getLength() - parameterLevel - 3 )
           << str.str() << " |" << endl;
};


#endif /* TNLLOGGER_IMPL_H_ */
Loading