From 9625820bc0e214e320f624ab173f0da9bb61324e Mon Sep 17 00:00:00 2001
From: ckloss <ckloss@fluid38.(none)>
Date: Fri, 29 Mar 2013 16:41:04 +0100
Subject: [PATCH] release version 2.3.2 on 2013-03-29_16-41-03

---
 doc/Manual.pdf             | Bin 6515519 -> 6515519 bytes
 src/cfd_datacoupling.cpp   |  40 ++++++++++++++++++++++++++++---------
 src/cfd_datacoupling.h     |   1 +
 src/cfd_datacoupling_mpi.h |  13 ++++++++----
 src/fix_dummy.h            |   2 ++
 src/fix_wall_gran.cpp      |   4 ++--
 src/vector_liggghts.h      |   2 +-
 src/version_liggghts.h     |   2 +-
 src/version_liggghts.txt   |   2 +-
 9 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/doc/Manual.pdf b/doc/Manual.pdf
index 3ea771f35e1c509f0e58b257f39b14664fbb9550..b474f1512b65e53e932f0c697d8a5aa3157b8733 100644
GIT binary patch
delta 414
zcmdmgt(O^uCv>t|8k!kf8a4K}_A|EjGqv_JxAwEN_OrJ3v$giKxAt?i_H(xObG7z!
zxAyb2_Vc#(^R@Q#xAqIP_6xT53$^wOxAu#)_KUXmi?#NPxAsf4_Di<*OSSe(xAx1l
z_RF^R%eD5)xArTv_A9pbE4B73xAv>F_N%t`tF`v4xAtqa_G`BGYqj=kxAyC__UpFx
z>$UdlxAq&f_8YeL8@2WuxAvQ~_M5i$o3-|vxAt4K_FK00TebFExAxn#_S?4h+qL%F
zxAr@<_B*!rJGJ&ZxAwcV_Pe(ByS4VaxAuFq_ItMWd$sm^xAyzA_WQQ>`?dD_xAq6L
z_6N512etMGxAup$_J_9ihqd;HxAsT0_D8n%N454xxAw=h_Q$sN$F=syxArHr_9wRX
zCvELd4$O)-O*Bt4OEfhwH?lM`Of@z)F-%J~FfcGpGD|T{NlrDkvmvM=*3OQrxFoTt
Yq@pM_jmyl)*xbU<f=gA^)!&T^0GI`!Qvd(}

delta 414
zcmdmgt(O^uCv>t|7#W%xnl|>g_A|EjGqv_JxAwEN_OrJ3v$giKxAt?i_H(xObG7z!
zxAyb2_Vc#(^R@Q#xAqIP_6xT53$^wOxAu#)_KUXmi?#NPxAsf4_Di<*OSSe(xAx1l
z_RF^R%eD5)xArTv_A9pbE4B73xAv>F_N%t`tF`v4xAtqa_G`BGYqj=kxAyC__UpFx
z>$UdlxAq&f_8YeL8@2WuxAvQ~_M5i$o3-|vxAt4K_FK00TebFExAxn#_S?4h+qL%F
zxAr@<_B*!rJGJ&ZxAwcV_Pe(ByS4VaxAuFq_ItMWd$sm^xAyzA_WQQ>`?dD_xAq6L
z_6N512etMGxAup$_J_9ihqd;HxAsT0_D8n%N454xxAw=h_Q$sN$F=syxArHr_9wRX
zCvELd4$O)-F*h?aO*6DGOExz#wlGdIPBTk0w6si0HZ)5zN;9yqvmvM=*3OQrxFoTt
Yq@pM_jmyl)*xbU<f=gA^)!&T^0Ba$i$p8QV

diff --git a/src/cfd_datacoupling.cpp b/src/cfd_datacoupling.cpp
index a1c6a293..f3f4a91d 100644
--- a/src/cfd_datacoupling.cpp
+++ b/src/cfd_datacoupling.cpp
@@ -57,6 +57,10 @@ CfdDatacoupling::CfdDatacoupling(class LAMMPS *lmp, int jarg,int narg, char **ar
       pushtypes_ = NULL;
       pushinvoked_ = NULL;
       pullinvoked_ = NULL;
+
+      ms_ = NULL;
+      ms_data_ = NULL;
+
       grow_();
 }
 
@@ -76,12 +80,9 @@ void CfdDatacoupling::init()
 {
     // multisphere - can be NULL
     FixMultisphere *fix_multisphere;
-    fix_multisphere = static_cast<FixMultisphere*>(modify->find_fix_style_strict("multisphere",0));
+    ms_ = static_cast<FixMultisphere*>(modify->find_fix_style_strict("multisphere",0));
 
-    if(!fix_multisphere)
-        ms_data_ = NULL;
-    else
-        ms_data_ = &fix_multisphere->data();
+    if(ms_) ms_data_ = &ms_->data();
 
     // empty list of requested properties
     // models do their init afterwards so list will be filled
@@ -207,6 +208,7 @@ void CfdDatacoupling::check_datatransfer()
 
 void CfdDatacoupling::add_pull_property(char *name,char *type)
 {
+    
     if(strlen(name) >= MAXLENGTH) error->all(FLERR,"Fix couple/cfd: Maximum string length for a variable exceeded");
     if(npull_ >= nvalues_max_) grow_();
 
@@ -218,6 +220,16 @@ void CfdDatacoupling::add_pull_property(char *name,char *type)
             error->all(FLERR,"Properties added via CfdDatacoupling::add_pull_property are inconsistent");
     }
 
+    // test if property is available
+
+    int len1,len2;
+    void *ptr = find_pull_property(name,type,len1,len2);
+    if (atom->nlocal && (!ptr || len1 < 0 || len2 < 0))
+    {
+        if(screen) fprintf(screen,"Property %s added via CfdDatacoupling::add_pull_property not found.\n",name);
+        error->one(FLERR,"This is fatal");
+    }
+
     strcpy(pullnames_[npull_],name);
     strcpy(pulltypes_[npull_],type);
     npull_++;
@@ -229,6 +241,7 @@ void CfdDatacoupling::add_pull_property(char *name,char *type)
 
 void CfdDatacoupling::add_push_property(char *name,char *type)
 {
+    
     if(strlen(name) >= MAXLENGTH)
         error->all(FLERR,"Fix couple/cfd: Maximum string length for a variable exceeded");
     if(npush_ >= nvalues_max_) grow_();
@@ -241,6 +254,16 @@ void CfdDatacoupling::add_push_property(char *name,char *type)
             error->all(FLERR,"Properties added via CfdDatacoupling::add_push_property are inconsistent");
     }
 
+    // test if property is available
+
+    int len1,len2;
+    void *ptr = find_push_property(name,type,len1,len2);
+    if (atom->nlocal && (!ptr || len1 < 0 || len2 < 0))
+    {
+        if(screen) fprintf(screen,"Property %s added via CfdDatacoupling::add_push_property not found.\n",name);
+        error->one(FLERR,"This is fatal");
+    }
+
     strcpy(pushnames_[npush_],name);
     strcpy(pushtypes_[npush_],type);
     npush_++;
@@ -287,13 +310,12 @@ void* CfdDatacoupling::find_property(int push,char *name,char *type,int &len1,in
     }
 
     // possiblility 2
-    // may come from a fix rigid/multisphere
+    // may come from a fix multisphere
     // also handles scalar-multisphere and vector-multisphere
 
-    if(ms_data_)
+    if(ms_)
     {
-        ptr = ms_data_->extract(name,len1,len2);
-
+        ptr = ms_->extract(name,len1,len2);
         if((strcmp(type,"scalar-multisphere") == 0) && (len2 != 1) || (strcmp(type,"vector-multisphere") == 0) && (len2 != 3))
             return NULL;
 
diff --git a/src/cfd_datacoupling.h b/src/cfd_datacoupling.h
index 52ee7a19..7a816abd 100644
--- a/src/cfd_datacoupling.h
+++ b/src/cfd_datacoupling.h
@@ -100,6 +100,7 @@ class CfdDatacoupling : protected Pointers {
   class FixCfdCoupling *fc_;
 
   // multisphere
+  class FixMultisphere *ms_;
   class MultisphereParallel *ms_data_;
 };
 
diff --git a/src/cfd_datacoupling_mpi.h b/src/cfd_datacoupling_mpi.h
index 8baab0d8..9f733e3d 100644
--- a/src/cfd_datacoupling_mpi.h
+++ b/src/cfd_datacoupling_mpi.h
@@ -116,7 +116,7 @@ void CfdDatacouplingMPI::pull_mpi(char *name,char *type,void *&from)
         if(!ms_data_)
             error->one(FLERR,"Transferring a multisphere property from/to LIGGGHTS requires a fix rigid/multisphere");
         for (int i = 0; i < len1; i++)
-            if ((m = ms_data_->map(i)) >= 0)
+            if ((m = ms_data_->map(i+1)) >= 0)
                 to_t[m] = allred[i];
     }
     else if(strcmp(type,"vector-multisphere") == 0)
@@ -125,7 +125,7 @@ void CfdDatacouplingMPI::pull_mpi(char *name,char *type,void *&from)
         if(!ms_data_)
             error->one(FLERR,"Transferring a multisphere property from/to LIGGGHTS requires a fix rigid/multisphere");
         for (int i = 0; i < len1; i++)
-            if ((m = ms_data_->map(i)) >= 0)
+            if ((m = ms_data_->map(i+1)) >= 0)
                 for (int j = 0; j < len2; j++)
                     to_t[m][j] = allred[i*len2 + j];
     }
@@ -156,6 +156,7 @@ void CfdDatacouplingMPI::push_mpi(char *name,char *type,void *&to)
 
     if (atom->nlocal && (!from || len1 < 0 || len2 < 0))
     {
+        
         if(screen) fprintf(screen,"LIGGGHTS could not find property %s to write data from calling program to.\n",name);
         lmp->error->one(FLERR,"This is fatal");
     }
@@ -197,7 +198,7 @@ void CfdDatacouplingMPI::push_mpi(char *name,char *type,void *&to)
         for (int i = 0; i < nbodies; i++) // loops over # local bodies
         {
             id = ms_data_->tag(i);
-            allred[id] = from_t[i];
+            allred[id-1] = from_t[i];
         }
     }
     else if(strcmp(type,"vector-multisphere") == 0)
@@ -209,8 +210,12 @@ void CfdDatacouplingMPI::push_mpi(char *name,char *type,void *&to)
         {
             id = ms_data_->tag(i);
             for (int j = 0; j < len2; j++)
-                allred[id*len2 + j] = from_t[i][j];
+            {
+                allred[(id-1)*len2 + j] = from_t[i][j];
+                
+            }
         }
+        
     }
     else if(strcmp(type,"scalar-global") == 0 || strcmp(type,"vector-global") == 0 || strcmp(type,"matrix-global") == 0)
     {
diff --git a/src/fix_dummy.h b/src/fix_dummy.h
index 6a97a2ca..86e56291 100644
--- a/src/fix_dummy.h
+++ b/src/fix_dummy.h
@@ -45,6 +45,8 @@ class FixMultisphere : public Fix {
   void set_v_integrate(double *v) {}
   int belongs_to(int i) {return -1;}
 
+  void* extract(char*& a, int& b, int& c) {return NULL;}
+
   int calc_n_steps(int iatom,double *p_ref,double *normalvec,double *v_normal)
   { return 0; }
 
diff --git a/src/fix_wall_gran.cpp b/src/fix_wall_gran.cpp
index d1ff3403..c3c22d25 100644
--- a/src/fix_wall_gran.cpp
+++ b/src/fix_wall_gran.cpp
@@ -670,7 +670,7 @@ void FixWallGran::post_force_primitive(int vflag)
 
     if(deltan > 0.)
     {
-      vectorZeroizeN(c_history[iPart],dnum_);
+      if(c_history) vectorZeroizeN(c_history[iPart],dnum_);
     }
     else
     {
@@ -680,7 +680,7 @@ void FixWallGran::post_force_primitive(int vflag)
           vectorCross3D(shearAxisVec_,rdist,v_wall);
           
       }
-      post_force_eval_contact(iPart,deltan,delta,v_wall,c_history[iPart],NULL);
+      post_force_eval_contact(iPart,deltan,delta,v_wall,c_history?c_history[iPart]:0,NULL);
     }
   }
 }
diff --git a/src/vector_liggghts.h b/src/vector_liggghts.h
index 43d2133a..22d536e5 100644
--- a/src/vector_liggghts.h
+++ b/src/vector_liggghts.h
@@ -419,7 +419,7 @@ inline void printVecN(FILE *out,char *name, int *vec, int n)
 {
     fprintf(out," vector %s:\n",name);
     for(int i = 0; i < n; i++)
-        fprintf(out,"%d \n",vec[i]);
+        fprintf(out,"%d ",vec[i]);
     fprintf(out,"\n");
 }
 
diff --git a/src/version_liggghts.h b/src/version_liggghts.h
index 7d7d3a29..e1a70f11 100644
--- a/src/version_liggghts.h
+++ b/src/version_liggghts.h
@@ -1 +1 @@
-#define LIGGGHTS_VERSION "LIGGGHTS-PUBLIC 2.3.1, compiled 2013-03-28-21:52:06 by ckloss"
+#define LIGGGHTS_VERSION "LIGGGHTS-PUBLIC 2.3.2, compiled 2013-03-29-16:39:37 by ckloss"
diff --git a/src/version_liggghts.txt b/src/version_liggghts.txt
index 2bf1c1cc..f90b1afc 100644
--- a/src/version_liggghts.txt
+++ b/src/version_liggghts.txt
@@ -1 +1 @@
-2.3.1
+2.3.2
-- 
GitLab