瀏覽代碼

minor changes, bug fix in Comm

Dhairya Malhotra 5 年之前
父節點
當前提交
9ba997df14
共有 3 個文件被更改,包括 19 次插入6 次删除
  1. 1 1
      include/sctl/boundary_quadrature.hpp
  2. 8 4
      include/sctl/comm.txx
  3. 10 1
      include/sctl/kernel_functions.hpp

+ 1 - 1
include/sctl/boundary_quadrature.hpp

@@ -1727,7 +1727,7 @@ template <class Real> class Quadrature {
       }
     }
 
-    template <int CoordDim, int FnDim, class Real, class FnBasis, class ElemList> static void DiscretizeSurfaceFn(Vector<FnBasis>& U, const ElemList& elements, std::function<void(Real*,Real*,Real*)> fn) {
+    template <int CoordDim, int FnDim, class FnBasis, class ElemList> static void DiscretizeSurfaceFn(Vector<FnBasis>& U, const ElemList& elements, std::function<void(Real*,Real*,Real*)> fn) {
       using CoordBasis = typename ElemList::CoordBasis;
       const long Nelem = elements.NElem();
       U.ReInit(Nelem * FnDim);

+ 8 - 4
include/sctl/comm.txx

@@ -110,10 +110,12 @@ template <class SType> void* Comm::Isend(ConstIterator<SType> sbuf, Long scount,
   return &request;
 #else
   auto it = recv_req.find(tag);
-  if (it == recv_req.end())
+  if (it == recv_req.end()) {
     send_req.insert(std::pair<Integer, ConstIterator<char>>(tag, (ConstIterator<char>)sbuf));
-  else
+  } else {
     memcopy(it->second, (ConstIterator<char>)sbuf, scount * sizeof(SType));
+    recv_req.erase(it);
+  }
   return nullptr;
 #endif
 }
@@ -131,10 +133,12 @@ template <class RType> void* Comm::Irecv(Iterator<RType> rbuf, Long rcount, Inte
   return &request;
 #else
   auto it = send_req.find(tag);
-  if (it == send_req.end())
+  if (it == send_req.end()) {
     recv_req.insert(std::pair<Integer, Iterator<char>>(tag, (Iterator<char>)rbuf));
-  else
+  } else {
     memcopy((Iterator<char>)rbuf, it->second, rcount * sizeof(RType));
+    send_req.erase(it);
+  }
   return nullptr;
 #endif
 }

+ 10 - 1
include/sctl/kernel_functions.hpp

@@ -65,8 +65,17 @@ template <class uKernel> class GenericKernel {
     }
 
     template <class Real, Integer DOF> void uKernelEval(Iterator<Real> u, ConstIterator<Real> r, ConstIterator<Real> n, ConstIterator<Real> f) const {
+      SCTL_UNUSED(u[0]);
+      SCTL_UNUSED(f[0]);
+      SCTL_UNUSED(r[0]);
+      SCTL_UNUSED(n[0]);
+      SCTL_UNUSED(u[KDIM1*DOF-1]);
+      SCTL_UNUSED(f[KDIM0*DOF-1]);
+      SCTL_UNUSED(r[DIM-1]);
+      SCTL_UNUSED(n[DIM-1]);
+
       Real M[KDIM0][KDIM1];
-      uKernel::Eval(M, *(Real (*)[DIM])r, *(Real (*)[DIM])n, ctx_ptr);
+      uKernel::Eval(M, *(Real (*)[DIM])(&r[0]), *(Real (*)[DIM])(&n[0]), ctx_ptr);
       for (Integer i = 0; i < DOF; i++) {
         for (Integer k0 = 0; k0 < KDIM0; k0++) {
           for (Integer k1 = 0; k1 < KDIM1; k1++) {