From 5e3684a6376be3e877229a6583fc59d805de9b3e Mon Sep 17 00:00:00 2001
From: Marco D'Antonio <m.dantonio18@studenti.unisa.it>
Date: Tue, 8 Mar 2022 15:50:48 +0100
Subject: [PATCH] Curl computation always applies sources in kernel

---
 src/libgmshdg/kernels_cpu.cpp |  2 +-
 src/maxwell/maxwell_cpu.cpp   | 20 --------------------
 2 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/src/libgmshdg/kernels_cpu.cpp b/src/libgmshdg/kernels_cpu.cpp
index 49adea5..72231d2 100644
--- a/src/libgmshdg/kernels_cpu.cpp
+++ b/src/libgmshdg/kernels_cpu.cpp
@@ -63,7 +63,7 @@ void compute_field_curl(const entity_data_cpu& ed,
     }
 }
 
-void compute_field_curl_sources(const entity_data_cpu& ed,
+void compute_field_curl(const entity_data_cpu& ed,
     const vecxd& fx, const vecxd& fy, const vecxd& fz, double alpha,
     vecxd& curl_fx, vecxd& curl_fy, vecxd& curl_fz,
     const vecxd& jx, const vecxd& jy, const vecxd& jz)
diff --git a/src/maxwell/maxwell_cpu.cpp b/src/maxwell/maxwell_cpu.cpp
index 59582a7..bd04eb3 100644
--- a/src/maxwell/maxwell_cpu.cpp
+++ b/src/maxwell/maxwell_cpu.cpp
@@ -119,18 +119,8 @@ compute_curls(solver_state& state, const field& curr, field& next)
     for (const auto& ed : state.eds)
     {
         compute_field_curl(ed, curr.Ex, curr.Ey, curr.Ez, -1.0, next.Hx, next.Hy, next.Hz);
-        #ifndef ADD_SOURCES
-        compute_field_curl(ed, curr.Hx, curr.Hy, curr.Hz, 1.0, next.Ex, next.Ey, next.Ez);
-        #else
         compute_field_curl(ed, curr.Hx, curr.Hy, curr.Hz, 1.0, next.Ex, next.Ey, next.Ez, state.Jx_src, state.Jy_src, state.Jz_src);
-        #endif
     }
-
-    #ifndef ADD_SOURCES
-    next.Ex -= state.Jx_src;
-    next.Ey -= state.Jy_src;
-    next.Ez -= state.Jz_src;
-    #endif
 }
 
 static void
@@ -147,18 +137,8 @@ compute_curls_H(solver_state& state, const field& curr, field& next)
 {
     for (const auto& ed : state.eds)
     {
-        #ifndef ADD_SOURCES
-        compute_field_curl(ed, curr.Hx, curr.Hy, curr.Hz, 1.0, next.Ex, next.Ey, next.Ez);
-        #else
         compute_field_curl(ed, curr.Hx, curr.Hy, curr.Hz, 1.0, next.Ex, next.Ey, next.Ez, state.Jx_src, state.Jy_src, state.Jz_src);
-        #endif
     }
-
-    #ifndef ADD_SOURCES
-    next.Ex -= state.Jx_src;
-    next.Ey -= state.Jy_src;
-    next.Ez -= state.Jz_src;
-    #endif
 }
 #else
 static void
-- 
GitLab