diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2021-02-02 19:46:48 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2021-02-02 19:46:48 +0300 |
commit | 9ad828dbad94d279521875db47a3472a38cc9b29 (patch) | |
tree | 7f7ef01c32299b3259ca7d0737ea9fe558b8bc82 /extern/mantaflow/preprocessed/fileio/iogrids.cpp | |
parent | f8359b5f52d65a3d59ca9d24db67805d2a0ce316 (diff) |
Fluid: Updated Mantaflow source files
Includes improvements for the file IO. Namely, more meta data will be written from now on.
This change is required to prevent IO issues (e.g. T84649) that arised through the use of sparse grids caching (introduced in 2.92).
Diffstat (limited to 'extern/mantaflow/preprocessed/fileio/iogrids.cpp')
-rw-r--r-- | extern/mantaflow/preprocessed/fileio/iogrids.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/extern/mantaflow/preprocessed/fileio/iogrids.cpp b/extern/mantaflow/preprocessed/fileio/iogrids.cpp index 7cedbb484ba..d138cd2925f 100644 --- a/extern/mantaflow/preprocessed/fileio/iogrids.cpp +++ b/extern/mantaflow/preprocessed/fileio/iogrids.cpp @@ -628,13 +628,24 @@ template<class T> int readGridUni(const string &name, Grid<T> *grid) // current file format UniHeader head; assertMsg(gzread(gzf, &head, sizeof(UniHeader)) == sizeof(UniHeader), - "can't read file, no header present"); - assertMsg(head.dimX == grid->getSizeX() && head.dimY == grid->getSizeY() && - head.dimZ == grid->getSizeZ(), - "grid dim doesn't match, " << Vec3(head.dimX, head.dimY, head.dimZ) << " vs " - << grid->getSize()); + "readGridUni: Can't read file, no header present"); assertMsg(unifyGridType(head.gridType) == unifyGridType(grid->getType()), - "grid type doesn't match " << head.gridType << " vs " << grid->getType()); + "readGridUni: Grid type doesn't match " << head.gridType << " vs " + << grid->getType()); + + const Vec3i curGridSize = grid->getParent()->getGridSize(); + const Vec3i headGridSize(head.dimX, head.dimY, head.dimZ); +# if BLENDER + // Correct grid size is only a soft requirement in Blender + if (headGridSize != curGridSize) { + debMsg("readGridUni: Grid dim doesn't match, " << headGridSize << " vs " << curGridSize, 1); + return 0; + } +# else + assertMsg(headGridSize == curGridSize, + "readGridUni: Grid dim doesn't match, " << headGridSize << " vs " << curGridSize); +# endif + # if FLOATINGPOINT_PRECISION != 1 // convert float to double Grid<T> temp(grid->getParent()); |