-
Notifications
You must be signed in to change notification settings - Fork 3
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
set coordinates to real symbols #170
base: master
Are you sure you want to change the base?
Conversation
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.
@e-moral-sanchez I suggest you add some basic tests for the TerminalExpr
function (which is constructor of the namesake class in module sympde.expr.evaluation
), and mark those which fail with @pytest.mark.xfail
.
The problem with |
Excellent. Please update the PR description... |
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.
I have a few comments (also to better understand the previous code)
@@ -204,8 +204,14 @@ def __new__(cls, name, dim=None, **kwargs): | |||
obj._is_plus = None | |||
|
|||
lcoords = ['x1', 'x2', 'x3'][:ldim] | |||
lcoords_real = [Symbol(i, real=True) for i in lcoords] | |||
lcoords_symbols = {i: si for i,si in zip(lcoords, lcoords_real)} |
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.
these names are a bit misleading...
lcoords_real
is a list of symbols and lcoords_symbols
the corresponding dict.
maybe rename ?
e.g. lcoords_real
-> lcoords_sym
and lcoords_symbols
-> lcoords_dict
?
lcoords_symbols = {i: si for i,si in zip(lcoords, lcoords_real)} | ||
|
||
obj._logical_coordinates = Tuple(*lcoords_real) | ||
|
||
lcoords = [Symbol(i) for i in lcoords] |
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.
Just above, we have lcoords = ['x1', 'x2', 'x3'][:ldim]
...
this new lcoords
is now a list of Symbols but without the real flag... this is really confusing.
@@ -232,6 +238,7 @@ def __new__(cls, name, dim=None, **kwargs): | |||
constants_values.update( kwargs ) | |||
d = {a:numpy_to_native_python(constants_values[a.name]) for a in constants} | |||
args = args.subs(d) | |||
args = args.subs(lcoords_symbols) |
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.
so, the coordinate symbols were not substituted before and they must be substituted now?
-Coordinates are
Sympy
symbols which should have the attributereal=True
to avoid problems with code generation.Linked to issue #169