Skip to content

Commit

Permalink
Merge pull request #629 from OP2/Melina97/fix_cache_problem
Browse files Browse the repository at this point in the history
Melina97/fix cache problem
  • Loading branch information
dham authored Jul 27, 2021
2 parents 117e4b7 + 8423537 commit 6101f6b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pyop2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,21 @@ def __init__(self, data=None, map=None, access=None, lgmaps=None, unroll_map=Fal
raise MapValueError(
"To set of %s doesn't match the set of %s." % (map, data))

def recreate(self, data=None, map=None, access=None, lgmaps=None, unroll_map=None):
"""Creates a new Dat based on the existing Dat with the changes specified.
:param data: A data-carrying object, either :class:`Dat` or class:`Mat`
:param map: A :class:`Map` to access this :class:`Arg` or the default
if the identity map is to be used.
:param access: An access descriptor of type :class:`Access`
:param lgmaps: For :class:`Mat` objects, a tuple of 2-tuples of local to
global maps used during assembly."""
return type(self)(data=data or self.data,
map=map or self.map,
access=access or self.access,
lgmaps=lgmaps or self.lgmaps,
unroll_map=False if unroll_map is None else unroll_map)

@cached_property
def _kernel_args_(self):
return self.data._kernel_args_
Expand Down

0 comments on commit 6101f6b

Please sign in to comment.