From fb87689c6a6593dead64dacc0e3fe632794d296e Mon Sep 17 00:00:00 2001 From: "Keaton J. Burns" Date: Fri, 27 Sep 2024 09:58:33 -0400 Subject: [PATCH] Change field methods to use wrapped array.copyto. This makes set_state issue a warning instead of an error for real-valued EVPs. --- dedalus/core/field.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dedalus/core/field.py b/dedalus/core/field.py index 7222c5a7..1f41a394 100644 --- a/dedalus/core/field.py +++ b/dedalus/core/field.py @@ -16,6 +16,7 @@ from ..libraries.fftw import fftw_wrappers as fftw +from ..tools.array import copyto from ..tools.config import config from ..tools.cache import CachedMethod, CachedAttribute from ..tools.exceptions import UndefinedParityError @@ -567,7 +568,7 @@ def __setitem__(self, layout, data): """Set data viewed in a specified layout.""" layout = self.dist.get_layout_object(layout) self.preset_layout(layout) - np.copyto(self.data, data) + copyto(self.data, data) def get_basis(self, coord): return self.domain.get_basis(coord) @@ -599,7 +600,7 @@ def set_global_data(self, global_data): self.set_local_data(global_data[np.ix_(*elements)]) def set_local_data(self, local_data): - np.copyto(self.data, local_data) + copyto(self.data, local_data) def change_scales(self, scales): """Change data to specified scales.""" @@ -619,7 +620,7 @@ def change_scales(self, scales): # Copy over scale change old_data = self.data self.preset_scales(scales) - np.copyto(self.data, old_data) + copyto(self.data, old_data) def change_layout(self, layout): """Change data to specified layout."""