Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ if(ENABLE_MINIMAL)
set(ENABLE_UTILS OFF)
set(ENABLE_TESTS OFF)
endif()

# Metaflag for pyEXP only

if(ENABLE_PYEXP_ONLY)
Expand All @@ -86,7 +86,7 @@ if(ENABLE_PYEXP_ONLY)
set(ENABLE_UTILS OFF)
set(ENABLE_TESTS OFF)
endif()

# Set mpirun launcher for CTest

set(EXP_MPI_LAUNCH "mpirun" CACHE STRING "Command to run an MPI application (for unit tests only)")
Expand Down Expand Up @@ -297,13 +297,13 @@ if(ENABLE_TESTS)
add_subdirectory(tests)
endif()

# try to find pybind11 and build wrapper python module
find_package(Python3 COMPONENTS Interpreter Development)
message(STATUS "python3 include dirs: ${Python3_INCLUDE_DIRS}")
if(Python3_FOUND)
set(HAVE_PYTHON3 TRUE)
else()
if(ENABLE_PYEXP)
if(ENABLE_PYEXP)
# try to find pybind11 and build wrapper python module
find_package(Python3 COMPONENTS Interpreter Development)
message(STATUS "python3 include dirs: ${Python3_INCLUDE_DIRS}")
if(Python3_FOUND)
set(HAVE_PYTHON3 TRUE)
else()
message(FATAL_ERROR "You asked for pyEXP but I cannot find a Python3 environment. Please make Python3 available or disable pyEXP. CMake will exit." )
endif()
endif()
Expand Down Expand Up @@ -404,4 +404,3 @@ set(CMAKE_CXX_FLAGS_UBSAN
# from the same source.
configure_file(${CMAKE_SOURCE_DIR}/config_cmake.h_in ${CMAKE_BINARY_DIR}/config_exp.h)
include_directories(${PROJECT_BINARY_DIR})

3 changes: 2 additions & 1 deletion exputil/DiskDensityFunc.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <stdexcept>
#include "DiskDensityFunc.H"

#ifdef HAVE_PYTHON3
Expand Down Expand Up @@ -38,7 +39,7 @@ DiskDensityFunc::DiskDensityFunc(const std::string& modulename,
const std::string& funcname)
: funcname(funcname)
{
throw std::runtime_error("DiskDensityFunc: you environoment does not have Python3 support. Use a built-in density target or install Python3 and recompile");
throw std::runtime_error("DiskDensityFunc: your environoment does not have Python3 support. Use a built-in density target or install Python3 and recompile");
}

DiskDensityFunc::~DiskDensityFunc()
Expand Down
8 changes: 6 additions & 2 deletions include/DiskDensityFunc.H
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
#define _DiskDensityFunc_H_

#include <functional>
#include <string>

#include "config_exp.h"

#ifdef HAVE_PYTHON3
#include <pybind11/pybind11.h>
#include <pybind11/embed.h>

Expand All @@ -26,12 +28,14 @@
a = 1.0 # Scale radius
h = 0.2 # Scale height
f = math.exp(-0.5*math.fabs(z)/h) # Prevent overflows
sech = 2.0*f / (1.0 + f*f) #
sech = 2.0*f / (1.0 + f*f) #
return math.exp(-R/a)*sech*sech/(8*math.pi*h*a*a)

--------------------------cut here--------------------------------

*/
#endif

class __attribute__((visibility("default")))
DiskDensityFunc
{
Expand Down
Loading