Merged in fix/gtsam_unstable/partition (pull request #354)

Make gtsam_unstable/partition compile again
release/4.3a0
Chris Beall 2018-12-18 17:59:35 +00:00 committed by Frank Dellaert
commit 58ef0dceb6
7 changed files with 19 additions and 17 deletions

View File

@ -10,9 +10,9 @@ set (gtsam_unstable_subdirs
slam slam
) )
if(GTSAM_BUILD_METIS) # Only build partition if metis is built if(GTSAM_SUPPORT_NESTED_DISSECTION) # Only build partition if metis is built
set (gtsam_unstable_subdirs ${gtsam_unstable_subdirs} partition) set (gtsam_unstable_subdirs ${gtsam_unstable_subdirs} partition)
endif(GTSAM_BUILD_METIS) endif(GTSAM_SUPPORT_NESTED_DISSECTION)
set(GTSAM_UNSTABLE_BOOST_LIBRARIES ${GTSAM_BOOST_LIBRARIES}) set(GTSAM_UNSTABLE_BOOST_LIBRARIES ${GTSAM_BOOST_LIBRARIES})
@ -55,9 +55,9 @@ set(gtsam_unstable_srcs
${slam_srcs} ${slam_srcs}
) )
if(GTSAM_BUILD_METIS) # Only build partition if metis is built if(GTSAM_SUPPORT_NESTED_DISSECTION) # Only build partition if metis is built
set (gtsam_unstable_srcs ${gtsam_unstable_srcs} ${partition_srcs}) set (gtsam_unstable_srcs ${gtsam_unstable_srcs} ${partition_srcs})
endif(GTSAM_BUILD_METIS) endif(GTSAM_SUPPORT_NESTED_DISSECTION)
# Versions - same as core gtsam library # Versions - same as core gtsam library
set(gtsam_unstable_version ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}) set(gtsam_unstable_version ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH})

View File

@ -1,5 +1,5 @@
# Install headers # Install headers
file(GLOB partition_headers "*.h") file(GLOB partition_headers "*.h")
install(FILES ${partition_headers} DESTINATION include/gtsam_unstable/parition) install(FILES ${partition_headers} DESTINATION include/gtsam_unstable/partition)
add_subdirectory(tests) add_subdirectory(tests)

View File

@ -284,7 +284,7 @@ namespace gtsam { namespace partition {
throw std::runtime_error("separatorPartitionByMetis: invalid sepsize from Metis ND!"); throw std::runtime_error("separatorPartitionByMetis: invalid sepsize from Metis ND!");
} }
return boost::make_optional<MetisResult >(result); return result;
} }
/* *************************************************************************/ /* *************************************************************************/
@ -359,7 +359,7 @@ namespace gtsam { namespace partition {
std::cout << "edgeCut: " << edgeCut << std::endl; std::cout << "edgeCut: " << edgeCut << std::endl;
} }
return boost::make_optional<MetisResult >(result); return result;
} }
/* ************************************************************************* */ /* ************************************************************************* */
@ -474,7 +474,7 @@ namespace gtsam { namespace partition {
if (!result.is_initialized()) { if (!result.is_initialized()) {
std::cout << "metis failed!" << std::endl; std::cout << "metis failed!" << std::endl;
return 0; return boost::none;
} }
if (reduceGraph) { if (reduceGraph) {

View File

@ -6,7 +6,6 @@
* Description: generic graph types used in partitioning * Description: generic graph types used in partitioning
*/ */
#include <iostream> #include <iostream>
#include <boost/tuple/tuple.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
@ -105,9 +104,8 @@ namespace gtsam { namespace partition {
list<vector<size_t> > islands; list<vector<size_t> > islands;
map<size_t, vector<size_t> > arrays = dsf.arrays(); map<size_t, vector<size_t> > arrays = dsf.arrays();
size_t key; vector<size_t> array; for(const auto& kv : arrays)
for(boost::tie(key, array): arrays) islands.push_back(kv.second);
islands.push_back(array);
return islands; return islands;
} }
@ -305,7 +303,8 @@ namespace gtsam { namespace partition {
// regenerating islands // regenerating islands
map<size_t, vector<size_t> > labelIslands = dsf.arrays(); map<size_t, vector<size_t> > labelIslands = dsf.arrays();
size_t label; vector<size_t> island; size_t label; vector<size_t> island;
for(boost::tie(label, island): labelIslands) { for(const auto& li: labelIslands) {
tie(label, island) = li;
vector<size_t> filteredIsland; // remove singular cameras from array vector<size_t> filteredIsland; // remove singular cameras from array
filteredIsland.reserve(island.size()); filteredIsland.reserve(island.size());
for(const size_t key: island) { for(const size_t key: island) {

View File

@ -8,6 +8,7 @@
#pragma once #pragma once
#include <set>
#include <list> #include <list>
#include <vector> #include <vector>
#include <stdexcept> #include <stdexcept>

View File

@ -179,9 +179,11 @@ TEST ( Partition, findSeparator2 )
} }
/* *************************************************************************/ /* *************************************************************************/
// l1-l8 l9-l16 l17-l24 /**
// / | / \ | \ * l1-l8 l9-l16 l17-l24
// x25 x26 x27 x28 * / | / \ | \
* x25 x26 x27 x28
*/
TEST ( Partition, findSeparator3_with_reduced_camera ) TEST ( Partition, findSeparator3_with_reduced_camera )
{ {
GenericGraph3D graph; GenericGraph3D graph;

View File

@ -42,7 +42,7 @@ cmake -DCMAKE_BUILD_TYPE=Release \
-DGTSAM_BUILD_TIMING:BOOL=OFF \ -DGTSAM_BUILD_TIMING:BOOL=OFF \
-DGTSAM_BUILD_EXAMPLES_ALWAYS:BOOL=OFF \ -DGTSAM_BUILD_EXAMPLES_ALWAYS:BOOL=OFF \
-DGTSAM_WITH_TBB:BOOL=OFF \ -DGTSAM_WITH_TBB:BOOL=OFF \
-DGTSAM_BUILD_METIS:BOOL=OFF \ -DGTSAM_SUPPORT_NESTED_DISSECTION:BOOL=OFF \
-DGTSAM_INSTALL_GEOGRAPHICLIB:BOOL=OFF \ -DGTSAM_INSTALL_GEOGRAPHICLIB:BOOL=OFF \
-DGTSAM_BUILD_UNSTABLE:BOOL=OFF \ -DGTSAM_BUILD_UNSTABLE:BOOL=OFF \
-DGTSAM_MEX_BUILD_STATIC_MODULE:BOOL=ON .. -DGTSAM_MEX_BUILD_STATIC_MODULE:BOOL=ON ..