Commit 65132ec8 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

resolved some extensions errors and adapted test CMakeLists

parent 9b8b6cf1
Pipeline #1742 failed with stages
in 26 minutes and 30 seconds
......@@ -47,7 +47,7 @@ cmake_dependent_option(ENABLE_ZOLTAN
"ENABLE_PARALLEL_DOMAIN" false)
cmake_dependent_option(ENABLE_PARALLEL_SOLVERS
"Add some problem dependent solver, e.g. Feti, Navier-Stokes and Cahn-Hilliard" true
"Add some problem dependent solvers, e.g. Feti, Navier-Stokes and Cahn-Hilliard" true
"ENABLE_PARALLEL_DOMAIN" false)
cmake_dependent_option(ENABLE_BDDCML
......@@ -55,13 +55,6 @@ cmake_dependent_option(ENABLE_BDDCML
"ENABLE_PARALLEL_DOMAIN" false)
# }
# additional options for Extensions
# {
cmake_dependent_option(ENABLE_BASE_PROBLEMS
"Use base_problems" true
"ENABLE_EXTENSIONS" false)
# }
# enable/disable some more features
option(ENABLE_COMPRESSION "Use output compression for vtu and arh files" true)
mark_as_advanced(ENABLE_COMPRESSION)
......
......@@ -40,8 +40,8 @@ find_package_handle_standard_args(BDDCML
REQUIRED_VARS BDDCML_LIBRARY BDDCML_HEADER
)
if(BDDCML_FOUND AND MPI_FOUND AND NOT TARGET BDDCML::BDDCML)
add_library(BDDCML::BDDCML INTERFACE IMPORTED)
if(BDDCML_FOUND AND NOT TARGET BDDCML::BDDCML)
add_library(BDDCML::BDDCML INTERFACE IMPORTED GLOBAL)
get_filename_component(BDDCML_INCLUDE_DIR ${BDDCML_HEADER} PATH)
......
......@@ -52,7 +52,7 @@ find_package_handle_standard_args(HYPRE
)
if(HYPRE_FOUND AND MPI_FOUND AND NOT TARGET HYPRE::HYPRE)
add_library(HYPRE::HYPRE INTERFACE IMPORTED)
add_library(HYPRE::HYPRE INTERFACE IMPORTED GLOBAL)
get_filename_component(HYPRE_LIB_DIR ${HYPRE_LIBRARY} PATH)
file(GLOB HYPRE_LIBS ${HYPRE_LIB_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}HYPRE*${CMAKE_SHARED_LIBRARY_SUFFIX})
......
......@@ -33,27 +33,27 @@ find_path(PETSC_PKG_CONFIG "PETSc.pc"
if (PETSC_PKG_CONFIG)
set(ENV{PKG_CONFIG_PATH} "${PETSC_PKG_CONFIG_PATH}:$ENV{PKG_CONFIG_PATH}")
if (PETSc_FIND_VERSION)
pkg_check_modules(PETSC QUIET PETSc>=${PETSc_FIND_VERSION} IMPORTED_TARGET)
else ()
pkg_check_modules(PETSC QUIET PETSc IMPORTED_TARGET)
endif ()
if (PETSC_STATIC_FOUND)
set(PETSc_VERSION ${PETSC_STATIC_VERSION})
elseif (PETSC_FOUND)
set(PETSc_VERSION ${PETSC_VERSION})
endif ()
if ((PETSC_STATIC_FOUND OR PETSC_FOUND) AND NOT TARGET PETSc::PETSc)
add_library(PETSc::PETSc INTERFACE IMPORTED)
target_link_libraries(PETSc::PETSc INTERFACE PkgConfig::PETSC)
endif()
endif (PETSC_PKG_CONFIG)
if (PETSc_FIND_VERSION)
pkg_check_modules(PETSC QUIET PETSc>=${PETSc_FIND_VERSION} IMPORTED_TARGET)
else ()
pkg_check_modules(PETSC QUIET PETSc IMPORTED_TARGET)
endif ()
if (PETSC_STATIC_FOUND)
set(PETSc_VERSION ${PETSC_STATIC_VERSION})
elseif (PETSC_FOUND)
set(PETSc_VERSION ${PETSC_VERSION})
endif ()
if ((PETSC_STATIC_FOUND OR PETSC_FOUND) AND NOT TARGET PETSc::PETSc)
add_library(PETSc::PETSc INTERFACE IMPORTED GLOBAL)
target_link_libraries(PETSc::PETSc INTERFACE PkgConfig::PETSC)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PETSc
REQUIRED_VARS PETSC_PKG_CONFIG
REQUIRED_VARS PETSc_VERSION
VERSION_VAR PETSc_VERSION
)
......@@ -20,15 +20,10 @@ macro(target_enable_cxx14 RESULT_VAR _TARGET_ _SCOPE_)
if (COMPILER_SUPPORTS_CXX14_FLAG AND CXX14_COMPILES_WITH_CXX14_FLAG)
target_compile_options(${_TARGET_} ${_SCOPE_} "-std=c++14")
set(${RESULT_VAR} true CACHE BOOL "Enable C++14 compiler features" FORCE)
set(${RESULT_VAR} TRUE)
else ()
check_cxx_source_compiles("${CXX14_CODE}" CXX14_COMPILES)
if (CXX14_COMPILES)
set(${RESULT_VAR} true CACHE BOOL "Enable C++14 compiler features" FORCE)
else ()
set(${RESULT_VAR} false CACHE BOOL "Enable C++14 compiler features" FORCE)
endif ()
set(${RESULT_VAR} ${CXX14_COMPILES})
endif ()
endmacro(target_enable_cxx14)
......@@ -52,14 +47,23 @@ macro(target_enable_cxx11 RESULT_VAR _TARGET_ _SCOPE_)
if (COMPILER_SUPPORTS_CXX11_FLAG AND CXX11_COMPILES_WITH_CXX11_FLAG)
target_compile_options(${_TARGET_} ${_SCOPE_} "-std=c++11")
set(${RESULT_VAR} true CACHE BOOL "Enable C++11 compiler features" FORCE)
set(${RESULT_VAR} TRUE)
else ()
check_cxx_source_compiles("${CXX11_CODE}" CXX11_COMPILES)
if (CXX11_COMPILES)
set(${RESULT_VAR} true CACHE BOOL "Enable C++11 compiler features" FORCE)
else ()
set(${RESULT_VAR} false CACHE BOOL "Enable C++11 compiler features" FORCE)
endif ()
set(${RESULT_VAR} ${CXX11_COMPILES})
endif ()
endmacro(target_enable_cxx11)
macro(target_set_cxx_standard _TARGET_ _SCOPE_)
target_enable_cxx14(SUPPORTS_CXX14 ${_TARGET_} ${_SCOPE_})
if (SUPPORTS_CXX14)
target_compile_definitions(${_TARGET_} ${_SCOPE_} "AMDIS_HAS_CXX14=1")
else ()
target_enable_cxx11(SUPPORTS_CXX11 ${_TARGET_} ${_SCOPE_})
endif ()
if (NOT SUPPORTS_CXX11 AND NOT SUPPORTS_CXX14)
message(FATAL_ERROR "AMDiS needs at least c++11, but the current compiler does not support this standard!")
endif ()
target_compile_definitions(${_TARGET_} ${_SCOPE_} "AMDIS_HAS_CXX11=1")
endmacro(target_set_cxx_standard)
add_subdirectory(mtl4)
add_subdirectory(muparser_v134)
if (ENABLE_EXTENSIONS)
add_subdirectory(nanoflann)
add_subdirectory(pugixml)
endif (ENABLE_EXTENSIONS)
\ No newline at end of file
add_subdirectory(nanoflann)
add_subdirectory(pugixml)
\ No newline at end of file
......@@ -6,7 +6,7 @@ include(CMakePackageConfigHelpers)
include(target_enable_cxx11)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel" FORCE)
endif(NOT CMAKE_BUILD_TYPE)
......@@ -14,8 +14,8 @@ endif(NOT CMAKE_BUILD_TYPE)
set(MUPARSER_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(MUPARSER_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
file(GLOB MUPARSER_HEADERS "${MUPARSER_SOURCE_DIR}/*.cpp")
file(GLOB MUPARSER_SOURCES "${MUPARSER_INCLUDE_DIR}/*.h")
file(GLOB MUPARSER_SOURCES "${MUPARSER_SOURCE_DIR}/*.cpp")
file(GLOB MUPARSER_HEADERS "${MUPARSER_INCLUDE_DIR}/*.h")
add_library(MuParser
${MUPARSER_HEADERS}
${MUPARSER_SOURCES}
......@@ -28,10 +28,8 @@ target_include_directories(MuParser
$<BUILD_INTERFACE:${MUPARSER_INCLUDE_DIR}>
)
#set_property(TARGET muparser PROPERTY POSITION_INDEPENDENT_CODE ON)
target_enable_cxx11(MUPARSER_ENABLE_CXX11 MuParser PRIVATE)
target_compile_definitions(MuParser PRIVATE AMDIS_HAS_CXX11=1)
#set_property(TARGET MuParser PROPERTY POSITION_INDEPENDENT_CODE ON)
target_set_cxx_standard(MuParser PRIVATE)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/MuParserConfig.cmake.in
${PROJECT_BINARY_DIR}/MuParserConfig.cmake
......
......@@ -43,7 +43,9 @@ namespace mu
//---------------------------------------------------------------------------
ParserErrorMsg::~ParserErrorMsg()
{}
{
std::cout << "Destructor" << std::endl;
}
//---------------------------------------------------------------------------
/** \brief Assignement operator is deactivated.
......
......@@ -251,18 +251,7 @@ set_target_properties(AMDiS${POSTFIX}
# set compiler standard
# ---------------------
target_enable_cxx14(SUPPORTS_CXX14 AMDiS${POSTFIX} PUBLIC)
if (SUPPORTS_CXX14)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "AMDIS_HAS_CXX14=1")
else ()
target_enable_cxx11(SUPPORTS_CXX11 AMDiS${POSTFIX} PUBLIC)
endif ()
if (NOT SUPPORTS_CXX11 AND NOT SUPPORTS_CXX14)
message(FATAL_ERROR "AMDiS needs at least c++11, but the current compiler does not support this standard!")
endif ()
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "AMDIS_HAS_CXX11=1")
target_set_cxx_standard(AMDiS${POSTFIX} PUBLIC)
# configure external packages
# ---------------------------
......@@ -293,53 +282,69 @@ target_link_libraries(AMDiS${POSTFIX} MuParser::MuParser)
if (ENABLE_PNG)
find_package(PNG REQUIRED)
target_link_libraries(AMDiS${POSTFIX} PNG::PNG)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "HAVE_PNG=1")
if (PNG_FOUND)
target_link_libraries(AMDiS${POSTFIX} PNG::PNG)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "HAVE_PNG=1")
endif (PNG_FOUND)
endif (ENABLE_PNG)
if (ENABLE_MPI OR ENABLE_PARALLEL_DOMAIN)
find_package(MPI REQUIRED MPICXX)
target_link_libraries(AMDiS${POSTFIX} MPI::MPI_CXX)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "HAVE_MPI=1")
if (MPI_FOUND)
target_link_libraries(AMDiS${POSTFIX} MPI::MPI_CXX)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "HAVE_MPI=1")
endif (MPI_FOUND)
endif ()
if (ENABLE_COMPRESSION)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "AMDIS_HAS_COMPRESSION=1")
endif (ENABLE_COMPRESSION)
if (ENABLE_UMFPACK)
find_package(UMFPACK 4.5 REQUIRED)
target_link_libraries(AMDiS${POSTFIX} UMFPACK::UMFPACK)
endif (ENABLE_UMFPACK)
if (ENABLE_HYPRE)
find_package(HYPRE REQUIRED)
target_link_libraries(AMDiS${POSTFIX} HYPRE::HYPRE)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "MTL_HAS_HYPRE=1;HAVE_HYPRE=1")
endif (ENABLE_HYPRE)
if (ENABLE_SEQ_PETSC OR ENABLE_PARALLEL_DOMAIN)
find_package(PETSc 3.3 REQUIRED)
target_link_libraries(AMDiS${POSTFIX} PETSc::PETSc)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "PETSC_VERSION=${PETSc_VERSION}")
if (PETSc_FOUND)
target_link_libraries(AMDiS${POSTFIX} PETSc::PETSc)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "PETSC_VERSION=${PETSc_VERSION}")
endif (PETSc_FOUND)
endif ()
if (ENABLE_PARALLEL_DOMAIN)
find_package(ParMETIS 4.0 REQUIRED)
target_link_libraries(AMDiS${POSTFIX} ParMETIS::ParMETIS)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "HAVE_PARALLEL_DOMAIN_AMDIS=1;HAVE_PARALLEL_PETSC=1")
if (ParMETIS_FOUND)
target_link_libraries(AMDiS${POSTFIX} ParMETIS::ParMETIS)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "HAVE_PARALLEL_DOMAIN_AMDIS=1;HAVE_PARALLEL_PETSC=1")
endif (ParMETIS_FOUND)
endif (ENABLE_PARALLEL_DOMAIN)
if (ENABLE_UMFPACK)
find_package(UMFPACK 4.5 REQUIRED)
if (UMFPACK_FOUND)
target_link_libraries(AMDiS${POSTFIX} UMFPACK::UMFPACK)
endif (UMFPACK_FOUND)
endif (ENABLE_UMFPACK)
if (ENABLE_HYPRE)
find_package(HYPRE REQUIRED)
if (HYPRE_FOUND)
target_link_libraries(AMDiS${POSTFIX} HYPRE::HYPRE)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "MTL_HAS_HYPRE=1;HAVE_HYPRE=1")
endif (HYPRE_FOUND)
endif (ENABLE_HYPRE)
if (ENABLE_BDDCML)
find_package(BDDCML REQUIRED)
target_link_libraries(AMDiS${POSTFIX} BDDCML::BDDCML)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "HAVE_BDDCML=1")
if (BDDCML_FOUND)
target_link_libraries(AMDiS${POSTFIX} BDDCML::BDDCML)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "HAVE_BDDCML=1")
endif (BDDCML_FOUND)
endif (ENABLE_BDDCML)
if (ENABLE_ZOLTAN)
find_package(ZOLTAN REQUIRED)
target_link_libraries(AMDiS${POSTFIX} ZOLTAN::ZOLTAN)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "HAVE_ZOLTAN=1")
if (ZOLTAN_FOUND)
target_link_libraries(AMDiS${POSTFIX} ZOLTAN::ZOLTAN)
target_compile_definitions(AMDiS${POSTFIX} PUBLIC "HAVE_ZOLTAN=1")
endif (ZOLTAN_FOUND)
endif (ENABLE_ZOLTAN)
if (ENABLE_EXTENSIONS)
......
......@@ -110,9 +110,10 @@ namespace AMDiS
}
#else
using MatSolverPackage_t = MatSolverPackage;
inline PetscErrorCode pc_factor_set_mat_solver_package(PC pc, MatSolverPackage stype)
template <class MSP>
inline PetscErrorCode pc_factor_set_mat_solver_package(PC pc, MSP&& stype)
{
return PCFactorSetMatSolverPackage(pc, stype);
return PCFactorSetMatSolverPackage(pc, std::forward<MSP>(stype));
}
#endif
......
unset(ENV{LIBRARY_PATH})
project("AMDiS test suite")
cmake_minimum_required(VERSION 2.8.10)
cmake_minimum_required(VERSION 3.5)
find_package(AMDIS REQUIRED ${COMPONENT})
include_directories(${AMDIS_INCLUDE_DIRS})
add_definitions(${AMDIS_COMPILEFLAGS})
find_package(AMDiS REQUIRED ${COMPONENT})
enable_testing()
......@@ -14,9 +12,5 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
# Add the unit_test_framework for some tests
find_package(Boost REQUIRED unit_test_framework)
if (AMDIS_HAS_PARALLEL_DOMAIN)
# add_subdirectory(mpi)
else ()
add_subdirectory(seq)
endif (AMDIS_HAS_PARALLEL_DOMAIN)
add_subdirectory(seq)
add_subdirectory(other)
......@@ -5,7 +5,7 @@ foreach(s ${sources})
get_filename_component(swe ${s} NAME_WE)
add_executable(${swe}_mpi ${s})
target_link_libraries(${swe}_mpi ${AMDIS_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(${swe}_mpi AMDiS::AMDiS-p Boost::unit_test_framework)
list(APPEND TEST_DEPENDENCIES ${swe}_mpi)
endforeach(s)
......
set(TEST_DEPENDENCIES "")
if (AMDIS_HAS_PARALLEL_DOMAIN)
if (ENABLE_PARALLEL_DOMAIN)
list(APPEND RUN_PARALLEL "mpirun" "-np" "2")
else ()
set(RUN_PARALLEL "")
......@@ -8,8 +8,8 @@ endif ()
add_executable(test_expr src/Test_Expressions.cc)
target_link_libraries(test_expr ${AMDIS_LIBRARIES})
if (NOT AMDIS_HAS_PARALLEL_DOMAIN)
target_link_libraries(test_expr AMDiS)
if (NOT ENABLE_PARALLEL_DOMAIN)
add_test(NAME RunTestExpr_1d WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND test_expr init/test_expr.dat.1d)
endif ()
add_test(NAME RunTestExpr_2d WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${RUN_PARALLEL} ${CMAKE_CURRENT_BINARY_DIR}/test_expr init/test_expr.dat.2d)
......@@ -18,8 +18,8 @@ list(APPEND TEST_DEPENDENCIES test_expr)
add_executable(test_basis src/Test_BasisFunction.cc)
target_link_libraries(test_basis ${AMDIS_LIBRARIES})
if (NOT AMDIS_HAS_PARALLEL_DOMAIN)
target_link_libraries(test_basis AMDiS)
if (NOT ENABLE_PARALLEL_DOMAIN)
add_test(NAME RunTestBasis_1d WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND test_basis init/test_basisFct.dat.1d)
endif ()
add_test(NAME RunTestBasis_2d WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${RUN_PARALLEL} ${CMAKE_CURRENT_BINARY_DIR}/test_basis init/test_basisFct.dat.2d)
......@@ -28,21 +28,21 @@ list(APPEND TEST_DEPENDENCIES test_basis)
add_executable(test_writer src/Test_Writer.cc)
target_link_libraries(test_writer ${AMDIS_LIBRARIES})
target_link_libraries(test_writer AMDiS)
list(APPEND TEST_DEPENDENCIES test_writer)
add_executable(test_arh3 src/Test_Arh3.cc)
target_link_libraries(test_arh3 ${AMDIS_LIBRARIES})
target_link_libraries(test_arh3 AMDiS)
list(APPEND TEST_DEPENDENCIES test_arh3)
add_executable(test_mat_vec src/Test_MatrixVectorOperations.cc)
target_link_libraries(test_mat_vec ${AMDIS_LIBRARIES})
target_link_libraries(test_mat_vec AMDiS)
list(APPEND TEST_DEPENDENCIES test_mat_vec)
add_executable(test_problemStat src/Test_ProblemStat.cc)
target_link_libraries(test_problemStat ${AMDIS_LIBRARIES})
if (NOT AMDIS_HAS_PARALLEL_DOMAIN)
target_link_libraries(test_problemStat AMDiS)
if (NOT ENABLE_PARALLEL_DOMAIN)
add_test(NAME RunTestProblemStat_1d WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND test_problemStat init/test_problemStat.dat.1d)
add_test(NAME RunTestProblemStat_2d WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND test_problemStat init/test_problemStat.dat.2d)
add_test(NAME RunTestProblemStat_3d WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND test_problemStat init/test_problemStat.dat.3d)
......@@ -51,31 +51,31 @@ list(APPEND TEST_DEPENDENCIES test_problemStat)
# parallel tests
if (AMDIS_HAS_PARALLEL_DOMAIN)
if (ENABLE_PARALLEL_DOMAIN)
add_executable(test_synch src/Test_Synch.cc)
target_link_libraries(test_synch ${AMDIS_LIBRARIES})
target_link_libraries(test_synch AMDiS)
add_test(NAME RunTestSynch_2d WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${RUN_PARALLEL} ${CMAKE_CURRENT_BINARY_DIR}/test_synch init/test_synch.dat.2d)
add_test(NAME RunTestSynch_3d WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${RUN_PARALLEL} ${CMAKE_CURRENT_BINARY_DIR}/test_synch init/test_synch.dat.3d)
list(APPEND TEST_DEPENDENCIES test_synch)
endif (AMDIS_HAS_PARALLEL_DOMAIN)
endif (ENABLE_PARALLEL_DOMAIN)
# tests if AMDiS-Extensions
if (AMDIS_NEED_EXTENSIONS AND NOT AMDIS_HAS_PARALLEL_DOMAIN)
if (ENABLE_EXTENSIONS AND NOT ENABLE_PARALLEL_DOMAIN)
add_executable(test_bg_mesh src/Test_BackgroundMesh2.cc)
target_link_libraries(test_bg_mesh ${AMDIS_LIBRARIES})
target_link_libraries(test_bg_mesh AMDiS)
add_test(NAME RunTestBgMesh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND test_bg_mesh init/test_bg_mesh.dat)
list(APPEND TEST_DEPENDENCIES test_bg_mesh)
add_executable(test_views src/Test_Views.cc)
target_link_libraries(test_views ${AMDIS_LIBRARIES})
target_link_libraries(test_views AMDiS)
add_test(NAME RunTestViews_2d WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND test_views init/test_views.dat.2d)
list(APPEND TEST_DEPENDENCIES test_views)
add_executable(test_vtk src/Test_Vtk.cc)
target_link_libraries(test_vtk ${AMDIS_LIBRARIES})
target_link_libraries(test_vtk AMDiS)
list(APPEND TEST_DEPENDENCIES test_vtk)
endif (AMDIS_NEED_EXTENSIONS AND NOT AMDIS_HAS_PARALLEL_DOMAIN)
endif (ENABLE_EXTENSIONS AND NOT ENABLE_PARALLEL_DOMAIN)
add_dependencies(check ${TEST_DEPENDENCIES})
......@@ -5,7 +5,7 @@
* Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
* Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
*
* Authors:
* Authors:
* Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
......@@ -15,7 +15,7 @@
* This file is part of AMDiS
*
* See also license.opensource.txt in the distribution.
*
*
******************************************************************************/
......@@ -26,8 +26,8 @@
#define AMDIS_TEST_BACKGROUND_MESH_H
#include "AMDiS.h"
#include "Views.h"
#include "BackgroundMesh.h"
#include "extensions/Views.h"
#include "extensions/search/BackgroundMesh.h"
#include "boost/date_time/posix_time/posix_time.hpp"
namespace amdis_tests
......@@ -37,7 +37,7 @@ namespace amdis_tests
using namespace AMDiS::extensions;
class Test_BackgroundMesh {
public:
public:
void init(const FiniteElemSpace *feSpace_,const FiniteElemSpace *feSpace2_) {
feSpace = feSpace_;
feSpace2 = feSpace2_;
......@@ -45,51 +45,51 @@ namespace amdis_tests
boxCreated = false;
boxFilled = false;
}
void test1()
{
ptime start_time;
time_duration td;
WorldVector<double> center; center.set(0.0);
WorldVector<double> dimension; dimension.set(1.0);
DOFVector<double> vec(feSpace, "vec");
std::vector<int> N(Global::getGeo(WORLD), 4);
Parameters::get("box->dimension", N);
// test 1: create and fill Box
start_time= microsec_clock::local_time();
box = Box::provideBackgroundMesh(feSpace);
td = microsec_clock::local_time()-start_time;
std::cout<<"create box ... "<<(td.total_milliseconds()/1000.0)<<" sec\n";
// start_time= microsec_clock::local_time();
// box->fillBox(feSpace);
// td = microsec_clock::local_time()-start_time;
// std::cout<<"fillBox ... "<<(td.total_milliseconds()/1000.0)<<" sec\n";
std::cout<<"nr of dofs = "<<vec.getUsedSize()<<"\n";
// test 2: test whether a point is recognised as inside
BOOST_CHECK( box->inBox(center) );
// test 3: test whether a point outside of the box is recognised as ouside
WorldVector<double> outside = 2.0*dimension;
BOOST_CHECK( !box->inBox(outside) );
WorldVector<double> first; first.set(-1.0);
BOOST_CHECK( box->inBox(first) );
WorldVector<double> last; last.set(1.0);
start_time= microsec_clock::local_time();
BOOST_CHECK( box->inBox(last) );
td = microsec_clock::local_time()-start_time;
std::cout<<"inBox + getBox ... "<<(td.total_milliseconds()/1000.0)<<" sec\n";
std::vector<DataType> nearestData;
int nData = 3;
Parameters::get("box->nr of neares data", nData);
start_time= microsec_clock::local_time();
......@@ -97,14 +97,14 @@ namespace amdis_tests
td = microsec_clock::local_time()-start_time;
std::cout<<"getNearestData ... "<<(td.total_milliseconds()/1000.0)<<" sec\n";
BOOST_CHECK( nearestData.size() == nData );
std::cout<<"nearestData = {\n";
for (int i = 0; i < nData; i++)
std::cout<<" ["<<nearestData[i].first<<"; "<<nearestData[i].second<<"], \n";
std::cout<<"\n}\n";
vec.interpol(new AMDiS::Norm2Sqr<WorldVector<double> >);
double exact1 = AMDiS::Norm2Sqr<WorldVector<double> >()(center);
double value0 = box->evalAtPoint(vec, center, 0);
double value1 = box->evalAtPoint(vec, center, 1);
......@@ -114,7 +114,7 @@ namespace amdis_tests
std::cout<< "|evalAtPoint(center,1) - "<<exact1<<"| = "<<abs(value1-exact1)<<"\n";
std::cout<< "|evalAtPoint(center,2) - "<<exact1<<"| = "<<abs(value2-exact1)<<"\n";
std::cout<< "|evalAtPoint(center,3) - "<<exact1<<"| = "<<abs(value3-exact1)<<"\n";
double exact2 = AMDiS::Norm2Sqr<WorldVector<double> >()(last);
value0 = box->evalAtPoint(vec, last, 0);
value1 = box->evalAtPoint(vec, last, 1);
......@@ -124,7 +124,7 @@ namespace amdis_tests
std::cout<< "|evalAtPoint(last,1) - "<<exact2<<"| = "<<abs(value1-exact2)<<"\n";
std::cout<< "|evalAtPoint(last,2) - "<<exact2<<"| = "<<abs(value2-exact2)<<"\n";
std::cout<< "|evalAtPoint(last,3) - "<<exact2<<"| = "<<abs(value3-exact2)<<"\n";
last.set(std::sqrt(2.0)/3.0);
double exact3 = AMDiS::Norm2Sqr<WorldVector<double> >()(last);
value0 = box->evalAtPoint(vec, last, 0);
......@@ -135,16 +135,16 @@ namespace amdis_tests
std::cout<< "|evalAtPoint(last,1) - "<<exact3<<"| = "<<abs(value1-exact3)<<"\n";
std::cout<< "|evalAtPoint(last,2) - "<<exact3<<"| = "<<abs(value2-exact3)<<"\n";
std::cout<< "|evalAtPoint(last,3) - "<<exact3<<"| = "<<abs(value3-exact3)<<"\n";
boxCreated = true;
}
//____________________________________________________________________________//
void test2()
{
BOOST_REQUIRE( boxCreated );
ptime start_time;
time_duration td;
......@@ -156,8 +156,8 @@ namespace amdis_tests
WorldVector<double> point;