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

Expressions as Functions API #148

Open
2 tasks
ratnania opened this issue Mar 6, 2024 · 3 comments
Open
2 tasks

Expressions as Functions API #148

ratnania opened this issue Mar 6, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@ratnania
Copy link
Contributor

ratnania commented Mar 6, 2024

Up to now, we were allowing expression (using the coordinates) to be passed directly in the weak formulation.
We encountered two major problems with this approach

  • sometimes an error is raised because we cannot check the linearity/bilinearity of a form.
  • it may make the code very slow

This issue aims at allowing the definition of a Function, as a container, for two major uses;

  • by providing its symbolic expression. example,
F = Function((x,y), x**2+y**2)

in which case, F will not appear as a free-variable, and its expression will be provided in TerminalExpr like in the valued Constant case.

  • by providing its actual implementation, meaning, providing a Python code. In this case, the code must be pyccelized first to check that it can be used in our pipeline with psydac.
@ratnania ratnania added the enhancement New feature or request label Mar 6, 2024
@ratnania ratnania self-assigned this Mar 6, 2024
@yguclu
Copy link
Member

yguclu commented Mar 6, 2024

Do we want a Function to be only scalar valued, or also vector and matrix valued?

@yguclu
Copy link
Member

yguclu commented Mar 6, 2024

Given that we already have the classes ScalarFunction and VectorFunction, which must belong to a ScalarFunctionSpace or VectorFunctionSpace, I suggest that we use the name UserFunction for this class.

@ratnania
Copy link
Contributor Author

ratnania commented Mar 6, 2024

I agree that we need to think about the API. We have different ways of doing it;

  • Use ScalarFunction and VectorFunction and allow them to have an expression or implemented code,
  • Rename ScalarFunction and VectorFunction to UndefinedScalarFunction and UndefinedVectorFunction, and use ScalarFunction and VectorFunction with expression/code, in addition to a new object MatrixFunction.
    The latter seems to be more appropriate, since the user (does not and) will not call UndefinedScalarFunction and UndefinedVectorFunction constructors, but use element_of.

@yguclu yguclu transferred this issue from pyccel/IGA-Python Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants