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

Added tnlSolverTest.

TNL can be compiled without CXX11 support.
parent 464aa148
Loading
Loading
Loading
Loading
+25 −24
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ set( tnlVersion "0.1" )
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

include( OptimizeForArchitecture )
include( UseCodeCoverage )

####
# Settings for debug/release version
@@ -219,30 +220,30 @@ else( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" )
  endif(CPPUNIT_LIBRARY)
endif( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" )

if( BUILD_MPI )
   FIND_PATH( PETSC_INCLUDE_DIR petsc.h
     /usr/include/petsc
     ${PETSC_DIR}/${PETSC_ARCH}/include
     ${PETSC_DIR}/include
     DOC "PETSC headers."
   )
   if( ${PETSC_INCLUDE_DIR} STREQUAL "PETSC_INCLUDE_DIR-NOTFOUND" )
      message( "PETSC not found." ) 
   else()
      message( "PETSC headers found -- ${PETSC_INCLUDE_DIR}" )
      FIND_LIBRARY(PETSC_LIBRARY petsc
                  ${PETSC_INCLUDE_DIR}/../lib
                  /usr/local/lib
                  /usr/lib)
      if( PETSC_LIBRARY )
         #string( REPLACE ";" " " MPI_LIBRARIES "${MPI_CXX_LIBRARIES}" )
         #set( PETSC_LIBRARY "${MPI_LIBRARIES} ${PETSC_LIBRARY}")
         message( "PETSC library found -- ${PETSC_LIBRARY}")
         list( GET MPI_CXX_INCLUDE_PATH 0 MPI_CXX_PATH )
         set(PETSC_CXX_FLAGS "-DHAVE_PETSC -I${PETSC_INCLUDE_DIR} -DHAVE_MPI -I${MPI_CXX_PATH}")                     
      endif()
   endif()
endif()
#if( BUILD_MPI )
#   FIND_PATH( PETSC_INCLUDE_DIR petsc.h
#     /usr/include/petsc
#     ${PETSC_DIR}/${PETSC_ARCH}/include
#     ${PETSC_DIR}/include
#     DOC "PETSC headers."
#   )
#   if( ${PETSC_INCLUDE_DIR} STREQUAL "PETSC_INCLUDE_DIR-NOTFOUND" )
#      message( "PETSC not found." ) 
#   else()
#      message( "PETSC headers found -- ${PETSC_INCLUDE_DIR}" )
#      FIND_LIBRARY(PETSC_LIBRARY petsc
#                  ${PETSC_INCLUDE_DIR}/../lib
#                  /usr/local/lib
#                  /usr/lib)
#      if( PETSC_LIBRARY )
#         #string( REPLACE ";" " " MPI_LIBRARIES "${MPI_CXX_LIBRARIES}" )
#         #set( PETSC_LIBRARY "${MPI_LIBRARIES} ${PETSC_LIBRARY}")
#         message( "PETSC library found -- ${PETSC_LIBRARY}")
#         list( GET MPI_CXX_INCLUDE_PATH 0 MPI_CXX_PATH )
#         set(PETSC_CXX_FLAGS "-DHAVE_PETSC -I${PETSC_INCLUDE_DIR} -DHAVE_MPI -I${MPI_CXX_PATH}")                     
#      endif()
#   endif()
#endif()


ENABLE_TESTING()
+31 −0
Original line number Diff line number Diff line
#http://www.cmake.org/pipermail/cmake/2010-March/036063.html


OPTION( ENABLE_CODECOVERAGE "Enable code coverage testing support" )

if ( ENABLE_CODECOVERAGE )

    if ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
        message( WARNING "Code coverage results with an optimised (non-Debug) build may be misleading" )
    endif ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )

    if ( NOT DEFINED CODECOV_OUTPUTFILE )
        set( CODECOV_OUTPUTFILE cmake_coverage.output )
    endif ( NOT DEFINED CODECOV_OUTPUTFILE )

    if ( NOT DEFINED CODECOV_HTMLOUTPUTDIR )
        set( CODECOV_HTMLOUTPUTDIR coverage_results )
    endif ( NOT DEFINED CODECOV_HTMLOUTPUTDIR )

    if ( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCXX )
        find_program( CODECOV_GCOV gcov )
        find_program( CODECOV_LCOV lcov )
        find_program( CODECOV_GENHTML genhtml )
        add_definitions( -fprofile-arcs -ftest-coverage )
        link_libraries( gcov )
        set( CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} --coverage )
        add_custom_target( coverage_init ALL ${CODECOV_LCOV} --base-directory .  --directory ${CMAKE_BINARY_DIR} --output-file ${CODECOV_OUTPUTFILE} --capture --initial )
        add_custom_target( coverage ${CODECOV_LCOV} --base-directory .  --directory ${CMAKE_BINARY_DIR} --output-file ${CODECOV_OUTPUTFILE} --capture COMMAND genhtml -o ${CODECOV_HTMLOUTPUTDIR} ${CODECOV_OUTPUTFILE} )
    endif ( CMAKE_COMPILER_IS_GNUCXX )

endif (ENABLE_CODECOVERAGE )
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include <matrix/tnlCSRMatrix.h>
#include <solvers/preconditioners/tnlDummyPreconditioner.h>
#include <solvers/tnlSolverMonitor.h>
#include <core/tnlLogger.h>
#include <core/tnlVector.h>
#include <core/tnlSharedVector.h>
@@ -57,6 +58,8 @@ class simpleProblemSolver
                        DofVectorType& _u,
                        DofVectorType& _fu );

   tnlSolverMonitor< RealType, IndexType >* getSolverMonitor();

   protected:

   DofVectorType dofVector;
+8 −0
Original line number Diff line number Diff line
@@ -173,4 +173,12 @@ void simpleProblemSolver< Mesh> :: GetExplicitRHS( const RealType& time,
#endif
}

template< typename Mesh >
tnlSolverMonitor< typename simpleProblemSolver< Mesh > :: RealType,
                  typename simpleProblemSolver< Mesh > :: IndexType >*
   simpleProblemSolver< Mesh > ::  getSolverMonitor()
{
   return 0;
}

#endif /* SIMPLEPROBLEM_IMPL_H_ */
+4 −1
Original line number Diff line number Diff line
@@ -2,14 +2,17 @@ ADD_SUBDIRECTORY( linear )
ADD_SUBDIRECTORY( pde )
ADD_SUBDIRECTORY( ode )

SET( headers tnlIterativeSolverMonitor_impl.h
SET( headers tnlIterativeSolver_impl.h
             tnlIterativeSolverMonitor_impl.h
             tnlSolver_impl.h
             tnlSolverStarter_impl.h
             tnlSolverInitiator_impl.h )

SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/solvers ) 
set( tnl_implementation_solvers_SOURCES
     ${tnl_implementation_solvers_linear_SOURCES}
     ${tnl_implementation_solvers_ode_SOURCES}
     ${CURRENT_DIR}/tnlIterativeSolver_impl.cpp
     PARENT_SCOPE )

INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/solvers )
Loading