[Bf-blender-cvs] [dc70424faa0] fluid-mantaflow: Mantaflow: Updated manta preprocessed files

Sebastián Barschkis noreply at git.blender.org
Sat Apr 6 22:13:46 CEST 2019


Commit: dc70424faa0d215f31c55e259acb197a8766b983
Author: Sebastián Barschkis
Date:   Fri Apr 5 21:38:12 2019 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBdc70424faa0d215f31c55e259acb197a8766b983

Mantaflow: Updated manta preprocessed files

New pp files with updated init plugin

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

M	intern/mantaflow/intern/manta_pp/omp/plugin/initplugins.cpp
M	intern/mantaflow/intern/manta_pp/tbb/plugin/initplugins.cpp

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

diff --git a/intern/mantaflow/intern/manta_pp/omp/plugin/initplugins.cpp b/intern/mantaflow/intern/manta_pp/omp/plugin/initplugins.cpp
index eb8f8b1f500..b80bfe44832 100644
--- a/intern/mantaflow/intern/manta_pp/omp/plugin/initplugins.cpp
+++ b/intern/mantaflow/intern/manta_pp/omp/plugin/initplugins.cpp
@@ -160,30 +160,34 @@ LevelsetGrid obstacleLevelset(const FlagGrid& flags) {
 
 
 
- struct KnApplyEmission : public KernelBase { KnApplyEmission(const FlagGrid& flags, Grid<Real>& density, const Grid<Real>& emission, bool isAbsolute) :  KernelBase(&flags,0) ,flags(flags),density(density),emission(emission),isAbsolute(isAbsolute)   { runMessage(); run(); }  inline void op(int i, int j, int k, const FlagGrid& flags, Grid<Real>& density, const Grid<Real>& emission, bool isAbsolute )  {
-	if (!flags.isFluid(i,j,k) || emission(i,j,k) == 0.) return;
+ struct KnApplyEmission : public KernelBase { KnApplyEmission(const FlagGrid& flags, Grid<Real>& target, const Grid<Real>& source, bool isAbsolute, int type) :  KernelBase(&flags,0) ,flags(flags),target(target),source(source),isAbsolute(isAbsolute),type(type)   { runMessage(); run(); }  inline void op(int i, int j, int k, const FlagGrid& flags, Grid<Real>& target, const Grid<Real>& source, bool isAbsolute, int type )  {
+	// if type is given, ony check apply emission when celltype matches type from flaggrid
+	bool isInflow = (type & FlagGrid::TypeInflow && flags.isInflow(i,j,k));
+	bool isOutflow = (type & FlagGrid::TypeOutflow && flags.isOutflow(i,j,k));
+	if (type && !isInflow && !isOutflow) return;
+
 	if (isAbsolute)
-		density(i,j,k) = emission(i,j,k);
+		target(i,j,k) = source(i,j,k);
 	else
-		density(i,j,k) += emission(i,j,k);
-}   inline const FlagGrid& getArg0() { return flags; } typedef FlagGrid type0;inline Grid<Real>& getArg1() { return density; } typedef Grid<Real> type1;inline const Grid<Real>& getArg2() { return emission; } typedef Grid<Real> type2;inline bool& getArg3() { return isAbsolute; } typedef bool type3; void runMessage() { debMsg("Executing kernel KnApplyEmission ", 3); debMsg("Kernel range" <<  " x "<<  maxX  << " y "<< maxY  << " z "<< minZ<<" - "<< maxZ  << " "   , 4); }; void run() {  cons [...]
+		target(i,j,k) += source(i,j,k);
+}   inline const FlagGrid& getArg0() { return flags; } typedef FlagGrid type0;inline Grid<Real>& getArg1() { return target; } typedef Grid<Real> type1;inline const Grid<Real>& getArg2() { return source; } typedef Grid<Real> type2;inline bool& getArg3() { return isAbsolute; } typedef bool type3;inline int& getArg4() { return type; } typedef int type4; void runMessage() { debMsg("Executing kernel KnApplyEmission ", 3); debMsg("Kernel range" <<  " x "<<  maxX  << " y "<< maxY  << " z "<< mi [...]
 #pragma omp parallel 
  {  
 #pragma omp for  
-  for (int k=minZ; k < maxZ; k++) for (int j=0; j < _maxY; j++) for (int i=0; i < _maxX; i++) op(i,j,k,flags,density,emission,isAbsolute);  } } else { const int k=0; 
+  for (int k=minZ; k < maxZ; k++) for (int j=0; j < _maxY; j++) for (int i=0; i < _maxX; i++) op(i,j,k,flags,target,source,isAbsolute,type);  } } else { const int k=0; 
 #pragma omp parallel 
  {  
 #pragma omp for  
-  for (int j=0; j < _maxY; j++) for (int i=0; i < _maxX; i++) op(i,j,k,flags,density,emission,isAbsolute);  } }  } const FlagGrid& flags; Grid<Real>& density; const Grid<Real>& emission; bool isAbsolute;   };
+  for (int j=0; j < _maxY; j++) for (int i=0; i < _maxX; i++) op(i,j,k,flags,target,source,isAbsolute,type);  } }  } const FlagGrid& flags; Grid<Real>& target; const Grid<Real>& source; bool isAbsolute; int type;   };
 #line 115 "plugin/initplugins.cpp"
 
 
 
 //! Add emission values
 //isAbsolute: whether to add emission values to existing, or replace
-void applyEmission(FlagGrid& flags, Grid<Real>& density, Grid<Real>& emission, bool isAbsolute) {
-	KnApplyEmission(flags, density, emission, isAbsolute);
-} static PyObject* _W_7 (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, "applyEmission" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); Grid<Real>& density = *_args.getPtr<Grid<Real> >("density",1,&_lock); Grid<Real>& emission = *_args.getPtr<Grid<Real [...]
+void applyEmission(FlagGrid& flags, Grid<Real>& target, Grid<Real>& source, bool isAbsolute=true, int type=0) {
+	KnApplyEmission(flags, target, source, isAbsolute, type);
+} static PyObject* _W_7 (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, "applyEmission" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); Grid<Real>& target = *_args.getPtr<Grid<Real> >("target",1,&_lock); Grid<Real>& source = *_args.getPtr<Grid<Real> >( [...]
 
 // blender init functions for meshes
 
@@ -201,7 +205,7 @@ void applyEmission(FlagGrid& flags, Grid<Real>& density, Grid<Real>& emission, b
  {  
 #pragma omp for  
   for (int j=0; j < _maxY; j++) for (int i=0; i < _maxX; i++) op(i,j,k,flags,density,sdf,value,sigma);  } }  } const FlagGrid& flags; Grid<Real>& density; const Grid<Real>& sdf; Real value; Real sigma;   };
-#line 133 "plugin/initplugins.cpp"
+#line 137 "plugin/initplugins.cpp"
 
 
 //! Init noise-modulated density inside mesh
@@ -481,7 +485,7 @@ inline static Real calcFraction(Real phi1, Real phi2)
  {  
 #pragma omp for  
   for (int j=1; j < _maxY; j++) for (int i=1; i < _maxX; i++) op(i,j,k,flags,phiObs,fractions,boundaryWidth);  } }  } const FlagGrid& flags; const Grid<Real>& phiObs; MACGrid& fractions; const int& boundaryWidth;   };
-#line 343 "plugin/initplugins.cpp"
+#line 347 "plugin/initplugins.cpp"
 
 
 
@@ -492,7 +496,7 @@ void updateFractions(const FlagGrid& flags, const Grid<Real>& phiObs, MACGrid& f
 } static PyObject* _W_16 (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, "updateFractions" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; const FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); const Grid<Real>& phiObs = *_args.getPtr<Grid<Real> >("phiObs",1,&_lock); MACGrid& fractions = *_args.getPt [...]
 
 
- struct KnUpdateFlagsObs : public KernelBase { KnUpdateFlagsObs(FlagGrid& flags, const MACGrid* fractions, const Grid<Real>& phiObs, const Grid<Real>* phiOut ) :  KernelBase(&flags,1) ,flags(flags),fractions(fractions),phiObs(phiObs),phiOut(phiOut)   { runMessage(); run(); }  inline void op(int i, int j, int k, FlagGrid& flags, const MACGrid* fractions, const Grid<Real>& phiObs, const Grid<Real>* phiOut  )  {
+ struct KnUpdateFlagsObs : public KernelBase { KnUpdateFlagsObs(FlagGrid& flags, const MACGrid* fractions, const Grid<Real>& phiObs, const Grid<Real>* phiOut, const Grid<Real>* phiIn) :  KernelBase(&flags,1) ,flags(flags),fractions(fractions),phiObs(phiObs),phiOut(phiOut),phiIn(phiIn)   { runMessage(); run(); }  inline void op(int i, int j, int k, FlagGrid& flags, const MACGrid* fractions, const Grid<Real>& phiObs, const Grid<Real>* phiOut, const Grid<Real>* phiIn )  {
 
 	bool isObs = false;
 	if(fractions) {
@@ -510,29 +514,32 @@ void updateFractions(const FlagGrid& flags, const Grid<Real>& phiObs, MACGrid& f
 	}
 
 	bool isOutflow = false;
+	bool isInflow = false;
  	if (phiOut && (*phiOut)(i,j,k) < 0.) isOutflow = true;
+ 	if (phiIn && (*phiIn)(i,j,k) < 0.) isInflow = true;
 
  	if (isObs)          flags(i,j,k) = FlagGrid::TypeObstacle;
+ 	else if (isInflow)  flags(i,j,k) = (FlagGrid::TypeFluid | FlagGrid::TypeInflow);
  	else if (isOutflow) flags(i,j,k) = (FlagGrid::TypeEmpty | FlagGrid::TypeOutflow);
   	else                flags(i,j,k) = FlagGrid::TypeEmpty;
-}   inline FlagGrid& getArg0() { return flags; } typedef FlagGrid type0;inline const MACGrid* getArg1() { return fractions; } typedef MACGrid type1;inline const Grid<Real>& getArg2() { return phiObs; } typedef Grid<Real> type2;inline const Grid<Real>* getArg3() { return phiOut; } typedef Grid<Real> type3; void runMessage() { debMsg("Executing kernel KnUpdateFlagsObs ", 3); debMsg("Kernel range" <<  " x "<<  maxX  << " y "<< maxY  << " z "<< minZ<<" - "<< maxZ  << " "   , 4); };

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list