Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow C++17 language features. #2298

Merged
merged 17 commits into from Jan 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitmodules
Expand Up @@ -12,7 +12,7 @@
url = https://github.com/ufz/tclap.git
[submodule "ThirdParty/autocheck"]
path = ThirdParty/autocheck
url = https://github.com/thejohnfreeman/autocheck.git
url = https://github.com/ufz/autocheck.git
[submodule "ThirdParty/metis"]
path = ThirdParty/metis
url = https://github.com/scibuilder/metis.git
Expand All @@ -25,3 +25,9 @@
[submodule "ThirdParty/pybind11"]
path = ThirdParty/pybind11
url = https://github.com/pybind/pybind11.git
[submodule "ThirdParty/googletest"]
path = ThirdParty/googletest
url = https://github.com/google/googletest.git
[submodule "ThirdParty/jedbrown-cmake-modules"]
path = ThirdParty/jedbrown-cmake-modules
url = https://github.com/jedbrown/cmake-modules.git
3 changes: 2 additions & 1 deletion BaseLib/ConfigTree.cpp
Expand Up @@ -73,7 +73,8 @@ ConfigTree(ConfigTree && other)

ConfigTree::~ConfigTree()
{
if (std::uncaught_exception()) {
if (std::uncaught_exceptions() > 0)
{
/* If the stack unwinds the check below shall be suppressed in order to
* not accumulate false-positive configuration errors.
*/
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Expand Up @@ -8,9 +8,12 @@ cmake_minimum_required(VERSION 3.3)
# Set CMake policies
cmake_policy(SET CMP0011 NEW)
cmake_policy(SET CMP0054 NEW)
if(${CMAKE_VERSION} VERSION_GREATER 3.9.6)
if(POLICY 0071)
cmake_policy(SET CMP0071 NEW)
endif()
if(POLICY 0074)
cmake_policy(SET CMP0074 NEW)
endif()

if(WIN32 AND
NOT ${CMAKE_GENERATOR} STREQUAL Ninja AND
Expand Down Expand Up @@ -309,7 +312,7 @@ endif()
# Add subdirectories with the projects
add_subdirectory( ThirdParty )
include_directories( SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty )
include_directories( SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/gtest/include )
include_directories( SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/googletest/googletest/include )
include_directories( SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/autocheck/include )
include_directories( SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/tclap/include )
include_directories( SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/json/include )
Expand Down
11 changes: 4 additions & 7 deletions GeoLib/Grid.h
Expand Up @@ -177,22 +177,19 @@ class Grid : public GeoLib::AABB
static POINT const* copyOrAddress(POINT const& p) { return &p; }
static POINT* copyOrAddress(POINT* p) { return p; }

std::array<std::size_t,3> _n_steps;
std::array<double, 3> _step_sizes;
std::array<std::size_t,3> _n_steps = {{1, 1, 1}};
std::array<double, 3> _step_sizes = {{0.0, 0.0, 0.0}};
/**
* This is an array that stores pointers to POINT objects.
*/
std::vector<POINT*>* _grid_cell_nodes_map;
std::vector<POINT*>* _grid_cell_nodes_map = nullptr;
};

template <typename POINT>
template <typename InputIterator>
Grid<POINT>::Grid(InputIterator first, InputIterator last,
std::size_t max_num_per_grid_cell)
: GeoLib::AABB(first, last),
_n_steps({{1, 1, 1}}),
_step_sizes({{0.0, 0.0, 0.0}}),
_grid_cell_nodes_map(nullptr)
: GeoLib::AABB(first, last)
{
auto const n_pnts(std::distance(first,last));

Expand Down
27 changes: 22 additions & 5 deletions Jenkinsfile
Expand Up @@ -9,7 +9,7 @@ pipeline {
ansiColor('xterm')
timestamps()
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '10'))
timeout(time: 3, unit: 'HOURS')
timeout(time: 4, unit: 'HOURS')
}
stages {
// *************************** Git Check **********************************
Expand Down Expand Up @@ -82,9 +82,12 @@ pipeline {
additionalBuildArgs '--pull'
}
}
environment {
OMP_NUM_THREADS = '1'
}
steps {
script {
sh 'conan user'
sh 'git submodule sync'
configure {
cmakeOptions =
'-DOGS_CPU_ARCHITECTURE=generic ' +
Expand Down Expand Up @@ -150,7 +153,7 @@ pipeline {
}
steps {
script {
sh 'conan user'
sh 'git submodule sync'
configure {
cmakeOptions =
'-DOGS_CPU_ARCHITECTURE=generic '
Expand All @@ -171,8 +174,12 @@ pipeline {
expression { return stage_required.build || stage_required.full }
}
agent { label "envinf1"}
environment {
OMP_NUM_THREADS = '1'
}
steps {
script {
sh 'git submodule sync'
configure {
cmakeOptions =
'-DOGS_BUILD_UTILS=ON ' +
Expand Down Expand Up @@ -204,9 +211,13 @@ pipeline {
expression { return stage_required.build || stage_required.full }
}
agent { label "envinf1"}
environment {
OMP_NUM_THREADS = '1'
}
steps {
script {
configure {
sh 'git submodule sync'
cmakeOptions =
'-DOGS_BUILD_UTILS=ON ' +
'-DBUILD_SHARED_LIBS=ON ' +
Expand Down Expand Up @@ -242,10 +253,12 @@ pipeline {
environment {
MSVC_NUMBER = '15'
MSVC_VERSION = '2017'
OMP_NUM_THREADS = '1'
}
steps {
script {
// CLI
bat 'git submodule sync'
bat 'conan remove --locks'
configure {
cmakeOptions =
Expand Down Expand Up @@ -289,8 +302,12 @@ pipeline {
expression { return stage_required.build || stage_required.full }
}
agent { label "mac"}
environment {
OMP_NUM_THREADS = '1'
}
steps {
script {
sh 'git submodule sync'
configure {
cmakeOptions =
'-DOGS_CPU_ARCHITECTURE=core2 ' +
Expand Down Expand Up @@ -368,7 +385,7 @@ pipeline {
}
steps {
script {
sh 'conan user'
sh 'git submodule sync'
sh 'find $CONAN_USER_HOME -name "system_reqs.txt" -exec rm {} \\;'
configure {
cmakeOptions =
Expand Down Expand Up @@ -478,7 +495,7 @@ pipeline {
}
steps {
script {
sh 'conan user'
sh 'git submodule sync'
sh 'find $CONAN_USER_HOME -name "system_reqs.txt" -exec rm {} \\;'
configure {
cmakeOptions =
Expand Down
6 changes: 4 additions & 2 deletions Tests/BaseLib/TestAlgorithm.cpp
Expand Up @@ -9,6 +9,7 @@

#include <algorithm>
#include <numeric>
#include <random>
#include <vector>

#include <gtest/gtest.h>
Expand All @@ -19,12 +20,13 @@ TEST(BaseLibAlgorithm, testreorderVector)
{
const std::size_t size = 100;
std::vector<double> vec(size);
std::generate(vec.begin(), vec.end(), std::rand);
std::default_random_engine random_engine;
std::generate(vec.begin(), vec.end(), random_engine);
std::vector<double> vec0 = vec;

std::vector<int> order(size);
std::iota(order.begin(), order.end(), 0);
std::random_shuffle(order.begin(), order.end());
std::shuffle(order.begin(), order.end(), random_engine);

BaseLib::reorderVector(vec, order);

Expand Down
2 changes: 1 addition & 1 deletion Tests/CMakeLists.txt
Expand Up @@ -39,7 +39,7 @@ set_target_properties(testrunner PROPERTIES FOLDER Testing)

target_link_libraries(testrunner
ApplicationsFileIO
GTest
gtest
MeshGeoToolsLib
MaterialLib
MeshLib
Expand Down
Expand Up @@ -367,7 +367,7 @@
<vtkdiff>
<file>out_beam_medium_ED_pcs_0_ts_100_t_1.000000.vtu</file>
<field>sigma</field>
<absolute_tolerance>9e-7</absolute_tolerance>
<absolute_tolerance>1e-6</absolute_tolerance>
<relative_tolerance>0</relative_tolerance>
</vtkdiff>
<vtkdiff>
Expand Down
Expand Up @@ -304,13 +304,13 @@
<vtkdiff>
<file>m2_1Dlozengebt_pcs_0_ts_500_t_1.000000.vtu</file>
<field>displacement</field>
<absolute_tolerance>5e-12</absolute_tolerance>
<absolute_tolerance>7e-12</absolute_tolerance>
<relative_tolerance>0</relative_tolerance>
</vtkdiff>
<vtkdiff>
<file>m2_1Dlozengebt_pcs_0_ts_500_t_1.000000.vtu</file>
<field>epsilon</field>
<absolute_tolerance>1e-12</absolute_tolerance>
<absolute_tolerance>7e-12</absolute_tolerance>
<relative_tolerance>0</relative_tolerance>
</vtkdiff>
<vtkdiff>
Expand Down
3 changes: 2 additions & 1 deletion ThirdParty/CMakeLists.txt
Expand Up @@ -17,7 +17,8 @@ if(MSVC)
set_target_properties(logog PROPERTIES COMPILE_FLAGS /W0)
endif()

add_subdirectory(gtest)
set(gtest_force_shared_crt ON CACHE INTERNAL "") # Use dynamic MSVC runtime
add_subdirectory(googletest)

# This is a workaround for Travis builds.
option(OGS_USE_OPTIONAL_SUBMODULES "Option for enabling optional submodules" OFF)
Expand Down
2 changes: 1 addition & 1 deletion ThirdParty/cmake-modules
1 change: 1 addition & 0 deletions ThirdParty/googletest
Submodule googletest added at 9ab640