44from devito .symbolics .extended_sympy import ReservedWord , Cast , ValueLimit
55from devito .tools import (Bunch , float2 , float3 , float4 , double2 , double3 , double4 , # noqa
66 int2 , int3 , int4 , ctypes_vector_mapper )
7+ from devito .tools .dtypes_lowering import mapper as dtype_mapper
78
89__all__ = ['cast_mapper' , 'CustomType' , 'limits_mapper' , 'INT' , 'FLOAT' , 'BaseCast' , # noqa
910 'DOUBLE' , 'VOID' , 'NoDeclStruct' , 'c_complex' , 'c_double_complex' ]
@@ -69,8 +70,6 @@ def cast_mapper(arg):
6970 return lambda v , dtype = None , ** kw : Cast (v , dtype = arg , ** kw )
7071
7172
72- FLOAT = cast_mapper (np .float32 )
73- DOUBLE = cast_mapper (np .float64 )
7473ULONG = cast_mapper (np .uint64 )
7574UINTP = cast_mapper ((np .uint32 , '*' ))
7675
@@ -88,13 +87,10 @@ class VOID(BaseCast):
8887 _dtype = 'void'
8988
9089
91- class INT (BaseCast ):
92-
93- _dtype = np .int32
94-
95-
9690# Dynamically create INT, INT2, .... INTP, INT2P, ... FLOAT, ...
97- for base_name in ['int' , 'float' , 'double' ]:
91+ for (base_name , dtype ) in dtype_mapper .items ():
92+ name = base_name .upper ()
93+ globals ()[name ] = type (name , (BaseCast ,), {'_dtype' : dtype })
9894 for i in ['2' , '3' , '4' ]:
9995 v = '%s%s' % (base_name , i )
10096 globals ()[v .upper ()] = cast_mapper (v )
0 commit comments