[Bf-blender-cvs] [7711b72c83] fluid-mantaflow: updated manta vec3 extrapolation
Sebastián Barschkis
noreply at git.blender.org
Tue Mar 7 01:26:28 CET 2017
Commit: 7711b72c837cbfa641803393e13b40592fdf02ec
Author: Sebastián Barschkis
Date: Mon Feb 20 11:39:34 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB7711b72c837cbfa641803393e13b40592fdf02ec
updated manta vec3 extrapolation
now using inside mode as well - similar to extrapolateLsSimple()
===================================================================
M intern/mantaflow/intern/manta_pp/fastmarch.cpp
===================================================================
diff --git a/intern/mantaflow/intern/manta_pp/fastmarch.cpp b/intern/mantaflow/intern/manta_pp/fastmarch.cpp
index 96bd1f014e..c9b3ad1888 100644
--- a/intern/mantaflow/intern/manta_pp/fastmarch.cpp
+++ b/intern/mantaflow/intern/manta_pp/fastmarch.cpp
@@ -573,16 +573,23 @@ void extrapolateLsSimple(Grid<Real>& phi, int distance = 4, bool inside=false )
// extrapolate centered vec3 values from marked fluid cells
-void extrapolateVec3Simple(Grid<Vec3>& vel, Grid<Real>& phi, int distance = 4) {
+void extrapolateVec3Simple(Grid<Vec3>& vel, Grid<Real>& phi, int distance = 4, bool inside=false) {
Grid<int> tmp( vel.getParent() );
tmp.clear();
const int dim = (vel.is3D() ? 3:2);
- // mark all inside
- FOR_IJK_BND(vel,1) {
- if ( phi(i,j,k) < 0. ) { tmp(i,j,k) = 1; }
- }
- // + first layer outside
+ // by default, march outside
+ if(!inside) {
+ // mark all inside
+ FOR_IJK_BND(phi,1) {
+ if ( phi(i,j,k) < 0. ) { tmp(i,j,k) = 1; }
+ }
+ } else {
+ FOR_IJK_BND(phi,1) {
+ if ( phi(i,j,k) > 0. ) { tmp(i,j,k) = 1; }
+ }
+ }
+ // + first layer around
FOR_IJK_BND(vel,1) {
Vec3i p(i,j,k);
if ( tmp(p) ) continue;
@@ -591,13 +598,13 @@ void extrapolateVec3Simple(Grid<Vec3>& vel, Grid<Real>& phi, int distance = 4) {
tmp(i,j,k) = 2; n=2*dim;
}
}
- }
+ }
for(int d=2; d<1+distance; ++d) {
knExtrapolateLsSimple<Vec3>(vel, distance, tmp, d, Vec3(0.) );
}
knSetRemaining<Vec3>(vel, tmp, Vec3(0.) );
-} static PyObject* _W_3 (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, "extrapolateVec3Simple" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; Grid<Vec3>& vel = *_args.getPtr<Grid<Vec3> >("vel",0,&_lock); Grid<Real>& phi = *_args.getPtr<Grid<Real> >("phi",1,&_lock); int distance = _args.getOpt<int >("distance",2 [...]
+} static PyObject* _W_3 (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, "extrapolateVec3Simple" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; Grid<Vec3>& vel = *_args.getPtr<Grid<Vec3> >("vel",0,&_lock); Grid<Real>& phi = *_args.getPtr<Grid<Real> >("phi",1,&_lock); int distance = _args.getOpt<int >("distance",2 [...]
More information about the Bf-blender-cvs
mailing list