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

Ensure that with_ works for all immutable objects #694

Merged
merged 30 commits into from May 31, 2019
Merged

Conversation

sdrave
Copy link
Member

@sdrave sdrave commented May 29, 2019

This rather large PR adds some code to ImmutableMeta.__call__ which checks if all __init__ arguments of an immutable class are available as attributes of the generated object. This is necessary for with_ to work correctly.

All other commits in this PR fix various classes for which this condition is not satisfied. In some cases some attributes are renamed (from _foo to foo) and many missing attributes are added. Some refactoring happened along the way:

  • UnstructuredTriangleGrid now has a factory method from_vertices which will be usually used to instantiate the grid.
  • GmshGrid has been removed. Instead an UnstructuredTriangleGrid is instantiated directly.
  • BoundaryInfoFromIndicators is now GenericBoundaryInfo with a from_indicators factory method.
  • GmshBoundaryInfo has been removed. Instead, GenericBoundaryInfo is used.
  • SubgridBoundaryInfo has been removed. Instead, GenericBoundaryInfo is used.

One main motivation for #549 was to ensure that with_ always works. Since dataclasses do not really seem to work for us, this PR can be seen as a step towards a similar goal. (Another PR will follow to get rid of some of the boilerplate code in __init__.)

sdrave added 28 commits May 29, 2019
 _domain, _num_intervals, _identify_left_right -> domain, num_intervals, identify_left_right
_mapping, _adjoint_mapping -> mapping, adjoint_mapping
…_ args

and add parent_entities attribute to make with_ work
…aryInfo

The refactored class is more flexible to use an compatible with with_.
and use generic classes instead.
@sdrave sdrave added this to the 2019.2 milestone May 29, 2019
@sdrave sdrave requested review from renefritze and pmli May 29, 2019
@sdrave sdrave mentioned this pull request May 29, 2019
src/pymor/core/interfaces.py Outdated Show resolved Hide resolved
pmli
pmli approved these changes May 31, 2019
@sdrave sdrave merged commit 8ac6c56 into master May 31, 2019
4 of 7 checks passed
@sdrave sdrave deleted the ensure_with branch May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants