Correct rounding of GCell horizontal size in GCell::doGrid().

* Change: In Anabatic::GCell::doGrid(), the GCell where square using the
    slice height as side. This was leading to vertical edges with slightly
    different capacities when the vertical picth was not a multiple of
    the horizontal one. This was not a bug per se as the global router
    is able to manage any interval.
      Now the horizontal side is rounded on the slice step.
This commit is contained in:
Jean-Paul Chaput 2018-04-13 15:00:13 +02:00
parent cabbab5140
commit 580ca0892c
1 changed files with 12 additions and 7 deletions

View File

@ -771,11 +771,16 @@ namespace Anabatic {
bool openSession = Session::isOpen(); bool openSession = Session::isOpen();
if (not openSession) getAnabatic()->openSession(); if (not openSession) getAnabatic()->openSession();
DbU::Unit side = Session::getSliceHeight(); DbU::Unit vside = Session::getSliceHeight();
DbU::Unit hside = Session::getSliceHeight();
Interval hspan = getSide( Flags::Horizontal ); Interval hspan = getSide( Flags::Horizontal );
Interval vspan = getSide( Flags::Vertical ); Interval vspan = getSide( Flags::Vertical );
// if (hspan.getSize() < 2*side) { if (hside % Session::getSliceStep()) {
hside += Session::getSliceStep() - hside % Session::getSliceStep();
}
// if (hspan.getSize() < 2*hside) {
// cerr << Error( "GCell::doGrid(): GCell is too narrow (dx:%s) to build a grid.\n" // cerr << Error( "GCell::doGrid(): GCell is too narrow (dx:%s) to build a grid.\n"
// " (%s)" // " (%s)"
// , DbU::getValueString(hspan.getSize()).c_str() // , DbU::getValueString(hspan.getSize()).c_str()
@ -785,7 +790,7 @@ namespace Anabatic {
// return false; // return false;
// } // }
// if (vspan.getSize() < 2*side) { // if (vspan.getSize() < 2*vside) {
// cerr << Error( "GCell::doGrid(): GCell is too narrow (dy:%s) to build a grid.\n" // cerr << Error( "GCell::doGrid(): GCell is too narrow (dy:%s) to build a grid.\n"
// " (%s)" // " (%s)"
// , DbU::getValueString(vspan.getSize()).c_str() // , DbU::getValueString(vspan.getSize()).c_str()
@ -796,20 +801,20 @@ namespace Anabatic {
GCell* row = this; GCell* row = this;
GCell* column = NULL; GCell* column = NULL;
DbU::Unit ycut = vspan.getVMin()+side; DbU::Unit ycut = vspan.getVMin()+vside;
for ( ; ycut < vspan.getVMax() ; ycut += side ) { for ( ; ycut < vspan.getVMax() ; ycut += vside ) {
column = row; column = row;
row = row->hcut( ycut ); row = row->hcut( ycut );
row->setType( Flags::MatrixGCell ); row->setType( Flags::MatrixGCell );
for ( DbU::Unit xcut = hspan.getVMin()+side ; xcut < hspan.getVMax() ; xcut += side ) { for ( DbU::Unit xcut = hspan.getVMin()+hside ; xcut < hspan.getVMax() ; xcut += hside ) {
column = column->vcut( xcut ); column = column->vcut( xcut );
column->setType( Flags::MatrixGCell ); column->setType( Flags::MatrixGCell );
} }
} }
column = row; column = row;
for ( DbU::Unit xcut = hspan.getVMin()+side ; xcut < hspan.getVMax() ; xcut += side ) { for ( DbU::Unit xcut = hspan.getVMin()+hside ; xcut < hspan.getVMax() ; xcut += hside ) {
column = column->vcut( xcut ); column = column->vcut( xcut );
column->setType( Flags::MatrixGCell ); column->setType( Flags::MatrixGCell );
} }