Skip to content

Commit 598fd62

Browse files
Merge pull request #2665 from devitocodes/fixup-bundle-symshape
compiler: Fix Bundle.symbolic_shape
2 parents f483933 + ec430f3 commit 598fd62

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

devito/types/array.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,17 @@ def initvalue(self):
491491

492492
@cached_property
493493
def symbolic_shape(self):
494-
from devito.symbolics import FieldFromPointer, IndexedPointer # noqa
495-
ffp = FieldFromPointer(self._C_field_shape, self._C_symbol)
496-
ret = [s if is_integer(s) else IndexedPointer(ffp, i)
497-
for i, s in enumerate(super().symbolic_shape)]
498-
return DimensionTuple(*ret, getters=self.dimensions)
494+
if self._mem_mapped:
495+
# E.g., `(uv_vec->shape[0], uv_vec->shape[1], uv_vec->shape[2])`
496+
from devito.symbolics import FieldFromPointer, IndexedPointer # noqa
497+
ffp = FieldFromPointer(self._C_field_shape, self._C_symbol)
498+
ret = [s if is_integer(s) else IndexedPointer(ffp, i)
499+
for i, s in enumerate(super().symbolic_shape)]
500+
return DimensionTuple(*ret, getters=self.dimensions)
501+
else:
502+
# There's no accompanying C struct, so we simply return `c0`'s symbolic
503+
# shape, i.e. something along the lines of `(x_size, y_size, z_size)`
504+
return self.c0.symbolic_shape
499505

500506
@property
501507
def _mem_heap(self):

0 commit comments

Comments
 (0)