angel  mercurial changeset:
graph_generator.hpp
Go to the documentation of this file.
00001 // $Id: graph_generator.hpp,v 1.4 2003/03/25 17:42:00 gottschling Exp $
00002 /*
00003 #############################################################
00004 # This file is part of angel released under the BSD license #
00005 # The full COPYRIGHT notice can be found in the top         #
00006 # level directory of the angel distribution                 #
00007 #############################################################
00008 */
00009 
00010 
00011 #ifndef         _graph_generator_include_
00012 #define         _graph_generator_include_
00013 
00014 
00015 //
00016 // random graph generator for DAGs similar to real program's c-graph
00017 //
00018 
00019 #include <vector>
00020 #include <time.h>
00021 
00022 #include "angel_types.hpp"
00023 
00024 namespace angel {
00025 
00038 void random_statement (int inputs, int expr, const std::vector<double>& p,
00039                        c_graph_t& statement);
00040 
00050 void random_statement_vector (int max_expr, double unary, 
00051                               std::vector<c_graph_t>& statement_vector);
00052 
00059 void stats2block (int inputs, int outputs, const std::vector<c_graph_t>& stats, 
00060                   c_graph_t& block);
00061 
00070 void random_block (int inputs, int outputs, int stats, int max_exp, double unary,
00071                    c_graph_t& block);
00072 
00078 void block2loop (const c_graph_t& block, int loops,
00079                  c_graph_t& loop);
00080 
00081 
00082 // Initializes the random generator unless SAME_RANDOM_VALUES is defined
00083 struct random_init_t {
00084   int dummy;
00085   random_init_t () : dummy (7) { 
00086 #ifndef SAME_RANDOM_VALUES
00087     srand (time (0));
00088 #endif
00089   }
00090 };
00091   
00092 extern random_init_t random_init_object;
00093 
00094 } // namespace angel
00095 
00096 #endif  // _graph_generator_include_
00097 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines