bool checkSubArithmeticDSS( const DSL & D,
                            const typename DSL::Point & A, 
                            const typename DSL::Point & B ) 
{
  typedef typename DSL::Fraction Fraction;
  typedef typename DSL::Integer Integer;
  typedef typename DSL::Quotient Quotient;
  typedef typename DSL::Point Point;
  typedef typename DSL::ConstIterator ConstIterator;
  typedef typename DSL::Point2I Point2I;
  typedef typename DSL::Vector2I Vector2I;
  typedef ArithmeticalDSS<ConstIterator, Integer, 4> ADSS;

  ConstIterator it = D.begin( A );
  ConstIterator it_end = D.end( B );
  ADSS dss;
  dss.init( it );
  while ( ( dss.end() != it_end )
          && ( dss.extendForward() ) ) {}
  std::cout << D.a() << " " << D.b() << " " << D.mu() << " "
            << dss.getA() << " " << dss.getB() << " " << dss.getMu() << " "
            << A[0] << " " << A[1] << " " << B[0] << " " << B[1] 
            << std::endl;

  return true;
}
Ejemplo n.º 2
0
bool checkSubStandardDSLQ0( const DSL & D,
                            const typename DSL::Point & A, 
                            const typename DSL::Point & B ) 
{
  typedef typename DSL::Integer Integer;
  typedef typename DSL::ConstIterator ConstIterator;
  typedef ArithmeticalDSSComputer<ConstIterator, Integer, 4> ADSS;

  DSL S = D.reversedSmartDSS( A, B );
  ConstIterator it = D.begin( A );
  ConstIterator it_end = D.end( B );
  ADSS dss;
  dss.init( it );
  while ( ( dss.end() != it_end )
          && ( dss.extendFront() ) ) {}
  bool ok = S.a() == dss.a() 
    &&  S.b() == dss.b() 
    &&  S.mu() == dss.mu(); 
  if ( ! ok )
    {
      trace.info() << "-------------------------------------------------------"
                   << std::endl;
      trace.info() << "D = " << D // << " U1=" << U1 << " U2=" << U2
                   << " " << D.pattern().rE() << endl;
      trace.info() << "S(" << A << "," << B << ") = "
                   << S << " " << S.pattern() << endl;
      trace.info() << "ArithDSS = " << dss << std::endl;
    }
  // if ( ok )
  //   trace.info() << "========================== OK =========================";
  // else
  //   trace.info() << "eeeeeeeeeeeeeeeeeeeeeeeeee KO eeeeeeeeeeeeeeeeeeeeeeeee";
  // std::cerr << std::endl;
  return ok;
}
bool checkSubArithmeticDSS( const DSL & D,
                            const typename DSL::Point & A, 
                            const typename DSL::Point & B ) 
{
  typedef typename DSL::Integer Integer;
  typedef typename DSL::ConstIterator ConstIterator;
  typedef ArithmeticalDSSComputer<ConstIterator, Integer, 4> ADSS;

  ConstIterator it = D.begin( A );
  ConstIterator it_end = D.end( B );
  ADSS dss;
  dss.init( it );
  while ( ( dss.end() != it_end )
          && ( dss.extendFront() ) ) {}
  std::cout << D.a() << " " << D.b() << " " << D.mu() << " "
            << dss.a() << " " << dss.b() << " " << dss.mu() << " "
            << A[0] << " " << A[1] << " " << B[0] << " " << B[1] 
            << std::endl;

  return true;
}
Ejemplo n.º 4
0
bool rangeTest(const DSL& dsl)
{
  ASSERT( dsl.mu() == 0 ); 
  typedef typename DSL::Point Point; 

  unsigned int nbok = 0;
  unsigned int nb = 0;
  
  trace.beginBlock ( "Range/Iterator services..." );
  trace.info() << dsl << std::endl; 

  Point first(0,0); 
  Point last(dsl.b(), dsl.a()); 
  trace.info() << "from " << first << " to " << last << std::endl; 

  if (dsl.isValid())
    nbok++; 
  nb++; 

  trace.info() << "(" << nbok << "/" << nb << ") "
  	       << std::endl;

  {//forward pass  
    typedef typename DSL::ConstIterator I; 
    BOOST_CONCEPT_ASSERT(( boost_concepts::ReadableIteratorConcept<I> )); 
    BOOST_CONCEPT_ASSERT(( boost_concepts::BidirectionalTraversalConcept<I> ));
    bool res = true; 
    int c = 0; 
    for (I it = dsl.begin(first), itEnd = dsl.end(last); 
	 ( (it != itEnd)&&(res)&&(c<100) ); 
	 ++it, ++c)
      {
	trace.info() << "(" << it->operator[](0) << "," << it->operator[](1) << ") ";  
	if ( !dsl(*it) )
	  res = false; 
      }
    trace.info() << " : " << c << " points " << std::endl; 
    trace.info() << std::endl; 

    if ( (res)&&(c == (dsl.omega()+1)) ) 
      nbok++; 
    nb++;

    trace.info() << "(" << nbok << "/" << nb << ") "
		 << std::endl;
  }

  {//backward pass
    typedef typename DSL::ConstReverseIterator I; 
    BOOST_CONCEPT_ASSERT(( boost_concepts::ReadableIteratorConcept<I> )); 
    BOOST_CONCEPT_ASSERT(( boost_concepts::BidirectionalTraversalConcept<I> ));
    bool res = true; 
    int c = 0; 
    for (I it = dsl.rbegin(last), itEnd = dsl.rend(first); 
	 ( (it != itEnd)&&(res)&&(c<100) ); 
	 ++it, ++c)
      {
	trace.info() << "(" << it->operator[](0) << "," << it->operator[](1) << ") ";  
	if ( !dsl(*it) )
	  res = false; 
      }
    trace.info() << " : " << c << " points " << std::endl; 
    trace.info() << std::endl; 

    if ( (res)&&(c == (dsl.omega()+1)) ) 
      nbok++; 
    nb++;

    trace.info() << "(" << nbok << "/" << nb << ") "
		 << std::endl;
  }

  trace.endBlock();
  
  return nbok == nb;
}
Ejemplo n.º 5
0
bool rangeTest(const DSL& dsl)
{
  typedef typename DSL::Point Point; 

  unsigned int nbok = 0;
  unsigned int nb = 0;
  
  trace.beginBlock ( "Range/Iterator services..." );
  trace.info() << dsl << std::endl; 

  Point origin = dsl.getPoint();
  Point first = Point(origin[0]-dsl.b(), origin[1]-dsl.a());
  Point last = Point(first[0]+dsl.b(), first[1]+dsl.a()); 
  trace.info() << "from " << first << " to " << last << std::endl; 

  if (dsl.isValid())
    nbok++; 
  nb++; 

  trace.info() << "(" << nbok << "/" << nb << ") "
  	       << std::endl;

  {//forward pass  
    typedef typename DSL::ConstIterator I; 
    BOOST_CONCEPT_ASSERT(( boost_concepts::ReadableIteratorConcept<I> )); 
    BOOST_CONCEPT_ASSERT(( boost_concepts::RandomAccessTraversalConcept<I> ));
    bool res = true; 
    int c = 0; 
    for (I it = dsl.begin(first), itEnd = dsl.end(last); 
	 ( (it != itEnd)&&(res)&&(c<100) ); 
	 ++it, ++c)
      {
	trace.info() << "(" << it->operator[](0) << "," << it->operator[](1) << ") ";  
	if ( !dsl(*it) )
	  res = false; 
      }
    trace.info() << " : " << c << " points " << std::endl; 
    trace.info() << std::endl; 

    if ( (res)&&(c == (dsl.omega()+1)) ) 
      nbok++; 
    nb++;

    trace.info() << "(" << nbok << "/" << nb << ") "
		 << std::endl;
  }

  {//backward pass
    typedef typename DSL::ConstReverseIterator I; 
    BOOST_CONCEPT_ASSERT(( boost_concepts::ReadableIteratorConcept<I> )); 
    BOOST_CONCEPT_ASSERT(( boost_concepts::RandomAccessTraversalConcept<I> ));
    bool res = true; 
    int c = 0; 
    for (I it = dsl.rbegin(last), itEnd = dsl.rend(first); 
	 ( (it != itEnd)&&(res)&&(c<100) ); 
	 ++it, ++c)
      {
	trace.info() << "(" << it->operator[](0) << "," << it->operator[](1) << ") ";  
	if ( !dsl(*it) )
	  res = false; 
      }
    trace.info() << " : " << c << " points " << std::endl; 
    trace.info() << std::endl; 

    if ( (res)&&(c == (dsl.omega()+1)) ) 
      nbok++; 
    nb++;

    trace.info() << "(" << nbok << "/" << nb << ") "
		 << std::endl;
  }

  {//random access services  
    typedef typename DSL::ConstIterator I; 
    BOOST_CONCEPT_ASSERT(( boost_concepts::ReadableIteratorConcept<I> )); 
    BOOST_CONCEPT_ASSERT(( boost_concepts::RandomAccessTraversalConcept<I> ));
    bool res = true; 
    int c = 0; 
    I itBegin = dsl.begin(first); 
    for (I it = itBegin, itEnd = dsl.end(last); 
	 ( (it != itEnd)&&(res)&&(c<100) ); 
	 ++it, ++c)
      {
	trace.info() << "(" << it->operator[](0) << "," << it->operator[](1) << ") " << it.remainder() << ", ";  
	I it2 = ( itBegin + c ); 
	if ( (it != it2) || ((it2 - itBegin) != c) )
	  res = false; 
      }
    int n = c; 
    trace.info() << " : " << c << " points " << std::endl; 
    trace.info() << std::endl; 

    if (res) 
      nbok++; 
    nb++;

    trace.info() << "(" << nbok << "/" << nb << ") "
		 << std::endl;

    --n; 
    c = 0; 
    for (I it = (itBegin+n), itEnd = itBegin; 
	 ( (it!=itEnd)&&(res)&&(c < 100) );
	 --it, ++c )
      {
	trace.info() << "(" << it->operator[](0) << "," << it->operator[](1) << ") " << it.remainder() << ", ";  
	I it2 = ( (itBegin+n) - c ); 
	if ( (it != it2) || (((itBegin+n) - it2) != c) )
	  res = false; 
      }

    if (res) 
      nbok++; 
    nb++;

    trace.info() << "(" << nbok << "/" << nb << ") "
		 << std::endl;
  }


  trace.endBlock();
  
  return nbok == nb;
}