[Bf-blender-cvs] [acee60cc583] fluid-mantaflow: updated manta pp files
Sebastián Barschkis
noreply at git.blender.org
Wed Nov 29 19:12:26 CET 2017
Commit: acee60cc5830c76efc807f33600a88f03c3191ba
Author: Sebastián Barschkis
Date: Mon Nov 27 11:01:03 2017 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rBacee60cc5830c76efc807f33600a88f03c3191ba
updated manta pp files
===================================================================
M intern/mantaflow/CMakeLists.txt
M intern/mantaflow/intern/manta_pp/omp/gitinfo.h
M intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
M intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp
A intern/mantaflow/intern/manta_pp/omp/plugin/sndparticles.cpp
M intern/mantaflow/intern/manta_pp/omp/python/defines.py.reg
M intern/mantaflow/intern/manta_pp/omp/python/defines.py.reg.cpp
M intern/mantaflow/intern/manta_pp/omp/registration.cpp
M intern/mantaflow/intern/manta_pp/tbb/gitinfo.h
M intern/mantaflow/intern/manta_pp/tbb/plugin/extforces.cpp
M intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp
A intern/mantaflow/intern/manta_pp/tbb/plugin/sndparticles.cpp
M intern/mantaflow/intern/manta_pp/tbb/python/defines.py.reg
M intern/mantaflow/intern/manta_pp/tbb/python/defines.py.reg.cpp
M intern/mantaflow/intern/manta_pp/tbb/registration.cpp
===================================================================
diff --git a/intern/mantaflow/CMakeLists.txt b/intern/mantaflow/CMakeLists.txt
index 00df23dfa70..998578fc021 100644
--- a/intern/mantaflow/CMakeLists.txt
+++ b/intern/mantaflow/CMakeLists.txt
@@ -145,6 +145,7 @@ set(SRC
${MANTA_PP}/plugin/meshplugins.cpp
# ${MANTA_PP}/plugin/numpyconvert.cpp
${MANTA_PP}/plugin/pressure.cpp
+ ${MANTA_PP}/plugin/sndparticles.cpp
${MANTA_PP}/plugin/surfaceturbulence.cpp
# ${MANTA_PP}/plugin/tfplugins.cpp
${MANTA_PP}/plugin/vortexplugins.cpp
diff --git a/intern/mantaflow/intern/manta_pp/omp/gitinfo.h b/intern/mantaflow/intern/manta_pp/omp/gitinfo.h
index 6b555c545d3..b772b7fe1ca 100644
--- a/intern/mantaflow/intern/manta_pp/omp/gitinfo.h
+++ b/intern/mantaflow/intern/manta_pp/omp/gitinfo.h
@@ -1,4 +1,4 @@
-#define MANTA_GIT_VERSION "commit 73bde2d6730e7f05d7f4963ac1eb0fe75590fb96"
+#define MANTA_GIT_VERSION "commit 8fdd0f9d3d5bb67ae5bad8e06eabda0ba2c896e7"
diff --git a/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp b/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
index 7815f901518..6aba3764f85 100644
--- a/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
+++ b/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
@@ -32,77 +32,17 @@ using namespace std;
namespace Manta {
-//! add Forces between fl/fl and fl/em cells (interpolate cell centered forces to MAC grid)
- struct KnAddForceIfLower : public KernelBase { KnAddForceIfLower(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 ) {
- bool curFluid = flags.isFluid(i,j,k);
- bool curEmpty = flags.isEmpty(i,j,k);
- if (!curFluid && !curEmpty) return;
-
- if (flags.isFluid(i-1,j,k) || (curFluid && flags.isEmpty(i-1,j,k))) {
- Real forceMACX = 0.5*(force(i-1,j,k).x + force(i,j,k).x);
- Real min = std::min(vel(i,j,k).x, forceMACX);
- Real max = std::max(vel(i,j,k).x, forceMACX);
- Real sum = vel(i,j,k).x + forceMACX;
- vel(i,j,k).x = (forceMACX > 0) ? std::min(sum, max) : std::max(sum, min);
- }
- if (flags.isFluid(i,j-1,k) || (curFluid && flags.isEmpty(i,j-1,k))) {
- Real forceMACY = 0.5*(force(i,j-1,k).y + force(i,j,k).y);
- Real min = std::min(vel(i,j,k).y, forceMACY);
- Real max = std::max(vel(i,j,k).y, forceMACY);
- Real sum = vel(i,j,k).y + forceMACY;
- vel(i,j,k).y = (forceMACY > 0) ? std::min(sum, max) : std::max(sum, min);
- }
- if (vel.is3D() && (flags.isFluid(i,j,k-1) || (curFluid && flags.isEmpty(i,j,k-1)))) {
- Real forceMACZ = 0.5*(force(i,j,k-1).z + force(i,j,k).z);
- Real min = std::min(vel(i,j,k).z, forceMACZ);
- Real max = std::max(vel(i,j,k).z, forceMACZ);
- Real sum = vel(i,j,k).z + forceMACZ;
- vel(i,j,k).z = (forceMACZ > 0) ? std::min(sum, max) : std::max(sum, min);
- }
-} inline FlagGrid& getArg0() { return flags; } typedef FlagGrid type0;inline MACGrid& getArg1() { return vel; } typedef MACGrid type1;inline Grid<Vec3>& getArg2() { return force; } typedef Grid<Vec3> type2; void runMessage() { debMsg("Executing kernel KnAddForceIfLower ", 3); debMsg("Kernel range" << " x "<< maxX << " y "<< maxY << " z "<< minZ<<" - "<< maxZ << " " , 4); }; void run() { const int _maxX = maxX; const int _maxY = maxY; if (maxZ > 1) {
-#pragma omp parallel
- {
-#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,flags,vel,force); } } else { const int k=0;
-#pragma omp parallel
- {
-#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 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 constant force between fl/fl and fl/em cells
struct KnApplyForceField : public KernelBase { KnApplyForceField(FlagGrid& flags, MACGrid& vel, Grid<Vec3>& force, Grid<Real>* include, bool additive, bool isMAC) : KernelBase(&flags,1) ,flags(flags),vel(vel),force(force),include(include),additive(additive),isMAC(isMAC) { runMessage(); run(); } inline void op(int i, int j, int k, FlagGrid& flags, MACGrid& vel, Grid<Vec3>& force, Grid<Real>* include, bool additive, bool isMAC ) {
bool curFluid = flags.isFluid(i,j,k);
bool curEmpty = flags.isEmpty(i,j,k);
if (!curFluid && !curEmpty) return;
if (include && ((*include)(i,j,k) > 0.)) return;
-
+
Real forceX = (isMAC) ? force(i,j,k).x : 0.5*(force(i-1,j,k).x + force(i,j,k).x);
Real forceY = (isMAC) ? force(i,j,k).y : 0.5*(force(i,j-1,k).y + force(i,j,k).y);
Real forceZ = (isMAC) ? force(i,j,k).z : 0.5*(force(i,j,k-1).z + force(i,j,k).z);
-
+
if (flags.isFluid(i-1,j,k) || (curFluid && flags.isEmpty(i-1,j,k)))
vel(i,j,k).x = (additive) ? vel(i,j,k).x+forceX : forceX;
if (flags.isFluid(i,j-1,k) || (curFluid && flags.isEmpty(i,j-1,k)))
@@ -118,7 +58,7 @@ void addGridToPartsVec3( Grid<Vec3>& source , BasicParticleSystem& parts , Parti
{
#pragma omp for
for (int j=1; j < _maxY; j++) for (int i=1; i < _maxX; i++) op(i,j,k,flags,vel,force,include,additive,isMAC); } } } FlagGrid& flags; MACGrid& vel; Grid<Vec3>& force; Grid<Real>* include; bool additive; bool isMAC; };
-#line 66 "plugin/extforces.cpp"
+#line 24 "plugin/extforces.cpp"
@@ -128,7 +68,7 @@ void addGridToPartsVec3( Grid<Vec3>& source , BasicParticleSystem& parts , Parti
bool curEmpty = flags.isEmpty(i,j,k);
if (!curFluid && !curEmpty) return;
if (exclude && ((*exclude)(i,j,k) < 0.)) return;
-
+
if (flags.isFluid(i-1,j,k) || (curFluid && flags.isEmpty(i-1,j,k)))
vel(i,j,k).x = (additive) ? vel(i,j,k).x+force.x : force.x;
if (flags.isFluid(i,j-1,k) || (curFluid && flags.isEmpty(i,j-1,k)))
@@ -144,7 +84,7 @@ void addGridToPartsVec3( Grid<Vec3>& source , BasicParticleSystem& parts , Parti
{
#pragma omp for
for (int j=1; j < _maxY; j++) for (int i=1; i < _maxX; i++) op(i,j,k,flags,vel,force,exclude,additive); } } } FlagGrid& flags; MACGrid& vel; Vec3 force; Grid<Real>* exclude; bool additive; };
-#line 85 "plugin/extforces.cpp"
+#line 43 "plugin/extforces.cpp"
@@ -152,12 +92,12 @@ void addGridToPartsVec3( Grid<Vec3>& source , BasicParticleSystem& parts , Parti
void addGravity(FlagGrid& flags, MACGrid& vel, Vec3 gravity, Grid<Real>* exclude=NULL) {
Vec3 f = gravity * flags.getParent()->getDt() / flags.getDx();
KnApplyForce(flags, vel, f, exclude, true);
-} 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 >("gravit
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list