Commit 6af7d854 authored by Florent Jacquemard's avatar Florent Jacquemard
Browse files

debug KeySI : missing termination condition for construction of inner (ar. 2) bar runs

parent e4a11171
......@@ -367,7 +367,7 @@ void KeySI::transitionsBar(std::stack<const Transition*>& st,
t[1] = &(addBinaryBarTransition(_state, env));
}
// the arity of the transition in nthe stack will determine
// the arity of the transition in the stack will determine
// if we continue processing the rest of the segment or stop.
// remaining interval is smaller than a bar and not inhabited
......
......@@ -161,7 +161,7 @@ void KeySI::init_nextsibling(const KeySI& parent,
}
/// @todo cases grace and fork
assert(_interval);
assert(_interval->aligned());
// assert(_interval->aligned());
}
......@@ -348,6 +348,7 @@ void KeySI::RunsTerminal(const Transition& t,
/// double bar (end of score)
else if (SymbLabel::bar(a) && (SymbLabel::arity(a) == 0))
{
// condition of termination : end of input segment reached
if ((_interval->rduration() < _barlen) && (! _interval->inhabited()))
{
// 0 or -1 point to read in interval
......@@ -393,7 +394,9 @@ void KeySI::RunsInner(const Transition& t,
else if (SymbLabel::bar(a))
{
assert(SymbLabel::arity(a) == 2);
RunFactory<KeySI>::innerRun(*this, t, si);
// end of input segment not reached (condition of termination)
if ((_interval->rduration() >= _barlen) || _interval->inhabited())
RunFactory<KeySI>::innerRun(*this, t, si);
}
else
{
......
......@@ -190,7 +190,7 @@ double Interval::rduration() const
std::ostream& operator<<(std::ostream& o, const Interval& p)
{
o << "[";
o << "mtu[";
p.mbegin().printint(o);
o << ", ";
if (p.mopen())
......@@ -198,7 +198,7 @@ std::ostream& operator<<(std::ostream& o, const Interval& p)
else
p.mend().printint(o);
o << "[";
o << " [";
o << " rtu[";
o << p.rbegin();
o << ", ";
if (p.ropen())
......
......@@ -104,8 +104,8 @@ IntervalTree* IntervalTree::split(const InputSegment* s,
// first new sub-interval starting at rbegin of dur rdur
// aligned
TRACE("iTree.split(1) of interval {}: [{}, {}] [{}, {}]",
*(this), rbegin(), rpivot, mbegin(), mpivot);
TRACE("iTree.split(1) of interval {} = mtu[{}, {}[ rtu[{}, {}[",
*(this), mbegin(), mpivot, rbegin(), rpivot);
// p[0] is aligned
p[0] = ih->make(s,
rbegin(), rpivot,
......@@ -128,8 +128,8 @@ IntervalTree* IntervalTree::split(const InputSegment* s,
else
rendnew = rpivot;
TRACE("iTree.split(2) of interval {}: [{}, {}] [{}, {}]",
*(this), rpivot, rendnew, mpivot, mend());
TRACE("iTree.split(2) of interval {} = mtu[{}, {}[ rtu[{}, {}[",
*(this), mpivot, mend(), rpivot, rendnew);
// p[1] is not aligned
p[1] = ih->make(s,
rpivot, rendnew,
......@@ -172,8 +172,8 @@ IntervalTree* IntervalTree::split_back(const InputSegment* s,
// first new sub-interval starting at rbegin
// aligned
TRACE("iTree.split_back(1) of meta {}: [{}, {}] [{}, {}]",
*(this), rbegin(), rpivot, mbegin(), mpivot);
TRACE("iTree.split_back(1) of meta {} = mtu[{}, {}[ rtu[{}, {}[",
*(this), mbegin(), mpivot, rbegin(), rpivot);
p[0] = ih->make(s,
rbegin(), rpivot,
mbegin(), mpivot,
......@@ -188,8 +188,8 @@ IntervalTree* IntervalTree::split_back(const InputSegment* s,
// second new sub-interval starting at rbegin of dur rdur
// aligned
TRACE("iTree.split_back(2) of meta {}: [{}, {}] [{}, {}]",
*(this), rpivot, rdur, mpivot, mdur);
TRACE("iTree.split_back(2) of meta {} = mtu[{}, {}[ rtu[{}, {}[",
*(this), mpivot, mdur, rpivot, rdur);
p[1] = ih->make(s,
rpivot, rdur,
mpivot, mdur,
......@@ -284,7 +284,7 @@ void IntervalTree::fillSubtrees(const InputSegment* s,
b = pt->align(s, b);
}
TRACE("iTree.sub({}/{}) of {} = [{}, {}[ [{}, {}]",
TRACE("iTree.sub({}/{}) of {} = mtu[{}, {}[ rtu[{}, {}[",
j+1, a, *(this), mbeg, mbeg+mdur, rbeg, rbeg_next);
v.push_back(pt);
......@@ -320,6 +320,9 @@ IntervalTree* IntervalTree::subm(const InputSegment* s,
rtu_t rdur = ((rtu_t) m) * (rend() - rbegin()) / ((rtu_t) a);
mtu_t mbeg = mbegin();
mtu_t mdur = MTU::make(m) * ((mend() - mbegin()) / MTU::make(a));
TRACE("iTree.subm({}:{}/{}) of {} = mtu[{}, {}[ rtu[{}, {}[",
i+1, m, a, *(this), mbeg, mbeg+mdur, rbeg, rbeg+rdur);
return ih->make(s,
rbeg, rbeg+rdur,
mbeg, mbeg+mdur,
......@@ -357,7 +360,10 @@ IntervalTree* IntervalTree::nexti(const InputSegment* s,
this->parent(), sibling);
assert(pt);
assert(pt->aligned());
// if (! pt->aligned()) pt->align(s, b);
// if (! pt->aligned()) pt->align(s, b);
TRACE("iTree.nexti of {} = mtu[{}, {}[ rtu[{}, {}[",
*(this), mbeg, mbeg+mdur, rbeg, rbeg+rdur);
return pt;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment