[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47779] branches/smoke2/intern/smoke/ intern: WIP commit
Daniel Genrich
daniel.genrich at gmx.net
Tue Jun 12 11:25:25 CEST 2012
Revision: 47779
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47779
Author: genscher
Date: 2012-06-12 09:25:18 +0000 (Tue, 12 Jun 2012)
Log Message:
-----------
WIP commit
Modified Paths:
--------------
branches/smoke2/intern/smoke/intern/FLUID_3D.cpp
branches/smoke2/intern/smoke/intern/FLUID_3D.h
branches/smoke2/intern/smoke/intern/FLUID_3D_SOLVERS.cpp
Modified: branches/smoke2/intern/smoke/intern/FLUID_3D.cpp
===================================================================
--- branches/smoke2/intern/smoke/intern/FLUID_3D.cpp 2012-06-12 08:50:40 UTC (rev 47778)
+++ branches/smoke2/intern/smoke/intern/FLUID_3D.cpp 2012-06-12 09:25:18 UTC (rev 47779)
@@ -1001,14 +1001,17 @@
*/
// copyBorderAll(_pressure, 0, _zRes);
+ VectorXf result;
+ result.setZero(linearIndex);
+
// solve Poisson equation
- solvePressurePre(_pressure, _divergence, _obstacles, b, A, gti);
+ solvePressurePre(_pressure, _divergence, _obstacles, b, A, gti, result);
for(unsigned int i = 0; i < _xRes * _yRes * _zRes; i++)
{
- float value = (_pressure[i] - b[i]);
+ float value = (_pressure[i] - result[gti(i)]);
if(value > 0.01)
- printf("error: p: %f, b: %f\n", _pressure[i], b[i]);
+ printf("error: p: %f, b: %f\n", _pressure[i], result[gti(i)]);
}
#if 0
{
@@ -1045,15 +1048,24 @@
{
float vMask[3] = {1.0f, 1.0f, 1.0f}, vObst[3] = {0, 0, 0};
float vR = 0.0f, vL = 0.0f, vT = 0.0f, vB = 0.0f, vD = 0.0f, vU = 0.0f;
+/*
+ float pC = result[gti(FINDEX(x, y, z))]; // center
+ float pR = result[gti(FINDEX(x + 1, y, z))]; // right
+ float pL = result[gti(FINDEX(x - 1, y, z))]; // left
+ float pT = result[gti(FINDEX(x, y + 1, z))]; // top
+ float pB = result[gti(FINDEX(x, y - 1, z))]; // bottom
+ float pU = result[gti(FINDEX(x, y, z + 1))]; // Up
+ float pD = result[gti(FINDEX(x, y, z - 1))]; // Down
+*/
+
+ float pC = _pressure[index]; // center
+ float pR = _pressure[index + 1]; // right
+ float pL = _pressure[index - 1]; // left
+ float pT = _pressure[index + _xRes]; // top
+ float pB = _pressure[index - _xRes]; // bottom
+ float pU = _pressure[index + _slabSize]; // Up
+ float pD = _pressure[index - _slabSize]; // Down
- float pC = b[index]; // center
- float pR = b[index + 1]; // right
- float pL = b[index - 1]; // left
- float pT = b[index + _slabSize]; // top
- float pB = b[index - _slabSize]; // bottom
- float pU = b[index + _xRes]; // Up
- float pD = b[index - _xRes]; // Down
-
if(!_obstacles[index])
{
// DG TODO: What if obstacle is left + right and one is moving?
Modified: branches/smoke2/intern/smoke/intern/FLUID_3D.h
===================================================================
--- branches/smoke2/intern/smoke/intern/FLUID_3D.h 2012-06-12 08:50:40 UTC (rev 47778)
+++ branches/smoke2/intern/smoke/intern/FLUID_3D.h 2012-06-12 09:25:18 UTC (rev 47779)
@@ -170,7 +170,7 @@
void diffuseHeat();
void solvePressure(float* field, float* b, unsigned char* skip);
- void solvePressurePre(float* field, float* b, unsigned char* skip, VectorXf &myb, SparseMatrix<float,RowMajor> &A, ArrayXd >i);
+ void solvePressurePre(float* field, float* b, unsigned char* skip, VectorXf &myb, SparseMatrix<float,RowMajor> &A, ArrayXd >i, VectorXf &result);
void solvePressureJacobian(float* p, float* d, unsigned char* ob);
Modified: branches/smoke2/intern/smoke/intern/FLUID_3D_SOLVERS.cpp
===================================================================
--- branches/smoke2/intern/smoke/intern/FLUID_3D_SOLVERS.cpp 2012-06-12 08:50:40 UTC (rev 47778)
+++ branches/smoke2/intern/smoke/intern/FLUID_3D_SOLVERS.cpp 2012-06-12 09:25:18 UTC (rev 47779)
@@ -168,7 +168,7 @@
if (_Acenter) delete[] _Acenter;
}
-void FLUID_3D::solvePressurePre(float* field, float* b, unsigned char* skip, VectorXf &myb, SparseMatrix<float,RowMajor> &A, ArrayXd >i)
+void FLUID_3D::solvePressurePre(float* field, float* b, unsigned char* skip, VectorXf &myb, SparseMatrix<float,RowMajor> &A, ArrayXd >i, VectorXf &result)
{
int x, y, z;
size_t index;
@@ -178,7 +178,6 @@
// i = 0
int i = 0;
- VectorXf result(arraySize);
result.setZero(arraySize);
_residual = new float[_totalCells]; // set 0
@@ -277,9 +276,9 @@
Pi.insert(it.row(), it.col()) = value;
}
}
+
direction = Pi.selfadjointView<Upper>() * residual;
-
// ???
delta_new = residual.dot(direction);
printf("DELTA_NEW old: %.12f, new: %.12f\n", deltaNew, delta_new);
@@ -408,6 +407,8 @@
for (x = 1; x < _xRes - 1; x++, index++)
_direction[index] = _h[index] + beta * _direction[index];
+ direction = h + mybeta * direction;
+
// i = i + 1
i++;
}
More information about the Bf-blender-cvs
mailing list