Skip to content

Commit

Permalink
Renamed _c32
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdiataei committed Sep 13, 2024
1 parent e21780e commit fd759d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions xlb/operator/boundary_condition/bc_regularized.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ def _construct_warp(self):
_opp_indices = self.velocity_set.opp_indices
_w = self.velocity_set.w
_c = self.velocity_set.c
_c32 = self.velocity_set.c32
_c_float = self.velocity_set.c32
_qi = self.velocity_set.qi
# TODO: related to _c32: this is way less than ideal. we should not be making new types
# TODO: related to _c_float: this is way less than ideal. we should not be making new types

@wp.func
def _get_fsum(
Expand All @@ -165,15 +165,15 @@ def get_normal_vectors_2d(
):
for l in range(_q):
if missing_mask[l] == wp.uint8(1) and wp.abs(_c[0, l]) + wp.abs(_c[1, l]) == 1:
return -_u_vec(_c32[0, l], _c32[1, l])
return -_u_vec(_c_float[0, l], _c_float[1, l])

@wp.func
def get_normal_vectors_3d(
missing_mask: Any,
):
for l in range(_q):
if missing_mask[l] == wp.uint8(1) and wp.abs(_c[0, l]) + wp.abs(_c[1, l]) + wp.abs(_c[2, l]) == 1:
return -_u_vec(_c32[0, l], _c32[1, l], _c32[2, l])
return -_u_vec(_c_float[0, l], _c_float[1, l], _c_float[2, l])

@wp.func
def bounceback_nonequilibrium(
Expand Down
6 changes: 3 additions & 3 deletions xlb/operator/boundary_condition/bc_zouhe.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def _construct_warp(self):
_u = _u_vec(u[0], u[1], u[2]) if _d == 3 else _u_vec(u[0], u[1])
_opp_indices = self.velocity_set.opp_indices
_c = self.velocity_set.c
_c32 = self.velocity_set.c32
_c_float = self.velocity_set.c32
# TODO: this is way less than ideal. we should not be making new types

@wp.func
Expand All @@ -193,7 +193,7 @@ def get_normal_vectors_2d(
):
l = lattice_direction
if wp.abs(_c[0, l]) + wp.abs(_c[1, l]) == 1:
normals = -_u_vec(_c32[0, l], _c32[1, l])
normals = -_u_vec(_c_float[0, l], _c_float[1, l])
return normals

@wp.func
Expand All @@ -216,7 +216,7 @@ def get_normal_vectors_3d(
):
for l in range(_q):
if missing_mask[l] == wp.uint8(1) and wp.abs(_c[0, l]) + wp.abs(_c[1, l]) + wp.abs(_c[2, l]) == 1:
return -_u_vec(_c32[0, l], _c32[1, l], _c32[2, l])
return -_u_vec(_c_float[0, l], _c_float[1, l], _c_float[2, l])

@wp.func
def bounceback_nonequilibrium(
Expand Down
6 changes: 3 additions & 3 deletions xlb/velocity_set/velocity_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _init_numpy_properties(self, c, w):
self._w = np.array(w)
self._opp_indices = self._construct_opposite_indices()
self._cc = self._construct_lattice_moment()
self._c32 = self._c.astype(np.float64)
self._c_float = self._c.astype(np.float64)
self._qi = self._construct_qi()

# Constants in NumPy
Expand All @@ -75,7 +75,7 @@ def _init_warp_properties(self):
self.w = wp.constant(wp.vec(self.q, dtype=dtype)(self._w))
self.opp_indices = wp.constant(wp.vec(self.q, dtype=wp.int32)(self._opp_indices))
self.cc = wp.constant(wp.mat((self.q, self.d * (self.d + 1) // 2), dtype=dtype)(self._cc))
self.c32 = wp.constant(wp.mat((self.d, self.q), dtype=dtype)(self._c32))
self.c32 = wp.constant(wp.mat((self.d, self.q), dtype=dtype)(self._c_float))
self.qi = wp.constant(wp.mat((self.q, self.d * (self.d + 1) // 2), dtype=dtype)(self._qi))

def _init_jax_properties(self):
Expand All @@ -87,7 +87,7 @@ def _init_jax_properties(self):
self.w = jnp.array(self._w, dtype=dtype)
self.opp_indices = jnp.array(self._opp_indices, dtype=jnp.int32)
self.cc = jnp.array(self._cc, dtype=dtype)
self.c32 = jnp.array(self._c32, dtype=dtype)
self.c32 = jnp.array(self._c_float, dtype=dtype)
self.qi = jnp.array(self._qi, dtype=dtype)

def _init_backend_constants(self):
Expand Down

0 comments on commit fd759d3

Please sign in to comment.