[Bf-blender-cvs] [4f338388d9b] fluid-mantaflow: Applied clang-format to manta preprocessed source files

Sebastián Barschkis noreply at git.blender.org
Sun Oct 6 22:13:57 CEST 2019


Commit: 4f338388d9b72ad115017f656ac667a52be5761f
Author: Sebastián Barschkis
Date:   Sun Oct 6 22:12:14 2019 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB4f338388d9b72ad115017f656ac667a52be5761f

Applied clang-format to manta preprocessed source files

Just for better readability, files remain read-only, i.e. editing in manta repo only

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

M	intern/mantaflow/intern/manta_develop/dependencies/cnpy/cnpy.cpp
M	intern/mantaflow/intern/manta_develop/dependencies/cnpy/cnpy.h
M	intern/mantaflow/intern/manta_develop/dependencies/cnpy/example1.cpp
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/manta.h
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/numpyWrap.cpp
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/numpyWrap.h
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/pclass.cpp
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/pclass.h
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/pconvert.cpp
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/pconvert.h
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/pvec3.cpp
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/pymain.cpp
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/pythonInclude.h
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/registry.cpp
M	intern/mantaflow/intern/manta_develop/helper/pwrapper/registry.h
M	intern/mantaflow/intern/manta_develop/helper/util/integrator.h
M	intern/mantaflow/intern/manta_develop/helper/util/interpol.h
M	intern/mantaflow/intern/manta_develop/helper/util/interpolHigh.h
M	intern/mantaflow/intern/manta_develop/helper/util/matrixbase.h
M	intern/mantaflow/intern/manta_develop/helper/util/mcubes.h
M	intern/mantaflow/intern/manta_develop/helper/util/quaternion.h
M	intern/mantaflow/intern/manta_develop/helper/util/randomstream.h
M	intern/mantaflow/intern/manta_develop/helper/util/rcmatrix.h
M	intern/mantaflow/intern/manta_develop/helper/util/simpleimage.cpp
M	intern/mantaflow/intern/manta_develop/helper/util/simpleimage.h
M	intern/mantaflow/intern/manta_develop/helper/util/solvana.h
M	intern/mantaflow/intern/manta_develop/helper/util/vector4d.cpp
M	intern/mantaflow/intern/manta_develop/helper/util/vector4d.h
M	intern/mantaflow/intern/manta_develop/helper/util/vectorbase.cpp
M	intern/mantaflow/intern/manta_develop/helper/util/vectorbase.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/commonkernels.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/commonkernels.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/conjugategrad.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/conjugategrad.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/conjugategrad.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/edgecollapse.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/edgecollapse.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/edgecollapse.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fastmarch.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fastmarch.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fastmarch.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fileio/iogrids.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fileio/iomeshes.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fileio/ioparticles.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fileio/mantaio.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fileio/mantaio.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fluidsolver.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fluidsolver.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fluidsolver.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/fluidsolver.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/general.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/general.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/general.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/gitinfo.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/grid.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/grid.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/grid.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/grid.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/grid4d.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/grid4d.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/grid4d.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/grid4d.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/kernel.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/kernel.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/kernel.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/levelset.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/levelset.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/levelset.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/levelset.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/mesh.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/mesh.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/mesh.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/mesh.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/movingobs.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/movingobs.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/movingobs.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/movingobs.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/multigrid.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/multigrid.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/multigrid.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/noisefield.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/noisefield.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/noisefield.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/noisefield.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/particle.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/particle.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/particle.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/particle.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/advection.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/apic.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/extforces.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/fire.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/flip.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/fluidguiding.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/initplugins.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/kepsilon.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/meshplugins.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/pressure.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/ptsplugins.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/secondaryparticles.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/surfaceturbulence.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/vortexplugins.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/waveletturbulence.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/plugin/waves.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/python/defines.py.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/python/defines.py.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/registration.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/shapes.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/shapes.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/shapes.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/shapes.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/test.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/timing.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/timing.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/timing.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/timing.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/turbulencepart.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/turbulencepart.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/turbulencepart.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/turbulencepart.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/vortexpart.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/vortexpart.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/vortexpart.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/vortexpart.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/vortexsheet.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/vortexsheet.h
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/vortexsheet.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/omp/vortexsheet.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/commonkernels.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/commonkernels.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/conjugategrad.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/conjugategrad.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/conjugategrad.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/edgecollapse.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/edgecollapse.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/edgecollapse.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fastmarch.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fastmarch.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fastmarch.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fileio/iogrids.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fileio/iomeshes.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fileio/ioparticles.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fileio/mantaio.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fileio/mantaio.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fluidsolver.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fluidsolver.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fluidsolver.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/fluidsolver.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/general.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/general.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/general.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/gitinfo.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/grid.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/grid.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/grid.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/grid.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/grid4d.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/grid4d.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/grid4d.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/grid4d.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/kernel.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/kernel.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/kernel.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/levelset.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/levelset.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/levelset.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/levelset.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/mesh.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/mesh.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/mesh.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/mesh.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/movingobs.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/movingobs.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/movingobs.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/movingobs.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/multigrid.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/multigrid.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/multigrid.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/noisefield.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/noisefield.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/noisefield.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/noisefield.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/particle.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/particle.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/particle.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/particle.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/advection.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/apic.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/extforces.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/fire.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/flip.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/fluidguiding.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/initplugins.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/kepsilon.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/meshplugins.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/pressure.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/ptsplugins.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/secondaryparticles.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/surfaceturbulence.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/vortexplugins.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/waveletturbulence.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/plugin/waves.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/python/defines.py.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/python/defines.py.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/registration.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/shapes.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/shapes.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/shapes.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/shapes.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/test.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/timing.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/timing.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/timing.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/timing.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/turbulencepart.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/turbulencepart.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/turbulencepart.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/turbulencepart.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/vortexpart.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/vortexpart.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/vortexpart.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/vortexpart.h.reg.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/vortexsheet.cpp
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/vortexsheet.h
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/vortexsheet.h.reg
M	intern/mantaflow/intern/manta_develop/preprocessed/tbb/vortexsheet.h.reg.cpp

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

diff --git a/intern/mantaflow/intern/manta_develop/dependencies/cnpy/cnpy.cpp b/intern/mantaflow/intern/manta_develop/dependencies/cnpy/cnpy.cpp
index 930ebe537cb..7f0ce21ece8 100644
--- a/intern/mantaflow/intern/manta_develop/dependencies/cnpy/cnpy.cpp
+++ b/intern/mantaflow/intern/manta_develop/dependencies/cnpy/cnpy.cpp
@@ -1,341 +1,385 @@
-//Copyright (C) 2011  Carl Rogers
-//Released under MIT License
-//license available in LICENSE file, or at http://www.opensource.org/licenses/mit-license.php
-
-#include"cnpy.h"
-#include<complex>
-#include<cstdlib>
-#include<algorithm>
-#include<cstring>
-#include<iomanip>
-#include<stdint.h>
-#include<stdexcept>
+// Copyright (C) 2011  Carl Rogers
+// Released under MIT License
+// license available in LICENSE file, or at http://www.opensource.org/licenses/mit-license.php
+
+#include "cnpy.h"
+#include <complex>
+#include <cstdlib>
+#include <algorithm>
+#include <cstring>
+#include <iomanip>
+#include <stdint.h>
+#include <stdexcept>
 #include <regex>
 
-char cnpy::BigEndianTest() {
-    int x = 1;
-    return (((char *)&x)[0]) ? '<' : '>';
+char cnpy::BigEndianTest()
+{
+  int x = 1;
+  return (((char *)&x)[0]) ? '<' : '>';
 }
 
-char cnpy::map_type(const std::type_info& t)
+char cnpy::map_type(const std::type_info &t)
 {
-    if(t == typeid(float) ) return 'f';
-    if(t == typeid(double) ) return 'f';
-    if(t == typeid(long double) ) return 'f';
-
-    if(t == typeid(int) ) return 'i';
-    if(t == typeid(char) ) return 'i';
-    if(t == typeid(short) ) return 'i';
-    if(t == typeid(long) ) return 'i';
-    if(t == typeid(long long) ) return 'i';
-
-    if(t == typeid(unsigned char) ) return 'u';
-    if(t == typeid(unsigned short) ) return 'u';
-    if(t == typeid(unsigned long) ) return 'u';
-    if(t == typeid(unsigned long long) ) return 'u';
-    if(t == typeid(unsigned int) ) return 'u';
-
-    if(t == typeid(bool) ) return 'b';
-
-    if(t == typeid(std::complex<float>) ) return 'c';
-    if(t == typeid(std::complex<double>) ) return 'c';
-    if(t == typeid(std::complex<long double>) ) return 'c';
-
-    else return '?';
+  if (t == typeid(float))
+    return 'f';
+  if (t == typeid(double))
+    return 'f';
+  if (t == typeid(long double))
+    return 'f';
+
+  if (t == typeid(int))
+    return 'i';
+  if (t == typeid(char))
+    return 'i';
+  if (t == typeid(short))
+    return 'i';
+  if (t == typeid(long))
+    return 'i';
+  if (t == typeid(long long))
+    return 'i';
+
+  if (t == typeid(unsigned char))
+    return 'u';
+  if (t == typeid(unsigned short))
+    return 'u';
+  if (t == typeid(unsigned long))
+    return 'u';
+  if (t == typeid(unsigned long long))
+    return 'u';
+  if (t == typeid(unsigned int))
+    return 'u';
+
+  if (t == typeid(bool))
+    return 'b';
+
+  if (t == typeid(std::complex<float>))
+    return 'c';
+  if (t == typeid(std::complex<double>))
+    return 'c';
+  if (t == typeid(std::complex<long double>))
+    return 'c';
+
+  else
+    return '?';
 }
 
-template<> std::vector<char>& cnpy::operator+=(std::vector<char>& lhs, const std::string rhs) {
-    lhs.insert(lhs.end(),rhs.begin(),rhs.end());
-    return lhs;
+template<> std::vector<char> &cnpy::operator+=(std::vector<char> &lhs, const std::string rhs)
+{
+  lhs.insert(lhs.end(), rhs.begin(), rhs.end());
+  return lhs;
 }
 
-template<> std::vector<char>& cnpy::operator+=(std::vector<char>& lhs, const char* rhs) {
-    //write in little endian
-    size_t len = strlen(rhs);
-    lhs.reserve(len);
-    for(size_t byte = 0; byte < len; byte++) {
-        lhs.push_back(rhs[byte]);
-    }
-    return lhs;
+template<> std::vector<char> &cnpy::operator+=(std::vector<char> &lhs, const char *rhs)
+{
+  // write in little endian
+  size_t len = strlen(rhs);
+  lhs.reserve(len);
+  for (size_t byte = 0; byte < len; byte++) {
+    lhs.push_back(rhs[byte]);
+  }
+  return lhs;
 }
 
-void cnpy::parse_npy_header(unsigned char* buffer,size_t& word_size, std::vector<size_t>& shape, bool& fortran_order) {
-    //std::string magic_string(buffer,6);
-    uint8_t major_version = *reinterpret_cast<uint8_t*>(buffer+6);
-    uint8_t minor_version = *reinterpret_cast<uint8_t*>(buffer+7);
-    uint16_t header_len = *reinterpret_cast<uint16_t*>(buffer+8);
-    std::string header(reinterpret_cast<char*>(buffer+9),header_len);
-
-    size_t loc1, loc2;
-
-    //fortran order
-    loc1 = header.find("fortran_order")+16;
-    fortran_order = (header.substr(loc1,4) == "True" ? true : false);
-
-    //shape
-    loc1 = header.find("(");
-    loc2 = header.find(")");
-
-    std::regex num_regex("[0-9][0-9]*");
-    std::smatch sm;
-    shape.clear();
-
-    std::string str_shape = header.substr(loc1+1,loc2-loc1-1);
-    while(std::regex_search(str_shape, sm, num_regex)) {
-        shape.push_back(std::stoi(sm[0].str()));
-        str_shape = sm.suffix().str();
-    }
-
-    //endian, word size, data type
-    //byte order code | stands for not applicable. 
-    //not sure when this applies except for byte array
-    loc1 = header.find("descr")+9;
-    bool littleEndian = (header[loc1] == '<' || header[loc1] == '|' ? true : false);
-    assert(littleEndian);
-
-    //char type = header[loc1+1];
-    //assert(type == map_type(T));
-
-    std::string str_ws = header.substr(loc1+2);
-    loc2 = str_ws.find("'");
-    word_size = atoi(str_ws.substr(0,loc2).c_str());
+void cnpy::parse_npy_header(unsigned char *buffer,
+                            size_t &word_size,
+                            std::vector<size_t> &shape,
+                            bool &fortran_order)
+{
+  // std::string magic_string(buffer,6);
+  uint8_t major_version = *reinterpret_cast<uint8_t *>(buffer + 6);
+  uint8_t minor_version = *reinterpret_cast<uint8_t *>(buffer + 7);
+  uint16_t header_len = *reinterpret_cast<uint16_t *>(buffer + 8);
+  std::string header(reinterpret_cast<char *>(buffer + 9), header_len);
+
+  size_t loc1, loc2;
+
+  // fortran order
+  loc1 = header.find("fortran_order") + 16;
+  fortran_order = (header.substr(loc1, 4) == "True" ? true : false);
+
+  // shape
+  loc1 = header.find("(");
+  loc2 = header.find(")");
+
+  std::regex num_regex("[0-9][0-9]*");
+  std::smatch sm;
+  shape.clear();
+
+  std::string str_shape = header.substr(loc1 + 1, loc2 - loc1 - 1);
+  while (std::regex_search(str_shape, sm, num_regex)) {
+    shape.push_back(std::stoi(sm[0].str()));
+    str_shape = sm.suffix().str();
+  }
+
+  // endian, word size, data type
+  // byte order code | stands for not applicable.
+  // not sure when this applies except for byte array
+  loc1 = header.find("descr") + 9;
+  bool littleEndian = (header[loc1] == '<' || header[loc1] == '|' ? true : false);
+  assert(littleEndian);
+
+  // char type = header[loc1+1];
+  // assert(type == map_type(T));
+
+  std::string str_ws = header.substr(loc1 + 2);
+  loc2 = str_ws.find("'");
+  word_size = atoi(str_ws.substr(0, loc2).c_str());
 }
 
-void cnpy::parse_npy_header(FILE* fp, size_t& word_size, std::vector<size_t>& shape, bool& fortran_order) {  
-    char buffer[256];
-    size_t res = fread(buffer,sizeof(char),11,fp);       
-    if(res != 11)
-        throw std::runtime_error("parse_npy_header: failed fread");
-    std::string header = fgets(buffer,256,fp);
-    assert(header[header.size()-1] == '\n');
-
-    size_t loc1, loc2;
-
-    //fortran order
-    loc1 = header.find("fortran_order");
-    if (loc1 == std::string::npos)
-        throw std::runtime_error("parse_npy_header: failed to find header keyword: 'fortran_order'");
-    loc1 += 16;
-    fortran_order = (header.substr(loc1,4) == "True" ? true : false);
-
-    //shape
-    loc1 = header.find("(");
-    loc2 = header.find(")");
-    if (loc1 == std::string::npos || loc2 == std::string::npos)
-        throw std::runtime_error("parse_npy_header: failed to find header keyword: '(' or ')'");
-
-    std::regex num_regex("[0-9][0-9]*");
-    std::smatch sm;
-    shape.clear();
-
-    std::string str_shape = header.substr(loc1+1,loc2-loc1-1);
-    while(std::regex_search(str_shape, sm, num_regex)) {
-        shape.push_back(std::stoi(sm[0].str()));
-        str_shape = sm.suffix().str();
-    }
-
-    //endian, word size, data type
-    //byte order code | stands for not applicable. 
-    //not sure when this applies except for byte array
-    loc1 = header.find("descr");
-    if (loc1 == std::string::npos)
-        throw std::runtime_error("parse_npy_header: failed to find header keyword: 'descr'");
-    loc1 += 9;
-    bool littleEndian = (header[loc1] == '<' || header[loc1] == '|' ? true : false);
-    assert(littleEndian);
-
-    //char type = header[loc1+1];
-    //assert(type == map_type(T));
-
-    std::string str_ws = header.substr(loc1+2);
-    loc2 = str_ws.find("'");
-    word_size = atoi(str_ws.substr(0,loc2).c_str());
+void cnpy::parse_npy_header(FILE *fp,
+                            size_t &word_size,
+                            std::vector<size_t> &shape,
+                            bool &fortran_order)
+{
+  char buffer[256];
+  size_t res = fread(buffer, sizeof(char), 11, fp);
+  if (res != 11)
+    throw std::runtime_error("parse_npy_header: failed fread");
+  std::string header = fgets(buffer, 256, fp);
+  assert(header[header.size() - 1] == '\n');
+
+  size_t loc1, loc2;
+
+  // fortran order
+  loc1 = header.find("fortran_order");
+  if (loc1 == std::string::npos)
+    throw std::runtime_error("parse_npy_header: failed to find header keyword: 'fortran_order'");
+  loc1 += 16;
+  fortran_order = (header.substr(loc1, 4) == "True" ? true : false);
+
+  // shape
+  loc1 = header.find("(");
+  loc2 = header.find(")");
+  if (loc1 == std::string::npos || loc2 == std::string::npos)
+    throw std::runtime_error("parse_npy_header: failed to find header keyword: '(' or ')'");
+
+  std::regex num_regex("[0-9][0-9]*");
+  std::smatch sm;
+  shape.clear();
+
+  std::string str_shape = header.substr(loc1 + 1, loc2 - loc1 - 1);
+  while (std::regex_search(str_shape, sm, num_regex)) {
+    shape.push_back(std::stoi(sm[0].str()));
+    str_shape = sm.suffix().str();
+  }
+
+  // endian, word size, data type
+  // byte order code | stands for not applicable.
+  // not sure when this applies except for byte array
+  loc

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list