From 463c496d46d123f491355109e13197bf9abc5b1f Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Sun, 18 Feb 2024 16:12:00 +0000 Subject: [PATCH] move get_readonly_view() --- firedrake/preconditioners/pmg.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/firedrake/preconditioners/pmg.py b/firedrake/preconditioners/pmg.py index 542fa1a977..82b538aea6 100644 --- a/firedrake/preconditioners/pmg.py +++ b/firedrake/preconditioners/pmg.py @@ -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""" @@ -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