← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3920: Add -= operator to OpenMPAccumulator.

 

------------------------------------------------------------
revno: 3920
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Mon 2014-04-14 16:44:08 +0200
message:
  Add -= operator to OpenMPAccumulator.
modified:
  lib/base/openmp-accu.hpp
  pkg/dem/ViscoelasticCapillarPM.cpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'lib/base/openmp-accu.hpp'
--- lib/base/openmp-accu.hpp	2013-03-28 19:18:22 +0000
+++ lib/base/openmp-accu.hpp	2014-04-14 14:44:08 +0000
@@ -101,6 +101,7 @@
 	~OpenMPAccumulator() { free((void*)data); }
 	// lock-free addition
 	void operator+=(const T& val){ *((T*)(data+omp_get_thread_num()*eSize))+=val; }
+	void operator-=(const T& val){ *((T*)(data+omp_get_thread_num()*eSize))-=val; }
 	// return summary value; must not be used concurrently
 	operator T() const { return get(); }
 	// reset to zeroValue; must NOT be used concurrently
@@ -136,6 +137,7 @@
 	T data;
 public:
 	void operator+=(const T& val){ data+=val; }
+	void operator-=(const T& val){ data-=val; }
 	operator T() const { return get(); }
 	void reset(){ data=ZeroInitializer<T>(); }
 	T get() const { return data; }

=== modified file 'pkg/dem/ViscoelasticCapillarPM.cpp'
--- pkg/dem/ViscoelasticCapillarPM.cpp	2014-04-14 14:11:53 +0000
+++ pkg/dem/ViscoelasticCapillarPM.cpp	2014-04-14 14:44:08 +0000
@@ -111,8 +111,8 @@
       return;
     } else {
       if (phys.liqBridgeActive) {
-        VLiqBridg += -phys.Vb;
-        NLiqBridg += -1;
+        VLiqBridg -= phys.Vb;
+        NLiqBridg -= 1;
       }
       scene->interactions->requestErase(I);
       return;
@@ -121,8 +121,8 @@
   
   if (phys.liqBridgeActive) {
     phys.liqBridgeActive=false;
-    VLiqBridg += -phys.Vb;
-    NLiqBridg += -1;
+    VLiqBridg -= phys.Vb;
+    NLiqBridg -= 1;
   }
   
   if (I->isActive) {


Follow ups