Microflow 3D  v1.0
MF::RW::VDBWriter< T_VDBGridType > Class Template Reference

The VDBWriter class provides a write interface for OpenVDB grid. More...

#include <VDBWriter.h>

Public Member Functions

 VDBWriter (const std::shared_ptr< T_VDBGridType > &Grid_Ptr, const std::string &FileName)
 
 ~VDBWriter ()=default
 

Static Public Member Functions

static std::shared_ptr< MF::RW::VDBWriter< T_VDBGridType > > New (const std::shared_ptr< T_VDBGridType > &Grid_Ptr, const std::string &FileName)
 

Detailed Description

template<class T_VDBGridType>
class MF::RW::VDBWriter< T_VDBGridType >

The VDBWriter class provides a write interface for OpenVDB grid.

Parameters
template<class t_vdbgridtype>=""> = <openvdb::FloatGrid::Ptr>, <openvdb::Int32Grid::Ptr>, <openvdb::DoubleGrid::Ptr> etc.

Definition at line 21 of file VDBWriter.h.

Constructor & Destructor Documentation

◆ VDBWriter()

template<class T_VDBGridType>
MF::RW::VDBWriter< T_VDBGridType >::VDBWriter ( const std::shared_ptr< T_VDBGridType > &  Grid_Ptr,
const std::string &  FileName 
)
inline

Definition at line 23 of file VDBWriter.h.

References MF::RW::VDBWriter< T_VDBGridType >::~VDBWriter().

23  {
24  std::string FileNameExt = FileName + ".vdb";
25  // Writing the openvdb grid to a file.
26  // Create a VDB file object.
27  openvdb::io::File file(FileNameExt);
28  // Add the grid pointer to a container.
29  openvdb::GridPtrVec grids;
30  grids.push_back(Grid_Ptr);
31  // Write out the contents of the container.
32  file.write(grids);
33  file.close();
34  std::cout << "Grid was saved successfully in VDB file: ----> " << FileNameExt << std::endl;
35  };

◆ ~VDBWriter()

template<class T_VDBGridType>
MF::RW::VDBWriter< T_VDBGridType >::~VDBWriter ( )
default

Member Function Documentation

◆ New()

template<class T_VDBGridType>
static std::shared_ptr<MF::RW::VDBWriter<T_VDBGridType> > MF::RW::VDBWriter< T_VDBGridType >::New ( const std::shared_ptr< T_VDBGridType > &  Grid_Ptr,
const std::string &  FileName 
)
inlinestatic

Definition at line 40 of file VDBWriter.h.

Referenced by MF::Database::GridVDB< T_VDBGridType >::saveToVDBFile().

40  {
41  auto VDBWriter_Ptr = std::make_shared<MF::RW::VDBWriter<T_VDBGridType>>(Grid_Ptr, FileName);
42  return VDBWriter_Ptr;
43  };

The documentation for this class was generated from the following file: