Forráskód Böngészése

Add single precision interface

Dhairya Malhotra 5 éve
szülő
commit
c4522ee95e
4 módosított fájl, 39 hozzáadás és 1 törlés
  1. 26 0
      include/kernels.f90
  2. 4 0
      include/kernels.h
  3. 1 1
      include/sctl/vec.hpp
  4. 8 0
      src/libkernels.cpp

+ 26 - 0
include/kernels.f90

@@ -1,5 +1,31 @@
 interface
 
+  subroutine helm3d_f(nd, zk, sources, charge, ns, ztarg, nt, pot, thresh) !bind(C, name="helm3d_f_")
+    implicit none
+    integer *4, intent(in) :: nd
+    complex *8, intent(in) :: zk
+    real    *8, intent(in) :: sources(*)
+    complex *8, intent(in) :: charge(*)
+    integer *4, intent(in) :: ns
+    real    *8, intent(in) :: ztarg(*)
+    integer *4, intent(in) :: nt
+    complex *8, intent(out):: pot(*)
+    real    *8, intent(in) :: thresh
+  end subroutine
+
+  subroutine helm3d_vec_f(nd, zk, sources, charge, ns, ztarg, nt, pot, thresh) !bind(C, name="helm3d_vec_f_")
+    implicit none
+    integer *4, intent(in) :: nd
+    complex *8, intent(in) :: zk
+    real    *8, intent(in) :: sources(*)
+    complex *8, intent(in) :: charge(*)
+    integer *4, intent(in) :: ns
+    real    *8, intent(in) :: ztarg(*)
+    integer *4, intent(in) :: nt
+    complex *8, intent(out):: pot(*)
+    real    *8, intent(in) :: thresh
+  end subroutine
+
   subroutine helm3d_d(nd, zk, sources, charge, ns, ztarg, nt, pot, thresh) !bind(C, name="helm3d_d_")
     implicit none
     integer *4, intent(in) :: nd

+ 4 - 0
include/kernels.h

@@ -7,6 +7,10 @@
 extern "C" {
 #endif
 
+void helm3d_f_(const int32_t* nd, const float* zk, const float* sources, const float* charge, const int32_t* ns, const float* ztarg, const int32_t* nt, float* pot, const float* thresh);
+
+void helm3d_vec_f_(const int32_t* nd, const float* zk, const float* sources, const float* charge, const int32_t* ns, const float* ztarg, const int32_t* nt, float* pot, const float* thresh);
+
 void helm3d_d_(const int32_t* nd, const double* zk, const double* sources, const double* charge, const int32_t* ns, const double* ztarg, const int32_t* nt, double* pot, const double* thresh);
 
 void helm3d_vec_d_(const int32_t* nd, const double* zk, const double* sources, const double* charge, const int32_t* ns, const double* ztarg, const int32_t* nt, double* pot, const double* thresh);

+ 1 - 1
include/sctl/vec.hpp

@@ -578,7 +578,7 @@ namespace SCTL_NAMESPACE {
       IntegerVec int_e2 = IntegerVec(int_one) + (int_x_ << SigBits);
 
       // Handle underflow
-      static constexpr IntegerType max_exp = -(1UL<<((sizeof(Real)*8-SigBits-2)));
+      static constexpr IntegerType max_exp = -(IntegerType)(1UL<<((sizeof(Real)*8-SigBits-2)));
       int_e2 &= (int_x_ > IntegerVec(max_exp));
 
       e2 = RealVec::LoadAligned((RealType*)&int_e2);

+ 8 - 0
src/libkernels.cpp

@@ -5,6 +5,14 @@
 extern "C" {
 #endif
 
+void helm3d_f_(const int32_t* nd, const float* zk, const float* sources, const float* charge, const int32_t* ns, const float* ztarg, const int32_t* nt, float* pot, const float* thresh) {
+  helm3d<float>(nd, zk, sources, charge, ns, ztarg, nt, pot, thresh);
+}
+
+void helm3d_vec_f_(const int32_t* nd, const float* zk, const float* sources, const float* charge, const int32_t* ns, const float* ztarg, const int32_t* nt, float* pot, const float* thresh) {
+  helm3d_vec<float,4>(nd, zk, sources, charge, ns, ztarg, nt, pot, thresh);
+}
+
 void helm3d_d_(const int32_t* nd, const double* zk, const double* sources, const double* charge, const int32_t* ns, const double* ztarg, const int32_t* nt, double* pot, const double* thresh) {
   helm3d<double>(nd, zk, sources, charge, ns, ztarg, nt, pot, thresh);
 }