[Bf-blender-cvs] [888d1801640] master: Fluid: Updated manta pp files

Sebastián Barschkis noreply at git.blender.org
Wed Feb 19 18:59:03 CET 2020


Commit: 888d180164004d121511609da044ea86c3aa9cb0
Author: Sebastián Barschkis
Date:   Wed Feb 19 18:58:09 2020 +0100
Branches: master
https://developer.blender.org/rB888d180164004d121511609da044ea86c3aa9cb0

Fluid: Updated manta pp files

Updates in the files include:
- New manta files now use an platform independent gzopen function
- Adjusted argument name for vorticity

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

M	extern/mantaflow/CMakeLists.txt
M	extern/mantaflow/preprocessed/fileio/iogrids.cpp
M	extern/mantaflow/preprocessed/fileio/iomeshes.cpp
M	extern/mantaflow/preprocessed/fileio/ioparticles.cpp
A	extern/mantaflow/preprocessed/fileio/ioutil.cpp
M	extern/mantaflow/preprocessed/fileio/mantaio.h
M	extern/mantaflow/preprocessed/gitinfo.h
M	extern/mantaflow/preprocessed/particle.cpp
M	extern/mantaflow/preprocessed/plugin/extforces.cpp
M	extern/mantaflow/preprocessed/plugin/flip.cpp
M	intern/mantaflow/intern/strings/smoke_script.h

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

diff --git a/extern/mantaflow/CMakeLists.txt b/extern/mantaflow/CMakeLists.txt
index 99d985578bd..7486f123666 100644
--- a/extern/mantaflow/CMakeLists.txt
+++ b/extern/mantaflow/CMakeLists.txt
@@ -117,6 +117,7 @@ set(SRC
   ${MANTA_PP}/fastmarch.cpp
   ${MANTA_PP}/fastmarch.h
   ${MANTA_PP}/fastmarch.h.reg.cpp
+  ${MANTA_PP}/fileio/ioutil.cpp
   ${MANTA_PP}/fileio/iogrids.cpp
   ${MANTA_PP}/fileio/iomeshes.cpp
   ${MANTA_PP}/fileio/ioparticles.cpp
diff --git a/extern/mantaflow/preprocessed/fileio/iogrids.cpp b/extern/mantaflow/preprocessed/fileio/iogrids.cpp
index 2b8ee905f99..acd1bda5174 100644
--- a/extern/mantaflow/preprocessed/fileio/iogrids.cpp
+++ b/extern/mantaflow/preprocessed/fileio/iogrids.cpp
@@ -298,7 +298,7 @@ template<class T> void writeGridRaw(const string &name, Grid<T> *grid)
   debMsg("writing grid " << grid->getName() << " to raw file " << name, 1);
 
 #if NO_ZLIB != 1
-  gzFile gzf = gzopen(name.c_str(), "wb1");  // do some compression
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");  // do some compression
   if (!gzf)
     errMsg("writeGridRaw: can't open file " << name);
   gzwrite(gzf, &((*grid)[0]), sizeof(T) * grid->getSizeX() * grid->getSizeY() * grid->getSizeZ());
@@ -313,7 +313,7 @@ template<class T> void readGridRaw(const string &name, Grid<T> *grid)
   debMsg("reading grid " << grid->getName() << " from raw file " << name, 1);
 
 #if NO_ZLIB != 1
-  gzFile gzf = gzopen(name.c_str(), "rb");
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
   if (!gzf)
     errMsg("readGridRaw: can't open file " << name);
 
@@ -350,7 +350,7 @@ void getUniFileSize(const string &name, int &x, int &y, int &z, int *t, std::str
 {
   x = y = z = 0;
 #if NO_ZLIB != 1
-  gzFile gzf = gzopen(name.c_str(), "rb");
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
   if (gzf) {
     char ID[5] = {0, 0, 0, 0, 0};
     gzread(gzf, ID, 4);
@@ -499,7 +499,7 @@ template<class T> void writeGridUni(const string &name, Grid<T> *grid)
   else
     errMsg("writeGridUni: unknown element type");
 
-  gzFile gzf = gzopen(name.c_str(), "wb1");  // do some compression
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");  // do some compression
   if (!gzf)
     errMsg("writeGridUni: can't open file " << name);
 
@@ -527,7 +527,7 @@ template<class T> void readGridUni(const string &name, Grid<T> *grid)
   debMsg("Reading grid " << grid->getName() << " from uni file " << name, 1);
 
 #if NO_ZLIB != 1
-  gzFile gzf = gzopen(name.c_str(), "rb");
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
   if (!gzf)
     errMsg("readGridUni: can't open file " << name);
 
@@ -736,7 +736,7 @@ template<class T> void writeGrid4dUni(const string &name, Grid4d<T> *grid)
   else
     errMsg("writeGrid4dUni: unknown element type");
 
-  gzFile gzf = gzopen(name.c_str(), "wb1");  // do some compression
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");  // do some compression
   if (!gzf)
     errMsg("writeGrid4dUni: can't open file " << name);
 
@@ -778,7 +778,7 @@ void readGrid4dUni(
 
   // optionally - reuse file handle, if valid one is passed in fileHandle pointer...
   if ((!fileHandle) || (fileHandle && (*fileHandle == NULL))) {
-    gzf = gzopen(name.c_str(), "rb");
+    gzf = (gzFile)safeGzopen(name.c_str(), "rb");
     if (!gzf)
       errMsg("readGrid4dUni: can't open file " << name);
 
@@ -905,7 +905,7 @@ template<class T> void writeGrid4dRaw(const string &name, Grid4d<T> *grid)
   debMsg("writing grid4d " << grid->getName() << " to raw file " << name, 1);
 
 #if NO_ZLIB != 1
-  gzFile gzf = gzopen(name.c_str(), "wb1");  // do some compression
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");  // do some compression
   if (!gzf)
     errMsg("writeGrid4dRaw: can't open file " << name);
   gzwrite(gzf,
@@ -922,7 +922,7 @@ template<class T> void readGrid4dRaw(const string &name, Grid4d<T> *grid)
   debMsg("reading grid4d " << grid->getName() << " from raw file " << name, 1);
 
 #if NO_ZLIB != 1
-  gzFile gzf = gzopen(name.c_str(), "rb");
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
   if (!gzf)
     errMsg("readGrid4dRaw: can't open file " << name);
 
diff --git a/extern/mantaflow/preprocessed/fileio/iomeshes.cpp b/extern/mantaflow/preprocessed/fileio/iomeshes.cpp
index 79a9e76da3f..906b849fffb 100644
--- a/extern/mantaflow/preprocessed/fileio/iomeshes.cpp
+++ b/extern/mantaflow/preprocessed/fileio/iomeshes.cpp
@@ -158,7 +158,7 @@ void readBobjFile(const string &name, Mesh *mesh, bool append)
   const Real dx = mesh->getParent()->getDx();
   const Vec3 gs = toVec3(mesh->getParent()->getGridSize());
 
-  gzFile gzf = gzopen(name.c_str(), "rb1");  // do some compression
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb1");  // do some compression
   if (!gzf)
     errMsg("readBobj: unable to open file");
 
@@ -213,7 +213,7 @@ void writeBobjFile(const string &name, Mesh *mesh)
   const Real dx = mesh->getParent()->getDx();
   const Vec3i gs = mesh->getParent()->getGridSize();
 
-  gzFile gzf = gzopen(name.c_str(), "wb1");  // do some compression
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");  // do some compression
   if (!gzf)
     errMsg("writeBobj: unable to open file");
 
@@ -412,7 +412,7 @@ template<class T> void readMdataUni(const std::string &name, MeshDataImpl<T> *md
   debMsg("reading mesh data " << mdata->getName() << " from uni file " << name, 1);
 
 #if NO_ZLIB != 1
-  gzFile gzf = gzopen(name.c_str(), "rb");
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
   if (!gzf)
     errMsg("can't open file " << name);
 
@@ -460,7 +460,7 @@ template<class T> void writeMdataUni(const std::string &name, MeshDataImpl<T> *m
   MuTime stamp;
   head.timestamp = stamp.time;
 
-  gzFile gzf = gzopen(name.c_str(), "wb1");  // do some compression
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");  // do some compression
   if (!gzf)
     errMsg("can't open file " << name);
   gzwrite(gzf, ID, 4);
diff --git a/extern/mantaflow/preprocessed/fileio/ioparticles.cpp b/extern/mantaflow/preprocessed/fileio/ioparticles.cpp
index a6cc7583327..2eab485beb3 100644
--- a/extern/mantaflow/preprocessed/fileio/ioparticles.cpp
+++ b/extern/mantaflow/preprocessed/fileio/ioparticles.cpp
@@ -176,7 +176,7 @@ void writeParticlesUni(const std::string &name, const BasicParticleSystem *parts
   MuTime stamp;
   head.timestamp = stamp.time;
 
-  gzFile gzf = gzopen(name.c_str(), "wb1");  // do some compression
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");  // do some compression
   if (!gzf)
     errMsg("can't open file " << name);
 
@@ -206,7 +206,7 @@ void readParticlesUni(const std::string &name, BasicParticleSystem *parts)
   debMsg("reading particles " << parts->getName() << " from uni file " << name, 1);
 
 #if NO_ZLIB != 1
-  gzFile gzf = gzopen(name.c_str(), "rb");
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
   if (!gzf)
     errMsg("can't open file " << name);
 
@@ -273,7 +273,7 @@ template<class T> void writePdataUni(const std::string &name, ParticleDataImpl<T
   MuTime stamp;
   head.timestamp = stamp.time;
 
-  gzFile gzf = gzopen(name.c_str(), "wb1");  // do some compression
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");  // do some compression
   if (!gzf)
     errMsg("can't open file " << name);
   gzwrite(gzf, ID, 4);
@@ -299,7 +299,7 @@ template<class T> void readPdataUni(const std::string &name, ParticleDataImpl<T>
   debMsg("reading particle data " << pdata->getName() << " from uni file " << name, 1);
 
 #if NO_ZLIB != 1
-  gzFile gzf = gzopen(name.c_str(), "rb");
+  gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
   if (!gzf)
     errMsg("can't open file " << name);
 
diff --git a/extern/mantaflow/preprocessed/fileio/ioutil.cpp b/extern/mantaflow/preprocessed/fileio/ioutil.cpp
new file mode 100644
index 00000000000..7c1682dfc5e
--- /dev/null
+++ b/extern/mantaflow/preprocessed/fileio/ioutil.cpp
@@ -0,0 +1,45 @@
+
+
+// DO NOT EDIT !
+// This file is generated using the MantaFlow preprocessor (prep generate).
+
+/******************************************************************************
+ *
+ * MantaFlow fluid solver framework
+ * Copyright 2011-2020 Tobias Pfaff, Nils Thuerey
+ *
+ * This program is free software, distributed under the terms of the
+ * Apache License, Version 2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Helper functions to handle file IO
+ *
+ ******************************************************************************/
+
+#include "mantaio.h"
+
+#if NO_ZLIB != 1
+extern "C" {
+#  include <zlib.h>
+}
+
+namespace Manta {
+
+//! helper to handle non ascii filenames correctly, mainly problematic on windows
+void *safeGzopen(const char *filename, const char *mode)
+{
+  gzFile gzfile;
+#  if defined(WIN32) || defined(_WIN32)
+  UTF16_ENCODE(filename);
+
+  // gzopen_w() is supported since zlib v1.2.7
+  gzfile = gzopen_w(filename_16, mode);
+  UTF16_UN_ENCODE(filename);
+#  else
+  gzfile = gzopen(filename, mode);
+#  endif
+  return gzfile;
+}
+#endif
+
+}  // namespace
diff --git a/extern/mantaflow/preprocessed/fileio/mantaio.h b/extern/mantaflow/preprocessed/fileio/mantaio.h
index 8bb0a5af6a4..fbfe4bdd5d4 100644
--- a/extern/mantaflow/preprocessed/fileio/mantaio.h
+++ b/extern/mantaflow/preprocessed/fileio/mantaio.h
@@ -76,6 +76,8 @@ template<class T> void readMdataUni(const std::string &name, MeshDataImpl<T> *md
 void getUniFileSize(
     const std::string &name, int &x, int &y, int &z, int *t = NULL, std::string *info = NULL);
 
+void *safeGzopen(const char *filename, const char *mode);
+
 }  // namespace Manta
 
 #endif
diff --git a/extern/mantaflow/preprocessed/gitinfo.h b/extern/mantaflow/preprocessed/gitinfo.h
index 943840958f6..0e84563eae3 100644
--- a/extern/mantaflow/preprocessed/gitinfo.h
+++ b/extern/mantaflow/preprocessed/gitinfo.h
@@ -1,3 +1,3 @@
 
 
-#define MANTA_GIT_VERSION "commit abfff159b5ea8cee93d858f4b8be2a308b58b51d"
+#define MANTA_GIT_VERSION "commit 7b9e0d841274c65dce911ec578bd0b4779971422"
diff --git a/extern/mantaflow/preprocessed/particle.cpp b/extern/mantaflow/preprocessed/particle.cpp
index 478f1417109..41af5d3ba81 100644
--- a/extern/mantaflow/preprocessed/particle.cpp
+++ b/extern/mantaflow/preprocessed

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list