ModelBlocks.hh 1.62 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * Copyright (C) 2007-2008 Dynare Team
 *
 * This file is part of Dynare.
 *
 * Dynare 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.
 *
 * Dynare 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 Dynare.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef MODELBLOCKS
#define MODELBLOCKS
#include "ModelNormalization.hh"

sebastien's avatar
sebastien committed
24
//! Sparse form of the graph, with strongly connected components
25
26
27
28
29
30
31
32
33
34
typedef struct block_result
{
  int size, n_sets;
  int *vertices;
  int *sets_s, *sets_f;
  int *order, *ordered;
}
  block_result_t;


sebastien's avatar
sebastien committed
35
//! Implements Tarjan algorithm
36
37
38
39
40
41
42
43
44
class Blocks
{
public:
  Blocks();
  void block_depth_search(int v);
  block_result_t* sc(Equation_set *g);
  void block_result_free(block_result_t *r);
  void block_result_print(block_result_t *r);
  void Print_Equation_gr(Equation_set* Equation);
sebastien's avatar
sebastien committed
45
  //! Converts the output of Tarjan algorithm into reordered incidence matrices
46
47
48
49
50
51
52
53
54
55
  void block_result_to_IM(block_result_t *r,bool* IM,int prologue, int n,simple* Index_Equ_IM,simple* Index_Var_IM);
  Equation_vertex *vertices;
  int *block_vertices, *sets_s, *sets_f;
  int *block_stack, *sp, tos;
  int *visit_nos, *low_link_nos;
  int n_visited, n_written, n_sets;
  int *pos_sc;
};
#endif