Skip to content
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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

set coordinates to real symbols #170

wants to merge 8 commits into from

Conversation

e-moral-sanchez
Copy link
Contributor

@e-moral-sanchez e-moral-sanchez commented Oct 13, 2024

-Coordinates are Sympy symbols which should have the attribute real=True to avoid problems with code generation.

Linked to issue #169

@e-moral-sanchez e-moral-sanchez changed the title set attibute of coordinates to real set coordinates to real symbols Oct 13, 2024
Copy link
Member

@yguclu yguclu left a 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.

@e-moral-sanchez e-moral-sanchez marked this pull request as ready for review December 2, 2024 10:30
@e-moral-sanchez
Copy link
Contributor Author

The problem with TerminalExpr has been fixed.
Since pyccel/psydac#445 passed the tests, this PR is ready.

@yguclu
Copy link
Member

yguclu commented Feb 12, 2025

The problem with TerminalExpr has been fixed. Since pyccel/psydac#445 passed the tests, this PR is ready.

Excellent. Please update the PR description...

Copy link
Collaborator

@campospinto campospinto left a 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)}
Copy link
Collaborator

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]
Copy link
Collaborator

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)
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants