Skip to content
Snippets Groups Projects
Commit 61e21b15 authored by Jean-Baptiste Keck's avatar Jean-Baptiste Keck
Browse files

this simple patch should resolve #42

parent d38c694b
No related branches found
No related tags found
1 merge request!16MPI operators
Pipeline #41395 failed
...@@ -75,7 +75,9 @@ class PythonDiffusion(DiffusionOperatorBase, OpenClMappable, HostOperator): ...@@ -75,7 +75,9 @@ class PythonDiffusion(DiffusionOperatorBase, OpenClMappable, HostOperator):
def setup(self, work): def setup(self, work):
super(PythonDiffusion, self).setup(work=work) super(PythonDiffusion, self).setup(work=work)
diffusion_filters = () diffusion_filters = ()
for (Fo,Ft,Kd) in zip(self.dFout.dfields, self.forward_transforms, self.all_dkds): for (Fo,Ft,Kd) in zip(self.dFout.dfields,
self.forward_transforms,
self.all_dkds):
args = (Ft.full_output_buffer,) + tuple(Kd) args = (Ft.full_output_buffer,) + tuple(Kd)
F = self.build_diffusion_filter(Fo.dim, *args) F = self.build_diffusion_filter(Fo.dim, *args)
diffusion_filters += (F,) diffusion_filters += (F,)
...@@ -94,7 +96,7 @@ class PythonDiffusion(DiffusionOperatorBase, OpenClMappable, HostOperator): ...@@ -94,7 +96,7 @@ class PythonDiffusion(DiffusionOperatorBase, OpenClMappable, HostOperator):
self.backward_transforms, self.backward_transforms,
self.diffusion_filters): self.diffusion_filters):
Ft(simulation=simulation) Ft(simulation=simulation)
filter_diffusion(nu_dt, Ft.output_buffer) filter_diffusion(nu_dt, Ft.full_output_buffer)
Bt(simulation=simulation) Bt(simulation=simulation)
for Fo in self.dFout.dfields: for Fo in self.dFout.dfields:
......
...@@ -634,6 +634,8 @@ class DiscreteScalarField(NamedScalarContainerI, TaggedObject): ...@@ -634,6 +634,8 @@ class DiscreteScalarField(NamedScalarContainerI, TaggedObject):
The continuous field that is dicrerized. The continuous field that is dicrerized.
topology: :class:`~hysop.topology.topology.Topology` topology: :class:`~hysop.topology.topology.Topology`
The topology where to allocate the discrete field. The topology where to allocate the discrete field.
register_discrete_field: bool, defaults to True
If set register input topology to input continuous field.
name : string, optional name : string, optional
A name for the field. A name for the field.
pretty_name: string or unicode, optional. pretty_name: string or unicode, optional.
......
...@@ -191,9 +191,24 @@ def test_tensor_field(): ...@@ -191,9 +191,24 @@ def test_tensor_field():
shape=(2, 2)) shape=(2, 2))
DT9 = DT0[:2, :2] DT9 = DT0[:2, :2]
DT10 = DT9.clone() DT10 = DT9.clone()
DT11, requests = DT10.tmp_dfield_like(name='DT11') DT11, requests11 = DT10.tmp_dfield_like(name='DT11')
work = requests().allocate(True) DT12, requests12 = DT10.tmp_dfield_like(name='DT11')
work = requests11().allocate(True)
DT11.honor_memory_request(work) DT11.honor_memory_request(work)
work = requests12().allocate(True)
DT12.honor_memory_request(work)
for df in DT11.data:
df[...] = 11
for df in DT12.data:
df[...] = 12
for df in DT11.data:
assert np.all(df == 11)
for df in DT12.data:
assert np.all(df == 12)
str(DT0) str(DT0)
DT0.short_description() DT0.short_description()
......
...@@ -37,10 +37,8 @@ class TestDiffusionOperator(object): ...@@ -37,10 +37,8 @@ class TestDiffusionOperator(object):
size_min=None, size_max=None): size_min=None, size_max=None):
assert dim > 0 assert dim > 0
# periodic boundaries removes one computational point size_min = first_not_None(size_min, self.size_min)
# so we add one here. size_max = first_not_None(size_max, self.size_max)
size_min = first_not_None(size_min, self.size_min) + 1
size_max = first_not_None(size_max, self.size_max) + 1
shape = tuple(npw.random.randint(low=size_min, high=size_max, size=dim).tolist()) shape = tuple(npw.random.randint(low=size_min, high=size_max, size=dim).tolist())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment