graph_geometric.cc 2.48 KB
 Tiago Peixoto committed Oct 04, 2010 1 2 ``````// graph-tool -- a general graph modification and manipulation thingy // `````` Tiago Peixoto committed Jan 02, 2014 3 ``````// Copyright (C) 2006-2014 Tiago de Paula Peixoto `````` Tiago Peixoto committed Oct 04, 2010 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ``````// // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 3 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . #include "graph.hh" #include "graph_filtering.hh" #include "graph_geometric.hh" #include using namespace std; using namespace boost; using namespace graph_tool; typedef graph_tool::detail::get_all_graph_views `````` Tiago Peixoto committed May 31, 2014 31 `````` ::apply, `````` Tiago Peixoto committed Oct 04, 2010 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 `````` mpl::bool_,mpl::bool_, mpl::bool_,mpl::bool_ >::type graph_views; typedef property_map_types::apply >, GraphInterface::vertex_index_map_t, mpl::bool_ >::type prop_types; void geometric(GraphInterface& gi, python::object opoints, double r, python::object orange, bool periodic, boost::any pos) { python::object shape = opoints.attr("shape"); size_t size = python::extract(shape[0]); vector > points(size); vector > range(python::len(orange)); size = python::extract(shape[1]); for(size_t i = 0; i < points.size(); ++i) { points[i].resize(size); for (size_t j = 0; j < points[i].size(); ++j) points[i][j] = python::extract(opoints[i][j]); } for(size_t i = 0; i < range.size(); ++i) { range[i].first = python::extract(orange[i][0]); range[i].second = python::extract(orange[i][1]); } `````` Tiago Peixoto committed Nov 10, 2013 62 63 64 65 `````` run_action()(gi, std::bind(get_geometric(), placeholders::_1, placeholders::_2, std::ref(points), std::ref(range), r, periodic), `````` Tiago Peixoto committed Oct 04, 2010 66 67 `````` prop_types())(pos); }``````