Skip to content

Commit

Permalink
Adds baseline version of nicaea
Browse files Browse the repository at this point in the history
  • Loading branch information
EiffL committed Apr 6, 2018
1 parent df27806 commit 9a6112b
Show file tree
Hide file tree
Showing 147 changed files with 88,540 additions and 0 deletions.
Empty file added .gitignore
Empty file.
110 changes: 110 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
cmake_minimum_required(VERSION 2.6)
include(FindPkgConfig)

# Adding customized cmake module
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/")


project(nicaea)

cmake_policy(SET CMP0042 NEW)

#
# Loading dependencies
#
pkg_check_modules(PKGS REQUIRED fftw3 gsl)
include_directories(${PKGS_INCLUDE_DIRS})
link_directories(${PKGS_LIBRARY_DIRS})


#
# Compilation flags
#
set(CMAKE_C_FLAGS "-Wall -Wuninitialized -pedantic -O3 -fPIC -std=gnu9x")


#
# Building nicaea library
#
#
include_directories(Cosmo/include Coyote/include halomodel/include tools/include)
FILE(GLOB src_cosmo "${PROJECT_SOURCE_DIR}/Cosmo/src/*.c")
FILE(GLOB src_halo "${PROJECT_SOURCE_DIR}/halomodel/src/*.c")
FILE(GLOB src_coyote "${PROJECT_SOURCE_DIR}/Coyote/src/*.c")
FILE(GLOB src_tools "${PROJECT_SOURCE_DIR}/tools/src/*.c")
add_library(nicaea STATIC ${src_cosmo} ${src_halo} ${src_coyote} ${src_tools})
target_link_libraries(nicaea ${PKGS_LIBRARIES})

#
# Build python module
#
#
find_package(PythonLibsNew)
if (NOT PYTHON_LIBRARIES)
message("-- Python library not found, cannot install pynicaea")
endif()
find_package(Boost 1.45.0 COMPONENTS python)
if (NOT Boost_LIBRARIES)
message("-- Boost not found, cannot install pynicaea")
endif()
if (PYTHON_LIBRARIES AND Boost_LIBRARIES)
message("-- Adding pynicaea to targets")
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})

add_library(pynicaea SHARED python/bindings.cpp python/cosmo.cpp)
target_link_libraries(pynicaea nicaea ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
set_target_properties(pynicaea PROPERTIES PREFIX "")
set_target_properties(pynicaea PROPERTIES OUTPUT_NAME "nicaea")
endif()


#
# Compiling executables
#
#
add_executable(lensingdemo Demo/lensingdemo.c)
target_link_libraries(lensingdemo nicaea)

add_executable(cmb_bao_demo Demo/cmb_bao_demo.c)
target_link_libraries(cmb_bao_demo nicaea)

add_executable(cosebi_demo Demo/cosebi_demo.c)
target_link_libraries(cosebi_demo nicaea)

add_executable(decomp_eb_demo Demo/decomp_eb_demo.c)
target_link_libraries(decomp_eb_demo nicaea)

add_executable(halomodeldemo Demo/halomodeldemo.c)
target_link_libraries(halomodeldemo nicaea)

add_executable(sn1ademo Demo/sn1ademo.c)
target_link_libraries(sn1ademo nicaea)

add_executable(third_order_demo Demo/third_order_demo.c)
target_link_libraries(third_order_demo nicaea)


#
# Install (by default in the project directory)
#
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})

# Install nicaea library
INSTALL(TARGETS nicaea DESTINATION lib)

# Install nicaea headers
FILE(GLOB inc "${PROJECT_SOURCE_DIR}/tools/include/*.h" "${PROJECT_SOURCE_DIR}/Cosmo/include/*.h" "${PROJECT_SOURCE_DIR}/halomodel/include/*.h" "${PROJECT_SOURCE_DIR}/Coyote/include/*.h")
INSTALL(FILES ${inc} DESTINATION include/nicaea)

# install nicaea executables
INSTALL(TARGETS lensingdemo cmb_bao_demo decomp_eb_demo halomodeldemo sn1ademo cosebi_demo third_order_demo DESTINATION bin)

#
# Tests
#
enable_testing()
message("-- Creating test module lensingdemo")
add_test(NAME lensingdemo COMMAND ${CMAKE_INSTALL_PREFIX}/bin/lensingdemo WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/par_files)
add_test(NAME cmb_bao_demo COMMAND ${CMAKE_INSTALL_PREFIX}/bin/cmb_bao_demo WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/par_files)


35 changes: 35 additions & 0 deletions Cosmo/include/cmb_bao.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* ============================================================ *
* cmb_bao.h *
* Martin Kilbinger *
* ============================================================ */

#ifndef __CMB_BAO_H
#define __CMB_BAO_H


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#include "cosmo.h"
#include "errorlist.h"
#include "io.h"
#include "maths.h"
#include "mvdens.h"


double z_star(cosmo *self);
double acoustic_scale(cosmo *self, error **err);
double shift_parameter(cosmo *self, error **err);
double D_V(cosmo *self, double a, error **err);

double chi2_cmbDP(cosmo *model, mvdens *g, error **err);
double chi2_bao(cosmo *model, mvdens *g, error **err);
double chi2_bao_only(cosmo *model, mvdens *g, error **err);
double chi2_bao_A(cosmo *model, mvdens *g, const double *z_BAO, error **err);
double chi2_bao_d_z(cosmo *model, mvdens *g, const double *z_BAO, error **err);
double chi2_bao_D_V_ratio(cosmo *model, mvdens *g, const double *z_BAO, error **err);


#endif
Loading

0 comments on commit 9a6112b

Please sign in to comment.