← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3532: Replace struct intReal by standard std::pair

 

------------------------------------------------------------
revno: 3532
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Mon 2014-11-17 12:34:44 +0100
message:
  Replace struct intReal by standard std::pair
modified:
  core/Scene.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 'core/Scene.hpp'
--- core/Scene.hpp	2014-10-15 06:44:01 +0000
+++ core/Scene.hpp	2014-11-17 11:34:44 +0000
@@ -32,14 +32,6 @@
 	class OpenGLRenderer;
 #endif
 
-#ifdef YADE_LIQMIGRATION
-struct intReal {
-	public:
-		id_t id;
-		Real Vol;
-};
-#endif
-
 class Scene: public Serializable{
 	public:
 		//! Adds material to Scene::materials. It also sets id of the material accordingly and returns it.
@@ -71,8 +63,8 @@
 		shared_ptr<Engine> engineByName(const string& s);
 
 		#ifdef YADE_LIQMIGRATION
-			OpenMPVector<Interaction* > addIntrs;    //Array of added interactions, needed for liquid migration.
-			OpenMPVector<intReal > delIntrs;     //Array of deleted interactions, needed for liquid migration.
+			OpenMPVector<Interaction* > addIntrs;             //Array of added interactions, needed for liquid migration.
+			OpenMPVector<std::pair<id_t, Real > > delIntrs;   //Array of deleted interactions, needed for liquid migration.
 		#endif
 
 		#ifdef YADE_OPENGL

=== modified file 'pkg/dem/ViscoelasticCapillarPM.cpp'
--- pkg/dem/ViscoelasticCapillarPM.cpp	2014-11-17 09:21:14 +0000
+++ pkg/dem/ViscoelasticCapillarPM.cpp	2014-11-17 11:34:44 +0000
@@ -122,8 +122,8 @@
           phys.Vf1 = phys.Vb/2.0;
           phys.Vf2 = phys.Vb/2.0;
         }
-        const intReal B1={id1, phys.Vf1};
-        const intReal B2={id2, phys.Vf2};
+        const std::pair<id_t, Real > B1 = {id1, phys.Vf1};
+        const std::pair<id_t, Real > B2 = {id2, phys.Vf2};
         scene->delIntrs.push_back(B1);
         scene->delIntrs.push_back(B2);
       #endif
@@ -375,10 +375,10 @@
   
   // Update volume water at each deleted interaction for each body
   for (unsigned int i=0; i<scene->delIntrs.size(); i++) {
-    shared_ptr<Body> b = Body::byId(scene->delIntrs[i].id,scene);
-    b->state->Vf += scene->delIntrs[i].Vol;
-    addBodyMapInt(bodyNeedUpdate, scene->delIntrs[i].id);
-    liqVolRup += scene->delIntrs[i].Vol;
+    shared_ptr<Body> b = Body::byId(scene->delIntrs[i].first,scene);
+    b->state->Vf += scene->delIntrs[i].second;
+    addBodyMapInt(bodyNeedUpdate, scene->delIntrs[i].first);
+    liqVolRup += scene->delIntrs[i].second;
   }
   scene->delIntrs.clear();