Graphviz 13.0.0~dev.20241222.1117
Loading...
Searching...
No Matches
block.h
Go to the documentation of this file.
1
20#pragma once
21
22#include <vector>
23#include <iostream>
24struct Variable;
25struct Constraint;
26
27class Block
28{
29 friend std::ostream& operator <<(std::ostream &os,const Block &b);
30public:
31 std::vector<Variable*> vars;
32 double posn;
33 double weight;
34 double wposn;
35 Block(Variable *v=nullptr);
36 Block(const Block &) = delete;
44 void merge(Block *b, Constraint *c, double dist);
45 void merge(Block *b, Constraint *c);
46 void mergeIn(Block *b);
47 void mergeOut(Block *b);
48 void split(Block *&l, Block *&r, Constraint *c);
49 Constraint* splitBetween(Variable* vl, Variable* vr, Block* &lb, Block* &rb);
50 void setUpInConstraints();
52 double cost();
53 bool deleted;
55 std::vector<Constraint *> in;
56 std::vector<Constraint *> out;
57private:
58 typedef enum {NONE, LEFT, RIGHT} Direction;
59 typedef std::pair<double, Constraint*> Pair;
60 void reset_active_lm(Variable *v, Variable *u);
61 double compute_dfdv(Variable *v, Variable *u, Constraint *&min_lm);
62 Pair compute_dfdv_between(
63 Variable*, Variable*, Variable*, Direction, bool);
64 bool canFollowLeft(const Constraint *c, const Variable *last);
65 bool canFollowRight(const Constraint *c, const Variable *last);
66 void populateSplitBlock(Block *b, Variable *v, Variable *u);
67 void addVariable(Variable *v);
68 std::vector<Constraint *> setUpConstraintHeap(bool use_in);
69};
static agxbuf last
last message
Definition agerror.c:29
Definition block.h:28
std::vector< Constraint * > out
Definition block.h:56
Block(const Block &)=delete
bool deleted
Definition block.h:53
Constraint * findMinInConstraint()
Definition block.cpp:178
std::vector< Variable * > vars
Definition block.h:31
double posn
Definition block.h:32
friend std::ostream & operator<<(std::ostream &os, const Block &b)
Definition block.cpp:417
Constraint * findMinLM()
Definition block.cpp:345
Constraint * splitBetween(Variable *vl, Variable *vr, Block *&lb, Block *&rb)
Definition block.cpp:377
void deleteMinOutConstraint()
Definition block.cpp:240
void mergeIn(Block *b)
Definition block.cpp:163
void mergeOut(Block *b)
Definition block.cpp:173
std::vector< Constraint * > in
Definition block.h:55
void setUpOutConstraints()
Definition block.cpp:103
double wposn
Definition block.h:34
void setUpInConstraints()
Definition block.cpp:100
double cost()
Definition block.cpp:408
double desiredWeightedPosition()
Definition block.cpp:93
double weight
Definition block.h:33
Constraint * findMinOutConstraint()
Definition block.cpp:227
void merge(Block *b, Constraint *c, double dist)
Definition block.cpp:146
void deleteMinInConstraint()
Definition block.cpp:237
Constraint * findMinLMBetween(Variable *lv, Variable *rv)
Definition block.cpp:351
long timeStamp
Definition block.h:54
static void split(void)
Definition ccomps.c:102
static double dist(int dim, double *x, double *y)
A constraint determines a minimum or exact spacing required between two variables.
Definition constraint.h:25
Definition closest.c:29