[Bf-blender-cvs] [065676a] soc-2014-fluid: updated mantaflow version
Roman Pogribnyi
noreply at git.blender.org
Sun Sep 21 16:38:16 CEST 2014
Commit: 065676a6f841de30d3c5ba5bed2550e4106f2673
Author: Roman Pogribnyi
Date: Sun Sep 21 14:43:44 2014 +0200
Branches: soc-2014-fluid
https://developer.blender.org/rB065676a6f841de30d3c5ba5bed2550e4106f2673
updated mantaflow version
===================================================================
M source/blender/python/manta_pp/CMakeLists.txt
M source/blender/python/manta_pp/conjugategrad.cpp
M source/blender/python/manta_pp/conjugategrad.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/fluidsolver.h.reg
M source/blender/python/manta_pp/fluidsolver.h.reg.cpp
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/gui/customctrl.cpp
M source/blender/python/manta_pp/gui/customctrl.h
M source/blender/python/manta_pp/gui/customctrl.h.reg
M source/blender/python/manta_pp/gui/customctrl.h.reg.cpp
M source/blender/python/manta_pp/gui/glwidget.cpp
M source/blender/python/manta_pp/gui/glwidget.h
M source/blender/python/manta_pp/gui/mainwindow.cpp
M source/blender/python/manta_pp/gui/mainwindow.h
M source/blender/python/manta_pp/gui/moc_customctrl.cxx_parameters
M source/blender/python/manta_pp/gui/moc_glwidget.cxx_parameters
M source/blender/python/manta_pp/gui/moc_mainwindow.cxx
M source/blender/python/manta_pp/gui/moc_mainwindow.cxx_parameters
M source/blender/python/manta_pp/gui/moc_meshpainter.cxx_parameters
M source/blender/python/manta_pp/gui/moc_painter.cxx_parameters
M source/blender/python/manta_pp/gui/moc_particlepainter.cxx_parameters
M source/blender/python/manta_pp/gui/moc_qtmain.cxx_parameters
M source/blender/python/manta_pp/gui/painter.cpp
M source/blender/python/manta_pp/gui/painter.h
M source/blender/python/manta_pp/gui/particlepainter.cpp
M source/blender/python/manta_pp/gui/qtmain.cpp
M source/blender/python/manta_pp/hginfo.h
M source/blender/python/manta_pp/kernel.h
M source/blender/python/manta_pp/levelset.cpp
M source/blender/python/manta_pp/mesh.cpp
M source/blender/python/manta_pp/mesh.h
M source/blender/python/manta_pp/particle.cpp
M source/blender/python/manta_pp/particle.h
M source/blender/python/manta_pp/particle.h.reg
M source/blender/python/manta_pp/particle.h.reg.cpp
M source/blender/python/manta_pp/plugin/advection.cpp
M source/blender/python/manta_pp/plugin/extforces.cpp
A source/blender/python/manta_pp/plugin/flip.cpp
M source/blender/python/manta_pp/plugin/initplugins.cpp
M source/blender/python/manta_pp/plugin/pressure.cpp
A source/blender/python/manta_pp/plugin/waves.cpp
M source/blender/python/manta_pp/pwrapper/manta.h
M source/blender/python/manta_pp/pwrapper/pclass.cpp
M source/blender/python/manta_pp/pwrapper/pconvert.cpp
M source/blender/python/manta_pp/pwrapper/registry.cpp
A source/blender/python/manta_pp/timing.cpp
A source/blender/python/manta_pp/timing.h
A source/blender/python/manta_pp/timing.h.reg
A source/blender/python/manta_pp/timing.h.reg.cpp
===================================================================
diff --git a/source/blender/python/manta_pp/CMakeLists.txt b/source/blender/python/manta_pp/CMakeLists.txt
index 61d52ed..f86fc94 100644
--- a/source/blender/python/manta_pp/CMakeLists.txt
+++ b/source/blender/python/manta_pp/CMakeLists.txt
@@ -35,10 +35,6 @@ ${CMAKE_CURRENT_SOURCE_DIR}/fileio.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fileio.h
${CMAKE_CURRENT_SOURCE_DIR}/fileio.h.reg
${CMAKE_CURRENT_SOURCE_DIR}/fileio.h.reg.cpp
-${CMAKE_CURRENT_SOURCE_DIR}/flip.cpp
-${CMAKE_CURRENT_SOURCE_DIR}/flip.h
-${CMAKE_CURRENT_SOURCE_DIR}/flip.h.reg
-${CMAKE_CURRENT_SOURCE_DIR}/flip.h.reg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fluidsolver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fluidsolver.h
${CMAKE_CURRENT_SOURCE_DIR}/fluidsolver.h.reg
@@ -78,12 +74,14 @@ ${CMAKE_CURRENT_SOURCE_DIR}/particle.h.reg
${CMAKE_CURRENT_SOURCE_DIR}/particle.h.reg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/plugin/advection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/plugin/extforces.cpp
+${CMAKE_CURRENT_SOURCE_DIR}/plugin/flip.cpp
${CMAKE_CURRENT_SOURCE_DIR}/plugin/initplugins.cpp
${CMAKE_CURRENT_SOURCE_DIR}/plugin/kepsilon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/plugin/meshplugins.cpp
${CMAKE_CURRENT_SOURCE_DIR}/plugin/pressure.cpp
${CMAKE_CURRENT_SOURCE_DIR}/plugin/vortexplugins.cpp
${CMAKE_CURRENT_SOURCE_DIR}/plugin/waveletturbulence.cpp
+${CMAKE_CURRENT_SOURCE_DIR}/plugin/waves.cpp
${CMAKE_CURRENT_SOURCE_DIR}/python/defines.py
${CMAKE_CURRENT_SOURCE_DIR}/python/defines.py.reg
${CMAKE_CURRENT_SOURCE_DIR}/python/defines.py.reg.cpp
@@ -92,6 +90,10 @@ ${CMAKE_CURRENT_SOURCE_DIR}/shapes.h
${CMAKE_CURRENT_SOURCE_DIR}/shapes.h.reg
${CMAKE_CURRENT_SOURCE_DIR}/shapes.h.reg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test.cpp
+${CMAKE_CURRENT_SOURCE_DIR}/timing.cpp
+${CMAKE_CURRENT_SOURCE_DIR}/timing.h
+${CMAKE_CURRENT_SOURCE_DIR}/timing.h.reg
+${CMAKE_CURRENT_SOURCE_DIR}/timing.h.reg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/turbulencepart.cpp
${CMAKE_CURRENT_SOURCE_DIR}/turbulencepart.h
${CMAKE_CURRENT_SOURCE_DIR}/turbulencepart.h.reg
@@ -104,56 +106,31 @@ ${CMAKE_CURRENT_SOURCE_DIR}/vortexsheet.cpp
${CMAKE_CURRENT_SOURCE_DIR}/vortexsheet.h
${CMAKE_CURRENT_SOURCE_DIR}/vortexsheet.h.reg
${CMAKE_CURRENT_SOURCE_DIR}/vortexsheet.h.reg.cpp
-#NOPP SOURCES
+
${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/pymain.cpp
+${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/pclass.h
${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/pclass.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/pvec3.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/pconvert.cpp
+${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/pconvert.h
+${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/registry.h
${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/registry.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/pythonInclude.h
-${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/pclass.h
-${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/registry.h
-${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/pconvert.h
${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/manta_api.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/manta.h
${CMAKE_CURRENT_SOURCE_DIR}/pwrapper/manta_api.h
${CMAKE_CURRENT_SOURCE_DIR}/util/vectorbase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/util/integrator.h
${CMAKE_CURRENT_SOURCE_DIR}/util/vectorbase.h
+${CMAKE_CURRENT_SOURCE_DIR}/util/vectorbase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/util/quaternion.h
${CMAKE_CURRENT_SOURCE_DIR}/util/interpol.h
+${CMAKE_CURRENT_SOURCE_DIR}/util/interpolHigh.h
${CMAKE_CURRENT_SOURCE_DIR}/util/mcubes.h
${CMAKE_CURRENT_SOURCE_DIR}/util/randomstream.h
${CMAKE_CURRENT_SOURCE_DIR}/util/solvana.h
-
-#gui/customctrl.cpp
-#gui/customctrl.h
-#gui/customctrl.h.reg
-#gui/customctrl.h.reg.cpp
-#gui/glwidget.cpp
-#gui/glwidget.h
-#gui/glwidget.h.reg
-#gui/glwidget.h.reg.cpp
-#gui/mainwindow.cpp
-#gui/mainwindow.h
-#gui/mainwindow.h.reg
-#gui/mainwindow.h.reg.cpp
-#gui/meshpainter.cpp
-#gui/meshpainter.h
-#gui/meshpainter.h.reg
-#gui/meshpainter.h.reg.cpp
-#gui/painter.cpp
-#gui/painter.h
-#gui/painter.h.reg
-#gui/painter.h.reg.cpp
-#gui/particlepainter.cpp
-#gui/particlepainter.h
-#gui/particlepainter.h.reg
-#gui/particlepainter.h.reg.cpp
-#gui/qtmain.cpp
-#gui/qtmain.h
-#gui/qtmain.h.reg
-#gui/qtmain.h.reg.cpp
)
+list(REMOVE_DUPLICATES "SRC")
+list_assert_duplicates("${SRC}")
blender_add_lib(bf_python_manta "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/python/manta_pp/conjugategrad.cpp b/source/blender/python/manta_pp/conjugategrad.cpp
index dabc0e6..95caa18 100644
--- a/source/blender/python/manta_pp/conjugategrad.cpp
+++ b/source/blender/python/manta_pp/conjugategrad.cpp
@@ -39,10 +39,10 @@ void InitPreconditionIncompCholesky(FlagGrid& flags,
Grid<Real>& orgA0, Grid<Real>& orgAi, Grid<Real>& orgAj, Grid<Real>& orgAk)
{
// compute IC according to Golub and Van Loan
- A0 = orgA0;
- Ai = orgAi;
- Aj = orgAj;
- Ak = orgAk;
+ A0.copyFrom( orgA0 );
+ Ai.copyFrom( orgAi );
+ Aj.copyFrom( orgAj );
+ Ak.copyFrom( orgAk );
FOR_IJK(A0) {
if (flags.isFluid(i,j,k)) {
@@ -209,7 +209,7 @@ template<class APPLYMAT>
void GridCg<APPLYMAT>::doInit() {
mInited = true;
- mResidual = mRhs; // p=0, residual = b
+ mResidual.copyFrom( mRhs ); // p=0, residual = b
if (mPcMethod == PC_ICP) {
assertMsg(mDst.is3D(), "ICP only supports 3D grids so far");
@@ -220,10 +220,10 @@ void GridCg<APPLYMAT>::doInit() {
InitPreconditionModifiedIncompCholesky2(mFlags, *mpPCA0, *mpA0, *mpAi, *mpAj, *mpAk);
ApplyPreconditionModifiedIncompCholesky2(mTmp, mResidual, mFlags, *mpPCA0, *mpA0, *mpAi, *mpAj, *mpAk);
} else {
- mTmp = mResidual;
+ mTmp.copyFrom( mResidual );
}
- mSearch = mTmp;
+ mSearch.copyFrom( mTmp );
mSigma = GridDotProduct(mTmp, mResidual);
}
@@ -253,7 +253,7 @@ bool GridCg<APPLYMAT>::iterate() {
else if (mPcMethod == PC_mICP)
ApplyPreconditionModifiedIncompCholesky2(mTmp, mResidual, mFlags, *mpPCA0, *mpA0, *mpAi, *mpAj, *mpAk);
else
- mTmp = mResidual;
+ mTmp.copyFrom( mResidual );
// compute norm of the residual?
if(this->mUseResNorm) {
diff --git a/source/blender/python/manta_pp/conjugategrad.h b/source/blender/python/manta_pp/conjugategrad.h
index 21f08b1..ccf5983 100644
--- a/source/blender/python/manta_pp/conjugategrad.h
+++ b/source/blender/python/manta_pp/conjugategrad.h
@@ -179,4 +179,3 @@ class GridCg : public GridCgInterface {
#endif
-
diff --git a/source/blender/python/manta_pp/fastmarch.cpp b/source/blender/python/manta_pp/fastmarch.cpp
index 260d81e..66612ed 100644
--- a/source/blender/python/manta_pp/fastmarch.cpp
+++ b/source/blender/python/manta_pp/fastmarch.cpp
@@ -231,7 +231,8 @@ void FastMarch<COMP,TDIR>::performMarching() {
}
// set boundary for plain array
- SetLevelsetBoundaries setls(mLevelset);
+ SetLevelsetBoundaries setls(mLevelset);
+ setls.getArg0(); // get rid of compiler warning...
}
// explicit instantiation
diff --git a/source/blender/python/manta_pp/fastmarch.h b/source/blender/python/manta_pp/fastmarch.h
index 1d8425f..9e8cf22 100644
--- a/source/blender/python/manta_pp/fastmarch.h
+++ b/source/blender/python/manta_pp/fastmarch.h
@@ -84,25 +84,13 @@ public:
//! cell is touched by marching from source cell
inline void transpTouch(int x,int y,int z, Real *weights, Real time) {
if(!mpVal || !mpFlags->isEmpty(x,y,z)) return;
- //if(!mpVal) return;
- T val = fmInterpolateNeighbors<GRID,T>(mpVal,x,y,z,weights); /*T(0.);
- if(weights[0]>0.0) val += mpVal->get(x+1, y+0, z+0) * weights[0];
- if(weights[1]>0.0) val += mpVal->get(x-1, y+0, z+0) * weights[1];
- if(weights[2]>0.0) val += mpVal->get(x+0, y+1, z+0) * weights[2];
- if(weights[3]>0.0) val += mpVal->get(x+0, y-1, z+0) * weights[3];
- if(mpVal->is3D()) {
- if(weights[4]>0.0) val += mpVal->get(x+0, y+0, z+1) * weights[4];
- if(weights[5]>0.0) val += mpVal->get(x+0, y+0, z-1) * weights[5];
- }*/
+ T val = fmInterpolateNeighbors<GRID,T>(mpVal,x,y,z,weights);
// set velocity components if adjacent is empty
if (mpFlags->isEmpty(x-1,y,z)) (*mpVal)(x,y,z).x = val.x;
if (mpFlags->isEmpty(x,y-1,z)) (*mpVal)(x,y,z).y = val.y;
if(mpVal->is3D()) { if (mpFlags->isEmpty(x,y,z-1)) (*mpVal)(x,y,z).z = val.z; }
- //(*mpVal)(x,y,z).x = val.x;
- //(*mpVal)(x,y,z).y = val.y;
- //if(mpVal->is3D()) { (*mpVal)(x,y,z).z = val.z; }
};
protected:
diff --git a/source/blender/python/manta_pp/fileio.cpp b/source/blender/python/manta_pp/fileio.cpp
index 8534c03..fbc9d7a 100644
--- a/source/blender/python/manta_pp/fileio.cpp
+++ b/source/blender/python/manta_pp/fileio.cpp
@@ -46,10 +46,68 @@ namespace Manta {
// mesh data
//*****************************************************************************
-void writeBobjFile(const string& name, Mesh* mesh) {
- cout << "writing mesh file " << name << endl;
+void readBobjFile(const string& name, Mesh* mesh, bool append) {
+ debMsg( "reading mesh file " << name ,1);
+ if (!append)
+ mesh->clear();
+ else
+ errMsg("readBobj: append not yet implemented!");
+
# if NO_ZLIB!=1
const Real dx = mesh->getParent()->getDx();
+ const Vec3 gs = toVec3( mesh->getParent()->getGridSize() );
+
+ gzFile gzf = gzopen(name.c_str(), "rb1"); // do some compression
+ if (!gzf)
+ errMsg("readBobj: unable to open file");
+
+ // read vertices
+ int num = 0;
+ gzread(gzf, &num, sizeof(int));
+ mesh->resizeNodes(num);
+ debMsg( "read mesh , verts "<<num,1);
+ for (int i=0; i<num; i++) {
+ Vector3D<float> pos;
+ gzread(gzf, &pos.value[0], sizeof(float)*3);
+ mesh->nodes(i).pos = toVec3(pos);
+
+ // convert to grid space
+ mesh->nodes(i).pos /= dx;
+ mesh->nodes(i).pos += gs*0.5;
+ }
+
+ // normals
+ num = 0;
+ gzread(gzf, &num, sizeof(int));
+ for (int i=0; i<num; i++) {
+ Vector3D<float> pos;
+ gzread(gzf, &pos.value[0], sizeof(float)*3);
+ mesh->nodes(i).normal = toVec3(pos);
+ }
+
+ // read tris
+ num = 0;
+ gzread(gzf, &num, sizeof(int));
+ mesh->resizeTris( num );
+ for(int t=0; t<num; t++) {
+ for(int j=0; j<3; j++) {
+ int trip = 0;
+ gzread(gzf, &trip, sizeof(int));
+ mesh->tris(t).c[j] = trip;
+ }
+ }
+ // note - vortex sheet info ignored for now... (see writeBobj)
+ gzclose( gzf );
+ debMsg( "read mesh , triangles "<<mesh->numTris()<<", vertices "<<mesh->numNodes()<<" ",1 );
+# else
+ debMsg( "file format not supported without zlib" ,1);
+# endif
+}
+
+void writeBobjFile(const string& name, Mesh* mesh) {
+ debMsg( "writing mesh file " << name ,1);
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list