123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- /**
- * @file tests/boost_graph/graph_partitioning.hpp
- * @author The PARADEVS Development Team
- * See the AUTHORS or Authors.txt file
- */
- /*
- * PARADEVS - the multimodeling and simulation environment
- * This file is a part of the PARADEVS environment
- *
- * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
- #ifndef __TESTS_BOOST_GRAPH_GRAPH_GENERATOR_HPP
- #define __TESTS_BOOST_GRAPH_GRAPH_GENERATOR_HPP 1
- #include <tests/boost_graph/partitioning/defs.hpp>
- #include <tests/boost_graph/partitioning/utils.hpp>
- #include <tests/boost_graph/partitioning/graph_build.hpp>
- namespace paradevs { namespace tests { namespace boost_graph {
- class GraphGenerator
- {
- public:
- GraphGenerator()
- { }
- virtual void generate(OrientedGraph& go) = 0;
- };
- class RandomGraphGenerator : public GraphGenerator
- {
- public:
- RandomGraphGenerator(unsigned int edge_number,
- std::vector<int> levels,
- unsigned int source_number,
- unsigned int min_neigh,
- unsigned int max_neigh) :
- edge_number(edge_number), levels(levels), source_number(source_number),
- min_neigh(min_neigh), max_neigh(max_neigh)
- { }
- virtual void generate(OrientedGraph& go)
- {
- // const char *texte = new const char();
- // texte = "file/data_base/tree/tree_20000.txt";
- // Graph_constructor_txt(texte,&go);
- //boost::timer t;
- build_generator_graph(&go, edge_number, source_number, min_neigh,
- max_neigh, levels);
- //double t3 = t.elapsed();
- //std::cout << "tmp_gen = " << t3 << std::endl;
- }
- private:
- unsigned int edge_number;
- std::vector<int> levels;
- unsigned int source_number;
- unsigned int min_neigh;
- unsigned int max_neigh;
- };
- class RandomGridGraphGenerator : public GraphGenerator
- {
- public:
- RandomGridGraphGenerator( int side,std::vector<std::pair<int,int>> vertex_selection,
- Entiers weight_vertex,const char *edge_weight, bool rec) :
- side(side), vertex_selection(vertex_selection), weight_vertex(weight_vertex),
- edge_weight(edge_weight), rec(rec)
- { }
- virtual void generate(OrientedGraph& go)
- {
- /*const char *texte = new const char();
- texte = "enregistrement.txt";
- Graph_constructor_txt(texte,&go);*/
- //boost::timer t;
- build_graph_grid(&go, side, vertex_selection, weight_vertex, edge_weight, rec);
- //double t3 = t.elapsed();
- //std::cout << "tmp_gen = " << t3 << std::endl;
- }
- private:
- int side;
- std::vector<std::pair<int,int>> vertex_selection;
- Entiers weight_vertex;
- const char *edge_weight;
- bool rec;
- };
- class RandomLinkedGraphGenerator : public GraphGenerator
- {
- public:
- RandomLinkedGraphGenerator(unsigned int edge_number,
- unsigned int levels,
- unsigned int min_neigh,
- unsigned int max_neigh) :
- edge_number(edge_number), levels(levels),
- min_neigh(min_neigh), max_neigh(max_neigh)
- { }
- virtual void generate(OrientedGraph& go)
- {
- // const char *texte = new const char();
- //texte = "file/data_base/HO_models.txt";
- // texte = "file/data_base/linked/linked10000.txt";
- // Graph_constructor_txt(texte,&go);
- build_generator_graph_linked(&go, edge_number, levels , min_neigh,
- max_neigh);
- }
- private:
- unsigned int edge_number;
- unsigned int levels;
- unsigned int min_neigh;
- unsigned int max_neigh;
- };
- class ArtificialGraphGenerator : public GraphGenerator
- {
- public:
- ArtificialGraphGenerator(unsigned int edge_number) :
- edge_number(edge_number)
- { }
- virtual void generate(OrientedGraph& go)
- { build_graph(go, edge_number); }
- private:
- unsigned int edge_number;
- };
- class ParcelGraphGenerator : public GraphGenerator
- {
- public:
- ParcelGraphGenerator(uint size_max,
- std::string name) :
- size_max(size_max), name(name)
- { }
- virtual void generate(OrientedGraph& go)
- {
- //const char *texte = new const char();
- //texte = "file/data_base/HO_models.txt";
- //texte = "file/data_base/linked/linked10000.txt";
- //Graph_constructor_txt(texte,&go);
- build_parcellaire_graph(&go, size_max, name);
- }
- private:
- uint size_max;
- std::string name;
- };
- class CorsenGraphGenerator : public GraphGenerator
- {
- public:
- CorsenGraphGenerator()
- { }
- virtual void generate(OrientedGraph& go)
- {
- //build_corsen_graph(go);
- }
- };
- } } } // namespace paradevs tests boost_graph
- #endif
|