Ensure that with_ works for all immutable objects#694
Merged
Conversation
…ttributes to ensure that with_ will work
…nent_shape to make with_ work
to make with_ work
_domain, _num_intervals, _identify_left_right -> domain, num_intervals, identify_left_right
…rt_some_type attrs to make with_ work
_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.
using GenericBoundaryInfo
renefritze
approved these changes
May 31, 2019
pmli
reviewed
May 31, 2019
pmli
approved these changes
May 31, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 forwith_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:
UnstructuredTriangleGridnow has a factory methodfrom_verticeswhich will be usually used to instantiate the grid.GmshGridhas been removed. Instead anUnstructuredTriangleGridis instantiated directly.BoundaryInfoFromIndicatorsis nowGenericBoundaryInfowith afrom_indicatorsfactory method.GmshBoundaryInfohas been removed. Instead,GenericBoundaryInfois used.SubgridBoundaryInfohas been removed. Instead,GenericBoundaryInfois 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__.)