Skip to content

Commit

Permalink
add ext tests (#27)
Browse files Browse the repository at this point in the history
* add cmake option for ext testing files

* update build workflow to not run all the time
  • Loading branch information
PaulSt authored Jan 30, 2022
1 parent a894310 commit 4e9e43f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: build

on:
push:
branches: [main]
pull_request:
branches: ['main**']
release:
types: [created]

Expand Down
18 changes: 11 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
project(ngstrefftz)

cmake_minimum_required(VERSION 3.1)

include_directories(../external_dependencies/ngstents/src)
option(EXT_TTEST "Add helpfull functions for testing" OFF)
option(USE_LAPACK "build ngstrefftz with LAPACK" ON)


find_package(NGSolve CONFIG REQUIRED
HINTS $ENV{NETGENDIR}/.. /opt/netgen/ /Applications/Netgen.app/Contents/Resources/CMake C:/netgen
)

# check if CMAKE_INSTALL_PREFIX is set by user, if not install in NGSolve python dir
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${NGSOLVE_INSTALL_DIR}/${NGSOLVE_INSTALL_DIR_PYTHON} CACHE PATH "Install dir" FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)


if (NOT TARGET _pytents)
include_directories(../external_dependencies/ngstents/src)
add_ngsolve_python_module(_pytents
../external_dependencies/ngstents/src/python_tents.cpp
../external_dependencies/ngstents/src/tents.cpp
Expand All @@ -31,16 +32,19 @@ add_ngsolve_python_module(_trefftz
specialcoefficientfunction.cpp
twavetents.cpp
embtrefftz.cpp
)
if(EXT_TTEST)
add_compile_definitions(EXT_TTEST)
target_sources(_trefftz PRIVATE
monomialfespace.cpp
mesh1dtents.cpp
#monomialfespace.cpp for testing
#airy.cpp for testing, require boost
#airy.cpp #for testing, requires boost
)
endif()
target_link_libraries(_trefftz PRIVATE _pytents)

#add_compile_options(PRIVATE -Wall -Wextra -pedantic)
#add_compile_options(-g -O0)

option( USE_LAPACK "build ngsolve with LAPACK" ON)
if (USE_LAPACK) # currently needed for SVD in embTrefftz, TODO: switch to ngsolve interface..
find_package(BLAS)
find_package(LAPACK)
Expand Down
10 changes: 7 additions & 3 deletions src/python_trefftz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
#include "specialcoefficientfunction.hpp"
#include "twavetents.hpp"
#include "embtrefftz.hpp"
#include "mesh1dtents.hpp"
//#include "monomialfespace.hpp"

#ifdef EXT_TTEST
#include "mesh1dtents.hpp"
#include "monomialfespace.hpp"
//#include "airy.cpp"
#endif

PYBIND11_MODULE (_trefftz, m)
{
Expand All @@ -23,8 +25,10 @@ PYBIND11_MODULE (_trefftz, m)
ExportSpecialCoefficientFunction (m);
ExportTWaveTents (m);
ExportEmbTrefftz (m);
#ifdef EXT_TTEST
ExportMesh1dTents (m);
// ExportMonomialFESpace(m);
ExportMonomialFESpace (m);
// ExportStdMathFunction<GenericAiry>(m, "airy", "airy function");
// ExportStdMathFunction<GenericAiryP>(m, "airyp", "airyp function");
#endif
}

0 comments on commit 4e9e43f

Please # to comment.