Debian Codegraph @

lib/vpsc/blocks.h

raw
1 /**
2 * \brief A block structure defined over the variables
3 *
4 * A block structure defined over the variables such that each block contains
5 * 1 or more variables, with the invariant that all constraints inside a block
6 * are satisfied by keeping the variables fixed relative to one another
7 *
8 * Authors:
9 * Tim Dwyer <[email protected]>
10 *
11 * Copyright (C) 2005 Authors
12 *
13 * This version is released under the CPL (Common Public License) with
14 * the Graphviz distribution.
15 * A version is also available under the LGPL as part of the Adaptagrams
16 * project: https://github.com/mjwybrow/adaptagrams.
17 * If you make improvements or bug fixes to this code it would be much
18 * appreciated if you could also contribute those changes back to the
19 * Adaptagrams repository.
20 */
21
22 #pragma once
23
24 #define LOGFILE "cRectangleOverlap.log"
25
26 #include <set>
27 #include <list>
28
29 class Block;
30 struct Variable;
31 struct Constraint;
32 /**
33 * A block structure defined over the variables such that each block contains
34 * 1 or more variables, with the invariant that all constraints inside a block
35 * are satisfied by keeping the variables fixed relative to one another
36 */
37 class Blocks : public std::set<Block*>
38 {
39 public:
40 Blocks(const int n, Variable *vs[]);
41 ~Blocks();
42 void mergeLeft(Block *r);
43 void mergeRight(Block *l);
44 void split(Block *b, Block *&l, Block *&r, Constraint *c);
45 std::list<Variable*> totalOrder();
46 void cleanup();
47 double cost();
48 private:
49 void dfsVisit(Variable *v, std::list<Variable*> &order);
50 void removeBlock(Block *doomed);
51 Variable **vs;
52 int nvs;
53 };
54
55 extern long blockTimeCtr;