Skip to content

Commit

Permalink
fix dummy particulator & builder
Browse files Browse the repository at this point in the history
  • Loading branch information
slayoo committed Aug 2, 2024
1 parent 4204892 commit c24a7d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions tests/unit_tests/dummy_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
import numpy as np

from PySDM.impl.mesh import Mesh
from PySDM.environments.impl import register_environment


@register_environment()
class DummyEnvironment: # pylint: disable=too-many-instance-attributes
def __init__(
self,
Expand Down Expand Up @@ -33,8 +35,8 @@ def __init__(
self.step_counter = 0
self.courant_field_data = courant_field_data

def register(self, particulator):
self.particulator = particulator
def register(self, *, builder):
self.particulator = builder.particulator
if hasattr(self, "halo"):
self.pred["water_vapour_mixing_ratio"] = particulator.backend.Storage.empty(
self.mesh.n_cell, dtype=float
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/dummy_particulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, backend_class, n_sd=0, formulae=None, grid=None):
env = DummyEnvironment(grid=grid)
Builder.__init__(self, n_sd, backend, env)
Particulator.__init__(self, n_sd, backend)
self.environment = env
self.environment = env.instantiate(builder=self)
self.particulator = self
self.req_attr_names = ["multiplicity", "cell id"]
self.attributes = None

0 comments on commit c24a7d3

Please sign in to comment.