Commit 40d467ba authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix compilation issues with clang

parent 2c18c898
......@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "graph_python_interface.hh"
#include "graph_filtering.hh"
#include "graph.hh"
#include "graph_selectors.hh"
......
......@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "graph_python_interface.hh"
#include "graph_filtering.hh"
#include "graph.hh"
#include "graph_selectors.hh"
......
......@@ -38,6 +38,8 @@ namespace boost
{
using namespace graph_tool;
struct graph_wrap_tag {};
template <class Graph>
class GraphWrap
{
......@@ -47,7 +49,8 @@ class GraphWrap
typedef typename vertex_property_type<Graph>::type vertex_property_type;
typedef typename edge_property_type<Graph>::type edge_property_type;
typedef typename Graph::graph_tag graph_tag;
typedef typename Graph::graph_tag orig_wrap_tag;
typedef graph_wrap_tag graph_tag;
typedef Graph orig_graph_t;
typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor;
......@@ -57,6 +60,72 @@ class GraphWrap
GraphInterface& _gi;
};
namespace detail {
template <typename PM>
struct graph_wrap_edge_property_map {
private:
PM underlying_pm;
public:
typedef typename property_traits<PM>::key_type key_type;
typedef typename property_traits<PM>::value_type value_type;
typedef typename property_traits<PM>::reference reference;
typedef typename property_traits<PM>::category category;
explicit graph_wrap_edge_property_map(const PM& pm): underlying_pm(pm) {}
friend reference
get(const graph_wrap_edge_property_map& m,
const key_type& e) {
return get(m.underlying_pm, e.underlying_desc);
}
friend void
put(const graph_wrap_edge_property_map& m,
const key_type& e,
const value_type& v) {
put(m.underlying_pm, e, v);
}
reference operator[](const key_type& k) {
return (this->underlying_pm)[k];
}
};
struct graph_wrap_vertex_property_selector {
template <class ReverseGraph, class Property, class Tag>
struct bind_ {
typedef typename ReverseGraph::orig_graph_t Graph;
typedef property_map<Graph, Tag> PMap;
typedef typename PMap::type type;
typedef typename PMap::const_type const_type;
};
};
struct graph_wrap_edge_property_selector {
template <class ReverseGraph, class Property, class Tag>
struct bind_ {
typedef typename ReverseGraph::orig_graph_t Graph;
typedef property_map<Graph, Tag> PMap;
typedef graph_wrap_edge_property_map<typename PMap::type> type;
typedef graph_wrap_edge_property_map<typename PMap::const_type> const_type;
};
};
} // namespace detail
template <>
struct vertex_property_selector<graph_wrap_tag> {
typedef detail::graph_wrap_vertex_property_selector type;
};
template <>
struct edge_property_selector<graph_wrap_tag> {
typedef detail::graph_wrap_edge_property_selector type;
};
template <class Graph>
GraphWrap<Graph> graph_wrap(Graph& g, GraphInterface& gi)
{
......
......@@ -404,7 +404,7 @@ struct get_sfdp_layout
val_t d = get_diff(group_cm[group[v]], pos[v], diff);
if (d > 0)
{
double Kp = K * pow(group_size[group[v]], mu_p);
double Kp = K * pow(double(group_size[group[v]]), mu_p);
val_t f = f_a(Kp, group_cm[group[v]], pos[v]) * mu * \
group_size[group[v]] * get(vweight, v);
for (size_t l = 0; l < 2; ++l)
......
......@@ -31,7 +31,8 @@ using namespace graph_tool;
python::object do_label_components(GraphInterface& gi, boost::any prop)
{
vector<size_t> hist;
run_action<>()(gi, bind<void>(label_components(), _1, _2, ref(hist)),
run_action<graph_tool::detail::all_graph_views,mpl::true_>()
(gi, bind<void>(label_components(), _1, _2, ref(hist)),
writable_vertex_scalar_properties())(prop);
return wrap_vector_owned(hist);
}
......@@ -52,8 +53,9 @@ do_label_biconnected_components(GraphInterface& gi, boost::any comp,
void do_label_out_component(GraphInterface& gi, size_t root, boost::any prop)
{
run_action<>()(gi, bind<void>(label_out_component(), _1, _2, root),
writable_vertex_scalar_properties())(prop);
run_action<graph_tool::detail::all_graph_views,mpl::true_>()
(gi, bind<void>(label_out_component(), _1, _2, root),
writable_vertex_scalar_properties())(prop);
}
void export_components()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment