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
10
11
from devito .finite_differences .elementary import Min , Max
11
12
from devito .tools import (Pickable , Bunch , as_tuple , is_integer , float2 , # noqa
12
13
float3 , float4 , double2 , double3 , double4 , int2 , int3 ,
@@ -811,6 +812,20 @@ class VOID(Cast):
811
812
_base_typ = 'void'
812
813
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
+
814
829
class CHARP (CastStar ):
815
830
base = CHAR
816
831
@@ -827,6 +842,14 @@ class USHORTP(CastStar):
827
842
base = USHORT
828
843
829
844
845
+ class CFLOATP (CastStar ):
846
+ base = CFLOAT
847
+
848
+
849
+ class CDOUBLEP (CastStar ):
850
+ base = CDOUBLE
851
+
852
+
830
853
cast_mapper = {
831
854
np .int8 : CHAR ,
832
855
np .uint8 : UCHAR ,
@@ -839,6 +862,8 @@ class USHORTP(CastStar):
839
862
np .float32 : FLOAT , # noqa
840
863
float : DOUBLE , # noqa
841
864
np .float64 : DOUBLE , # noqa
865
+ np .complex64 : CFLOAT , # noqa
866
+ np .complex128 : CDOUBLE , # noqa
842
867
843
868
(np .int8 , '*' ): CHARP ,
844
869
(np .uint8 , '*' ): UCHARP ,
@@ -849,7 +874,9 @@ class USHORTP(CastStar):
849
874
(np .int64 , '*' ): INTP , # noqa
850
875
(np .float32 , '*' ): FLOATP , # noqa
851
876
(float , '*' ): DOUBLEP , # noqa
852
- (np .float64 , '*' ): DOUBLEP # noqa
877
+ (np .float64 , '*' ): DOUBLEP , # noqa
878
+ (np .complex64 , '*' ): CFLOATP , # noqa
879
+ (np .complex128 , '*' ): CDOUBLEP , # noqa
853
880
}
854
881
855
882
for base_name in ['int' , 'float' , 'double' ]:
0 commit comments