|
7 | 7 | from sympy import Expr, Function, Number, Tuple, sympify
|
8 | 8 | from sympy.core.decorators import call_highest_priority
|
9 | 9 |
|
10 |
| -from devito import configuration |
11 | 10 | from devito.finite_differences.elementary import Min, Max
|
12 | 11 | from devito.tools import (Pickable, Bunch, as_tuple, is_integer, float2, # noqa
|
13 | 12 | float3, float4, double2, double3, double4, int2, int3,
|
|
20 | 19 | 'ListInitializer', 'Byref', 'IndexedPointer', 'Cast', 'DefFunction',
|
21 | 20 | 'MathFunction', 'InlineIf', 'ReservedWord', 'Keyword', 'String',
|
22 | 21 | 'Macro', 'Class', 'MacroArgument', 'CustomType', 'Deref', 'Namespace',
|
23 |
| - 'Rvalue', 'INT', 'FLOAT', 'DOUBLE', 'VOID', 'Null', 'SizeOf', 'rfunc', |
24 |
| - 'cast_mapper', 'BasicWrapperMixin', 'ValueLimit', 'limits_mapper'] |
| 22 | + 'Rvalue', 'Null', 'SizeOf', 'rfunc', 'BasicWrapperMixin', 'ValueLimit'] |
25 | 23 |
|
26 | 24 |
|
27 | 25 | class CondEq(sympy.Eq):
|
@@ -548,14 +546,6 @@ class ValueLimit(ReservedWord, sympy.Expr):
|
548 | 546 | pass
|
549 | 547 |
|
550 | 548 |
|
551 |
| -limits_mapper = { |
552 |
| - np.int32: Bunch(min=ValueLimit('INT_MIN'), max=ValueLimit('INT_MAX')), |
553 |
| - np.int64: Bunch(min=ValueLimit('LONG_MIN'), max=ValueLimit('LONG_MAX')), |
554 |
| - np.float32: Bunch(min=-ValueLimit('FLT_MAX'), max=ValueLimit('FLT_MAX')), |
555 |
| - np.float64: Bunch(min=-ValueLimit('DBL_MAX'), max=ValueLimit('DBL_MAX')), |
556 |
| -} |
557 |
| - |
558 |
| - |
559 | 549 | class DefFunction(Function, Pickable):
|
560 | 550 |
|
561 | 551 | """
|
@@ -773,120 +763,6 @@ def __new__(cls, base=''):
|
773 | 763 | return cls.base(base, '*')
|
774 | 764 |
|
775 | 765 |
|
776 |
| -# Dynamically create INT, INT2, .... INTP, INT2P, ... FLOAT, ... |
777 |
| -for base_name in ['int', 'float', 'double']: |
778 |
| - for i in ['', '2', '3', '4']: |
779 |
| - v = '%s%s' % (base_name, i) |
780 |
| - cls = type(v.upper(), (Cast,), {'_base_typ': v}) |
781 |
| - globals()[cls.__name__] = cls |
782 |
| - |
783 |
| - clsp = type('%sP' % v.upper(), (CastStar,), {'base': cls}) |
784 |
| - globals()[clsp.__name__] = clsp |
785 |
| - |
786 |
| - |
787 |
| -class CHAR(Cast): |
788 |
| - _base_typ = 'char' |
789 |
| - |
790 |
| - |
791 |
| -class SHORT(Cast): |
792 |
| - _base_typ = 'short' |
793 |
| - |
794 |
| - |
795 |
| -class USHORT(Cast): |
796 |
| - _base_typ = 'unsigned short' |
797 |
| - |
798 |
| - |
799 |
| -class UCHAR(Cast): |
800 |
| - _base_typ = 'unsigned char' |
801 |
| - |
802 |
| - |
803 |
| -class LONG(Cast): |
804 |
| - _base_typ = 'long' |
805 |
| - |
806 |
| - |
807 |
| -class ULONG(Cast): |
808 |
| - _base_typ = 'unsigned long' |
809 |
| - |
810 |
| - |
811 |
| -class VOID(Cast): |
812 |
| - _base_typ = 'void' |
813 |
| - |
814 |
| - |
815 |
| -class CFLOAT(Cast): |
816 |
| - |
817 |
| - @property |
818 |
| - def _base_typ(self): |
819 |
| - return configuration['compiler']._complex_ctype('float') |
820 |
| - |
821 |
| - |
822 |
| -class CDOUBLE(Cast): |
823 |
| - |
824 |
| - @property |
825 |
| - def _base_typ(self): |
826 |
| - return configuration['compiler']._complex_ctype('double') |
827 |
| - |
828 |
| - |
829 |
| -class CHARP(CastStar): |
830 |
| - base = CHAR |
831 |
| - |
832 |
| - |
833 |
| -class UCHARP(CastStar): |
834 |
| - base = UCHAR |
835 |
| - |
836 |
| - |
837 |
| -class SHORTP(CastStar): |
838 |
| - base = SHORT |
839 |
| - |
840 |
| - |
841 |
| -class USHORTP(CastStar): |
842 |
| - base = USHORT |
843 |
| - |
844 |
| - |
845 |
| -class CFLOATP(CastStar): |
846 |
| - base = CFLOAT |
847 |
| - |
848 |
| - |
849 |
| -class CDOUBLEP(CastStar): |
850 |
| - base = CDOUBLE |
851 |
| - |
852 |
| - |
853 |
| -cast_mapper = { |
854 |
| - np.int8: CHAR, |
855 |
| - np.uint8: UCHAR, |
856 |
| - np.int16: SHORT, # noqa |
857 |
| - np.uint16: USHORT, # noqa |
858 |
| - int: INT, # noqa |
859 |
| - np.int32: INT, # noqa |
860 |
| - np.int64: LONG, |
861 |
| - np.uint64: ULONG, |
862 |
| - np.float32: FLOAT, # noqa |
863 |
| - float: DOUBLE, # noqa |
864 |
| - np.float64: DOUBLE, # noqa |
865 |
| - np.complex64: CFLOAT, # noqa |
866 |
| - np.complex128: CDOUBLE, # noqa |
867 |
| - |
868 |
| - (np.int8, '*'): CHARP, |
869 |
| - (np.uint8, '*'): UCHARP, |
870 |
| - (int, '*'): INTP, # noqa |
871 |
| - (np.uint16, '*'): USHORTP, # noqa |
872 |
| - (np.int16, '*'): SHORTP, # noqa |
873 |
| - (np.int32, '*'): INTP, # noqa |
874 |
| - (np.int64, '*'): INTP, # noqa |
875 |
| - (np.float32, '*'): FLOATP, # noqa |
876 |
| - (float, '*'): DOUBLEP, # noqa |
877 |
| - (np.float64, '*'): DOUBLEP, # noqa |
878 |
| - (np.complex64, '*'): CFLOATP, # noqa |
879 |
| - (np.complex128, '*'): CDOUBLEP, # noqa |
880 |
| -} |
881 |
| - |
882 |
| -for base_name in ['int', 'float', 'double']: |
883 |
| - for i in [2, 3, 4]: |
884 |
| - v = '%s%d' % (base_name, i) |
885 |
| - cls = locals()[v] |
886 |
| - cast_mapper[cls] = locals()[v.upper()] |
887 |
| - cast_mapper[(cls, '*')] = locals()['%sP' % v.upper()] |
888 |
| - |
889 |
| - |
890 | 766 | # Some other utility objects
|
891 | 767 | Null = Macro('NULL')
|
892 | 768 |
|
|
0 commit comments