You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, support for pint and unit-qualified values is rudimentary. Mirheo knows how to transform Quantity objects to Mirheo's units, but it does not know if the dimensionality is correct. Concretely, when Mirheo receives a Quantity as an argument, it transforms it to the (mirL, mirT, mirM) unit system, takes the magnitude and discards the dimension.
This leads to hard to find bugs, e.g.: mole is not converted to N_avogadro, the fact that mesh scale depends on mirL may be forgotten etc.
We should find a way to add strict unit checking. To make that possible, either Python or the pybind C++ code somehow has to know the dimensionalities of all parameters of all APIs. The most robust solution I can think of is to replace real parameters (in bindings, not in the core) with Length, Duration, Energy and other similar types, each representing one dimensionality. Then we somehow define implicit conversions from pint Quantity to these types.
The text was updated successfully, but these errors were encountered:
At the moment, support for
pint
and unit-qualified values is rudimentary. Mirheo knows how to transformQuantity
objects to Mirheo's units, but it does not know if the dimensionality is correct. Concretely, when Mirheo receives aQuantity
as an argument, it transforms it to the (mirL, mirT, mirM) unit system, takes the magnitude and discards the dimension.This leads to hard to find bugs, e.g.: mole is not converted to N_avogadro, the fact that mesh scale depends on mirL may be forgotten etc.
We should find a way to add strict unit checking. To make that possible, either Python or the pybind C++ code somehow has to know the dimensionalities of all parameters of all APIs. The most robust solution I can think of is to replace
real
parameters (in bindings, not in the core) withLength
,Duration
,Energy
and other similar types, each representing one dimensionality. Then we somehow define implicit conversions from pintQuantity
to these types.The text was updated successfully, but these errors were encountered: