mirror of https://github.com/KLayout/klayout.git
Importing latest version of LStream package, bug fixes (mag instances, layer were duplicated)
This commit is contained in:
parent
f2928e94a8
commit
bd6f62013e
|
|
@ -275,9 +275,15 @@ SaveLayoutOptions::get_valid_layers (const db::Layout &layout, std::vector <std:
|
|||
|
||||
}
|
||||
|
||||
if (lm == LP_OnlyNumbered) {
|
||||
if (lm == LP_AsIs) {
|
||||
|
||||
for (std::vector<std::pair <unsigned int, db::LayerProperties> >::const_iterator l = all_layers.begin (); l != all_layers.end (); ++l) {
|
||||
for (auto l = all_layers.begin (); l != all_layers.end (); ++l) {
|
||||
layers.push_back (*l);
|
||||
}
|
||||
|
||||
} else if (lm == LP_OnlyNumbered) {
|
||||
|
||||
for (auto l = all_layers.begin (); l != all_layers.end (); ++l) {
|
||||
if (l->second.layer >= 0 && l->second.datatype >= 0) {
|
||||
layers.push_back (*l);
|
||||
}
|
||||
|
|
@ -285,7 +291,7 @@ SaveLayoutOptions::get_valid_layers (const db::Layout &layout, std::vector <std:
|
|||
|
||||
} else if (lm == LP_OnlyNamed) {
|
||||
|
||||
for (std::vector<std::pair <unsigned int, db::LayerProperties> >::const_iterator l = all_layers.begin (); l != all_layers.end (); ++l) {
|
||||
for (auto l = all_layers.begin (); l != all_layers.end (); ++l) {
|
||||
if (! l->second.name.empty ()) {
|
||||
layers.push_back (*l);
|
||||
}
|
||||
|
|
@ -293,7 +299,7 @@ SaveLayoutOptions::get_valid_layers (const db::Layout &layout, std::vector <std:
|
|||
|
||||
} else if (lm == LP_AssignName) {
|
||||
|
||||
for (std::vector<std::pair <unsigned int, db::LayerProperties> >::const_iterator l = all_layers.begin (); l != all_layers.end (); ++l) {
|
||||
for (auto l = all_layers.begin (); l != all_layers.end (); ++l) {
|
||||
layers.push_back (*l);
|
||||
if (l->second.name.empty ()) {
|
||||
layers.back ().second = tl::sprintf ("L%dD%d", l->second.layer, l->second.datatype);
|
||||
|
|
@ -304,7 +310,7 @@ SaveLayoutOptions::get_valid_layers (const db::Layout &layout, std::vector <std:
|
|||
|
||||
} else if (lm == LP_AssignNameWithPriority) {
|
||||
|
||||
for (std::vector<std::pair <unsigned int, db::LayerProperties> >::const_iterator l = all_layers.begin (); l != all_layers.end (); ++l) {
|
||||
for (auto l = all_layers.begin (); l != all_layers.end (); ++l) {
|
||||
layers.push_back (*l);
|
||||
if (l->second.name.empty ()) {
|
||||
layers.back ().second = tl::sprintf ("L%dD%d", l->second.layer, l->second.datatype);
|
||||
|
|
|
|||
|
|
@ -405,7 +405,8 @@ public:
|
|||
LP_OnlyNamed = 1,
|
||||
LP_AssignName = 2,
|
||||
LP_AssignNameWithPriority = 3,
|
||||
LP_AssignNumber = 4
|
||||
LP_AssignNumber = 4,
|
||||
LP_AsIs = 5
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -484,7 +484,12 @@ Compressed::compress_instances (const db::Cell::const_iterator &begin_instances,
|
|||
disp = create_repetition_from_array (&inst_array, array, irregular_array);
|
||||
}
|
||||
|
||||
db::CellInstArray single_inst (inst_array.object (), db::Trans (-disp) * inst_array.front ());
|
||||
db::CellInstArray single_inst;
|
||||
if (! inst_array.is_complex ()) {
|
||||
single_inst = db::CellInstArray (inst_array.object (), db::Trans (-disp) * inst_array.front ());
|
||||
} else {
|
||||
single_inst = db::CellInstArray (inst_array.object (), inst_array.complex_trans (db::Trans (-disp) * inst_array.front ()));
|
||||
}
|
||||
|
||||
// no compression -> just keep as is
|
||||
if (prop_id != 0) {
|
||||
|
|
@ -499,7 +504,13 @@ Compressed::compress_instances (const db::Cell::const_iterator &begin_instances,
|
|||
// As we configured the compressor with level 0, no regular array formation will happen here. This is
|
||||
// good for instances as array instances are special.
|
||||
db::Vector disp = inst_array.front ().disp ();
|
||||
db::CellInstArray single_inst (inst_array.object (), db::Trans (-disp) * inst_array.front ());
|
||||
|
||||
db::CellInstArray single_inst;
|
||||
if (! inst_array.is_complex ()) {
|
||||
single_inst = db::CellInstArray (inst_array.object (), db::Trans (-disp) * inst_array.front ());
|
||||
} else {
|
||||
single_inst = db::CellInstArray (inst_array.object (), inst_array.complex_trans (db::Trans (-disp) * inst_array.front ()));
|
||||
}
|
||||
|
||||
if (prop_id != 0) {
|
||||
inst_with_properties_compressor.add (db::CellInstArrayWithProperties (single_inst, prop_id), disp);
|
||||
|
|
|
|||
|
|
@ -111,8 +111,26 @@ Writer::write (db::Layout &layout, tl::OutputStream &stream, const db::SaveLayou
|
|||
m_meta_data_view_id = -1;
|
||||
|
||||
m_layers_to_write.clear ();
|
||||
options.get_valid_layers (layout, m_layers_to_write, db::SaveLayoutOptions::LP_OnlyNumbered);
|
||||
options.get_valid_layers (layout, m_layers_to_write, db::SaveLayoutOptions::LP_OnlyNamed);
|
||||
|
||||
#if KLAYOUT_MAJOR_VERSION == 0 && (KLAYOUT_MINOR_VERSION < 30 || (KLAYOUT_MINOR_VERSION == 30 && KLAYOUT_TINY_VERSION < 5))
|
||||
{
|
||||
options.get_valid_layers (layout, m_layers_to_write, db::SaveLayoutOptions::LP_OnlyNumbered);
|
||||
options.get_valid_layers (layout, m_layers_to_write, db::SaveLayoutOptions::LP_OnlyNamed);
|
||||
|
||||
// clean up layer duplicates - see TODO above
|
||||
auto lw = m_layers_to_write.begin ();
|
||||
std::set<unsigned int> lseen;
|
||||
for (auto l = m_layers_to_write.begin (); l != m_layers_to_write.end (); ++l) {
|
||||
if (lseen.find (l->first) == lseen.end ()) {
|
||||
*lw++ = *l;
|
||||
lseen.insert (l->first);
|
||||
}
|
||||
}
|
||||
m_layers_to_write.erase (lw, m_layers_to_write.end ());
|
||||
}
|
||||
#else
|
||||
options.get_valid_layers (layout, m_layers_to_write, db::SaveLayoutOptions::LP_AsIs);
|
||||
#endif
|
||||
|
||||
m_cells_to_write.clear ();
|
||||
options.get_cells (layout, m_cells_to_write, m_layers_to_write);
|
||||
|
|
|
|||
Loading…
Reference in New Issue