diff --git a/kite/CMakeLists.txt b/kite/CMakeLists.txt index 81b771bd..8c7beafa 100644 --- a/kite/CMakeLists.txt +++ b/kite/CMakeLists.txt @@ -18,7 +18,32 @@ IF(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0003 NEW) ENDIF(COMMAND CMAKE_POLICY) -SET(CMAKE_MODULE_PATH "$ENV{HURRICANE_TOP}/share/cmake_modules/") +# This macro has to be included in all the tools CMakeLists.txt as it's +# the sole means of localizing other tools/projects. +MACRO(SETUP_PROJECT_PATHS project) + IF( NOT("$ENV{${project}_USER_TOP}" STREQUAL "") ) + MESSAGE("-- ${project}_USER_TOP is set to $ENV{${project}_USER_TOP}") + SET(${project}_DIR_SEARCH "$ENV{${project}_USER_TOP}") + SET(PROJECT_MODULE_PATH "$ENV{${project}_USER_TOP}/share/cmake_modules/") + LIST(FIND CMAKE_MODULE_PATH "${PROJECT_MODULE_PATH}" DIR_INDEX) + IF( DIR_INDEX LESS 0) + LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_MODULE_PATH}") + ENDIF( DIR_INDEX LESS 0) + ENDIF( NOT("$ENV{${project}_USER_TOP}" STREQUAL "") ) + + IF( NOT("$ENV{${project}_TOP}" STREQUAL "") ) + MESSAGE("-- ${project}_TOP is set to $ENV{${project}_TOP}") + LIST(APPEND ${project}_DIR_SEARCH "$ENV{${project}_TOP}") + SET(PROJECT_MODULE_PATH "$ENV{${project}_TOP}/share/cmake_modules/") + LIST(FIND CMAKE_MODULE_PATH "${PROJECT_MODULE_PATH}" DIR_INDEX) + IF( DIR_INDEX LESS 0) + LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_MODULE_PATH}") + ENDIF( DIR_INDEX LESS 0) + ENDIF( NOT("$ENV{${project}_TOP}" STREQUAL "") ) +ENDMACRO(SETUP_PROJECT_PATHS project) + +SETUP_PROJECT_PATHS(IO) +SETUP_PROJECT_PATHS(CORIOLIS) SET(QT_USE_QTXML "true") diff --git a/kite/cmake_modules/FindKITE.cmake b/kite/cmake_modules/FindKITE.cmake index 7ec9d910..3093cbe7 100644 --- a/kite/cmake_modules/FindKITE.cmake +++ b/kite/cmake_modules/FindKITE.cmake @@ -12,14 +12,12 @@ SET(KITE_DIR_MESSAGE "Set the KITE_INCLUDE_DIR cmake cache entry to the ${KITE_I # don't even bother under WIN32 IF(UNIX) - - SET(KITE_DIR_SEARCH $ENV{CORIOLIS_TOP} $ENV{HURRICANE_TOP}) # # Look for an installation. # FIND_PATH(KITE_INCLUDE_PATH NAMES kite/KiteEngine.h PATHS # Look in other places. - ${KITE_DIR_SEARCH} + ${CORIOLIS_DIR_SEARCH} PATH_SUFFIXES include/coriolis # Help the user find it if we cannot. DOC "The ${KITE_INCLUDE_PATH_DESCRIPTION}" @@ -27,7 +25,7 @@ IF(UNIX) FIND_LIBRARY(KITE_LIBRARY_PATH NAMES kite - PATHS ${KITE_DIR_SEARCH} + PATHS ${CORIOLIS_DIR_SEARCH} PATH_SUFFIXES lib # Help the user find it if we cannot. DOC "The ${KITE_INCLUDE_PATH_DESCRIPTION}" @@ -35,7 +33,7 @@ IF(UNIX) FIND_LIBRARY(KITE_STATIC_LIBRARY_PATH NAMES kite-static - PATHS ${KITE_DIR_SEARCH} + PATHS ${CORIOLIS_DIR_SEARCH} PATH_SUFFIXES lib # Help the user find it if we cannot. DOC "The ${KITE_INCLUDE_PATH_DESCRIPTION}" diff --git a/kite/src/GCell.cpp b/kite/src/GCell.cpp index 44ecc3ba..74432cf8 100644 --- a/kite/src/GCell.cpp +++ b/kite/src/GCell.cpp @@ -30,6 +30,7 @@ #include "hurricane/DebugSession.h" #include "hurricane/Bug.h" #include "hurricane/Error.h" +#include "hurricane/Warning.h" #include "hurricane/Component.h" #include "hurricane/RoutingPad.h" #include "katabatic/AutoSegment.h" @@ -137,6 +138,7 @@ namespace Kite { using Hurricane::roundfp; using Hurricane::Bug; using Hurricane::Error; + using Hurricane::Warning; using Hurricane::ForEachIterator; using Hurricane::Component; using Hurricane::RoutingPad; @@ -163,6 +165,25 @@ namespace Kite { } +// ------------------------------------------------------------------- +// Class : "Kite::GCell::CompareByKey". +// +// lhs < rhs --> true + + + bool GCell::CompareByKey::operator() ( GCell* lhs, GCell* rhs ) + { + //int difference = floatCompare ( lhs->base()->getDensity(), rhs->base()->getDensity() ); + //if ( abs(difference) > 1000 ) return difference > 0; + + float difference = roundfp ( lhs->base()->getDensity() - rhs->base()->getDensity() ); + if ( difference != 0.0 ) return (difference > 0.0); + + if ( lhs->getIndex() < rhs->getIndex() ) return true; + return false; + } + + // ------------------------------------------------------------------- // Class : "Kite::GCell::CompareByStiffness". // @@ -583,6 +604,39 @@ namespace Kite { ,_map.size(),_requests.size()) << endl; } } + + + void DyKeyQueue::invalidate ( GCell* gcell ) + { + std::set::iterator igcell = _map.find(gcell); + if ( igcell != _map.end() ) { + _map.erase ( igcell ); + } + push ( gcell ); + } + + + void DyKeyQueue::push ( GCell* gcell ) + { + _requests.insert ( gcell ); + } + + + void DyKeyQueue::revalidate () + { + std::set::iterator igcell = _requests.begin(); + for ( ; igcell != _requests.end() ; ++igcell ) + _map.insert ( *igcell ); + } + + + GCell* DyKeyQueue::pop () + { + if ( _map.empty() ) return NULL; + std::set::iterator igcell = _map.begin(); + GCell* gcell = *igcell; + _map.erase ( igcell ); + } diff --git a/kite/src/kite/GCell.h b/kite/src/kite/GCell.h index aaa10d95..a9f0b0c7 100644 --- a/kite/src/kite/GCell.h +++ b/kite/src/kite/GCell.h @@ -27,6 +27,7 @@ #define __KITE_GCELL__ #include +#include #include #include @@ -73,6 +74,11 @@ namespace Kite { public: bool operator() ( GCell* lhs, GCell* rhs ); }; + // Sub-Class: "CompareByKey()". + class CompareByKey { + public: + bool operator() ( GCell* lhs, GCell* rhs ); + }; // Sub-Class: "CompareByStiffness()". class CompareByStiffness { public: @@ -221,8 +227,8 @@ namespace Kite { void invalidate ( GCell* ); void revalidate (); private: - set _map; - set _requests; + std::set _map; + std::set _requests; };