[Tools] Patch circuit library for dummy circuit models without any ports

This commit is contained in:
tangxifan 2021-02-24 10:36:48 -07:00
parent 0ce9b66c75
commit 7a5dd1bc02
1 changed files with 10 additions and 0 deletions

View File

@ -1214,6 +1214,16 @@ CircuitModelId CircuitLibrary::add_model(const enum e_circuit_model_type& type)
/* Build the fast look-up for circuit models */ /* Build the fast look-up for circuit models */
build_model_lookup(); build_model_lookup();
/* Add a placeholder in the fast look-up for model port
* This is to avoid memory holes when a circuit model
* does not have any ports.
* As a result, the fast look-up may not even create an entry
* for this model id, which cause fast look-up abort when there is
* a query on the model
*/
model_port_lookup_.resize(model_ids_.size());
model_port_lookup_[model_id].resize(NUM_CIRCUIT_MODEL_PORT_TYPES);
return model_id; return model_id;
} }