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

Handle numpy metadata (quadrature arrays) without throwing a warning #293

Closed
wants to merge 1 commit into from

Conversation

jorgensd
Copy link
Member

Handle string conversion of numpy arrays without throwing a UserWarning.

@@ -84,6 +86,8 @@ def canonicalize_metadata(metadata):
value = str(value)
elif hasattr(value, "ufl_signature"):
value = value.ufl_signature
elif isinstance(value, np.ndarray):
value = np.array2string(value, separator=" ")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this safe? That array can get quite big.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what happens for a numpy array as input to metadata atm irregardless (just throws a user warning).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'm just nervous about silencing a warning that might have an actual point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to avoid people sending in large arrays of custom quadrature points/weights we should find a better way to let people patch in custom quadrature rules.

Currently they have to be implemented in FINAT/FIAT/basix?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss this in person tomorrow. I have ideas.

@jorgensd
Copy link
Member Author

Issue opened in #294

@jorgensd jorgensd closed this Jun 13, 2024
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.

2 participants