diff --git a/alliance/src/nero/src/MDRGrid.cpp b/alliance/src/nero/src/MDRGrid.cpp index b7e9fb9f..5c649e1f 100644 --- a/alliance/src/nero/src/MDRGrid.cpp +++ b/alliance/src/nero/src/MDRGrid.cpp @@ -413,132 +413,3 @@ int CDRGrid::dz (int index, int d) return (index + d*XY); } - - - - -// ------------------------------------------------------------------- -// Destructor : "TMatrix::_CHollow::~_CHollow()". - -template -TMatrix<__CNode__>::_CHollow::~_CHollow (void) -{ - typename _CRow::iterator itRow; - typename _CLayer::iterator itLayer; - - - for (itLayer = nodes.begin (); - itLayer != nodes.end (); itLayer++) { - for (itRow = itLayer->second.begin (); - itRow != itLayer->second.end (); itRow++) { - delete itRow->second; - } - } -} - - - - -// ------------------------------------------------------------------- -// Method : "TMatrix::_CHollow::add()". - -template -__CNode__ &TMatrix<__CNode__>::_CHollow::add (int x, int y) -{ - typename _CRow::iterator itRow; - typename _CLayer::iterator itLayer; - - - itLayer = nodes.find (x); - if (itLayer == nodes.end ()) { nodes[x] = _CRow (); } - - itRow = nodes[x].find (y); - if (itRow == nodes[x].end ()) { nodes[x][y] = new __CNode__ (); } - - return (*(nodes[x][y])); -} - - - - -// ------------------------------------------------------------------- -// Method : "TMatrix::_CHollow::get()". - -template -__CNode__ *TMatrix<__CNode__>::_CHollow::get (int x, int y) -{ - typename _CRow::iterator itRow; - typename _CLayer::iterator itLayer; - - - itLayer = nodes.find (x); - if (itLayer == nodes.end ()) { return (NULL); } - - itRow = nodes[x].find (y); - if (itRow == nodes[x].end ()) { return (NULL); } - - return ((*itRow).second); -} - - - - -// ------------------------------------------------------------------- -// Constructor : "TMatrix::TMatrix()". - -template -TMatrix<__CNode__>::TMatrix (CDRGrid *drgrid) - : _drgrid(drgrid) - , hole () -{ - _grid = new __CNode__ [_drgrid->size]; -} - - - - -// ------------------------------------------------------------------- -// Destructor : "~TMatrix::TMatrix()". - -template -TMatrix<__CNode__>::~TMatrix (void) -{ - delete [] _grid; -} - - - - -// ------------------------------------------------------------------- -// Accessor : "TMatrix::&operator[]". - -template -__CNode__ &TMatrix<__CNode__>::operator[] (int index) -{ - if (index < _drgrid->XY ) { - __CNode__ *node = _zero.get (_drgrid->x(index), _drgrid->y(index)) ; - if ( node != NULL ) return ( *node ); - } else { - if (index < _drgrid->XYZ) return ( _grid[index - _drgrid->XY] ); - } - - return ( hole ); -} - - - - -// ------------------------------------------------------------------- -// Modifier : "TMatrix::add ()". - -template -__CNode__ &TMatrix<__CNode__>::add (int index) -{ - if (index < _drgrid->XY) { - return ( _zero.add (_drgrid->x(index), _drgrid->y(index)) ); - } else { - if (index < _drgrid->XYZ) return ( (*this)[index] ); - } - - return ( hole ); -} diff --git a/alliance/src/nero/src/MDefs.h b/alliance/src/nero/src/MDefs.h index a49d2201..929503fc 100644 --- a/alliance/src/nero/src/MDefs.h +++ b/alliance/src/nero/src/MDefs.h @@ -213,8 +213,6 @@ }; - - // --------------------------------------------------------------- // Detailed Routing Grid Class. @@ -340,6 +338,104 @@ }; + // --------------------------------------------------------------- + // Detailed Routing Matrix Class (methods) + + + template + TMatrix<__CNode__>::_CHollow::~_CHollow (void) + { + typename _CRow::iterator itRow; + typename _CLayer::iterator itLayer; + + + for (itLayer = nodes.begin (); + itLayer != nodes.end (); itLayer++) { + for (itRow = itLayer->second.begin (); + itRow != itLayer->second.end (); itRow++) { + delete itRow->second; + } + } + } + + + template + __CNode__ &TMatrix<__CNode__>::_CHollow::add (int x, int y) + { + typename _CRow::iterator itRow; + typename _CLayer::iterator itLayer; + + + itLayer = nodes.find (x); + if (itLayer == nodes.end ()) { nodes[x] = _CRow (); } + + itRow = nodes[x].find (y); + if (itRow == nodes[x].end ()) { nodes[x][y] = new __CNode__ (); } + + return (*(nodes[x][y])); + } + + + template + __CNode__ *TMatrix<__CNode__>::_CHollow::get (int x, int y) + { + typename _CRow::iterator itRow; + typename _CLayer::iterator itLayer; + + + itLayer = nodes.find (x); + if (itLayer == nodes.end ()) { return (NULL); } + + itRow = nodes[x].find (y); + if (itRow == nodes[x].end ()) { return (NULL); } + + return ((*itRow).second); + } + + + template + TMatrix<__CNode__>::TMatrix (CDRGrid *drgrid) + : _drgrid(drgrid) + , hole () + { + _grid = new __CNode__ [_drgrid->size]; + } + + + template + TMatrix<__CNode__>::~TMatrix (void) + { + delete [] _grid; + } + + + template + __CNode__ &TMatrix<__CNode__>::operator[] (int index) + { + if (index < _drgrid->XY ) { + __CNode__ *node = _zero.get (_drgrid->x(index), _drgrid->y(index)) ; + if ( node != NULL ) return ( *node ); + } else { + if (index < _drgrid->XYZ) return ( _grid[index - _drgrid->XY] ); + } + + return ( hole ); + } + + + template + __CNode__ &TMatrix<__CNode__>::add (int index) + { + if (index < _drgrid->XY) { + return ( _zero.add (_drgrid->x(index), _drgrid->y(index)) ); + } else { + if (index < _drgrid->XYZ) return ( (*this)[index] ); + } + + return ( hole ); + } + + // -------------------------------------------------------------------