Skip to content

Commit

Permalink
[ctc] simplifying CtcEval
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonRohou committed Aug 24, 2021
1 parent b4c5a2c commit ff5ecc9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 70 deletions.
74 changes: 5 additions & 69 deletions src/core/contractors/dyn/codac_CtcEval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,45 +335,10 @@ namespace codac
void CtcEval::contract(double t, IntervalVector& z, TubeVector& y, TubeVector& w)
{
assert(!std::isnan(t));
assert(y.size() == z.size());
assert(y.size() == w.size());
assert(y.tdomain().contains(t));
assert(y.tdomain() == w.tdomain());
assert(TubeVector::same_slicing(y, w));

if(y.size() != z.size() || y.size() != w.size())
throw DomainsSizeException(m_ctc_name);

if(z.is_empty() || y.is_empty() || w.is_empty())
{
z.set_empty();
y.set_empty();
w.set_empty();
return;
}

z &= y(t);

for(int i = 0 ; i < y.size() ; i++)
contract(t, z[i], y[i], w[i]);
Interval intv_t(t);
contract(intv_t, z, y, w);
}

/*void CtcEval::contract(const Interval& t, const Interval& z, Tube& y, Tube& w)
{
assert(y.tdomain() == w.tdomain());
assert(Tube::same_slicing(y, w));
if(t.is_empty() || z.is_empty() || y.is_empty() || w.is_empty())
{
y.set_empty();
w.set_empty();
return;
}
Interval _t(t), _z(z);
contract(_t, _z, y, w);
}*/

void CtcEval::contract(Interval& t, IntervalVector& z, TubeVector& y, TubeVector& w)
{
assert(y.size() == z.size());
Expand All @@ -393,42 +358,13 @@ namespace codac
return;
}

Interval t_result = Interval::EMPTY_SET;

t &= y.invert(z, t);
t &= y.invert(z, t); // is this useful?
z &= y(t);

for(int i = 0 ; i < y.size() ; i++)
{
Interval _t(t);
contract(_t, z[i], y[i], w[i]);
t_result |= _t;
}

t &= t_result;
contract(t, z[i], y[i], w[i]);
}
/*
void CtcEval::contract(const Interval& t, const IntervalVector& z, TubeVector& y, TubeVector& w)
{
assert(y.size() == z.size());
assert(y.size() == w.size());
assert(y.tdomain() == w.tdomain());
assert(TubeVector::same_slicing(y, w));
if(y.size() != z.size() || y.size() != w.size())
throw DomainsSizeException(m_ctc_name);
if(t.is_empty() || z.is_empty() || y.is_empty() || w.is_empty())
{
y.set_empty();
w.set_empty();
return;
}
Interval _t(t); IntervalVector _z(z);
contract(_t, _z, y, w);
}*/


void CtcEval::contract(Interval& t, Interval& z, const Tube& y)
{
if(t.is_empty() || z.is_empty() || y.is_empty())
Expand Down
2 changes: 1 addition & 1 deletion tests/core/tests_ctc_chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using namespace std;
using namespace ibex;
using namespace codac;

#define VIBES_DRAWING 0
//#define VIBES_DRAWING 0

TEST_CASE("CtcChain")
{
Expand Down

0 comments on commit ff5ecc9

Please sign in to comment.