Skip to content

Commit

Permalink
Change field methods to use wrapped array.copyto. This makes set_stat…
Browse files Browse the repository at this point in the history
…e issue a warning instead of an error for real-valued EVPs.
  • Loading branch information
kburns committed Sep 27, 2024
1 parent 1388ffd commit fb87689
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dedalus/core/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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."""
Expand All @@ -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."""
Expand Down

0 comments on commit fb87689

Please sign in to comment.