Added recursive extraction of all instances models in Tramontana.

This commit is contained in:
Jean-Paul Chaput 2023-03-28 16:08:11 +02:00
parent 5afb4cabe9
commit e968a5088f
2 changed files with 53 additions and 10 deletions

View File

@ -100,9 +100,10 @@ namespace Tramontana {
{ return static_cast<TramontanaEngine*>(ToolEngine::get(cell,staticGetName())); }
TramontanaEngine::TramontanaEngine ( Cell* cell )
: Super (cell)
TramontanaEngine::TramontanaEngine ( Cell* cell, uint32_t depth )
: Super (cell, (depth==0))
, _viewer (NULL)
, _depth (depth)
, _equipotentials()
{ }
@ -113,9 +114,9 @@ namespace Tramontana {
}
TramontanaEngine* TramontanaEngine::create ( Cell* cell )
TramontanaEngine* TramontanaEngine::create ( Cell* cell, uint32_t depth )
{
TramontanaEngine* tramontana = new TramontanaEngine ( cell );
TramontanaEngine* tramontana = new TramontanaEngine ( cell, depth );
tramontana->_postCreate();
@ -145,14 +146,52 @@ namespace Tramontana {
void TramontanaEngine::extract ()
{
cmess1 << " o Extracting " << getCell() << endl;
startMeasures();
if (getDepth() == 0) {
cmess1 << " o Extracting " << getCell() << endl;
startMeasures();
}
for ( Instance* instance : getCell()->getInstances() ) {
Cell* master = instance->getMasterCell();
TramontanaEngine* extractor = TramontanaEngine::get( master );
if (not extractor) {
extractor = TramontanaEngine::create( master, getDepth()+1 );
extractor->extract();
}
}
_extract();
if (getDepth() == 0) {
stopMeasures();
printMeasures();
}
}
void TramontanaEngine::_extract ()
{
if (getDepth()) {
startMeasures();
}
SweepLine sweepLine ( this );
sweepLine.run();
consolidate();
//showEquipotentials();
stopMeasures();
printMeasures();
if (getDepth()) {
stopMeasures();
ostringstream header;
ostringstream result;
header << " ";
for ( size_t i=0 ; i<getDepth() ; ++i ) header << " ";
header << "- " << getString( getCell()->getName() );
result << Timer::getStringTime (getTimer().getCombTime())
<< ", " << Timer::getStringMemory(getTimer().getIncrease());
cmess1 << Dots::asString( header.str(), result.str() ) << endl;
}
}

View File

@ -49,15 +49,17 @@ namespace Tramontana {
typedef ToolEngine Super;
public:
static const Name& staticGetName ();
static TramontanaEngine* create ( Cell* );
static TramontanaEngine* create ( Cell*, uint32_t depth=0 );
static TramontanaEngine* get ( const Cell* );
public:
const Name& getName () const;
inline uint32_t getDepth () const;
inline const std::set<Equipotential*,DBo::CompareById>
getEquipotentials () const;
inline void setViewer ( CellViewer* );
inline CellViewer* getViewer ();
void extract ();
void _extract ();
void consolidate ();
void showEquipotentials () const;
void add ( Equipotential* );
@ -69,10 +71,11 @@ namespace Tramontana {
static Name _toolName;
private:
CellViewer* _viewer;
uint32_t _depth;
std::set<Equipotential*,DBo::CompareById> _equipotentials;
protected:
// Constructors & Destructors.
TramontanaEngine ( Cell* );
TramontanaEngine ( Cell*, uint32_t depth );
virtual ~TramontanaEngine ();
virtual void _postCreate ();
virtual void _preDestroy ();
@ -84,6 +87,7 @@ namespace Tramontana {
inline void TramontanaEngine::setViewer ( CellViewer* viewer ) { _viewer=viewer; }
inline CellViewer* TramontanaEngine::getViewer () { return _viewer; }
inline uint32_t TramontanaEngine::getDepth () const { return _depth; }
inline const std::set<Equipotential*,DBo::CompareById>
TramontanaEngine::getEquipotentials () const { return _equipotentials; }