|
21 | 21 | 'CustomDimension', 'SteppingDimension', 'SubDimension', |
22 | 22 | 'MultiSubDimension', 'ConditionalDimension', 'ModuloDimension', |
23 | 23 | 'IncrDimension', 'BlockDimension', 'StencilDimension', |
24 | | - 'VirtualDimension', 'Spacing', 'dimensions'] |
| 24 | + 'VirtualDimension', 'Spacing', 'dimensions', 'CustomBoundSubDimension'] |
25 | 25 |
|
26 | 26 |
|
27 | 27 | SubDimensionThickness = namedtuple('SubDimensionThickness', 'left right') |
@@ -822,6 +822,39 @@ def __init_finalize__(self, name, parent, thickness, functions=None, |
822 | 822 | @cached_property |
823 | 823 | def bound_symbols(self): |
824 | 824 | return self.parent.bound_symbols |
| 825 | + |
| 826 | + |
| 827 | +class CustomBoundSubDimension(SubDimension): |
| 828 | + |
| 829 | + # have is_CustomSub = True ... here? |
| 830 | + |
| 831 | + __rargs__ = SubDimension.__rargs__ + ('custom_left', 'custom_right') |
| 832 | + |
| 833 | + def __init_finalize__(self, name, parent, thickness, local, |
| 834 | + custom_left=0, custom_right=0, **kwargs): |
| 835 | + self._custom_left = custom_left |
| 836 | + self._custom_right = custom_right |
| 837 | + super().__init_finalize__(name, parent, thickness, local) |
| 838 | + |
| 839 | + @property |
| 840 | + def custom_left(self): |
| 841 | + return self._custom_left |
| 842 | + |
| 843 | + @property |
| 844 | + def custom_right(self): |
| 845 | + return self._custom_right |
| 846 | + |
| 847 | + # @cached_property |
| 848 | + # def _interval(self): |
| 849 | + # left = self.parent.symbolic_min + self._offset_left |
| 850 | + # right = self.parent.symbolic_max - self._offset_right |
| 851 | + # return sympy.Interval(left, right) |
| 852 | + |
| 853 | + @cached_property |
| 854 | + def _interval(self): |
| 855 | + left = self.custom_left |
| 856 | + right = self.custom_right |
| 857 | + return sympy.Interval(left, right) |
825 | 858 |
|
826 | 859 |
|
827 | 860 | class SubsamplingFactor(Scalar): |
|
0 commit comments