[Bf-blender-cvs] [44f49e765b1] fluid-mantaflow: updated manta pp files

Sebastián Barschkis noreply at git.blender.org
Tue Jul 18 10:28:32 CEST 2017


Commit: 44f49e765b1b75078eb199852875f9d034d306f6
Author: Sebastián Barschkis
Date:   Mon Jul 17 21:58:26 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB44f49e765b1b75078eb199852875f9d034d306f6

updated manta pp files

added drop and float particle support. also improved drop particle generation.

===================================================================

M	intern/mantaflow/intern/manta_pp/omp/particle.h
M	intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
M	intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp
M	intern/mantaflow/intern/manta_pp/omp/registration.cpp
M	intern/mantaflow/intern/manta_pp/tbb/particle.h
M	intern/mantaflow/intern/manta_pp/tbb/plugin/extforces.cpp
M	intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp
M	intern/mantaflow/intern/manta_pp/tbb/registration.cpp

===================================================================

diff --git a/intern/mantaflow/intern/manta_pp/omp/particle.h b/intern/mantaflow/intern/manta_pp/omp/particle.h
index e2d7bf3c296..c057cd87377 100644
--- a/intern/mantaflow/intern/manta_pp/omp/particle.h
+++ b/intern/mantaflow/intern/manta_pp/omp/particle.h
@@ -45,6 +45,10 @@ class ParticleBase : public PbClass {public:
 	enum ParticleStatus {
 		PNONE         = 0,
 		PNEW          = (1<<1),  // particles newly created in this step
+		PDROPLET      = (1<<2),  // secondary particle types
+		PBUBBLE       = (1<<3),
+		PFLOAT        = (1<<4),
+		PTRACER       = (1<<5),
 		PDELETE       = (1<<10), // mark as deleted, will be deleted in next compress() step
 		PINVALID      = (1<<30), // unused
 	};
@@ -437,7 +441,7 @@ template <class S>  struct GridAdvectKernel : public KernelBase { GridAdvectKern
  {  
 #pragma omp for  
   for (IndexInt i = 0; i < _sz; i++) op(i,p,vel,flags,dt,deleteInObstacle,stopInObstacle,u);  }   } std::vector<S>& p; const MACGrid& vel; const FlagGrid& flags; Real dt; bool deleteInObstacle; bool stopInObstacle;  std::vector<Vec3>  u;  };
-#line 413 "particle.h"
+#line 417 "particle.h"
 
 ;
 
@@ -454,7 +458,7 @@ template <class S>  struct KnDeleteInObstacle : public KernelBase { KnDeleteInOb
  {  
 #pragma omp for  
   for (IndexInt i = 0; i < _sz; i++) op(i,p,flags);  }   } std::vector<S>& p; const FlagGrid& flags;   };
-#line 435 "particle.h"
+#line 439 "particle.h"
 
 
 
@@ -487,7 +491,7 @@ template <class S>  struct KnClampPositions : public KernelBase { KnClampPositio
  {  
 #pragma omp for  
   for (IndexInt i = 0; i < _sz; i++) op(i,p,flags,posOld,stopInObstacle);  }   } std::vector<S>& p; const FlagGrid& flags; ParticleDataImpl<Vec3> * posOld; bool stopInObstacle;   };
-#line 458 "particle.h"
+#line 462 "particle.h"
 
 
 
diff --git a/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp b/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
index eef4050b0bd..39dc87e5d41 100644
--- a/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
+++ b/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
@@ -71,6 +71,26 @@ namespace Manta {
 #line 24 "plugin/extforces.cpp"
 
 
+
+
+
+template <class T>  struct knAddFromGrid : public KernelBase { knAddFromGrid( BasicParticleSystem& p, Grid<T>& gsrc, ParticleDataImpl<T>& target ) :  KernelBase(p.size()) ,p(p),gsrc(gsrc),target(target)   { runMessage(); run(); }   inline void op(IndexInt idx,  BasicParticleSystem& p, Grid<T>& gsrc, ParticleDataImpl<T>& target  )  {
+	if (!p.isActive(idx)) return;
+	target[idx] += gsrc.getInterpolated( p[idx].pos );
+}    inline BasicParticleSystem& getArg0() { return p; } typedef BasicParticleSystem type0;inline Grid<T>& getArg1() { return gsrc; } typedef Grid<T> type1;inline ParticleDataImpl<T>& getArg2() { return target; } typedef ParticleDataImpl<T> type2; void runMessage() { debMsg("Executing kernel knAddFromGrid ", 3); debMsg("Kernel range" <<  " size "<<  size  << " "   , 4); }; void run() {   const IndexInt _sz = size; 
+#pragma omp parallel 
+ {  
+#pragma omp for  
+  for (IndexInt i = 0; i < _sz; i++) op(i,p,gsrc,target);  }   } BasicParticleSystem& p; Grid<T>& gsrc; ParticleDataImpl<T>& target;   };
+#line 54 "plugin/extforces.cpp"
+
+
+void addGridToParts( Grid<Real>& source , BasicParticleSystem& parts , ParticleDataImpl<Real>& target ) {
+	knAddFromGrid<Real>(parts, source, target);
+} static PyObject* _W_0 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "addGridToParts" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; Grid<Real>& source = *_args.getPtr<Grid<Real> >("source",0,&_lock); BasicParticleSystem& parts = *_args.getPtr<BasicParticleSystem >("parts",1,&_lock); ParticleDataImpl<Real>& t [...]
+void addGridToPartsVec3( Grid<Vec3>& source , BasicParticleSystem& parts , ParticleDataImpl<Vec3>& target ) {
+	knAddFromGrid<Vec3>(parts, source, target);
+} static PyObject* _W_1 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "addGridToPartsVec3" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; Grid<Vec3>& source = *_args.getPtr<Grid<Vec3> >("source",0,&_lock); BasicParticleSystem& parts = *_args.getPtr<BasicParticleSystem >("parts",1,&_lock); ParticleDataImpl<Vec3 [...]
 	
 //! add Forces between fl/fl and fl/em cells (interpolate cell centered forces to MAC grid)
  struct KnAddForceField : public KernelBase { KnAddForceField(FlagGrid& flags, MACGrid& vel, Grid<Vec3>& force) :  KernelBase(&flags,1) ,flags(flags),vel(vel),force(force)   { runMessage(); run(); }  inline void op(int i, int j, int k, FlagGrid& flags, MACGrid& vel, Grid<Vec3>& force )  {
@@ -93,7 +113,7 @@ namespace Manta {
  {  
 #pragma omp for  
   for (int j=1; j < _maxY; j++) for (int i=1; i < _maxX; i++) op(i,j,k,flags,vel,force);  } }  } FlagGrid& flags; MACGrid& vel; Grid<Vec3>& force;   };
-#line 53 "plugin/extforces.cpp"
+#line 66 "plugin/extforces.cpp"
 
 
 
@@ -118,7 +138,7 @@ namespace Manta {
  {  
 #pragma omp for  
   for (int j=1; j < _maxY; j++) for (int i=1; i < _maxX; i++) op(i,j,k,flags,vel,force);  } }  } FlagGrid& flags; MACGrid& vel; Vec3 force;   };
-#line 67 "plugin/extforces.cpp"
+#line 80 "plugin/extforces.cpp"
 
 
 
@@ -126,7 +146,7 @@ namespace Manta {
 void addGravity(FlagGrid& flags, MACGrid& vel, Vec3 gravity) {    
 	Vec3 f = gravity * flags.getParent()->getDt() / flags.getDx();
 	KnAddForce(flags, vel, f);
-} static PyObject* _W_0 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "addGravity" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",1,&_lock); Vec3 gravity = _args.get<Vec3 >("gravity",2,&_lock);   _retval  [...]
+} static PyObject* _W_2 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "addGravity" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",1,&_lock); Vec3 gravity = _args.get<Vec3 >("gravity",2,&_lock);   _retval  [...]
 
 //! kernel to add Buoyancy force 
  struct KnAddBuoyancy : public KernelBase { KnAddBuoyancy(FlagGrid& flags, Grid<Real>& factor, MACGrid& vel, Vec3 strength) :  KernelBase(&flags,1) ,flags(flags),factor(factor),vel(vel),strength(strength)   { runMessage(); run(); }  inline void op(int i, int j, int k, FlagGrid& flags, Grid<Real>& factor, MACGrid& vel, Vec3 strength )  {    
@@ -146,7 +166,7 @@ void addGravity(FlagGrid& flags, MACGrid& vel, Vec3 gravity) {
  {  
 #pragma omp for  
   for (int j=1; j < _maxY; j++) for (int i=1; i < _maxX; i++) op(i,j,k,flags,factor,vel,strength);  } }  } FlagGrid& flags; Grid<Real>& factor; MACGrid& vel; Vec3 strength;   };
-#line 87 "plugin/extforces.cpp"
+#line 100 "plugin/extforces.cpp"
 
 
 
@@ -154,7 +174,7 @@ void addGravity(FlagGrid& flags, MACGrid& vel, Vec3 gravity) {
 void addBuoyancy(FlagGrid& flags, Grid<Real>& density, MACGrid& vel, Vec3 gravity, Real coefficient=1.) {
 	Vec3 f = -gravity * flags.getParent()->getDt() / flags.getParent()->getDx() * coefficient;
 	KnAddBuoyancy(flags,density, vel, f);
-} static PyObject* _W_1 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "addBuoyancy" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); Grid<Real>& density = *_args.getPtr<Grid<Real> >("density",1,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",2,& [...]

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list