From 8c91806747b355f53b9f5b2348cff05977d6464f Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Tue, 31 Jan 2012 12:28:30 +0000
Subject: [PATCH] BUG: processorLduInterfaceTemplates.C: receive more than send

---
 .../processorLduInterfaceTemplates.C             | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C
index e7d84ce4847..f74f6865ca3 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C
+++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C
@@ -36,6 +36,8 @@ void Foam::processorLduInterface::send
     const UList<Type>& f
 ) const
 {
+    label nBytes = f.byteSize();
+
     if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
     {
         OPstream::write
@@ -43,32 +45,32 @@ void Foam::processorLduInterface::send
             commsType,
             neighbProcNo(),
             reinterpret_cast<const char*>(f.begin()),
-            f.byteSize(),
+            nBytes,
             tag()
         );
     }
     else if (commsType == Pstream::nonBlocking)
     {
-        resizeBuf(receiveBuf_, f.size()*sizeof(Type));
+        resizeBuf(receiveBuf_, nBytes);
 
         IPstream::read
         (
             commsType,
             neighbProcNo(),
             receiveBuf_.begin(),
-            receiveBuf_.size(),
+            nBytes,
             tag()
         );
 
-        resizeBuf(sendBuf_, f.byteSize());
-        memcpy(sendBuf_.begin(), f.begin(), f.byteSize());
+        resizeBuf(sendBuf_, nBytes);
+        memcpy(sendBuf_.begin(), f.begin(), nBytes);
 
         OPstream::write
         (
             commsType,
             neighbProcNo(),
             sendBuf_.begin(),
-            f.byteSize(),
+            nBytes,
             tag()
         );
     }
@@ -172,7 +174,7 @@ void Foam::processorLduInterface::compressedSend
                 commsType,
                 neighbProcNo(),
                 receiveBuf_.begin(),
-                receiveBuf_.size(),
+                nBytes,
                 tag()
             );
 
-- 
GitLab