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())); } { return static_cast<TramontanaEngine*>(ToolEngine::get(cell,staticGetName())); }
TramontanaEngine::TramontanaEngine ( Cell* cell ) TramontanaEngine::TramontanaEngine ( Cell* cell, uint32_t depth )
: Super (cell) : Super (cell, (depth==0))
, _viewer (NULL) , _viewer (NULL)
, _depth (depth)
, _equipotentials() , _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(); tramontana->_postCreate();
@ -145,14 +146,52 @@ namespace Tramontana {
void TramontanaEngine::extract () void TramontanaEngine::extract ()
{ {
cmess1 << " o Extracting " << getCell() << endl; if (getDepth() == 0) {
startMeasures(); 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 sweepLine ( this );
sweepLine.run(); sweepLine.run();
consolidate(); consolidate();
//showEquipotentials(); //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; typedef ToolEngine Super;
public: public:
static const Name& staticGetName (); static const Name& staticGetName ();
static TramontanaEngine* create ( Cell* ); static TramontanaEngine* create ( Cell*, uint32_t depth=0 );
static TramontanaEngine* get ( const Cell* ); static TramontanaEngine* get ( const Cell* );
public: public:
const Name& getName () const; const Name& getName () const;
inline uint32_t getDepth () const;
inline const std::set<Equipotential*,DBo::CompareById> inline const std::set<Equipotential*,DBo::CompareById>
getEquipotentials () const; getEquipotentials () const;
inline void setViewer ( CellViewer* ); inline void setViewer ( CellViewer* );
inline CellViewer* getViewer (); inline CellViewer* getViewer ();
void extract (); void extract ();
void _extract ();
void consolidate (); void consolidate ();
void showEquipotentials () const; void showEquipotentials () const;
void add ( Equipotential* ); void add ( Equipotential* );
@ -69,10 +71,11 @@ namespace Tramontana {
static Name _toolName; static Name _toolName;
private: private:
CellViewer* _viewer; CellViewer* _viewer;
uint32_t _depth;
std::set<Equipotential*,DBo::CompareById> _equipotentials; std::set<Equipotential*,DBo::CompareById> _equipotentials;
protected: protected:
// Constructors & Destructors. // Constructors & Destructors.
TramontanaEngine ( Cell* ); TramontanaEngine ( Cell*, uint32_t depth );
virtual ~TramontanaEngine (); virtual ~TramontanaEngine ();
virtual void _postCreate (); virtual void _postCreate ();
virtual void _preDestroy (); virtual void _preDestroy ();
@ -84,6 +87,7 @@ namespace Tramontana {
inline void TramontanaEngine::setViewer ( CellViewer* viewer ) { _viewer=viewer; } inline void TramontanaEngine::setViewer ( CellViewer* viewer ) { _viewer=viewer; }
inline CellViewer* TramontanaEngine::getViewer () { return _viewer; } inline CellViewer* TramontanaEngine::getViewer () { return _viewer; }
inline uint32_t TramontanaEngine::getDepth () const { return _depth; }
inline const std::set<Equipotential*,DBo::CompareById> inline const std::set<Equipotential*,DBo::CompareById>
TramontanaEngine::getEquipotentials () const { return _equipotentials; } TramontanaEngine::getEquipotentials () const { return _equipotentials; }