Commit: 76f42e3ffed6bfa28382c92ac523cfa8a2eb8e29
Author: Sebastián Barschkis
Date:   Fri Jan 22 15:18:51 2016 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rB76f42e3ffed6bfa28382c92ac523cfa8a2eb8e29

updated mantaflow pp files

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

M       source/blender/python/manta_pp/CMakeLists.txt
M       source/blender/python/manta_pp/commonkernels.h
M       source/blender/python/manta_pp/conjugategrad.cpp
M       source/blender/python/manta_pp/conjugategrad.h
M       source/blender/python/manta_pp/edgecollapse.cpp
M       source/blender/python/manta_pp/edgecollapse.h
M       source/blender/python/manta_pp/fastmarch.cpp
M       source/blender/python/manta_pp/fastmarch.h
M       source/blender/python/manta_pp/fileio.cpp
M       source/blender/python/manta_pp/fileio.h
M       source/blender/python/manta_pp/fluidsolver.cpp
M       source/blender/python/manta_pp/fluidsolver.h
M       source/blender/python/manta_pp/general.cpp
M       source/blender/python/manta_pp/general.h
M       source/blender/python/manta_pp/grid.cpp
M       source/blender/python/manta_pp/grid.h
M       source/blender/python/manta_pp/hginfo.h
M       source/blender/python/manta_pp/kernel.cpp
M       source/blender/python/manta_pp/kernel.h
M       source/blender/python/manta_pp/levelset.cpp
M       source/blender/python/manta_pp/levelset.h
M       source/blender/python/manta_pp/mesh.cpp
M       source/blender/python/manta_pp/mesh.h
M       source/blender/python/manta_pp/movingobs.cpp
M       source/blender/python/manta_pp/movingobs.h
M       source/blender/python/manta_pp/noisefield.cpp
M       source/blender/python/manta_pp/noisefield.h
M       source/blender/python/manta_pp/particle.cpp
M       source/blender/python/manta_pp/particle.h
M       source/blender/python/manta_pp/plugin/advection.cpp
M       source/blender/python/manta_pp/plugin/extforces.cpp
M       source/blender/python/manta_pp/plugin/fire.cpp
M       source/blender/python/manta_pp/plugin/flip.cpp
M       source/blender/python/manta_pp/plugin/initplugins.cpp
M       source/blender/python/manta_pp/plugin/kepsilon.cpp
M       source/blender/python/manta_pp/plugin/meshplugins.cpp
M       source/blender/python/manta_pp/plugin/pressure.cpp
M       source/blender/python/manta_pp/plugin/vortexplugins.cpp
M       source/blender/python/manta_pp/plugin/waveletturbulence.cpp
M       source/blender/python/manta_pp/plugin/waves.cpp
M       source/blender/python/manta_pp/pwrapper/registry.h
M       source/blender/python/manta_pp/shapes.cpp
M       source/blender/python/manta_pp/shapes.h
M       source/blender/python/manta_pp/test.cpp
M       source/blender/python/manta_pp/timing.cpp
M       source/blender/python/manta_pp/timing.h
M       source/blender/python/manta_pp/turbulencepart.cpp
M       source/blender/python/manta_pp/turbulencepart.h
M       source/blender/python/manta_pp/vortexpart.cpp
M       source/blender/python/manta_pp/vortexpart.h
M       source/blender/python/manta_pp/vortexsheet.cpp
M       source/blender/python/manta_pp/vortexsheet.h

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

diff --git a/source/blender/python/manta_pp/CMakeLists.txt 
b/source/blender/python/manta_pp/CMakeLists.txt
index b2b1926..b655485 100644
--- a/source/blender/python/manta_pp/CMakeLists.txt
+++ b/source/blender/python/manta_pp/CMakeLists.txt
@@ -1,4 +1,8 @@
-#add_definitions(-DGUI=1)
+if(WITH_OPENMP)
+       add_definitions(-DOPENMP)
+else()
+       message("Error. Mantaflow pp files require an OpenMP enabled compiler")
+endif()
 
 set(INC
        ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/source/blender/python/manta_pp/commonkernels.h 
b/source/blender/python/manta_pp/commonkernels.h
index eb81503..202905d 100644
--- a/source/blender/python/manta_pp/commonkernels.h
+++ b/source/blender/python/manta_pp/commonkernels.h
@@ -9,7 +9,7 @@
 
 
 
-#line 1 "/Users/user/Developer/Xcode 
Projects/blenderFireIntegration/mantaflowgit/source/commonkernels.h"
+#line 1 "/Users/user/Developer/Xcode 
Projects/mantaflowDevelop/mantaflowgit/source/commonkernels.h"
 /******************************************************************************
  *
  * MantaFlow fluid solver framework
@@ -38,13 +38,29 @@ namespace Manta {
  struct InvertCheckFluid : public KernelBase { InvertCheckFluid(FlagGrid& 
flags, Grid<Real>& grid) :  KernelBase(&flags,0) ,flags(flags),grid(grid)   { 
run(); }  inline void op(int idx, FlagGrid& flags, Grid<Real>& grid )  {
        if (flags.isFluid(idx) && grid[idx] > 0)
                grid[idx] = 1.0 / grid[idx];
-}   inline FlagGrid& getArg0() { return flags; } typedef FlagGrid type0;inline 
Grid<Real>& getArg1() { return grid; } typedef Grid<Real> type1; void run() {  
const int _sz = size; for (int i=0; i < _sz; i++) op(i, flags,grid);  } 
FlagGrid& flags; Grid<Real>& grid;   };
+}   inline FlagGrid& getArg0() { return flags; } typedef FlagGrid type0;inline 
Grid<Real>& getArg1() { return grid; } typedef Grid<Real> type1; void run() {  
const int _sz = size; 
+#pragma omp parallel 
+ { this->threadId = omp_get_thread_num(); this->threadNum = 
omp_get_num_threads();  
+#pragma omp for 
+  for (int i=0; i < _sz; i++) op(i,flags,grid);  }  } FlagGrid& flags; 
Grid<Real>& grid;   };
+#line 26 "commonkernels.h"
+
+
 
 //! Kernel: Squared sum over grid
 
  struct GridSumSqr : public KernelBase { GridSumSqr(Grid<Real>& grid) :  
KernelBase(&grid,0) ,grid(grid) ,sum(0)  { run(); }  inline void op(int idx, 
Grid<Real>& grid ,double& sum)  {
        sum += square((double)grid[idx]);    
-}   inline operator double () { return sum; } inline double  & getRet() { 
return sum; }  inline Grid<Real>& getArg0() { return grid; } typedef Grid<Real> 
type0; void run() {  const int _sz = size; for (int i=0; i < _sz; i++) op(i, 
grid,sum);  } Grid<Real>& grid;  double sum;  };
+}   inline operator double () { return sum; } inline double  & getRet() { 
return sum; }  inline Grid<Real>& getArg0() { return grid; } typedef Grid<Real> 
type0; void run() {  const int _sz = size; 
+#pragma omp parallel 
+ { this->threadId = omp_get_thread_num(); this->threadNum = 
omp_get_num_threads();  double sum = 0; 
+#pragma omp for nowait 
+  for (int i=0; i < _sz; i++) op(i,grid,sum); 
+#pragma omp critical
+{this->sum += sum; } }  } Grid<Real>& grid;  double sum;  };
+#line 33 "commonkernels.h"
+
+
 
 //! Kernel: rotation operator \nabla x v for centered vector fields
 
@@ -56,7 +72,18 @@ namespace Manta {
                v[1] = 0.5*((grid(i,j,k+1).x - grid(i,j,k-1).x) - 
(grid(i+1,j,k).z - grid(i-1,j,k).z));
        }
        dst(i,j,k) = v;
-}   inline const Grid<Vec3>& getArg0() { return grid; } typedef Grid<Vec3> 
type0;inline Grid<Vec3>& getArg1() { return dst; } typedef Grid<Vec3> type1; 
void run() {  const int _maxX = maxX; const int _maxY = maxY; for (int k=minZ; 
k< maxZ; k++) for (int j=1; j< _maxY; j++) for (int i=1; i< _maxX; i++) 
op(i,j,k, grid,dst);  } const Grid<Vec3>& grid; Grid<Vec3>& dst;   };;
+}   inline const Grid<Vec3>& getArg0() { return grid; } typedef Grid<Vec3> 
type0;inline Grid<Vec3>& getArg1() { return dst; } typedef Grid<Vec3> type1; 
void run() {  const int _maxX = maxX; const int _maxY = maxY; if (maxZ > 1) { 
+#pragma omp parallel 
+ { this->threadId = omp_get_thread_num(); this->threadNum = 
omp_get_num_threads();  
+#pragma omp for 
+  for (int k=minZ; k < maxZ; k++) for (int j=1; j < _maxY; j++) for (int i=1; 
i < _maxX; i++) op(i,j,k,grid,dst);  } } else { const int k=0; 
+#pragma omp parallel 
+ { this->threadId = omp_get_thread_num(); this->threadNum = 
omp_get_num_threads();  
+#pragma omp for 
+  for (int j=1; j < _maxY; j++) for (int i=1; i < _maxX; i++) 
op(i,j,k,grid,dst);  } }  } const Grid<Vec3>& grid; Grid<Vec3>& dst;   };
+#line 39 "commonkernels.h"
+
+;
 
 //! Kernel: divergence operator (from MAC grid)
 
@@ -65,7 +92,18 @@ namespace Manta {
        if(grid.is3D()) del[2] += grid(i,j,k+1).z;
        else            del[2]  = 0.;
        div(i,j,k) = del.x + del.y + del.z;
-}   inline Grid<Real>& getArg0() { return div; } typedef Grid<Real> 
type0;inline const MACGrid& getArg1() { return grid; } typedef MACGrid type1; 
void run() {  const int _maxX = maxX; const int _maxY = maxY; for (int k=minZ; 
k< maxZ; k++) for (int j=1; j< _maxY; j++) for (int i=1; i< _maxX; i++) 
op(i,j,k, div,grid);  } Grid<Real>& div; const MACGrid& grid;   };
+}   inline Grid<Real>& getArg0() { return div; } typedef Grid<Real> 
type0;inline const MACGrid& getArg1() { return grid; } typedef MACGrid type1; 
void run() {  const int _maxX = maxX; const int _maxY = maxY; if (maxZ > 1) { 
+#pragma omp parallel 
+ { this->threadId = omp_get_thread_num(); this->threadNum = 
omp_get_num_threads();  
+#pragma omp for 
+  for (int k=minZ; k < maxZ; k++) for (int j=1; j < _maxY; j++) for (int i=1; 
i < _maxX; i++) op(i,j,k,div,grid);  } } else { const int k=0; 
+#pragma omp parallel 
+ { this->threadId = omp_get_thread_num(); this->threadNum = 
omp_get_num_threads();  
+#pragma omp for 
+  for (int j=1; j < _maxY; j++) for (int i=1; i < _maxX; i++) 
op(i,j,k,div,grid);  } }  } Grid<Real>& div; const MACGrid& grid;   };
+#line 51 "commonkernels.h"
+
+
 
 //! Kernel: gradient operator for MAC grid
  struct GradientOpMAC : public KernelBase { GradientOpMAC(MACGrid& gradient, 
const Grid<Real>& grid) :  KernelBase(&gradient,1) 
,gradient(gradient),grid(grid)   { run(); }  inline void op(int i, int j, int 
k, MACGrid& gradient, const Grid<Real>& grid )  {
@@ -73,7 +111,18 @@ namespace Manta {
        if(grid.is3D()) grad[2] -= grid(i,j,k-1);
        else            grad[2]  = 0.;
        gradient(i,j,k) = grad;
-}   inline MACGrid& getArg0() { return gradient; } typedef MACGrid 
type0;inline const Grid<Real>& getArg1() { return grid; } typedef Grid<Real> 
type1; void run() {  const int _maxX = maxX; const int _maxY = maxY; for (int 
k=minZ; k< maxZ; k++) for (int j=1; j< _maxY; j++) for (int i=1; i< _maxX; i++) 
op(i,j,k, gradient,grid);  } MACGrid& gradient; const Grid<Real>& grid;   };
+}   inline MACGrid& getArg0() { return gradient; } typedef MACGrid 
type0;inline const Grid<Real>& getArg1() { return grid; } typedef Grid<Real> 
type1; void run() {  const int _maxX = maxX; const int _maxY = maxY; if (maxZ > 
1) { 
+#pragma omp parallel 
+ { this->threadId = omp_get_thread_num(); this->threadNum = 
omp_get_num_threads();  
+#pragma omp for 
+  for (int k=minZ; k < maxZ; k++) for (int j=1; j < _maxY; j++) for (int i=1; 
i < _maxX; i++) op(i,j,k,gradient,grid);  } } else { const int k=0; 
+#pragma omp parallel 
+ { this->threadId = omp_get_thread_num(); this->threadNum = 
omp_get_num_threads();  
+#pragma omp for 
+  for (int j=1; j < _maxY; j++) for (int i=1; i < _maxX; i++) 
op(i,j,k,gradient,grid);  } }  } MACGrid& gradient; const Grid<Real>& grid;   };
+#line 59 "commonkernels.h"
+
+
 
 //! Kernel: centered gradient operator 
  struct GradientOp : public KernelBase { GradientOp(Grid<Vec3>& gradient, 
const Grid<Real>& grid) :  KernelBase(&gradient,1) 
,gradient(gradient),grid(grid)   { run(); }  inline void op(int i, int j, int 
k, Grid<Vec3>& gradient, const Grid<Real>& grid )  {
@@ -81,34 +130,88 @@ namespace Manta {
                                                                   
grid(i,j+1,k)-grid(i,j-1,k), 0.);
        if(grid.is3D()) grad[2]= 0.5*( grid(i,j,k+1)-grid(i,j,k-1) );
        gradient(i,j,k) = grad;
-}   inline Grid<Vec3>& getArg0() { return gradient; } typedef Grid<Vec3> 
type0;inline const Grid<Real>& getArg1() { return grid; } typedef Grid<Real> 
type1; void run() {  const int _maxX = maxX; const int _maxY = maxY; for (int 
k=minZ; k< maxZ; k++) for (int j=1; j< _maxY; j++) for (int i=1; i< _maxX; i++) 
op(i,j,k, gradient,grid);  } Grid<Vec3>& gradient; const Grid<Real>& grid;   };
+}   inline Grid<Vec3>& getArg0() { return gradient; } typedef Grid<Vec3> 
type0;inline const Grid<Real>& getArg1() { return grid; } typedef Grid<Real> 
type1; void run() {  const int _maxX = maxX; const int _maxY = maxY; if (maxZ > 
1) { 
+#pragma omp parallel 
+ { this->threadId = omp_get_thread_num(); this->threadNum = 
omp_get_num_threads();  
+#pragma omp for 
+  for (int k=minZ; k < maxZ; k++) for (int j=1; j < _maxY; j++) for (int i=1; 
i < _maxX; i++) op(i,j,k,gradient,grid);  } } else { const int k=0; 
+#pragma omp parallel 
+ { this->threadId = omp_get_thread_num(); this->threadNum = 
omp_get_num_threads();  
+#pragma omp for 
+  for (int j=1; j < _maxY; j++) for (int i=1; i < _maxX; i++) 
op(i,j,k,gradient,grid);  } }  } Grid<Vec3>& gradient; const Grid<Real>& grid;  
 };
+#line 67 "commonkernels.h"
+
+
 
 //! Kernel: Laplace operator
  struct LaplaceOp : public KernelBase { LaplaceOp(Grid<Real>& laplace, const 
Grid<Real>& grid) :  KernelBase(&laplace,1) ,laplace(laplace),grid(grid)   { 
run(); }  inline void op(int i, int j, int k, Grid<Real>& laplace, const 
Grid<Real>& grid )  {
        laplace(i,j,k) = 
-(6.0*grid(i,j,k)-grid(i+1,j,k)-grid(i-1,j,k)-grid(i,j+1,k)-grid(i,j-1,k)-grid(i,j,k+1)-grid(i,j,k-1));
-}   inline Grid<Real>& getArg0() { return laplace; } typedef Grid<Real> 
type0;inline const Grid<Real>& getArg1() { return grid; } typedef Grid<Real> 
type1; void run() {  const int _maxX = maxX; const int _maxY = maxY; for (int 
k=minZ; k< maxZ; k++) for (int j=1; j< _maxY; j++) for (int i=1; i< _maxX; i++) 
op(i,j,k, laplace,grid);  } Grid<Real>& laplace; const Grid<Real>& grid;   };
+}   inline Grid<Real>& getArg0() { return laplace; } typedef Grid<Real> 
type0;inline const Grid<Real>& getArg1() { return grid; } typedef Grid<Real> 
type1; void run() {  const int _maxX = maxX; const int _maxY = max

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to