Skip to content

Commit

Permalink
move get_readonly_view()
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrubeck committed Feb 18, 2024
1 parent f209615 commit 463c496
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions firedrake/preconditioners/pmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,12 +559,6 @@ def expand_element(ele):
return ele


def get_readonly_view(arr):
result = arr.view()
result.flags.writeable = False
return result


def hash_fiat_element(element):
"""FIAT elements are not hashable,
this is not the best way to create a hash"""
Expand All @@ -587,6 +581,12 @@ def generate_key_evaluate_dual(source, target, derivative=None):
return hash_fiat_element(source) + hash_fiat_element(target) + (derivative,)


def get_readonly_view(arr):
result = arr.view()
result.flags.writeable = False
return result


@cached({}, key=generate_key_evaluate_dual)
def evaluate_dual(source, target, derivative=None):
"""Evaluate the action of a set of dual functionals of the target element
Expand Down

0 comments on commit 463c496

Please sign in to comment.