Skip to content

Commit

Permalink
Make the code work with the updated ALPSCore
Browse files Browse the repository at this point in the history
1. Request `boost::program_options` explicitly where needed;
2. Fix saving and loading parameters;
3. Other minor fixes.
  • Loading branch information
galexv committed Nov 27, 2017
1 parent 660ba8f commit 48422e1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ include_directories("${PROJECT_BINARY_DIR}/config")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
message(STATUS "Finding packages, please stand by...")
find_package(GSL REQUIRED)
find_package (Eigen3 3.1 REQUIRED)

# new ALPSCore provides Eigen
if (NOT ALPSCore_HAS_EIGEN_VERSION)
find_package (Eigen3 3.1 REQUIRED)
endif()

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-Wno-return-type-c-linkage SUPPORTS_FLAG)
Expand Down
6 changes: 4 additions & 2 deletions kk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ find_package(OpenMP)
if (OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
find_package(ALPSCore REQUIRED)
find_package(Boost 1.56 REQUIRED COMPONENTS program_options)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -DNDEBUG")


add_executable(kk kk.cpp )
target_link_libraries(kk ${ALPSCore_LIBRARIES} ${GSL_LIBRARIES})
target_link_libraries(kk ${Boost_LIBRARIES} ${GSL_LIBRARIES})
target_include_directories(kk PUBLIC ${Boost_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS})

install(TARGETS kk DESTINATION bin)
5 changes: 3 additions & 2 deletions legendre_convert/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project(legendre_convert)
add_executable(legendre_convert legendre_convert.cpp)

set(CMAKE_CXX_FLAGS "-W -Wno-sign-compare -O2 -g")
# use ALPSCore for transitive dependencies on Boost:
target_link_libraries(legendre_convert ${ALPSCore_LIBRARIES})
find_package(Boost 1.56 REQUIRED COMPONENTS program_options)
target_link_libraries(legendre_convert ${Boost_LIBRARIES})
target_include_directories(legendre_convert PUBLIC ${Boost_INCLUDE_DIRS})
install(TARGETS legendre_convert DESTINATION bin)
7 changes: 4 additions & 3 deletions test/parmsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "../src/maxent.hpp"
#include "gtest.h"
#include <alps/utilities/temporary_filename.hpp>
#include <alps/hdf5/vector.hpp>
#include <iostream>
#include "write_test_files.hpp"

Expand Down Expand Up @@ -229,7 +230,7 @@ TEST(Parameters,HDF5ContiParams){
p1["TEXT_OUTPUT"] = false;
p1["DATA_IN_HDF5"] = true;
p1["DATA"]=tf;
p1.save(oar);
oar["/parameters"] << p1;
std::vector<double> x,sigma;
for(int i=1;i<6;i++){
x.push_back(i/10.0);
Expand All @@ -240,8 +241,8 @@ TEST(Parameters,HDF5ContiParams){
oar.close();
//now read in same file
alps::hdf5::archive iar(tf, "r");
alps::params p;
p.load(iar);
alps::params p;
iar["/parameters"] >> p;
iar.close();

ContiParameters c(p);
Expand Down

0 comments on commit 48422e1

Please sign in to comment.