From 9fe64948abe991d18c1af3a52d81e87c24d39687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Barschkis?= Date: Wed, 24 Jun 2020 12:00:13 +0200 Subject: Fluid: Updated Mantaflow source with latest OpenVDB changes This updated set of Mantaflow files includes the improved OpenVDB file IO. With this update it is finally possible to store multiple grids per file. It is also possible to save particle systems and particle data to OpenVDB files. --- extern/mantaflow/preprocessed/grid.cpp | 42 +++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'extern/mantaflow/preprocessed/grid.cpp') diff --git a/extern/mantaflow/preprocessed/grid.cpp b/extern/mantaflow/preprocessed/grid.cpp index 0ea3afb91f4..76716beb1ac 100644 --- a/extern/mantaflow/preprocessed/grid.cpp +++ b/extern/mantaflow/preprocessed/grid.cpp @@ -122,48 +122,52 @@ template void Grid::swap(Grid &other) mData = dswap; } -template void Grid::load(string name) +template int Grid::load(string name) { if (name.find_last_of('.') == string::npos) errMsg("file '" + name + "' does not have an extension"); string ext = name.substr(name.find_last_of('.')); if (ext == ".raw") - readGridRaw(name, this); + return readGridRaw(name, this); else if (ext == ".uni") - readGridUni(name, this); + return readGridUni(name, this); else if (ext == ".vol") - readGridVol(name, this); + return readGridVol(name, this); else if (ext == ".npz") - readGridNumpy(name, this); -#if OPENVDB == 1 - else if (ext == ".vdb") - readGridVDB(name, this); -#endif // OPENVDB==1 + return readGridNumpy(name, this); + else if (ext == ".vdb") { + std::vector grids; + grids.push_back(this); + return readObjectsVDB(name, &grids); + } else errMsg("file '" + name + "' filetype not supported"); + return 0; } -template void Grid::save(string name) +template int Grid::save(string name) { if (name.find_last_of('.') == string::npos) errMsg("file '" + name + "' does not have an extension"); string ext = name.substr(name.find_last_of('.')); if (ext == ".raw") - writeGridRaw(name, this); + return writeGridRaw(name, this); else if (ext == ".uni") - writeGridUni(name, this); + return writeGridUni(name, this); else if (ext == ".vol") - writeGridVol(name, this); -#if OPENVDB == 1 - else if (ext == ".vdb") - writeGridVDB(name, this); -#endif // OPENVDB==1 + return writeGridVol(name, this); else if (ext == ".npz") - writeGridNumpy(name, this); + return writeGridNumpy(name, this); + else if (ext == ".vdb") { + std::vector grids; + grids.push_back(this); + return writeObjectsVDB(name, &grids); + } else if (ext == ".txt") - writeGridTxt(name, this); + return writeGridTxt(name, this); else errMsg("file '" + name + "' filetype not supported"); + return 0; } //****************************************************************************** -- cgit v1.2.3