-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for contact_id to be any Int #290
base: main
Are you sure you want to change the base?
Conversation
Thank you. |
And what happens if two contacts have the same ID in the config file? |
Can you add tests where the contact IDs are not in order? |
Partly yes. Before, the different weighting potentials were initialized inside a list, while now that is being done in a dictionary, so now changes for the user in the rea-in of a config file. At least not ones, that I can think of now. |
No error is thrown right now, when reading in a config file with two contacts of id: 1 and using
But when accessing the weighting potentials directly, only one is shown
How do we want to handle that case? We can throw an error if there is ambiguity in the contact ids. Another option is changing the ambigous contact id internally, maybe by adding one to the id or multiplying by 10. |
00c6657
to
5b60b2c
Compare
I get an error in sim = Simulation(SSD_examples[:ContactIDTest])
simulate!(sim)
calculate_capacitance_matrix(sim) |
Also, sim = Simulation(SSD_examples[:ContactIDTest])
simulate!(sim)
calculate_weighting_potential!(sim, 4) does actually calculate some field and stores it into the dict. |
No, we should throw an error in the construction of the |
All calls of this function already use contact.id |
But there is no contact with |
src/Simulation/Simulation.jl
Outdated
contact_ids = [contact.id for contact in sim.detector.contacts] | ||
if contact_id in contact_ids | ||
sim.weighting_potentials[contact_id] = WeightingPotential(ElectricPotentialArray(pcs), grid) | ||
else | ||
@error "No such contact" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid any unnecessary computations, please move the check if a contact with the
respective id
exists into the function calculate_weighting_potential!
at the very beginning.
Please also add a bit more information for the user:
!(contact_id in sim.detector.contacts) && @error "No contact with `ID = $(contact_id)`. Possible contact IDs are $(...)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
6c3a8c0
to
78f7f54
Compare
This should solve issue #288