summaryrefslogtreecommitdiffstats
path: root/src/libvpsc/block.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libvpsc/block.cpp')
-rw-r--r--src/libvpsc/block.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libvpsc/block.cpp b/src/libvpsc/block.cpp
index 69a439cd7..221df536a 100644
--- a/src/libvpsc/block.cpp
+++ b/src/libvpsc/block.cpp
@@ -23,6 +23,7 @@ using std::endl;
#endif
using std::vector;
+namespace vpsc {
void Block::addVariable(Variable* const v) {
v->block=this;
vars->push_back(v);
@@ -346,6 +347,22 @@ void Block::populateSplitBlock(Block *b, Variable* const v, Variable* const u) {
populateSplitBlock(b, (*c)->right, v);
}
}
+// Search active constraint tree from u to see if there is a directed path to v.
+// Returns true if path is found with all constraints in path having their visited flag
+// set true.
+bool Block::isActiveDirectedPathBetween(Variable* u, Variable *v) {
+ if(u==v) return true;
+ for (Cit c=u->out.begin();c!=u->out.end();++c) {
+ if(canFollowRight(*c,NULL)) {
+ if(isActiveDirectedPathBetween((*c)->right,v)) {
+ (*c)->visited=true;
+ return true;
+ }
+ (*c)->visited=false;
+ }
+ }
+ return false;
+}
/**
* Block needs to be split because of a violated constraint between vl and vr.
* We need to search the active constraint tree between l and r and find the constraint
@@ -402,3 +419,4 @@ ostream& operator <<(ostream &os, const Block& b)
}
return os;
}
+}