From 05036113bfcfea9845b1e22c3bb86e742bcaf5e9 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 9 Mar 2010 15:25:53 +0000 Subject: [PATCH] * ./hurricane/src/hviewer, ./coriolis/src/crlcore, ./coriolis/src/knik, ./coriolis/src/katabatic, ./coriolis/src/kite, ./coriolis/src/equinox, ./coriolis/src/solstice, ./coriolis/src/ispd: - SVN MOVE: Source tree simplification & uniformisation. Now all tools are at the same level, directly under the root of the repository. No more "coriolis/src". --- solstice/CMakeLists.txt | 27 + solstice/cmake_modules/CMakeLists.txt | 1 + solstice/cmake_modules/FindSOLSTICE.cmake | 47 ++ solstice/src/Brick.cpp | 98 ++++ solstice/src/BrickSweepLine.cpp | 45 ++ solstice/src/CMakeLists.txt | 52 ++ solstice/src/DisconnectError.cpp | 59 +++ solstice/src/GraphicSolsticeEngine.cpp | 249 +++++++++ solstice/src/RoutingError.cpp | 55 ++ solstice/src/RoutingErrorInformations.cpp | 124 +++++ solstice/src/RoutingErrorListModel.cpp | 123 +++++ solstice/src/RoutingErrorListWidget.cpp | 218 ++++++++ solstice/src/ShortCircuitError.cpp | 105 ++++ solstice/src/SolsticeEngine.cpp | 487 ++++++++++++++++++ solstice/src/TabRoutingError.cpp | 184 +++++++ solstice/src/TabRoutingErrorList.cpp | 143 +++++ solstice/src/old/RoutingErrorInformations.cpp | 131 +++++ solstice/src/old/RoutingErrorModel.cpp | 145 ++++++ solstice/src/old/RoutingErrorWidget.cpp | 247 +++++++++ solstice/src/old/TabRoutingError.cpp | 184 +++++++ solstice/src/solstice/Brick.h | 110 ++++ solstice/src/solstice/BrickSweepLine.h | 45 ++ solstice/src/solstice/DisconnectError.h | 76 +++ solstice/src/solstice/GraphicSolsticeEngine.h | 112 ++++ solstice/src/solstice/RoutingError.h | 104 ++++ .../src/solstice/RoutingErrorInformations.h | 205 ++++++++ solstice/src/solstice/RoutingErrorListModel.h | 110 ++++ .../src/solstice/RoutingErrorListWidget.h | 221 ++++++++ solstice/src/solstice/ShortCircuitError.h | 117 +++++ solstice/src/solstice/SolsticeEngine.h | 137 +++++ solstice/src/solstice/TabRoutingError.h | 86 ++++ solstice/src/solstice/TabRoutingErrorList.h | 65 +++ .../solstice/olds/RoutingErrorInformations.h | 110 ++++ .../src/solstice/olds/RoutingErrorModel.h | 80 +++ .../src/solstice/olds/RoutingErrorWidget.h | 173 +++++++ 35 files changed, 4475 insertions(+) create mode 100644 solstice/CMakeLists.txt create mode 100644 solstice/cmake_modules/CMakeLists.txt create mode 100644 solstice/cmake_modules/FindSOLSTICE.cmake create mode 100644 solstice/src/Brick.cpp create mode 100644 solstice/src/BrickSweepLine.cpp create mode 100644 solstice/src/CMakeLists.txt create mode 100644 solstice/src/DisconnectError.cpp create mode 100644 solstice/src/GraphicSolsticeEngine.cpp create mode 100644 solstice/src/RoutingError.cpp create mode 100644 solstice/src/RoutingErrorInformations.cpp create mode 100644 solstice/src/RoutingErrorListModel.cpp create mode 100644 solstice/src/RoutingErrorListWidget.cpp create mode 100644 solstice/src/ShortCircuitError.cpp create mode 100644 solstice/src/SolsticeEngine.cpp create mode 100644 solstice/src/TabRoutingError.cpp create mode 100644 solstice/src/TabRoutingErrorList.cpp create mode 100644 solstice/src/old/RoutingErrorInformations.cpp create mode 100644 solstice/src/old/RoutingErrorModel.cpp create mode 100644 solstice/src/old/RoutingErrorWidget.cpp create mode 100644 solstice/src/old/TabRoutingError.cpp create mode 100644 solstice/src/solstice/Brick.h create mode 100644 solstice/src/solstice/BrickSweepLine.h create mode 100644 solstice/src/solstice/DisconnectError.h create mode 100644 solstice/src/solstice/GraphicSolsticeEngine.h create mode 100644 solstice/src/solstice/RoutingError.h create mode 100644 solstice/src/solstice/RoutingErrorInformations.h create mode 100644 solstice/src/solstice/RoutingErrorListModel.h create mode 100644 solstice/src/solstice/RoutingErrorListWidget.h create mode 100644 solstice/src/solstice/ShortCircuitError.h create mode 100644 solstice/src/solstice/SolsticeEngine.h create mode 100644 solstice/src/solstice/TabRoutingError.h create mode 100644 solstice/src/solstice/TabRoutingErrorList.h create mode 100644 solstice/src/solstice/olds/RoutingErrorInformations.h create mode 100644 solstice/src/solstice/olds/RoutingErrorModel.h create mode 100644 solstice/src/solstice/olds/RoutingErrorWidget.h diff --git a/solstice/CMakeLists.txt b/solstice/CMakeLists.txt new file mode 100644 index 00000000..c6d60d95 --- /dev/null +++ b/solstice/CMakeLists.txt @@ -0,0 +1,27 @@ +PROJECT(SOLSTICE) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0) +IF(COMMAND CMAKE_POLICY) + CMAKE_POLICY(SET CMP0003 NEW) +ENDIF(COMMAND CMAKE_POLICY) + +SET(CMAKE_C_FLAGS_DEBUG "-g -Wall" CACHE STRING "Debug options." FORCE) +SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall" CACHE STRING "Debug options." FORCE) +#SET(CMAKE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE) +#SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE) +#SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE) +#SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE) + +SET(CMAKE_MODULE_PATH "$ENV{HURRICANE_TOP}/share/cmake_modules/") + +SET(QT_USE_QTXML "true") + +FIND_PACKAGE(Qt4 REQUIRED) # find and setup Qt4 for this project +FIND_PACKAGE(HURRICANE REQUIRED) +FIND_PACKAGE(CORIOLIS REQUIRED) +FIND_PACKAGE(EQUINOX REQUIRED) + +SET_LIB_LINK_MODE() + +ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(cmake_modules) diff --git a/solstice/cmake_modules/CMakeLists.txt b/solstice/cmake_modules/CMakeLists.txt new file mode 100644 index 00000000..46c42f90 --- /dev/null +++ b/solstice/cmake_modules/CMakeLists.txt @@ -0,0 +1 @@ +install ( FILES FindSOLSTICE.cmake DESTINATION /share/cmake_modules ) diff --git a/solstice/cmake_modules/FindSOLSTICE.cmake b/solstice/cmake_modules/FindSOLSTICE.cmake new file mode 100644 index 00000000..363ee03c --- /dev/null +++ b/solstice/cmake_modules/FindSOLSTICE.cmake @@ -0,0 +1,47 @@ +# - Find the Solstice includes and libraries. +# The following variables are set if Coriolis is found. If SOLSTICE is not +# found, SOLSTICE_FOUND is set to false. +# SOLSTICE_FOUND - True when the Coriolis include directory is found. +# SOLSTICE_INCLUDE_DIR - the path to where the Coriolis include files are. +# SOLSTICE_LIBRARIES - The path to where the Coriolis library files are. + + +SET(SOLSTICE_INCLUDE_PATH_DESCRIPTION "directory containing the Solstice include files. E.g /usr/local/include/coriolis or /asim/coriolis/include/coriolis") + +SET(SOLSTICE_DIR_MESSAGE "Set the SOLSTICE_INCLUDE_DIR cmake cache entry to the ${SOLSTICE_INCLUDE_PATH_DESCRIPTION}") + +# don't even bother under WIN32 +IF(UNIX) + + SET(SOLSTICE_DIR_SEARCH $ENV{CORIOLIS_TOP} $ENV{HURRICANE_TOP}) + # + # Look for an installation. + # + FIND_PATH(SOLSTICE_INCLUDE_PATH NAMES solstice/Equi.h PATHS + # Look in other places. + ${SOLSTICE_DIR_SEARCH} + PATH_SUFFIXES include/coriolis + # Help the user find it if we cannot. + DOC "The ${SOLSTICE_INCLUDE_PATH_DESCRIPTION}" + ) + + FIND_LIBRARY(SOLSTICE_LIBRARY_PATH + NAMES solstice + PATHS ${SOLSTICE_DIR_SEARCH} + PATH_SUFFIXES lib + # Help the user find it if we cannot. + DOC "The ${SOLSTICE_INCLUDE_PATH_DESCRIPTION}" + ) + + FIND_LIBRARY(SOLSTICE_STATIC_LIBRARY_PATH + NAMES solstice-static + PATHS ${SOLSTICE_DIR_SEARCH} + PATH_SUFFIXES lib + # Help the user find it if we cannot. + DOC "The ${SOLSTICE_INCLUDE_PATH_DESCRIPTION}" + ) + + SET_LIBRARIES_PATH(SOLSTICE SOLSTICE) + HURRICANE_CHECK_LIBRARIES(SOLSTICE) + +ENDIF(UNIX) diff --git a/solstice/src/Brick.cpp b/solstice/src/Brick.cpp new file mode 100644 index 00000000..2c9f41c2 --- /dev/null +++ b/solstice/src/Brick.cpp @@ -0,0 +1,98 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./Brick.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + +#include + +#include "hurricane/Occurrence.h" +#include "hurricane/Box.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/DbU.h" + +#include "hurricane/Error.h" +#include "crlcore/Utilities.h" +#include + +#include + + + + +namespace Solstice { + + using namespace Hurricane; + using namespace std; + + + const DbU::Unit& Brick::getXmin() const { return _box.getXMin(); }; + const DbU::Unit& Brick::getYmin() const { return _box.getYMin(); }; + const DbU::Unit& Brick::getXmax() const { return _box.getXMax(); }; + const DbU::Unit& Brick::getYmax() const { return _box.getYMax(); }; + long Brick::GetLowPoint() const { return _box.getYMin(); } + long Brick::GetHighPoint() const { return _box.getYMax(); } + + bool Brick::isEmpty () const { return _box.isEmpty(); }; + + + Brick::Brick(const Occurrence& hypernet, const Occurrence& componentoccurrence, const Box& box, + BasicLayer* basiclayer) + : _hypernet(hypernet) + , _componentoccurrence(componentoccurrence) + , _box(box) + , _basicLayer(basiclayer) + { + + } + + Brick::~Brick() {}; + + + + + + Brick* Brick::create(const Occurrence& hypernet, const Occurrence& componentoccurrence, const Box& box, + BasicLayer* basiclayer) + { + Brick* brick = new Brick(hypernet, componentoccurrence, box, basiclayer); + if(!brick) { + throw Error("can't create Brick : allocation failed"); + } + + return brick; + } + + void Brick::destroy() { + delete this; + } + + string Brick::_getString() const { + string s = "< Brick " + getString(_hypernet) + " " + getString(_componentoccurrence) + " "; + s += "\n" + getString(_box) + " " + getString(_basicLayer->getName()) + " >"; + return s; + } + + +}// End of namespace Solstice + + + diff --git a/solstice/src/BrickSweepLine.cpp b/solstice/src/BrickSweepLine.cpp new file mode 100644 index 00000000..fa7fb911 --- /dev/null +++ b/solstice/src/BrickSweepLine.cpp @@ -0,0 +1,45 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./BrickSweepLine.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include "solstice/SolsticeEngine.h" +#include "solstice/Brick.h" +namespace Equinox { + + using Solstice::SolsticeEngine; + using Solstice::Brick; + + template class SweepLine; +} diff --git a/solstice/src/CMakeLists.txt b/solstice/src/CMakeLists.txt new file mode 100644 index 00000000..5ea3b3c6 --- /dev/null +++ b/solstice/src/CMakeLists.txt @@ -0,0 +1,52 @@ + + include ( ${QT_USE_FILE} ) + + include_directories ( ${SOLSTICE_SOURCE_DIR}/src + ${HURRICANE_INCLUDE_DIR} + ${CORIOLIS_INCLUDE_DIR} + ) + + + set ( includes solstice/Brick.h + solstice/ShortCircuitError.h + solstice/DisconnectError.h + solstice/SolsticeEngine.h + solstice/RoutingError.h + solstice/BrickSweepLine.h + solstice/RoutingErrorInformations.h + ) + set ( mocIncludes solstice/RoutingErrorListModel.h + solstice/RoutingErrorListWidget.h + solstice/TabRoutingErrorList.h + solstice/GraphicSolsticeEngine.h ) + + set ( cpps Brick.cpp + RoutingError.cpp + BrickSweepLine.cpp + SolsticeEngine.cpp + ShortCircuitError.cpp + GraphicSolsticeEngine.cpp + RoutingErrorListModel.cpp + DisconnectError.cpp + RoutingErrorListWidget.cpp + TabRoutingErrorList.cpp + RoutingErrorInformations.cpp + + ) + + qt4_wrap_cpp ( mocCpps ${mocIncludes} ) + + add_library ( solstice ${cpps} ${mocCpps} ) + target_link_libraries ( solstice ${EQUINOX_LIBRARIES} + ${CORIOLIS_LIBRARIES} + ${HURRICANE_LIBRARIES} + ${HURRICANE_GRAPHICAL_LIBRARIES} + ${QT_LIBRARIES} + ${LEFDEF_LIBRARIES} + ${OA_LIBRARIES} + ) + install ( TARGETS solstice DESTINATION /lib) + install ( FILES ${includes} + ${mocIncludes} DESTINATION /include/coriolis/solstice ) + + diff --git a/solstice/src/DisconnectError.cpp b/solstice/src/DisconnectError.cpp new file mode 100644 index 00000000..9bef27bb --- /dev/null +++ b/solstice/src/DisconnectError.cpp @@ -0,0 +1,59 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | | +// | Updater : Bodin bruno | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./DisconnectError.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x +#include +#include +#include +#include +#include +#include + +namespace Solstice { + + using namespace Hurricane; + DisconnectError::DisconnectError(Cell*cell, const Occurrence& occurrence, int count) : + RoutingError(cell,count), + _occurrence(occurrence) + { + + if (dynamic_cast(occurrence.getEntity())) + forEach ( Component*, component, dynamic_cast(occurrence.getEntity())->getComponents() ) { + _occurrences->insert(Occurrence ( *component ) ); + } + // _area = occurrence.getBoundingBox(); + _area = Box(); + } + DisconnectError::~DisconnectError() {}; + + + + string DisconnectError::getErrorDescription () const + { + return "Deconnexion du Net " + _occurrence.getEntity()->_getString() ; + } ; + + +} // End of Solstice namespace. diff --git a/solstice/src/GraphicSolsticeEngine.cpp b/solstice/src/GraphicSolsticeEngine.cpp new file mode 100644 index 00000000..ddb401e5 --- /dev/null +++ b/solstice/src/GraphicSolsticeEngine.cpp @@ -0,0 +1,249 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./GraphicSolsticeEngine.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + + +namespace Solstice { + + using namespace std; + using Hurricane::Error; + using Hurricane::Warning; + using Hurricane::Graphics; + using CRL::AllianceFramework; + + +// ------------------------------------------------------------------- +// Class : "CRL::GraphicSolsticeEngine". + + + size_t GraphicSolsticeEngine::_references = 0; + GraphicSolsticeEngine* GraphicSolsticeEngine::_singleton = NULL; + + + SolsticeEngine* GraphicSolsticeEngine::createEngine ( ) + { + Cell* cell = getCell (); + + SolsticeEngine* solstice = SolsticeEngine::get ( cell ); + if ( !solstice ) { + solstice = SolsticeEngine::create ( cell ); + } + return solstice; + } + + + + + void GraphicSolsticeEngine::initSolsticeRoutingError ( CellWidget* widget ) + { + // QPainter& painter = widget->getPainter(); + + + } + + + void GraphicSolsticeEngine::drawSolsticeRoutingError ( CellWidget* widget + , const Go* go + , const BasicLayer* basicLayer + , const Box& box + , const Transformation& transformation + ) + { + const RoutingError* error = static_cast(go); + QPainter& painter = widget->getPainter(); + QColor c = QColor(Qt::red); + c.setAlpha(100); + c = c.darker(widget->getDarkening()); + painter.setPen (QPen(c,15)); + painter.setBrush(c); + painter.drawRect ( widget->dbuToDisplayRect(error->getBoundingBox()) ); + } + + + + + + + + GraphicSolsticeEngine* GraphicSolsticeEngine::grab () + { + if ( !_references ) + _singleton = new GraphicSolsticeEngine (); + _references++; + return _singleton; + } + + + const Name& GraphicSolsticeEngine::getName () const + { return SolsticeEngine::getStaticName(); } + + + + + Cell* GraphicSolsticeEngine::getCell () + { + if ( !_viewer ) { + throw Error ( "Solstice: GraphicSolsticeEngine not bound to any Viewer." ); + return NULL; + } + + if ( !_viewer->getCell() ) { + throw Error ( "Solstice: No Cell is loaded into the Viewer." ); + return NULL; + } + + return _viewer->getCell(); + } + + + + size_t GraphicSolsticeEngine::release () + { + _references--; + if ( !_references ) { + delete _singleton; + _singleton = NULL; + } + return _references; + } + + + + void GraphicSolsticeEngine::addToMenu ( CellViewer* viewer ) + { + assert ( _viewer == NULL ); + _viewer = viewer; + + QMenu* prMenu = _viewer->findChild("viewer.menuBar.extract"); + if ( !prMenu ) { + throw("Solstice doit être chargé avant Equinox (c'est plus convenable , Non ??"); + } + + + + QAction* gTestAction = _viewer->findChild("viewer.menuBar.extract.solstice.test"); + if ( gTestAction ) + cerr << Warning("GraphicSolsticeEngine::addToMenu() - Solstice test already hooked in.") << endl; + else { + gTestAction = new QAction ( tr("Solstice - Testing"), _viewer ); + gTestAction->setObjectName ( "viewer.menuBar.extract.test" ); + gTestAction->setStatusTip ( tr("Run the Solstice Test") ); + gTestAction->setVisible ( true ); + prMenu->addAction ( gTestAction ); + + connect ( gTestAction, SIGNAL(triggered()), this, SLOT(test()) ); + } + + // fin du sous menu + + connect ( this, SIGNAL(cellPreModificated ()), _viewer->getCellWidget(), SLOT(cellPreModificate ()) ); + connect ( this, SIGNAL(cellPostModificated()), _viewer->getCellWidget(), SLOT(cellPostModificate()) ); + } + + + + void GraphicSolsticeEngine::test () + { + SolsticeEngine* solstice = createEngine ( ); + if ( !solstice ) return; + + emit cellPreModificated (); + + solstice->compare (); + + emit cellPostModificated (); + _viewer->dumpObjectTree(); + QTabWidget* ctrlTab = _viewer->getControllerWidget(); + if (ctrlTab) { + ctrlTab->addTab ( _tabRoutingErrorList , "RoutingError" ); + (static_cast((_tabRoutingErrorList)))->setCellWidget ( _viewer->getCellWidget() ); + + PaletteWidget* palette = ctrlTab->findChild("controller.tabPalette.palette"); + if (palette) + { + palette->setItemVisible(RoutingError::_extensionName,true); + } else { + throw Warning("l'onglet controller.tabPalette.palette n'existe pas"); + } + + }else { + throw Warning("Le panel des erreurs de s'affichera pas"); + } + + } + + + GraphicSolsticeEngine::GraphicSolsticeEngine () + : GraphicTool () + , _viewer (NULL) + , _tabRoutingErrorList (new TabRoutingErrorList()) + { + _tabRoutingErrorList ->setObjectName ( "controller.tabRoutingErrorList" ); + addDrawGo ( RoutingError::_extensionName , initSolsticeRoutingError , drawSolsticeRoutingError ); + + } + + + GraphicSolsticeEngine::~GraphicSolsticeEngine() + { + // destruction des outils graphiques + //removeDrawGo ( RoutingError::_extensionName ); + //_tabRoutingErrorList->destroy(); + + // destruction de solstice + cout << "get cell" <destroy(); + + + } + + +} // End of Solstice namespace. diff --git a/solstice/src/RoutingError.cpp b/solstice/src/RoutingError.cpp new file mode 100644 index 00000000..e174aa50 --- /dev/null +++ b/solstice/src/RoutingError.cpp @@ -0,0 +1,55 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | | +// | Updater : Bodin bruno | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./RoutingError.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +#include +#include + +namespace Solstice { + + const Name RoutingError::_extensionName = "Solstice::RoutingError"; + + RoutingError::~RoutingError() {}; + + RoutingError::RoutingError(Cell* cell,int count): + ExtensionGo(cell), + _cell(cell), + _area(), + _count(count) + { + _occurrences = new set; + } + + + void RoutingError::translate ( const DbU::Unit& dx, const DbU::Unit& dy ) + { + // cout << "Translate !! " << endl; + } + + +} // End of Solstice namespace. diff --git a/solstice/src/RoutingErrorInformations.cpp b/solstice/src/RoutingErrorInformations.cpp new file mode 100644 index 00000000..515af2e4 --- /dev/null +++ b/solstice/src/RoutingErrorInformations.cpp @@ -0,0 +1,124 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./RoutingErrorInformations.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include + +#include "hurricane/Name.h" +#include "solstice/RoutingError.h" +#include "solstice/RoutingErrorInformations.h" + + +namespace Solstice { + + +// ------------------------------------------------------------------- +// Class : "RoutingErrorInformations" + + + int RoutingErrorInformations::getColumnCount () + { return 1; } + + + QVariant RoutingErrorInformations::getColumnName ( int column ) + { + switch ( column ) { + case 0: return QVariant(QObject::tr("RoutingError")); + } + return QVariant(QObject::tr("Column Out of Bound")); + } + + + QVariant RoutingErrorInformations::getColumn ( int column ) + { + switch ( column ) { + case 0: return QVariant(getString(getName()).c_str()); + } + return QVariant(QObject::tr("Column Out of Bound")); + } + + + RoutingErrorInformations::RoutingErrorInformations ( const RoutingError* routingError ) + : _routingError(routingError) + { } + + + RoutingErrorInformations::~RoutingErrorInformations () + { } + + +// ------------------------------------------------------------------- +// Class : "SimpleRoutingErrorInformations" + + string SimpleRoutingErrorInformations::getDescription() const { + return _routingError->getErrorDescription(); + } + + + + int SimpleRoutingErrorInformations::getColumnCount () + { return 3; } + + + QVariant SimpleRoutingErrorInformations::getColumnName ( int column ) + { + switch ( column ) { + case 0: return QVariant(QObject::tr("RoutingError")); + case 1: return QVariant(QObject::tr("Equipotentials")); + case 2: return QVariant(QObject::tr("Description")); + } + return QVariant(QObject::tr("Column Out of Bound")); + } + + + QVariant SimpleRoutingErrorInformations::getColumn ( int column ) + { + switch ( column ) { + case 0: return QVariant(getString(getName()).c_str()); + case 1: return QVariant((unsigned int)_routingError->getCount()); + case 2: return QVariant(getString( getDescription()).c_str()); + } + return QVariant(QObject::tr("Column Out of Bound")); + } + + + SimpleRoutingErrorInformations::SimpleRoutingErrorInformations ( const RoutingError* routingError ) + : RoutingErrorInformations(routingError) + , _plugsCount(_routingError->getAllOccurrences()->size()) + { } + + + SimpleRoutingErrorInformations::~SimpleRoutingErrorInformations () + { } + + +// ------------------------------------------------------------------- +// Class : "AbstractRoutingErrorInformationsVector" + + + AbstractRoutingErrorInformationsVector::~AbstractRoutingErrorInformationsVector () + { } + + +} // End of Hurricane namespace. diff --git a/solstice/src/RoutingErrorListModel.cpp b/solstice/src/RoutingErrorListModel.cpp new file mode 100644 index 00000000..0c74e844 --- /dev/null +++ b/solstice/src/RoutingErrorListModel.cpp @@ -0,0 +1,123 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./RoutingErrorlistModel.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + + +#include +#include + +#include "hurricane/Name.h" + +#include "hurricane/Cell.h" +#include "hurricane/viewer/Graphics.h" +#include "solstice/RoutingError.h" +#include "solstice/RoutingErrorInformations.h" +#include "solstice/RoutingErrorListModel.h" + + +namespace Solstice { + + + RoutingErrorListModel::RoutingErrorListModel ( QObject* parent ) + : QAbstractTableModel(parent) + , _cell(NULL) + , _routingErrorList(NULL) + { } + + + RoutingErrorListModel::~RoutingErrorListModel () + { + if ( _routingErrorList ) delete _routingErrorList; + } + + + QVariant RoutingErrorListModel::data ( const QModelIndex& index, int role ) const + { + static QFont nameFont = Graphics::getFixedFont ( QFont::Bold ); + static QFont valueFont = Graphics::getFixedFont ( QFont::Normal, true ); + + if ( role == Qt::SizeHintRole ) { + switch (index.column()) { + case 0: return 200; + default: return -1; + } + } + + if ( role == Qt::FontRole ) { + switch (index.column()) { + case 0: return nameFont; + default: return valueFont; + } + } + + if ( !index.isValid() ) return QVariant (); + + if ( role == Qt::DisplayRole ) { + int row = index.row (); + return _routingErrorList->getRow(row)->getColumn(index.column()); + } + return QVariant(); + } + + + QVariant RoutingErrorListModel::headerData ( int section + , Qt::Orientation orientation + , int role ) const + { + if ( ( orientation == Qt::Vertical ) || (role != Qt::DisplayRole) ) + return QVariant(); + + if ( !_routingErrorList ) { + if ( section == 0 ) return QVariant("RoutingError"); + return QVariant(); + } + + if ( section < _routingErrorList->getColumnCount() ) + return _routingErrorList->getColumnName(section); + + return QVariant(); + } + + + int RoutingErrorListModel::rowCount ( const QModelIndex& parent ) const + { + return (_routingErrorList) ? _routingErrorList->size() : 0; + } + + + int RoutingErrorListModel::columnCount ( const QModelIndex& parent ) const + { + return (_routingErrorList) ? _routingErrorList->getColumnCount() : 1; + } + + + const RoutingError* RoutingErrorListModel::getRoutingError ( int row ) + { + if ( !_routingErrorList || ( row >= (int)_routingErrorList->size() ) ) return NULL; + + return _routingErrorList->getRow(row)->getRoutingError(); + } + + +} // End of Hurricane namespace. diff --git a/solstice/src/RoutingErrorListWidget.cpp b/solstice/src/RoutingErrorListWidget.cpp new file mode 100644 index 00000000..7f26070d --- /dev/null +++ b/solstice/src/RoutingErrorListWidget.cpp @@ -0,0 +1,218 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// + +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./RoutingErrorListWidget.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + +#include + + +#include +#include +#include +#include + + + + +namespace Solstice { + + + RoutingErrorListWidget::RoutingErrorListWidget ( QWidget* parent ) + : QWidget (parent) + , _cellWidget (NULL) + , _cell (NULL) + , _baseModel (new RoutingErrorListModel(this)) + , _sortModel (new QSortFilterProxyModel(this)) + , _view (new QTableView(this)) + , _rowHeight (20) + , _selecteds () + , _forceReselect(false) + { + setAttribute ( Qt::WA_DeleteOnClose ); + setAttribute ( Qt::WA_QuitOnClose, false ); + setContextMenuPolicy ( Qt::ActionsContextMenu ); + + _rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4; + + _sortModel->setSourceModel ( _baseModel ); + _sortModel->setDynamicSortFilter ( true ); + _sortModel->setFilterKeyColumn ( 0 ); + + _view->setShowGrid(false); + _view->setAlternatingRowColors(true); + _view->setSelectionBehavior(QAbstractItemView::SelectRows); + _view->setSortingEnabled(true); + _view->setModel ( _sortModel ); + _view->horizontalHeader()->setStretchLastSection ( true ); + + QHeaderView* horizontalHeader = _view->horizontalHeader (); + horizontalHeader->setStretchLastSection ( true ); + horizontalHeader->setMinimumSectionSize ( 200 ); + + QHeaderView* verticalHeader = _view->verticalHeader (); + verticalHeader->setVisible ( false ); + + _filterPatternLineEdit = new QLineEdit(this); + QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this); + filterPatternLabel->setBuddy(_filterPatternLineEdit); + + QGridLayout* gLayout = new QGridLayout(); + gLayout->addWidget(_view , 1, 0, 1, 2); + gLayout->addWidget(filterPatternLabel , 2, 0); + gLayout->addWidget(_filterPatternLineEdit, 2, 1); + + setLayout ( gLayout ); + + + + QAction* fitErrorAction = new QAction ( tr("&Fit to Error"), this ); + fitErrorAction->setShortcut ( QKeySequence(tr("CTRL+F")) ); + fitErrorAction->setStatusTip ( tr("Fit the view to the Routing Error bounding box") ); + addAction ( fitErrorAction ); + + connect ( _filterPatternLineEdit , SIGNAL(textChanged(const QString &)) + , this , SLOT (textFilterChanged()) ); + connect ( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)) + , this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) ); + connect ( _baseModel, SIGNAL(layoutChanged()), this, SLOT(forceRowHeight ()) ); + + connect ( fitErrorAction , SIGNAL(triggered ()), this, SLOT(fitToError ()) ); + + + resize(300, 300); + } + + void RoutingErrorListWidget::fitToError () + { + const RoutingError* routingError = _baseModel->getRoutingError ( _sortModel->mapToSource(_view->currentIndex()).row() ); + + if ( routingError ) + { + _cellWidget->reframe(routingError->getBoundingBox().getInflated(DbU::lambda(30)),true); + } + } + + void RoutingErrorListWidget::forceRowHeight () + { + for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- ) + _view->setRowHeight ( rows, _rowHeight ); + } + + + void RoutingErrorListWidget::goTo ( int delta ) + { + if ( delta == 0 ) return; + + QModelIndex newIndex = _sortModel->index ( _view->currentIndex().row()+delta, 0, QModelIndex() ); + + if ( newIndex.isValid() ) + _view->selectRow ( newIndex.row() ); + } + + + void RoutingErrorListWidget::updateSelecteds () + { + _forceReselect = true; + + QItemSelection dummy; + updateSelecteds ( dummy, dummy ); + } + + + void RoutingErrorListWidget::updateSelecteds ( const QItemSelection& , const QItemSelection& ) + { + if ( _cellWidget ) _cellWidget->openRefreshSession (); + + _selecteds.resetAccesses (); + + const RoutingError* routingError; + QModelIndexList iList = _view->selectionModel()->selectedRows(); + for ( int i=0 ; igetRoutingError ( _sortModel->mapToSource(iList[i]).row() ); + if ( routingError ) { + + _selecteds.insert ( routingError ); + } + } + if ( _forceReselect ) { + _selecteds.forceInserteds(); + _forceReselect = false; + } + + SelectedRoutingErrorSet::iterator remove; + SelectedRoutingErrorSet::iterator isel = _selecteds.begin (); + + while ( isel != _selecteds.end() ) { + + switch ( isel->getAccesses() ) { + case 1: break; + case 64: + for(set::iterator i = isel->getRoutingError()->getAllOccurrences()->begin();i != isel->getRoutingError()->getAllOccurrences()->end();i++) + { + emit occurrenceSelected ( *i ); + } + break; + case 0: + for(set::iterator i = isel->getRoutingError()->getAllOccurrences()->begin();i != isel->getRoutingError()->getAllOccurrences()->end();i++) + { + emit occurrenceUnselected ( *i ); + } + remove = isel; + ++isel; + _selecteds.erase ( remove ); + continue; + default: + cerr << Bug("RoutingErrorListWidget::updateSelecteds(): invalid code %d" + ,isel->getAccesses()) << endl; + } + ++isel; + } + + if ( _cellWidget ) _cellWidget->closeRefreshSession (); + _cellWidget->refresh(); + } + + + void RoutingErrorListWidget::textFilterChanged () + { + _sortModel->setFilterRegExp ( _filterPatternLineEdit->text() ); + forceRowHeight (); + } + + + +} // End of Hurricane namespace. diff --git a/solstice/src/ShortCircuitError.cpp b/solstice/src/ShortCircuitError.cpp new file mode 100644 index 00000000..eb9409ea --- /dev/null +++ b/solstice/src/ShortCircuitError.cpp @@ -0,0 +1,105 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | | +// | Updater : Bodin bruno | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./ShortCircuitError.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x +#include +#include +#include +#include + +namespace Solstice { + + using namespace Hurricane; + + + + + ShortCircuitError::ShortCircuitError(Cell*cell, const Occurrence&occurrence1, const Occurrence&occurrence2) + : RoutingError(cell,1) + { + _errorOccurrences = new set; + _errorOccurrences->insert(occurrence1); + _errorOccurrences->insert(occurrence2); + + if(occurrence1 < occurrence2) { + _occurrence1 = occurrence2; + _occurrence2 = occurrence1; + } + else { + _occurrence1 = occurrence1; + _occurrence2 = occurrence2; + } + + _hypernet1 = SolsticeEngine::getTopNetOccurrence(_occurrence1); + _hypernet2 = SolsticeEngine::getTopNetOccurrence(_occurrence2); + _shortcircuitarea = _occurrence1.getBoundingBox().getIntersection(_occurrence2.getBoundingBox()); + + + // forEach ( Component*, component, dynamic_cast(_hypernet1.getEntity())->getComponents() ) { + // _occurrences->insert(Occurrence ( *component , _hypernet1.getPath() ) ); + // } + // + // forEach ( Component*, component, dynamic_cast(_hypernet2.getEntity())->getComponents() ) { + // _occurrences->insert(Occurrence ( *component , _hypernet2.getPath()) ); + // } + //_occurrences->insert(Occurrence(this)); + + _occurrences->insert(_hypernet1); + _occurrences->insert(_hypernet2); + + _area = _occurrence1.getBoundingBox().getUnion(_occurrence2.getBoundingBox()); + _area = _shortcircuitarea; + }; + + + + + + + string ShortCircuitError::getErrorDescription ()const + { + return "contact invalide entre " + + (_hypernet1).getEntity()->_getString() + " et " + + (_hypernet2).getEntity()->_getString() ; + }; + + + const Name& ShortCircuitError::getName () const {return _extensionName;} ; + int ShortCircuitError::getCount() const {return 1;}; + set* ShortCircuitError::getErrorOccurrences () const {return _errorOccurrences;}; + + +string ShortCircuitError::_getString() const +// ***************************************** +{ + string s = " " + getString(getCell()->getName()) + " : Short-Circuit happen at the position : "; + s += getString(_shortcircuitarea) ; + s += "\n between " + getString(_occurrence1) + " of " + getString(_occurrence1.getBoundingBox()) + " of HyperNet " + getString(_hypernet1); + s += "\n and " + getString(_occurrence2) + " of " + getString(_occurrence2.getBoundingBox()) + " of HyperNet " + getString(_hypernet2); + return s; +} + + +} // End of Solstice namespace. diff --git a/solstice/src/SolsticeEngine.cpp b/solstice/src/SolsticeEngine.cpp new file mode 100644 index 00000000..7e363f6a --- /dev/null +++ b/solstice/src/SolsticeEngine.cpp @@ -0,0 +1,487 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./SolsticeEngine.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include + +namespace Solstice { + + + using namespace std; + using namespace Hurricane; + using Equinox::DefaultStrategy; + using Equinox::EquinoxEngine; + using Equinox::Equi; + using Equinox::CompByXmin; + using Equinox::CompByXmax; + + // ------------------------------------------------------------------- + // Class : "Solstice::SolsticeEngine". + + Name SolsticeEngine::_toolName = "Solstice"; + Strategy * SolsticeEngine::_strategy = NULL; + + + + void SolsticeEngine::setStrategy (Strategy * s) + { + if (_strategy) + delete _strategy; + _strategy = s; + }; + + Strategy* SolsticeEngine::getStrategy () + { + if (!_strategy) { + _strategy = new DefaultStrategy(); + } + return _strategy; + } + + + Cell* SolsticeEngine::getCommonPath(Path path1, Path path2, Path& newpath1, Path& newpath2) + { + Instance * instance1 = path1.getHeadInstance(); + Instance * instance2 = path2.getHeadInstance(); + Path commonpath; + + while(instance1==instance2) + { + if(!instance1) break; + + path1 = path1.getTailPath(); + path2 = path2.getTailPath(); + + commonpath = commonpath.isEmpty()?Path(instance1):Path(commonpath, instance1); + + if(path1.isEmpty()) break; + if(path2.isEmpty()) break; + + instance1 = path1.getHeadInstance(); + instance2 = path2.getHeadInstance(); + } + + newpath1 = path1; + newpath2 = path2; + + if (commonpath.isEmpty()) + { + return NULL; + } + else + { + return commonpath.getMasterCell(); + } + } + + SolsticeEngine* SolsticeEngine::create (Cell* cell) + { + SolsticeEngine* solstice = new SolsticeEngine ( cell ); + + if(!solstice){ + throw Error("can't create Solstice : allocation failed"); + } + + solstice->_postCreate (); + return solstice; + } + + + void SolsticeEngine::_depthCreate(Cell * cell) + { + forEach(Instance*,instance, cell->getInstances()) + { + Cell * subcell = (*instance)->getMasterCell(); + SolsticeEngine * solstice = get(subcell); + if( (!(subcell->isLeaf())) && (!solstice) ) { + _depthCreate(subcell); + } + } + SolsticeEngine * solstice = get(cell); + if(!solstice) + create(cell); + } + + + SolsticeEngine* SolsticeEngine::get (const Cell* cell ) + { + return static_cast(ToolEngine::get(cell,_toolName)); + } + + + Record* SolsticeEngine::_getRecord () const + { + Record* record = ToolEngine::_getRecord (); + return ( record ); + } + + + SolsticeEngine::~SolsticeEngine () + { + } + + SolsticeEngine::SolsticeEngine (Cell* cell): + ToolEngine(cell), + _isCompared(false), + _routingErrors() + { + _routingErrors = new set; + } + + + + + + + + + + + void SolsticeEngine::_depthDestroy() + { + if(_cell->isLeaf()) + return ; + else { + forEach(Instance*,instance, _cell->getInstances()) + { + Cell * cell = (*instance)->getMasterCell(); + SolsticeEngine * solstice = get(cell); + if(solstice) solstice->_depthDestroy(); + } + this->destroy(); + } + } + + + + void SolsticeEngine::compare() + { + // Verify the extractor Equinox + // ****************************** + EquinoxEngine * equinox = EquinoxEngine::get(_cell); + if(!equinox){ + throw Error("Can't do comparison, because the extractor haven't been created"); + } + + if(!(equinox->isExtracted())) { + throw Error("Can't do comparison, because the extraction haven't been done"); + } + + // Create CEngine Solstice for all models except standards models. + // ***************************************************************** + _depthCreate(_cell); + + // If repeat Comparison, flush those olds errors and reset flags to false. + // ************************************************************************* + if(isCompared()) flushErrors(); + + // Run comparison and Print Statistique datas. + // ********************************************* + runComparison(); + + } + + + + + + void SolsticeEngine::runComparison() + { + map > map_hypernet2hyperequi; + set hypernets; + EquinoxEngine * equinox = Equinox::EquinoxEngine::get(_cell); + + forEach(Equi*,equi, equinox->getRoutingEquis()) + { + forEach(Occurrence,occurrence, (*equi)->getAllOccurrences()) + { + + // Check Net Power/Ground/Global + //******************************* + Net * net = dynamic_cast((*occurrence).getEntity()); + if(!net) + net = dynamic_cast((*occurrence).getEntity())->getNet(); + + if(net->isGlobal() || net->isGround() || net->isPower()) { + continue; + } + + + // Add HyperNet + //************** + Occurrence hypernet = getTopNetOccurrence((*occurrence)); +#ifdef ASSERT + assert(isHyperNetRootNetOccurrence(hypernet)); +#endif + hypernets.insert(hypernet); + map_hypernet2hyperequi[hypernet].insert((*equi)); + + } //end of forEach occurrence + + + // ShortCircuits Detection + //************************* + if(hypernets.size() > 1) { + cmess1 << "[BUG] ShortCircuit Detection with " << hypernets.size() << " nets on same Equi" << endl; + for (set::iterator i = hypernets.begin() ; i!= hypernets.end();i++) + cmess1 << " - Net " << (*i).getEntity()->_getString() << endl; + detectShortCircuit((*equi)); + } + + hypernets.clear(); + + } //end of forEach equi + + + // Disconnects Detection + //*********************** + for (map >::iterator i = map_hypernet2hyperequi.begin(); + i != map_hypernet2hyperequi.end(); + i++) + { + if( (*i).second.size()>1 ) { + cmess1 << "[BUG] Disconnection Detection with " << (*i).second.size() << " equi for net " << (*i).first.getEntity()->_getString() << endl; + + for (set::iterator j = (*i).second.begin(); + j != (*i).second.end(); + j++) + { + cmess1 << " - " << (*j) << endl ; + forEach(Occurrence,k,(*j)->getAllOccurrences()) { + cmess1 << " - " << (*k) << endl ; + } + } + + this->_routingErrors->insert(DisconnectError::create(getCell(),Occurrence((*i).first),(*i).second.size())); + + } + } + + map_hypernet2hyperequi.clear(); + setIsComparedTrue(_cell); + } + + + + + Occurrence SolsticeEngine::getTopNetOccurrence(Occurrence occurrence) + { + Path path = occurrence.getPath(); + + if( path.isEmpty() ) { + Net * net = dynamic_cast(occurrence.getEntity()); + if(net) { + return occurrence; + } + else { + Component * component = dynamic_cast(occurrence.getEntity()); + if(!component) + throw Error("Unknow occurrence in EQUINOX::GetUpperNetOccurrence()"); + return Occurrence(component->getNet()); + } + } + else { + Net * net = dynamic_cast(occurrence.getEntity()); + + if(net) { + if( !(net->isExternal()) ) + return occurrence; + Instance * tailinstance = path.getTailInstance(); + Plug * plug = tailinstance->getPlug(net); + + if( !(plug->isConnected()) ) + return occurrence; + + + Net * uppernet = plug->getNet(); + return getTopNetOccurrence(Occurrence(uppernet, path.getHeadPath())); + } + else { + Component* component = dynamic_cast(occurrence.getEntity()); + return getTopNetOccurrence(Occurrence(component->getNet(), occurrence.getPath())); + } + } + } + + + + void SolsticeEngine::detectShortCircuit(Equi* equi) + { + + // Create Bricks for all component occurrences in this hyper-equi. + // *************************************************************** + vector* BricksByXmin = new vector ; + vector* BricksByXmax = new vector ; + + forEach(Occurrence,occurrence, equi->getEquiComponentOccurrences()) { + Occurrence hypernet = getTopNetOccurrence((*occurrence)); + Component* component = dynamic_cast((*occurrence).getEntity()); + + Box box = (*occurrence).getBoundingBox(); + + forEach ( BasicLayer*, i, component->getLayer()->getBasicLayers() ) + if (Strategy::isExtractableLayer(*i)) + { + + Brick * brick = Brick::create(hypernet, (*occurrence), box, *i); + BricksByXmin->push_back(brick); + BricksByXmax->push_back(brick); + } + } + + + + // Sort these two tables. + // ********************* + sort< vector::iterator , CompByXmin > ( BricksByXmin->begin(), BricksByXmin->end(), CompByXmin() ); + sort< vector::iterator , CompByXmax > ( (BricksByXmax->begin()), BricksByXmax->end(), CompByXmax() ); + + + BrickSweepLine* sweepLine = BrickSweepLine::create(this,getStrategy()); + + sweepLine->run(BricksByXmin,BricksByXmax,false,0); + + } + + + + + + + void SolsticeEngine::setIsComparedTrue(Cell * cell) + { + SolsticeEngine * solstice = get(cell); + solstice->setIsCompared(true); + + forEach(Instance*,instance, cell->getInstances()) + { + Cell * subcell = (*instance)->getMasterCell(); + SolsticeEngine * solstice = get(subcell); + if( (!(subcell->isLeaf())) && (!(solstice->isCompared())) ) + setIsComparedTrue(subcell); + } + } + + + void SolsticeEngine::getAllSolstices(Cell* cell, set& solstices) + { + SolsticeEngine* solstice = get(cell); + solstices.insert(solstice); + forEach(Instance*,instance, cell->getInstances()) + { + Cell * subcell = (*instance)->getMasterCell(); + if( (!(subcell->isLeaf())) ) + getAllSolstices(subcell, solstices); + } + } + + + + void SolsticeEngine::insertInterval ( Brick*brick ,stack * enumResultStack) + { + while( !(enumResultStack->empty()) ) { + Brick* findedbrick = dynamic_cast(enumResultStack->top()); + enumResultStack->pop(); + if(findedbrick->getHyperNet()!=brick->getHyperNet()) { // Shorts-Circuits + Occurrence occurrence1 = brick->getComponentOccurrence(); + Occurrence occurrence2 = findedbrick->getComponentOccurrence(); + Path newpath1; + Path newpath2; + + Cell * errorcell = getCommonPath(occurrence1.getPath(), occurrence2.getPath(), newpath1, newpath2); + SolsticeEngine * solstice = NULL; + + if(errorcell) { + solstice = get(errorcell); + + if(!solstice) { + cout << getString(errorcell) <_routingErrors->insert(error); + } + } + } + void SolsticeEngine::removeInterval (Brick* item) + { + item->destroy(); + } + + + void SolsticeEngine::clearErrors() { + for(set::iterator e = _routingErrors->begin(); + e != _routingErrors->end() ; + e++) + (*e)->destroy(); + _routingErrors->clear(); + + }; + + void SolsticeEngine::flushErrors() + { + forEach(Instance*,instance, _cell->getInstances()) + { + Cell * cell = (*instance)->getMasterCell(); + SolsticeEngine * solstice = get(cell); + if( (!(cell->isLeaf())) && (solstice->isCompared()) ) { + solstice->flushErrors(); + } + } + + clearErrors(); + setIsCompared(false); + } + + + + +}// End of namespace Solstice diff --git a/solstice/src/TabRoutingError.cpp b/solstice/src/TabRoutingError.cpp new file mode 100644 index 00000000..e7c79b80 --- /dev/null +++ b/solstice/src/TabRoutingError.cpp @@ -0,0 +1,184 @@ + + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./TabRoutingError.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include "hurricane/viewer/NetInformations.h" +#include +#include +#include + + +namespace Solstice { + +// ------------------------------------------------------------------- +// Class : "Hurricane::TabRoutingError". + + void TabRoutingError::select ( const RoutingError* error) + { + // cout << " TabRoutingError::SELECT" << flush; + forEach(Occurrence,occurrence,getCollection(error->getOccurrenceToSel())) { + // cout << " + 1" << flush; + getCellWidget()->select((*occurrence)); + } + }; + + void TabRoutingError::unselect ( const RoutingError* error) + { + // cout << " TabRoutingError::UNSELECT" << flush; + forEach(Occurrence,occurrence,getCollection(error->getOccurrenceToSel())) { + // cout << " - 1" << flush; + getCellWidget()->unselect((*occurrence)); + } + }; + + TabRoutingError::TabRoutingError ( QWidget* parent ) + : ControllerTab (parent) + , _routingErrorBrowser (new RoutingErrorListWidget()) + , _syncRoutingError (new QCheckBox()) + , _syncSelection (new QCheckBox()) + , _cwCumulativeSelection (false) + { + _routingErrorBrowser->setObjectName ( "controller.tabRoutingError.routingErrorBrowser" ); + + QVBoxLayout* wLayout = new QVBoxLayout (); + wLayout->setContentsMargins ( 10, 0, 10, 0 ); + wLayout->setSpacing ( 0 ); + + _syncRoutingError->setText ( tr("Sync RoutingError") ); + _syncRoutingError->setChecked ( false ); + _syncRoutingError->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) ); + connect ( _syncRoutingError, SIGNAL(toggled(bool)), this, SLOT(setSyncRoutingError(bool)) ); + + _syncSelection->setText ( tr("Sync Selection") ); + _syncSelection->setChecked ( false ); + _syncSelection->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) ); + connect ( _syncSelection, SIGNAL(toggled(bool)), this, SLOT(setSyncSelection(bool)) ); + + QHBoxLayout* commands = new QHBoxLayout (); + commands->setContentsMargins ( 0, 0, 0, 0 ); + commands->addStretch (); + commands->addWidget ( _syncRoutingError ); + commands->addStretch (); + commands->addWidget ( _syncSelection ); + commands->addStretch (); + wLayout->addLayout ( commands ); + + QFrame* separator = new QFrame (); + separator->setFrameShape ( QFrame::HLine ); + separator->setFrameShadow ( QFrame::Sunken ); + wLayout->addWidget ( separator ); + wLayout->addWidget ( _routingErrorBrowser ); + + setLayout ( wLayout ); + } + + + void TabRoutingError::setSyncRoutingError ( bool state ) + { + + if ( state && getCellWidget() ) { + _routingErrorBrowser->setCell ( getCellWidget()->getCell() ); + } else { + _routingErrorBrowser->setCell ( NULL ); + } +} + + + void TabRoutingError::setSyncSelection ( bool state ) + { + if ( state && getCellWidget() && _syncRoutingError->isChecked() ) { + _cwCumulativeSelection = getCellWidget()->cumulativeSelection(); + if ( !_cwCumulativeSelection ) { + getCellWidget()->openRefreshSession (); + getCellWidget()->unselectAll (); + getCellWidget()->closeRefreshSession (); + } + getCellWidget()->setShowSelection ( true ); + + connect ( _routingErrorBrowser, + SIGNAL(routingErrorSelected (const RoutingError*)), + this, + SLOT(select (const RoutingError*)) ); + + connect ( _routingErrorBrowser, + SIGNAL(routingErrorUnselected(const RoutingError*)), + this, + SLOT(unselect(const RoutingError*)) ); + + _routingErrorBrowser->updateSelecteds (); + } else { + getCellWidget()->setShowSelection ( false ); + getCellWidget()->setCumulativeSelection ( _cwCumulativeSelection ); + _routingErrorBrowser->disconnect ( this, SLOT(select (const RoutingError*)) ); + _routingErrorBrowser->disconnect ( this, SLOT(unselect(const RoutingError*)) ); + } + } + + + void TabRoutingError::setCell ( Cell* cell ) + { + setSyncRoutingError ( _syncRoutingError->isChecked() ); + } + + + void TabRoutingError::setCellWidget ( CellWidget* cellWidget ) + { + if ( getCellWidget() != cellWidget ) { + ControllerTab::setCellWidget ( cellWidget ); + _routingErrorBrowser->setCellWidget ( cellWidget ); + if ( getCellWidget() ) { + connect ( getCellWidget(), SIGNAL(cellChanged(Cell*)), this, SLOT(setCell(Cell*)) ); + } + setSyncRoutingError ( _syncRoutingError->isChecked() ); + } + } + + + void TabRoutingError::cellPreModificate () + { + _routingErrorBrowser->setCell ( NULL ); + } + + + void TabRoutingError::cellPostModificate () + { + setSyncRoutingError ( _syncRoutingError->isChecked() ); + } + + +} // End of Solstice namespace. diff --git a/solstice/src/TabRoutingErrorList.cpp b/solstice/src/TabRoutingErrorList.cpp new file mode 100644 index 00000000..2e91a5fa --- /dev/null +++ b/solstice/src/TabRoutingErrorList.cpp @@ -0,0 +1,143 @@ + + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./TabRoutingErrorList.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + +#include +#include +#include + +#include + +namespace Solstice { + +// ------------------------------------------------------------------- +// Class : "Hurricane::TabRoutingErrorList". + + + TabRoutingErrorList::TabRoutingErrorList ( QWidget* parent ) + : ControllerTab (parent) + , _routingErrorListBrowser (new RoutingErrorListWidget()) + , _syncRoutingErrorList (new QCheckBox()) + , _syncSelection (new QCheckBox()) + , _cwCumulativeSelection(false) + { + _routingErrorListBrowser->setObjectName ( "controller.tabRoutingErrorList.routingErrorListBrowser" ); + + QVBoxLayout* wLayout = new QVBoxLayout (); + wLayout->setContentsMargins ( 10, 0, 10, 0 ); + wLayout->setSpacing ( 0 ); + + _syncRoutingErrorList->setText ( tr("Sync RoutingErrorList") ); + _syncRoutingErrorList->setChecked ( false ); + _syncRoutingErrorList->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) ); + connect ( _syncRoutingErrorList, SIGNAL(toggled(bool)), this, SLOT(setSyncRoutingErrorList(bool)) ); + + _syncSelection->setText ( tr("Sync Selection") ); + _syncSelection->setChecked ( false ); + _syncSelection->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) ); + connect ( _syncSelection, SIGNAL(toggled(bool)), this, SLOT(setSyncSelection(bool)) ); + + QHBoxLayout* commands = new QHBoxLayout (); + commands->setContentsMargins ( 0, 0, 0, 0 ); + commands->addStretch (); + commands->addWidget ( _syncRoutingErrorList ); + commands->addStretch (); + commands->addWidget ( _syncSelection ); + commands->addStretch (); + wLayout->addLayout ( commands ); + + QFrame* separator = new QFrame (); + separator->setFrameShape ( QFrame::HLine ); + separator->setFrameShadow ( QFrame::Sunken ); + wLayout->addWidget ( separator ); + wLayout->addWidget ( _routingErrorListBrowser ); + + setLayout ( wLayout ); + } + + + void TabRoutingErrorList::setSyncRoutingErrorList ( bool state ) + { + if ( state && getCellWidget() ) { + _routingErrorListBrowser->setCell ( getCellWidget()->getCell() ); + } else { + _routingErrorListBrowser->setCell ( NULL ); + } + } + + + void TabRoutingErrorList::setSyncSelection ( bool state ) + { + if ( state && getCellWidget() && _syncRoutingErrorList->isChecked() ) { + _cwCumulativeSelection = getCellWidget()->cumulativeSelection(); + if ( !_cwCumulativeSelection ) { + getCellWidget()->openRefreshSession (); + getCellWidget()->unselectAll (); + getCellWidget()->closeRefreshSession (); + } + getCellWidget()->setShowSelection ( true ); + connect ( _routingErrorListBrowser, SIGNAL(occurrenceSelected (const Occurrence)), getCellWidget(), SLOT(select (const Occurrence)) ); + connect ( _routingErrorListBrowser, SIGNAL(occurrenceUnselected(const Occurrence)), getCellWidget(), SLOT(unselect(const Occurrence)) ); + _routingErrorListBrowser->updateSelecteds (); + } else { + getCellWidget()->setShowSelection ( false ); + getCellWidget()->setCumulativeSelection ( _cwCumulativeSelection ); + _routingErrorListBrowser->disconnect ( getCellWidget(), SLOT(select (const Occurrence)) ); + _routingErrorListBrowser->disconnect ( getCellWidget(), SLOT(unselect(const Occurrence)) ); + } + } + + + void TabRoutingErrorList::setCell ( Cell* cell ) + { + setSyncRoutingErrorList ( _syncRoutingErrorList->isChecked() ); + } + + + void TabRoutingErrorList::setCellWidget ( CellWidget* cellWidget ) + { + if ( getCellWidget() != cellWidget ) { + ControllerTab::setCellWidget ( cellWidget ); + _routingErrorListBrowser->setCellWidget ( cellWidget ); + if ( getCellWidget() ) { + connect ( getCellWidget(), SIGNAL(cellChanged(Cell*)), this, SLOT(setCell(Cell*)) ); + } + setSyncRoutingErrorList ( _syncRoutingErrorList->isChecked() ); + } + } + + + void TabRoutingErrorList::cellPreModificate () + { + _routingErrorListBrowser->setCell ( NULL ); + } + + + void TabRoutingErrorList::cellPostModificate () + { + setSyncRoutingErrorList ( _syncRoutingErrorList->isChecked() ); + } + + +} // End of Solstice namespace. diff --git a/solstice/src/old/RoutingErrorInformations.cpp b/solstice/src/old/RoutingErrorInformations.cpp new file mode 100644 index 00000000..1e98e806 --- /dev/null +++ b/solstice/src/old/RoutingErrorInformations.cpp @@ -0,0 +1,131 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./GraphicSolsticeEngine.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + + #include + + #include "hurricane/Name.h" + #include "hurricane/Net.h" + #include "hurricane/Cell.h" + #include "solstice/RoutingErrorInformations.h" + + + namespace Solstice { + + + // ------------------------------------------------------------------- + // Class : "RoutingErrorInformations" + + + + RoutingErrorInformations::RoutingErrorInformations ( const RoutingError* error ) + : _error(error) + { } + + + RoutingErrorInformations::~RoutingErrorInformations () + { } + + + // ------------------------------------------------------------------- + // Class : "SimpleRoutingErrorInformations" + + + int RoutingErrorInformations::getColumnCount () + { return 3; } + + + QVariant RoutingErrorInformations::getColumnName ( int column ) + { + switch ( column ) { + case 0: return QVariant(QObject::tr("Cell")); + case 1: return QVariant(QObject::tr("Type")); + case 2: return QVariant(QObject::tr("Description")); + } + return QVariant(QObject::tr("Column Out of Bound")); + } + + + QVariant RoutingErrorInformations::getColumn ( int column ) + { + switch ( column ) { + case 0: return QVariant(getString(getCell()->getName()).c_str()); + case 1: return QVariant(getString(getName()).c_str()); + case 2: return QVariant(getString(getDescription()).c_str()); + } + return QVariant(QObject::tr("Column Out of Bound")); + } + + + + + RoutingErrorInformationsVector::~RoutingErrorInformationsVector () + { } + + + + void RoutingErrorInformationsVector::addRoutingError ( const RoutingError* error ) + { + _errorlist.push_back ( (error) ); + } + + + + RoutingErrorInformations* RoutingErrorInformationsVector::getRow ( int row ) + { + if ( row >= (int)_errorlist.size() ) return NULL; + + return &_errorlist[row]; + } + + + + int RoutingErrorInformationsVector::getColumnCount () const + { + return RoutingErrorInformations::getColumnCount(); + } + + + + QVariant RoutingErrorInformationsVector::getColumnName ( int column ) const + { + return RoutingErrorInformations::getColumnName ( column ); + } + + + + int RoutingErrorInformationsVector::size () const + { + return _errorlist.size(); + } + + + + + + + + + + } // End of Solstice namespace. diff --git a/solstice/src/old/RoutingErrorModel.cpp b/solstice/src/old/RoutingErrorModel.cpp new file mode 100644 index 00000000..06b12884 --- /dev/null +++ b/solstice/src/old/RoutingErrorModel.cpp @@ -0,0 +1,145 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./RoutingErrorModel.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +#include + +#include "hurricane/Name.h" +#include "hurricane/Net.h" +#include "hurricane/Cell.h" +#include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/NetInformations.h" + +#include "solstice/RoutingErrorModel.h" +#include "solstice/RoutingError.h" +#include "solstice/ShortCircuitError.h" + +namespace Solstice { + + + RoutingErrorModel::RoutingErrorModel ( QObject* parent ) + : QAbstractTableModel(parent) + , _cell(NULL) + , _routingError(NULL) + { } + + + RoutingErrorModel::~RoutingErrorModel () + { + if ( _routingError ) delete _routingError; + } + + + QVariant RoutingErrorModel::data ( const QModelIndex& index, int role ) const + { + static QFont nameFont = Graphics::getFixedFont ( QFont::Bold ); + static QFont valueFont = Graphics::getFixedFont ( QFont::Normal, true ); + + if ( role == Qt::SizeHintRole ) { + switch (index.column()) { + case 0: return 200; + default: return -1; + } + } + + if ( role == Qt::FontRole ) { + switch (index.column()) { + case 0: return nameFont; + default: return valueFont; + } + } + + if ( !index.isValid() ) return QVariant (); + + if ( role == Qt::DisplayRole ) { + int row = index.row (); + return _routingError->getRow(row)->getColumn(index.column()); + } + return QVariant(); + } + + + QVariant RoutingErrorModel::headerData ( int section + , Qt::Orientation orientation + , int role ) const + { + if ( ( orientation == Qt::Vertical ) || (role != Qt::DisplayRole) ) + return QVariant(); + + if ( !_routingError ) { + if ( section == 0 ) return QVariant("RoutingError"); + return QVariant(); + } + + if ( section < _routingError->getColumnCount() ) + return _routingError->getColumnName(section); + + return QVariant(); + } + + + int RoutingErrorModel::rowCount ( const QModelIndex& parent ) const + { + return (_routingError) ? _routingError->size() : 0; + } + + + int RoutingErrorModel::columnCount ( const QModelIndex& parent ) const + { + return (_routingError) ? _routingError->getColumnCount() : 1; + } + + + const RoutingError* RoutingErrorModel::getRoutingError ( int row ) + { + if ( !_routingError || ( row >= (int)_routingError->size() ) ) return NULL; + + return _routingError->getRow(row)->getRoutingError(); + } + + + void RoutingErrorModel::setCell ( Cell* cell ) + { + if ( _cell != cell ) { + if ( _cell ) + delete _routingError; + + _cell = cell; + _routingError = new RoutingErrorInformationsVector(); + if ( _cell ) { + SolsticeEngine* solstice = SolsticeEngine::get(_cell); + if (solstice) { + forEach(RoutingError*, sce ,getCollection(solstice->getRoutingErrorSet())) + { + _routingError->addRoutingError((*sce)); + } + } + } + + emit layoutChanged (); + } + } + +} // End of Solstice namespace. diff --git a/solstice/src/old/RoutingErrorWidget.cpp b/solstice/src/old/RoutingErrorWidget.cpp new file mode 100644 index 00000000..07c0178f --- /dev/null +++ b/solstice/src/old/RoutingErrorWidget.cpp @@ -0,0 +1,247 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./RoutingErrorWidget.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hurricane/Commons.h" +#include "hurricane/Net.h" + +#include "hurricane/viewer/Graphics.h" +#include "solstice/RoutingErrorModel.h" +#include "solstice/RoutingErrorWidget.h" + + +namespace { + + + using namespace Hurricane; + + +} // End of anonymous namespace. + + +namespace Solstice { + + + RoutingErrorWidget::RoutingErrorWidget ( QWidget* parent ) + : QWidget (parent) + , _cellWidget (NULL) + , _cell (NULL) + , _baseModel (new RoutingErrorModel(this)) + , _sortModel (new QSortFilterProxyModel(this)) + , _view (new QTableView(this)) + , _rowHeight (20) + , _selecteds () + , _forceReselect(false) + { + setAttribute ( Qt::WA_DeleteOnClose ); + setAttribute ( Qt::WA_QuitOnClose, false ); + setContextMenuPolicy ( Qt::ActionsContextMenu ); + + _rowHeight = QFontMetrics(Graphics::getFixedFont()).height() + 4; + + _sortModel->setSourceModel ( _baseModel ); + _sortModel->setDynamicSortFilter ( true ); + _sortModel->setFilterKeyColumn ( 0 ); + + _view->setShowGrid(false); + _view->setAlternatingRowColors(true); + _view->setSelectionBehavior(QAbstractItemView::SelectRows); + _view->setSortingEnabled(true); + _view->setModel ( _sortModel ); + _view->horizontalHeader()->setStretchLastSection ( true ); + + QHeaderView* horizontalHeader = _view->horizontalHeader (); + horizontalHeader->setStretchLastSection ( true ); + horizontalHeader->setMinimumSectionSize ( 200 ); + + QHeaderView* verticalHeader = _view->verticalHeader (); + verticalHeader->setVisible ( false ); + + _filterPatternLineEdit = new QLineEdit(this); + QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this); + filterPatternLabel->setBuddy(_filterPatternLineEdit); + + QGridLayout* gLayout = new QGridLayout(); + gLayout->addWidget(_view , 1, 0, 1, 2); + gLayout->addWidget(filterPatternLabel , 2, 0); + gLayout->addWidget(_filterPatternLineEdit, 2, 1); + + setLayout ( gLayout ); + + QAction* fitAction = new QAction ( tr("&Fit to Error"), this ); + fitAction->setShortcut ( QKeySequence(tr("CTRL+F")) ); + fitAction->setStatusTip ( tr("Fit the view to the Error's bounding box") ); + addAction ( fitAction ); + + connect ( _filterPatternLineEdit , SIGNAL(textChanged(const QString &)) + , this , SLOT (textFilterChanged()) ); + connect ( _view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)) + , this , SLOT (updateSelecteds (const QItemSelection&,const QItemSelection&)) ); + connect ( _baseModel, SIGNAL(layoutChanged()), this, SLOT(forceRowHeight ()) ); + connect ( fitAction , SIGNAL(triggered ()), this, SLOT(fitToRoutingError ()) ); + + resize(300, 300); + } + + + void RoutingErrorWidget::forceRowHeight () + { + for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- ) + _view->setRowHeight ( rows, _rowHeight ); + } + + + void RoutingErrorWidget::goTo ( int delta ) + { + if ( delta == 0 ) return; + + QModelIndex newIndex = _sortModel->index ( _view->currentIndex().row()+delta, 0, QModelIndex() ); + + if ( newIndex.isValid() ) + _view->selectRow ( newIndex.row() ); + } + + + void RoutingErrorWidget::updateSelecteds () + { + _forceReselect = true; + + QItemSelection dummy; + updateSelecteds ( dummy, dummy ); + } + + + void RoutingErrorWidget::updateSelecteds ( const QItemSelection& , const QItemSelection& ) + { + if ( _cellWidget ) _cellWidget->openRefreshSession (); + + _selecteds.resetAccesses (); + + const RoutingError* error; + QModelIndexList iList = _view->selectionModel()->selectedRows(); + for ( int i=0 ; igetRoutingError ( _sortModel->mapToSource(iList[i]).row() ); + cout << error->getName(); + if ( error ) { + _selecteds.insert ( error ); + } + } + + if ( _forceReselect ) { + _selecteds.forceInserteds(); + _forceReselect = false; + } + + SelectedRoutingErrorSet::iterator remove; + SelectedRoutingErrorSet::iterator isel = _selecteds.begin (); + while ( isel != _selecteds.end() ) { + switch ( isel->getAccesses() ) { + case 1: + emit routingErrorSelected ( isel->getRoutingError() ); + cout << "EMIT NONE" << flush; break; + case 64: + cout << "EMIT SELECT" << flush; + emit routingErrorSelected ( isel->getRoutingError() ); + break; + case 0: + cout << "EMIT UNSELECT" << flush; + emit routingErrorUnselected ( isel->getRoutingError() ); + remove = isel; + ++isel; + _selecteds.erase ( remove ); + continue; + default: + cerr << Bug("RoutingErrorWidget::updateSelecteds(): invalid code %d" + ,isel->getAccesses()) << endl; + } + ++isel; + } + + if ( _cellWidget ) _cellWidget->closeRefreshSession (); + } + + + void RoutingErrorWidget::textFilterChanged () + { + _sortModel->setFilterRegExp ( _filterPatternLineEdit->text() ); + forceRowHeight (); + } + + + void RoutingErrorWidget::fitToRoutingError () + { + const RoutingError* routingError = _baseModel->getRoutingError ( _sortModel->mapToSource(_view->currentIndex()).row() ); + if ( routingError ) emit routingErrorFitted ( routingError ); + } + + + + void RoutingErrorWidget::setCellWidget ( CellWidget* cw ) + { + if ( _cellWidget ) { + disconnect ( this, 0, _cellWidget, 0 ); + } + + _cellWidget = cw; + if ( _cellWidget ) { + setCell ( _cellWidget->getCell() ); + /*TODO*/ + // connect ( this, SIGNAL(routingErrorFitted(const RoutingError*)), _cellWidget, SLOT(fitToNet (const Net*)) ); + } else + + setCell ( NULL ); + } + + + void RoutingErrorWidget::setCell ( Cell* cell ) + { + _cell = cell; + _view->selectionModel()->clear (); + _baseModel->setCell ( cell ); + + string windowTitle = "RoutingError" + getString(cell); + setWindowTitle ( tr(windowTitle.c_str()) ); + + int rows = _sortModel->rowCount (); + for ( rows-- ; rows >= 0 ; rows-- ) + _view->setRowHeight ( rows, _rowHeight ); + _view->selectRow ( 0 ); + _view->resizeColumnToContents ( 0 ); + } + + + + + + +} // End of Solstice namespace. diff --git a/solstice/src/old/TabRoutingError.cpp b/solstice/src/old/TabRoutingError.cpp new file mode 100644 index 00000000..88785c15 --- /dev/null +++ b/solstice/src/old/TabRoutingError.cpp @@ -0,0 +1,184 @@ + + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./TabRoutingError.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include "hurricane/viewer/NetInformations.h" +#include +#include +#include + + +namespace Solstice { + +// ------------------------------------------------------------------- +// Class : "Hurricane::TabRoutingError". + + void TabRoutingError::select ( const RoutingError* error) + { + cout << " TabRoutingError::SELECT" << flush; + forEach(Occurrence,occurrence,getCollection(error->getOccurrenceToSel())) { + cout << " + 1" << flush; + getCellWidget()->select((*occurrence)); + } + }; + + void TabRoutingError::unselect ( const RoutingError* error) + { + cout << " TabRoutingError::UNSELECT" << flush; + forEach(Occurrence,occurrence,getCollection(error->getOccurrenceToSel())) { + cout << " - 1" << flush; + getCellWidget()->unselect((*occurrence)); + } + }; + + TabRoutingError::TabRoutingError ( QWidget* parent ) + : ControllerTab (parent) + , _routingErrorBrowser (new RoutingErrorListWidget()) + , _syncRoutingError (new QCheckBox()) + , _syncSelection (new QCheckBox()) + , _cwCumulativeSelection (false) + { + _routingErrorBrowser->setObjectName ( "controller.tabRoutingError.routingErrorBrowser" ); + + QVBoxLayout* wLayout = new QVBoxLayout (); + wLayout->setContentsMargins ( 10, 0, 10, 0 ); + wLayout->setSpacing ( 0 ); + + _syncRoutingError->setText ( tr("Sync RoutingError") ); + _syncRoutingError->setChecked ( false ); + _syncRoutingError->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) ); + connect ( _syncRoutingError, SIGNAL(toggled(bool)), this, SLOT(setSyncRoutingError(bool)) ); + + _syncSelection->setText ( tr("Sync Selection") ); + _syncSelection->setChecked ( false ); + _syncSelection->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) ); + connect ( _syncSelection, SIGNAL(toggled(bool)), this, SLOT(setSyncSelection(bool)) ); + + QHBoxLayout* commands = new QHBoxLayout (); + commands->setContentsMargins ( 0, 0, 0, 0 ); + commands->addStretch (); + commands->addWidget ( _syncRoutingError ); + commands->addStretch (); + commands->addWidget ( _syncSelection ); + commands->addStretch (); + wLayout->addLayout ( commands ); + + QFrame* separator = new QFrame (); + separator->setFrameShape ( QFrame::HLine ); + separator->setFrameShadow ( QFrame::Sunken ); + wLayout->addWidget ( separator ); + wLayout->addWidget ( _routingErrorBrowser ); + + setLayout ( wLayout ); + } + + + void TabRoutingError::setSyncRoutingError ( bool state ) + { + + if ( state && getCellWidget() ) { + _routingErrorBrowser->setCell ( getCellWidget()->getCell() ); + } else { + _routingErrorBrowser->setCell ( NULL ); + } +} + + + void TabRoutingError::setSyncSelection ( bool state ) + { + if ( state && getCellWidget() && _syncRoutingError->isChecked() ) { + _cwCumulativeSelection = getCellWidget()->cumulativeSelection(); + if ( !_cwCumulativeSelection ) { + getCellWidget()->openRefreshSession (); + getCellWidget()->unselectAll (); + getCellWidget()->closeRefreshSession (); + } + getCellWidget()->setShowSelection ( true ); + + connect ( _routingErrorBrowser, + SIGNAL(routingErrorSelected (const RoutingError*)), + this, + SLOT(select (const RoutingError*)) ); + + connect ( _routingErrorBrowser, + SIGNAL(routingErrorUnselected(const RoutingError*)), + this, + SLOT(unselect(const RoutingError*)) ); + + _routingErrorBrowser->updateSelecteds (); + } else { + getCellWidget()->setShowSelection ( false ); + getCellWidget()->setCumulativeSelection ( _cwCumulativeSelection ); + _routingErrorBrowser->disconnect ( this, SLOT(select (const RoutingError*)) ); + _routingErrorBrowser->disconnect ( this, SLOT(unselect(const RoutingError*)) ); + } + } + + + void TabRoutingError::setCell ( Cell* cell ) + { + setSyncRoutingError ( _syncRoutingError->isChecked() ); + } + + + void TabRoutingError::setCellWidget ( CellWidget* cellWidget ) + { + if ( getCellWidget() != cellWidget ) { + ControllerTab::setCellWidget ( cellWidget ); + _routingErrorBrowser->setCellWidget ( cellWidget ); + if ( getCellWidget() ) { + connect ( getCellWidget(), SIGNAL(cellChanged(Cell*)), this, SLOT(setCell(Cell*)) ); + } + setSyncRoutingError ( _syncRoutingError->isChecked() ); + } + } + + + void TabRoutingError::cellPreModificate () + { + _routingErrorBrowser->setCell ( NULL ); + } + + + void TabRoutingError::cellPostModificate () + { + setSyncRoutingError ( _syncRoutingError->isChecked() ); + } + + +} // End of Solstice namespace. diff --git a/solstice/src/solstice/Brick.h b/solstice/src/solstice/Brick.h new file mode 100644 index 00000000..16fe3299 --- /dev/null +++ b/solstice/src/solstice/Brick.h @@ -0,0 +1,110 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./Brick.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __SOLSTICE_BRICK__ +#define __SOLSTICE_BRICK__ + +namespace Hurricane { + + class Occurrence; + class Box; + class BasicLayer; + class Unit; +} + +namespace Equinox { + class Interval; +} +namespace Solstice { + + using namespace std; + using Equinox::Interval; + using Hurricane::Occurrence; + using Hurricane::Box; + using Hurricane::BasicLayer; + using Hurricane::DbU; + class Brick : public Interval + { + + public : + static Brick* create(const Occurrence&, const Occurrence&, const Box&, BasicLayer*); + void destroy(); + + + public : + + /**/ bool isEmpty () const; + /**/ string _getString() const; + + /**/ const DbU::Unit& getXmin() const; + /**/ const DbU::Unit& getYmin() const; + /**/ const DbU::Unit& getXmax() const; + /**/ const DbU::Unit& getYmax() const; + inline const Box& getBoundingBox(); + inline const Occurrence& getHyperNet(); + inline const Occurrence& getComponentOccurrence() const; + inline BasicLayer* getBasicLayer(); + virtual long GetLowPoint() const; + virtual long GetHighPoint() const; + + + private : + Occurrence _hypernet; + Occurrence _componentoccurrence; + Box _box; + BasicLayer* _basicLayer; + + protected : + Brick(const Occurrence& ,const Occurrence&, const Box&, BasicLayer*); + virtual ~Brick(); + + private : + Brick(const Brick&); + Brick& operator=(const Brick&); + +}; // End of class Brick + + + // Inline Functions. + inline const Box& Brick::getBoundingBox() { return _box; }; + inline const Occurrence& Brick::getHyperNet() { return _hypernet; }; + inline const Occurrence& Brick::getComponentOccurrence() const { return _componentoccurrence; }; + inline BasicLayer* Brick::getBasicLayer(){ return _basicLayer; }; + + + + + + + +} // End of Equinox namespace. + + + + + + + +#endif // __SOLSTICE_BRICK__ diff --git a/solstice/src/solstice/BrickSweepLine.h b/solstice/src/solstice/BrickSweepLine.h new file mode 100644 index 00000000..b3f98d2f --- /dev/null +++ b/solstice/src/solstice/BrickSweepLine.h @@ -0,0 +1,45 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./BrickSweepLine.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + +#ifndef _SOLSTICE_BRICKSWEEPLINE_H +#define _SOLSTICE_BRICKSWEEPLINE_H + +#include "equinox/SweepLine.h" +namespace Equinox { + + template + class SweepLine; + +} + +namespace Solstice { + + class Brick; + class SolsticeEngine; + + + typedef Equinox::SweepLine BrickSweepLine; + +} + +#endif //_SOLSTICE_BRICKSWEEPLINE_H diff --git a/solstice/src/solstice/DisconnectError.h b/solstice/src/solstice/DisconnectError.h new file mode 100644 index 00000000..33c9320a --- /dev/null +++ b/solstice/src/solstice/DisconnectError.h @@ -0,0 +1,76 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | | +// | Updater : Bodin bruno | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./solstice/DisconnectError.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + +#ifndef __SOLSTICE_DISCONNECT_ERROR__ +#define __SOLSTICE_DISCONNECT_ERROR__ + +#include + +namespace Solstice { + + + + class DisconnectError : public RoutingError + { + + public : + inline static DisconnectError* create (Cell* cell, + const Occurrence& occurrence, + int count); + + public : + //Champs ListBox + + inline virtual const Name& getName () const ; + inline virtual string getErrorName () const ; + /**/ virtual string getErrorDescription () const ; + inline virtual set* getErrorOccurrences () const ; + + + private : + /**/ DisconnectError (Cell* cell, + const Occurrence& occurrence, + int count); + /**/ virtual ~DisconnectError () ; + private : + /**/ Occurrence _occurrence; + + + }; + + //inlines + + inline set* DisconnectError::getErrorOccurrences () const {return _occurrences;}; + inline const Name& DisconnectError::getName () const {return _extensionName;} ; + inline string DisconnectError::getErrorName () const {return "Deconnexion";}; + inline DisconnectError* DisconnectError::create (Cell* cell, const Occurrence& occurrence, int count) { DisconnectError* de = new DisconnectError (cell,occurrence,count); de->_postCreate(); return de;}; + + + +} // End of Solstice namespace. + +#endif // __SOLSTICE_DISCONNECT_ERROR__ diff --git a/solstice/src/solstice/GraphicSolsticeEngine.h b/solstice/src/solstice/GraphicSolsticeEngine.h new file mode 100644 index 00000000..07d577ed --- /dev/null +++ b/solstice/src/solstice/GraphicSolsticeEngine.h @@ -0,0 +1,112 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./GraphicSolsticeEngine.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + + +#ifndef __SOLSTICE_GRAPHIC_SOLSTICE_ENGINE__ +#define __SOLSTICE_GRAPHIC_SOLSTICE_ENGINE__ + + +#include + + + +#include "crlcore/GraphicToolEngine.h" +// #include "solstice/TabRoutingError.h" + +namespace Hurricane { + class Go; + class BasicLayer; + class Transformation; + class CellWidget; + class CellViewer; +} + + + +namespace Solstice { + + + using Hurricane::Cell; + using Hurricane::Go; + using Hurricane::Box; + using Hurricane::BasicLayer; + using Hurricane::Transformation; + using Hurricane::CellWidget; + using Hurricane::CellViewer; + using CRL::GraphicTool; + using CRL::Name; + + class SolsticeEngine; + class TabRoutingErrorList; + + + // ------------------------------------------------------------------- + // Class : "Solstice::GraphicSolsticeEngine". + + + class GraphicSolsticeEngine : public GraphicTool { + Q_OBJECT; + + public: + + /**/ static void initSolsticeRoutingError ( CellWidget* ); + /**/ static void drawSolsticeRoutingError ( CellWidget* + , const Go* + , const BasicLayer* + , const Box& + , const Transformation& + ); + + + /**/ SolsticeEngine* createEngine (); + /**/ static GraphicSolsticeEngine* grab (); + /**/ virtual const Name& getName () const; + /**/ Cell* getCell (); + /**/ virtual size_t release (); + /**/ virtual void addToMenu ( CellViewer* ); + + + + public slots: + /**/ void test (); + + + + private: + static size_t _references; + static GraphicSolsticeEngine*_singleton; + /**/ CellViewer* _viewer; + /**/ TabRoutingErrorList* _tabRoutingErrorList; + protected: + /**/ GraphicSolsticeEngine (); + virtual ~GraphicSolsticeEngine (); + + }; //end of class GraphicSolsticeEngine + +} // End of Solstice namespace. + + + +#endif // _SOLSTICE__GRAPHIC_SOLSTICE_ENGINE__ diff --git a/solstice/src/solstice/RoutingError.h b/solstice/src/solstice/RoutingError.h new file mode 100644 index 00000000..c2aab81d --- /dev/null +++ b/solstice/src/solstice/RoutingError.h @@ -0,0 +1,104 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | | +// | Updater : Bodin bruno | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./solstice/RoutingError.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + +#ifndef __SOLSTICE_ROUTING_ERROR__ +#define __SOLSTICE_ROUTING_ERROR__ + +#include +#include + +#include +#include +#include + +namespace Hurricane { + class Box; + class Net; + class Cell; + class Name; + class Occurrence; +} + +namespace Solstice { + + using namespace std; + using namespace Hurricane; + + class RoutingError : public ExtensionGo + { + + public : + inline Cell * getCell () const ; + inline Box getBoundingBox () const ; + inline int getCount () const ; + inline set* getAllOccurrences () const ; + /**/ virtual set* getErrorOccurrences () const = 0; + inline void destroy (); + + //Champs ListBox + /**/ virtual const Name& getName () const = 0; + /**/ virtual string getErrorName () const = 0; + /**/ virtual string getErrorDescription () const = 0; + + //ExtensionGO inherited + /**/ void translate ( const DbU::Unit& dx, + const DbU::Unit& dy ); + + protected: + inline void _postCreate (); + inline void _preDestroy (); + /**/ RoutingError (Cell * cell, + int count); + virtual ~RoutingError (); + + + public : + static const Name _extensionName; + + protected : + + /**/ Cell * _cell; + /**/ Box _area; + /**/ int _count; + /**/ set* _occurrences; + + }; + + inline Cell * RoutingError::getCell () const { return _cell;}; + inline Box RoutingError::getBoundingBox () const { return _area;}; + inline set* RoutingError::getAllOccurrences () const { return _occurrences;}; + inline int RoutingError::getCount () const { return _count;}; + + inline void RoutingError::_postCreate () { ExtensionGo::_postCreate();}; + inline void RoutingError::_preDestroy () { ExtensionGo::_preDestroy(); _occurrences->clear(); }; + inline void RoutingError::destroy () { _preDestroy(); delete this; }; +} // End of Solstice namespace. + +INSPECTOR_P_SUPPORT(Solstice::RoutingError); + + +#endif // __SOLSTICE_ROUTING_ERROR__ diff --git a/solstice/src/solstice/RoutingErrorInformations.h b/solstice/src/solstice/RoutingErrorInformations.h new file mode 100644 index 00000000..c0da39f2 --- /dev/null +++ b/solstice/src/solstice/RoutingErrorInformations.h @@ -0,0 +1,205 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Project. +// Copyright (C) Laboratoire LIP6 - Departement ASIM +// Universite Pierre et Marie Curie +// +// Main contributors : +// Christophe Alexandre +// Sophie Belloeil +// Hugo Clément +// Jean-Paul Chaput +// Damien Dupuis +// Christian Masson +// Marek Sroka +// +// The Coriolis Project is free software; you can redistribute it +// and/or modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// The Coriolis Project is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with the Coriolis Project; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA +// +// License-Tag +// Authors-Tag +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./RoutingErrorInformations.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __ROUTINGERROR_INFORMATIONS_H__ +#define __ROUTINGERROR_INFORMATIONS_H__ + +#include + +#include + +#include "hurricane/Commons.h" + +namespace Hurricane { + + class Cell; + class Name; + +} + +namespace Solstice { + + using Hurricane::Name; + + class RoutingError; + + + +// ------------------------------------------------------------------- +// Class : "RoutingErrorInformations" + + + class RoutingErrorInformations { + public: + RoutingErrorInformations ( const RoutingError* routingError ); + virtual ~RoutingErrorInformations (); + static int getColumnCount (); + static QVariant getColumnName ( int column ); + virtual QVariant getColumn ( int column ); + inline const RoutingError* getRoutingError () const; + inline const Name getName () const; + + protected: + const RoutingError* _routingError; + }; + + + inline const RoutingError* RoutingErrorInformations::getRoutingError () const + { return _routingError; } + + + inline const Name RoutingErrorInformations::getName () const + { return _routingError->getErrorName(); } + + +// ------------------------------------------------------------------- +// Class : "SimpleRoutingErrorInformations" + + + class SimpleRoutingErrorInformations : public RoutingErrorInformations { + public: + SimpleRoutingErrorInformations ( const RoutingError* routingError ); + virtual ~SimpleRoutingErrorInformations (); + static int getColumnCount (); + static QVariant getColumnName ( int column ); + virtual QVariant getColumn ( int column ); + inline size_t getPlugsCount () const; + /**/ string getDescription () const; + + protected: + size_t _plugsCount; + }; + + + inline size_t SimpleRoutingErrorInformations::getPlugsCount () const + { return _plugsCount; } + + +// ------------------------------------------------------------------- +// Class : "AbstractRoutingErrorInformationsVector" + + + class AbstractRoutingErrorInformationsVector { + public: + virtual ~AbstractRoutingErrorInformationsVector (); + virtual void addRoutingError ( const RoutingError* routingError ) = 0; + virtual RoutingErrorInformations* getRow ( int row ) = 0; + virtual int getColumnCount () const = 0; + virtual QVariant getColumnName ( int column ) const = 0; + virtual int size () const = 0; + }; + + +// ------------------------------------------------------------------- +// Template Class : "RoutingErrorInformationsVector" + + + template + class RoutingErrorInformationsVector : public AbstractRoutingErrorInformationsVector { + public: + virtual ~RoutingErrorInformationsVector (); + virtual void addRoutingError ( const RoutingError* routingError ); + virtual InformationType* getRow ( int row ); + virtual int getColumnCount () const; + virtual QVariant getColumnName ( int column ) const; + virtual int size () const; + protected: + vector _routingErrorlist; + }; + + + template + RoutingErrorInformationsVector::~RoutingErrorInformationsVector () + { } + + + template + void RoutingErrorInformationsVector::addRoutingError ( const RoutingError* routingError ) + { + _routingErrorlist.push_back ( InformationType(routingError) ); + } + + + template + InformationType* RoutingErrorInformationsVector::getRow ( int row ) + { + if ( row >= (int)_routingErrorlist.size() ) return NULL; + + return &_routingErrorlist[row]; + } + + + template + int RoutingErrorInformationsVector::getColumnCount () const + { + return InformationType::getColumnCount(); + } + + + template + QVariant RoutingErrorInformationsVector::getColumnName ( int column ) const + { + return InformationType::getColumnName ( column ); + } + + + template + int RoutingErrorInformationsVector::size () const + { + return _routingErrorlist.size(); + } + + +} // End of Hurricane namespace. + + +#endif // __ROUTINGERROR_INFORMATIONS_H__ diff --git a/solstice/src/solstice/RoutingErrorListModel.h b/solstice/src/solstice/RoutingErrorListModel.h new file mode 100644 index 00000000..139f1bec --- /dev/null +++ b/solstice/src/solstice/RoutingErrorListModel.h @@ -0,0 +1,110 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./RoutingErrorListModel.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_ROUTINGERRORLIST_MODEL__ +#define __HURRICANE_ROUTINGERRORLIST_MODEL__ + +#include + +#include +#include +#include + +#include "hurricane/Commons.h" +#include "hurricane/Name.h" + +#include "hurricane/Cell.h" +#include "hurricane/viewer/Graphics.h" + +#include "solstice/RoutingError.h" +#include "solstice/SolsticeEngine.h" +#include "solstice/RoutingErrorInformations.h" + +namespace Hurricane { + + class Cell; + + +} + +namespace Solstice { + + + + + class RoutingErrorListModel : public QAbstractTableModel { + Q_OBJECT; + + public: + RoutingErrorListModel ( QObject* parent=NULL ); + ~RoutingErrorListModel (); + template + void setCell ( Cell* cell ); + int rowCount ( const QModelIndex& parent=QModelIndex() ) const; + int columnCount ( const QModelIndex& parent=QModelIndex() ) const; + QVariant data ( const QModelIndex& index, int role=Qt::DisplayRole ) const; + QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const; + inline Cell* getCell (); + const RoutingError* getRoutingError ( int row ); + + private: + Cell* _cell; + AbstractRoutingErrorInformationsVector* _routingErrorList; + }; + + +// Inline Functions. + + inline Cell* RoutingErrorListModel::getCell () { return _cell; } + + +// Template Functions. + + template + void RoutingErrorListModel::setCell ( Cell* cell ) + { + if ( _cell != cell ) { + if ( _cell ) + delete _routingErrorList; + + _cell = cell; + _routingErrorList = new RoutingErrorInformationsVector(); + + if ( _cell ) { + SolsticeEngine* solstice = SolsticeEngine::get(_cell); + forEach(RoutingError*, routingError ,getCollection(solstice->getRoutingErrorSet())) + { + _routingErrorList->addRoutingError ( *routingError ); + } + } + + emit layoutChanged (); + } + } + + +} // End of Hurricane namespace. + + +#endif // __ROUTINGERRORLIST_MODEL_H__ diff --git a/solstice/src/solstice/RoutingErrorListWidget.h b/solstice/src/solstice/RoutingErrorListWidget.h new file mode 100644 index 00000000..55c0a054 --- /dev/null +++ b/solstice/src/solstice/RoutingErrorListWidget.h @@ -0,0 +1,221 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./solstice/RoutingErrorListWidget.h.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_ROUTINGERRORLIST_WIDGET__ +#define __HURRICANE_ROUTINGERRORLIST_WIDGET__ + + +#include + +#include +#include +#include + +#include "hurricane/Commons.h" +#include "hurricane/Bug.h" +#include "hurricane/viewer/CellWidget.h" +#include "solstice/RoutingErrorListModel.h" +#include "hurricane/viewer/CellWidget.h" + + +class QSortFilterProxyModel; +class QModelIndex; +class QTableView; +class QLineEdit; +class QComboBox; +class QHeaderView; + +namespace Hurricane { + + class Cell; + +} + +namespace Solstice { + + + using std::set; + class RoutingError; + + + +// ------------------------------------------------------------------- +// Class : "SelectedRoutingError". + + + class SelectedRoutingError { + public: + inline SelectedRoutingError (); + inline SelectedRoutingError ( const RoutingError*, size_t access=0 ); + inline const RoutingError* getRoutingError () const; + inline size_t getAccesses () const; + inline void incAccesses () const; + inline void setInserted () const; + inline void resetAccesses () const; + private: + const RoutingError* _routingError; + mutable size_t _accesses; + }; + + + inline SelectedRoutingError::SelectedRoutingError () : _routingError(NULL), _accesses(0) { } + inline SelectedRoutingError::SelectedRoutingError ( const RoutingError* routingError, size_t accesses ) : _routingError(routingError), _accesses(accesses) { } + inline const RoutingError* SelectedRoutingError::getRoutingError () const { return _routingError; } + inline void SelectedRoutingError::setInserted () const { _accesses = 64; } + inline size_t SelectedRoutingError::getAccesses () const { return _accesses; } + inline void SelectedRoutingError::incAccesses () const { ++_accesses; } + inline void SelectedRoutingError::resetAccesses () const { _accesses = 0; } + + + struct SelectedRoutingErrorCompare { + inline bool operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs ); + }; + + + inline bool SelectedRoutingErrorCompare::operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs ) + { + return lhs.getRoutingError() < rhs.getRoutingError(); + } + + +// ------------------------------------------------------------------- +// Class : "SelectedRoutingErrorSet". + + + class SelectedRoutingErrorSet : public set{ + public: + void insert ( const RoutingError* ); + void forceInserteds (); + void resetAccesses (); + }; + + + inline void SelectedRoutingErrorSet::insert ( const RoutingError* routingError ) + { + iterator iselected = find(SelectedRoutingError(routingError)); + if ( iselected != end() ) { + iselected->incAccesses (); + } + else + set::insert ( SelectedRoutingError(routingError,64) ); + } + + + inline void SelectedRoutingErrorSet::forceInserteds () + { + for ( iterator iselected=begin() ; iselected != end() ; ++iselected ) + iselected->setInserted (); + } + + + inline void SelectedRoutingErrorSet::resetAccesses () + { + for ( iterator iselected=begin() ; iselected != end() ; ++iselected ) + iselected->resetAccesses (); + } + + +// ------------------------------------------------------------------- +// Class : "RoutingErrorListWidget". + + + class RoutingErrorListWidget : public QWidget { + Q_OBJECT; + + public: + RoutingErrorListWidget ( QWidget* parent=NULL ); + inline Cell* getCell (); + template + void setCellWidget ( CellWidget* ); + template + void setCell ( Cell* ); + void goTo ( int ); + void updateSelecteds (); + signals: + /**/ void occurrenceSelected ( const Occurrence ); + /**/ void occurrenceUnselected ( const Occurrence ); + /**/ void routingErrorFitted ( const RoutingError* ); + public slots: + void forceRowHeight (); + private slots: + /**/ void fitToError (); + void textFilterChanged (); + void updateSelecteds ( const QItemSelection& , const QItemSelection& ); + + private: + CellWidget* _cellWidget; + Cell* _cell; + RoutingErrorListModel* _baseModel; + QSortFilterProxyModel* _sortModel; + QTableView* _view; + QLineEdit* _filterPatternLineEdit; + int _rowHeight; + SelectedRoutingErrorSet _selecteds; + bool _forceReselect; + }; + + + template + void RoutingErrorListWidget::setCellWidget ( CellWidget* cw ) + { + if ( _cellWidget ) { + disconnect ( this, 0, _cellWidget, 0 ); + } + + _cellWidget = cw; + if ( _cellWidget ) { + setCell ( _cellWidget->getCell() ); + /*TODO*/ + //connect ( this, SIGNAL(routingErrorFitted(const RoutingError*)), _cellWidget, SLOT(fitToRoutingError (const RoutingError*)) ); + } else + setCell ( NULL ); + } + + + template + void RoutingErrorListWidget::setCell ( Cell* cell ) + { + _cell = cell; + _view->selectionModel()->clear (); + _baseModel->setCell ( cell ); + + string windowTitle = "RoutingErrorList" + getString(cell); + setWindowTitle ( tr(windowTitle.c_str()) ); + + int rows = _sortModel->rowCount (); + for ( rows-- ; rows >= 0 ; rows-- ) + _view->setRowHeight ( rows, _rowHeight ); + _view->selectRow ( 0 ); + _view->resizeColumnToContents ( 0 ); + } + + + inline Cell* RoutingErrorListWidget::getCell () { return _cell; } + + +} // End of Hurricane namespace. + + +#endif // __HURRICANE_ROUTINGERRORLIST_WIDGET_H__ diff --git a/solstice/src/solstice/ShortCircuitError.h b/solstice/src/solstice/ShortCircuitError.h new file mode 100644 index 00000000..a06c96f6 --- /dev/null +++ b/solstice/src/solstice/ShortCircuitError.h @@ -0,0 +1,117 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | | +// | Updater : Bodin bruno | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./solstice/ShortCircuitError.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __SOLSTICE_SHORT_CIRCUIT_ERROR__ +#define __SOLSTICE_SHORT_CIRCUIT_ERROR__ + +#include +#include + + +#include + +namespace Hurricane { + + class Point; + + +} + + +namespace Equinox { + class Equi; +} + + + +namespace Solstice { + + + using Hurricane::Occurrence; + using Hurricane::Point; + using Hurricane::Box; + + using namespace std; + + class ShortCircuitError : public RoutingError { + + public : + inline static ShortCircuitError* create (Cell*, + const Occurrence&, + const Occurrence&); + // Accessors + public: + /**/ virtual const Name& getName () const ; + inline virtual string getErrorName () const ; + /**/ string getErrorDescription () const ; + inline virtual int getCount () const ; + inline virtual set* getErrorOccurrences () const ; + inline const Occurrence& getOccurrence1 () const; + inline const Occurrence& getOccurrence2 () const; + inline const Box& getShortCircuitArea () const; + inline const Occurrence& getHyperNet1 () const; + inline const Occurrence& getHyperNet2 () const; + inline void setOccurrence1 (const Occurrence occurrence); + inline void setOccurrence2 (const Occurrence occurrence); + /**/ string _getString () const; + /**/ const Point getShortCircuitAreaCenter() const; + private : + /**/ ShortCircuitError (Cell*, + const Occurrence&, + const Occurrence&); + inline ~ShortCircuitError (); + + // Attributs + private : + /**/ Occurrence _occurrence1; + /**/ Occurrence _occurrence2; + /**/ Occurrence _hypernet1; + /**/ Occurrence _hypernet2; + /**/ Box _shortcircuitarea; + /**/ set* _errorOccurrences; + + + + }; // End of class ShortCircuitError + + + //inline functions + inline string ShortCircuitError::getErrorName () const {return "Court-circuit";}; + inline const Occurrence& ShortCircuitError::getOccurrence1 () const { return _occurrence1; }; + inline const Occurrence& ShortCircuitError::getOccurrence2 () const { return _occurrence2; }; + inline const Box& ShortCircuitError::getShortCircuitArea () const { return _shortcircuitarea; }; + inline const Occurrence& ShortCircuitError::getHyperNet1 () const { return _hypernet1; }; + inline const Occurrence& ShortCircuitError::getHyperNet2 () const { return _hypernet2; }; + inline void ShortCircuitError::setOccurrence1 (const Occurrence occurrence) { _occurrence1 = occurrence; }; + inline void ShortCircuitError::setOccurrence2 (const Occurrence occurrence) { _occurrence2 = occurrence; }; + inline ShortCircuitError::~ShortCircuitError () {}; + inline ShortCircuitError*ShortCircuitError::create (Cell* cell, const Occurrence& o1,const Occurrence& o2) { ShortCircuitError* de = new ShortCircuitError (cell,o1,o2); de->_postCreate(); return de;}; + +} // End of Solstice namespace. + +#endif // __SOLSTICE_SHORT_CIRCUIT_ERROR__ diff --git a/solstice/src/solstice/SolsticeEngine.h b/solstice/src/solstice/SolsticeEngine.h new file mode 100644 index 00000000..1bb79ba2 --- /dev/null +++ b/solstice/src/solstice/SolsticeEngine.h @@ -0,0 +1,137 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./solstice/SolsticeEngine.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __SOLSTICE_SOLSTICE_ENGINE__ +#define __SOLSTICE_SOLSTICE_ENGINE__ + +#include "crlcore/ToolEngine.h" + +namespace Hurricane { + class Occurrence; + class Cell; + class Path; +} + +namespace Equinox { + class Equi; + class Interval; + class Strategy; + +} +namespace Solstice { + + using namespace std; + using namespace Hurricane; + + using CRL::ToolEngine; + + using Equinox::Equi; + using Equinox::Strategy; + + class Brick; + class ShortCircuitError; + class RoutingError; + + + class SolsticeEngine : public ToolEngine { + + public: + static SolsticeEngine* create (Cell*); + static SolsticeEngine* get (const Cell* ); + static inline Name& getStaticName (); + static Occurrence getTopNetOccurrence (Occurrence occurrence); + + protected: + static Strategy * getStrategy (); + static void setStrategy (Strategy *); + + static void _depthCreate ( Cell*); + static Cell* getCommonPath (Path path1, + Path path2, + Path& newpath1, + Path& newpath2); + static void setIsComparedTrue (Cell * cell); + static void getAllSolstices (Cell* cell, + set& solstices); + + public: + virtual inline const Name& getName () const; + virtual Record* _getRecord () const; + virtual inline string _getString () const; + virtual inline string _getTypeName () const; + + public : + /**/ inline void destroy (); + /**/ void flushErrors (); + /**/ void compare (); + /**/ void insertInterval (Brick*, + stack *enumResultStack); + /**/ void removeInterval (Brick* item); + inline const set* getRoutingErrorSet (); + + protected : + /**/ void clearErrors (); + inline void setIsCompared (const bool flag); + /**/ void runComparison (); + /**/ void detectShortCircuit (Equi* equi); + inline bool isCompared () const; + private: + // Attributes. + static Strategy * _strategy; + static Name _toolName; + /**/ bool _isCompared; + /**/ set* _routingErrors; + + protected: + // Constructors & Destructors. + /**/ SolsticeEngine (Cell*); + virtual ~SolsticeEngine (); + virtual inline void _postCreate (); + virtual inline void _preDestroy (); + /**/ void _depthDestroy (); + +private: + /**/ SolsticeEngine (const SolsticeEngine&); + /**/ SolsticeEngine& operator= (const SolsticeEngine&); + + }; // End of class SolsticeEngine + + //inline functions + inline Name& SolsticeEngine::getStaticName () { return _toolName;}; + inline bool SolsticeEngine::isCompared () const { return _isCompared; }; + inline void SolsticeEngine::setIsCompared (const bool flag) { _isCompared = flag; }; + inline const set* SolsticeEngine::getRoutingErrorSet () { return _routingErrors;}; + inline const Name& SolsticeEngine::getName () const { return _toolName;}; + inline string SolsticeEngine::_getString () const { return "";}; + inline string SolsticeEngine::_getTypeName () const { return "Solstice";}; + inline void SolsticeEngine::_postCreate () { ToolEngine::_postCreate ();}; + inline void SolsticeEngine::_preDestroy () { ToolEngine::_preDestroy ();flushErrors();}; + inline void SolsticeEngine::destroy () { _preDestroy(); delete this;}; + + +} // End of Solstice namespace. + + +#endif // __SOLSTICE_SOLSTICE_ENGINE__ diff --git a/solstice/src/solstice/TabRoutingError.h b/solstice/src/solstice/TabRoutingError.h new file mode 100644 index 00000000..2a9e6c0d --- /dev/null +++ b/solstice/src/solstice/TabRoutingError.h @@ -0,0 +1,86 @@ + + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./solstice/TabRoutingError.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + + +#ifndef __SOLSTICE_TAB_ROUTINGERROR__ +#define __SOLSTICE_TAB_ROUTINGERROR__ + + +#include + +#include + +class QCheckBox; +class QComboBox; + +namespace Hurricane { + class Cell; + class Occurrence; +} + + +namespace Solstice { + + using Hurricane::Cell; + using Hurricane::CellWidget; + using Hurricane::ControllerTab; + + class RoutingError; + class RoutingErrorListWidget; + + class TabRoutingError : public ControllerTab { + Q_OBJECT; + + public: + TabRoutingError ( QWidget* parent=NULL ); + inline RoutingErrorListWidget* getRoutingErrorBrowser (); + inline QCheckBox* getSyncRoutingError (); + inline QCheckBox* getSyncSelection (); + virtual void cellPreModificate (); + virtual void cellPostModificate (); + public slots: + virtual void setCell ( Cell* ); + virtual void setCellWidget ( CellWidget* ); + virtual void setSyncRoutingError ( bool ); + virtual void setSyncSelection ( bool ); + void select ( const RoutingError* ); + void unselect ( const RoutingError* ); + protected: + RoutingErrorListWidget* _routingErrorBrowser; + QCheckBox* _syncRoutingError; + QCheckBox* _syncSelection; + bool _cwCumulativeSelection; + }; + + + inline RoutingErrorListWidget* TabRoutingError::getRoutingErrorBrowser () { return _routingErrorBrowser; } + inline QCheckBox* TabRoutingError::getSyncRoutingError () { return _syncRoutingError; } + inline QCheckBox* TabRoutingError::getSyncSelection () { return _syncSelection; } + + +}//end of namespace solstice + +#endif //TAB_ROUTINGERROR diff --git a/solstice/src/solstice/TabRoutingErrorList.h b/solstice/src/solstice/TabRoutingErrorList.h new file mode 100644 index 00000000..64705ace --- /dev/null +++ b/solstice/src/solstice/TabRoutingErrorList.h @@ -0,0 +1,65 @@ + + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./TabRoutingErrorList.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + +#include +#include + +namespace Solstice { + + + using Hurricane::ControllerTab; + +// ------------------------------------------------------------------- +// Class : "Hurricane::TabRoutingErrorList". + + + class TabRoutingErrorList : public ControllerTab { + Q_OBJECT; + + public: + TabRoutingErrorList ( QWidget* parent=NULL ); + inline RoutingErrorListWidget* getRoutingErrorListBrowser (); + inline QCheckBox* getSyncRoutingErrorList (); + inline QCheckBox* getSyncSelection (); + virtual void cellPreModificate (); + virtual void cellPostModificate (); + public slots: + virtual void setCell ( Cell* ); + virtual void setCellWidget ( CellWidget* ); + virtual void setSyncRoutingErrorList ( bool ); + virtual void setSyncSelection ( bool ); + protected: + RoutingErrorListWidget* _routingErrorListBrowser; + QCheckBox* _syncRoutingErrorList; + QCheckBox* _syncSelection; + bool _cwCumulativeSelection; + }; + + + inline RoutingErrorListWidget* TabRoutingErrorList::getRoutingErrorListBrowser () { return _routingErrorListBrowser; } + inline QCheckBox* TabRoutingErrorList::getSyncRoutingErrorList () { return _syncRoutingErrorList; } + inline QCheckBox* TabRoutingErrorList::getSyncSelection () { return _syncSelection; } + +} // End of Solstice namespace. diff --git a/solstice/src/solstice/olds/RoutingErrorInformations.h b/solstice/src/solstice/olds/RoutingErrorInformations.h new file mode 100644 index 00000000..8dd9eccb --- /dev/null +++ b/solstice/src/solstice/olds/RoutingErrorInformations.h @@ -0,0 +1,110 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Wu Yife | +// | E-mail : Wu.Yifei@lip6.fr | +// | =============================================================== | +// | C++ Header : "./RoutingErrorInformations.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + +#ifndef __SOLSTICE_ROUTINGERROR_INFORMATIONS__ +#define __SOLSTICE_ROUTINGERROR_INFORMATIONS__ + +#include + +#include + +#include "hurricane/Commons.h" + +#include "solstice/RoutingError.h" + +namespace Hurricane { + +} + +namespace Solstice { + + using Hurricane::Name; + using std::vector; + class Cell; + + +// ------------------------------------------------------------------- +// Class : "RoutingErrorInformations" + + + class RoutingErrorInformations { + public: + RoutingErrorInformations ( const RoutingError* error ); + virtual ~RoutingErrorInformations (); + static int getColumnCount (); + static QVariant getColumnName ( int column ); + virtual QVariant getColumn ( int column ); + inline const RoutingError* getRoutingError () const; + inline const Name getName () const; + inline const string getDescription () const; + inline const Cell* getCell () const; + protected: + const RoutingError* _error; + }; + + + inline const RoutingError* RoutingErrorInformations::getRoutingError () const + { return _error; } + + + inline const Name RoutingErrorInformations::getName () const + { + return _error->getName(); + } + + inline const string RoutingErrorInformations::getDescription () const + { + return _error->getDescription(); + } + + inline const Cell* RoutingErrorInformations::getCell () const + { + return _error->getCell(); + } + + +// ------------------------------------------------------------------- +// Class : "RoutingErrorInformationsVector" + + + class RoutingErrorInformationsVector { + public: + virtual ~RoutingErrorInformationsVector (); + virtual void addRoutingError ( const RoutingError* error ); + virtual RoutingErrorInformations* getRow ( int row ); + virtual int getColumnCount () const ; + virtual QVariant getColumnName ( int column ) const ; + virtual int size () const ; + + + vector _errorlist; + }; + + + + +} // End of Solstice namespace. + + +#endif // __ROUTING_ERROR_INFORMATIONS_H__ diff --git a/solstice/src/solstice/olds/RoutingErrorModel.h b/solstice/src/solstice/olds/RoutingErrorModel.h new file mode 100644 index 00000000..ddbc8901 --- /dev/null +++ b/solstice/src/solstice/olds/RoutingErrorModel.h @@ -0,0 +1,80 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./RoutingErrorModel.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __SOLSTICE_ROUTINGERROR_MODEL__ +#define __SOLSTICE_ROUTINGERROR_MODEL__ + +#include + +#include +#include +#include + +#include "hurricane/Commons.h" +#include "hurricane/Name.h" +#include "hurricane/Net.h" +#include "hurricane/Cell.h" +#include "hurricane/viewer/Graphics.h" +#include "solstice/RoutingErrorInformations.h" +#include "solstice/SolsticeEngine.h" + +namespace { + + + using namespace Hurricane; + + +} // End of anonymous namespace. + +namespace Solstice { + + + class RoutingErrorModel : public QAbstractTableModel { + Q_OBJECT; + + public: + RoutingErrorModel ( QObject* parent=NULL ); + ~RoutingErrorModel (); + void setCell ( Cell* cell ); + int rowCount ( const QModelIndex& parent=QModelIndex() ) const; + int columnCount ( const QModelIndex& parent=QModelIndex() ) const; + QVariant data ( const QModelIndex& index, int role=Qt::DisplayRole ) const; + QVariant headerData ( int section, Qt::Orientation orientation, int role=Qt::DisplayRole ) const; + inline Cell* getCell (); + const RoutingError* getRoutingError ( int row ); + + private: + Cell* _cell; + RoutingErrorInformationsVector* _routingError; + }; + + +// Inline Functions. + + inline Cell* RoutingErrorModel::getCell () { return _cell; } + +} // End of Solstice namespace. + + +#endif // _SOLSTICE_ROUTINGERROR_MODEL__ diff --git a/solstice/src/solstice/olds/RoutingErrorWidget.h b/solstice/src/solstice/olds/RoutingErrorWidget.h new file mode 100644 index 00000000..3b8d799a --- /dev/null +++ b/solstice/src/solstice/olds/RoutingErrorWidget.h @@ -0,0 +1,173 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | S O L S T I C E - C o m p a r a t o r | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./solstice/RoutingErrorWidget.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __SOLSTICE_ROUTINGERROR_WIDGET__ +#define __SOLSTICE_ROUTINGERROR_WIDGET__ + + +#include + +#include +#include +#include + +#include "hurricane/Commons.h" +#include "hurricane/Bug.h" +#include "hurricane/viewer/CellWidget.h" + +#include "solstice/RoutingErrorModel.h" + +class QSortFilterProxyModel; +class QModelIndex; +class QTableView; +class QLineEdit; +class QComboBox; +class QHeaderView; + + +namespace Solstice { + + + using std::set; + + // ------------------------------------------------------------------- + // Class : "SelectedRoutingError". + + + class SelectedRoutingError { + public: + inline SelectedRoutingError (); + inline SelectedRoutingError ( const RoutingError*, + size_t access=0 ); + inline const RoutingError* getRoutingError () const; + inline size_t getAccesses () const; + inline void incAccesses () const; + inline void setInserted () const; + inline void resetAccesses () const; + private: + const RoutingError* _routingError; + mutable size_t _accesses; + }; + + + inline SelectedRoutingError::SelectedRoutingError () : _routingError(NULL), _accesses(0) { } + inline SelectedRoutingError::SelectedRoutingError ( const RoutingError* RoutingError, size_t accesses ) : _routingError(RoutingError), _accesses(accesses) { } + inline const RoutingError* SelectedRoutingError::getRoutingError () const { return _routingError; } + inline void SelectedRoutingError::setInserted () const { _accesses = 64; } + inline size_t SelectedRoutingError::getAccesses () const { return _accesses; } + inline void SelectedRoutingError::incAccesses () const { ++_accesses; } + inline void SelectedRoutingError::resetAccesses () const { _accesses = 0; } + + + struct SelectedRoutingErrorCompare { + inline bool operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs ); + }; + + + inline bool SelectedRoutingErrorCompare::operator() ( const SelectedRoutingError& lhs, const SelectedRoutingError& rhs ) + { + return lhs.getRoutingError()->getName() < rhs.getRoutingError()->getName(); + } + + +// ------------------------------------------------------------------- +// Class : "SelectedRoutingErrorSet". + + + class SelectedRoutingErrorSet : public set{ + public: + void insert ( const RoutingError* ); + void forceInserteds (); + void resetAccesses (); + }; + + + inline void SelectedRoutingErrorSet::insert ( const RoutingError* RoutingError ) + { + iterator iselected = find(SelectedRoutingError(RoutingError)); + if ( iselected != end() ) + iselected->incAccesses (); + else + set::insert ( SelectedRoutingError(RoutingError,64) ); + } + + + inline void SelectedRoutingErrorSet::forceInserteds () + { + for ( iterator iselected=begin() ; iselected != end() ; ++iselected ) + iselected->setInserted (); + } + + + inline void SelectedRoutingErrorSet::resetAccesses () + { + for ( iterator iselected=begin() ; iselected != end() ; ++iselected ) + iselected->resetAccesses (); + } + +// ------------------------------------------------------------------- +// Class : "RoutingErrorWidget". + + + class RoutingErrorWidget : public QWidget { + Q_OBJECT; + + public: + RoutingErrorWidget ( QWidget* parent=NULL ); + inline Cell* getCell (); + /**/ void setCellWidget ( CellWidget* ); + /**/ void setCell ( Cell* ); + /**/ void goTo ( int ); + /**/ void updateSelecteds (); + signals: + /**/ void routingErrorSelected ( const RoutingError* ); + /**/ void routingErrorUnselected ( const RoutingError* ); + /**/ void routingErrorFitted ( const RoutingError* ); + public slots: + /**/ void forceRowHeight (); + private slots: + /**/ void textFilterChanged (); + /**/ void updateSelecteds ( const QItemSelection& , const QItemSelection& ); + /**/ void fitToRoutingError (); + + private: + /**/ CellWidget* _cellWidget; + /**/ Cell* _cell; + /**/ RoutingErrorModel* _baseModel; + /**/ QSortFilterProxyModel* _sortModel; + /**/ QTableView* _view; + /**/ QLineEdit* _filterPatternLineEdit; + /**/ int _rowHeight; + /**/ SelectedRoutingErrorSet _selecteds; + /**/ bool _forceReselect; + }; + + inline Cell* RoutingErrorWidget::getCell () { return _cell; } + + +} // End of Hurricane namespace. + + +#endif // __SOLSTICE_ROUTINGERROR_WIDGET_H__