57 : AnalyticalF<3,T,T>(1), _spacing{spacing}
58 {
59 OstreamManager clout(std::cout, "PorosityVolumeImporter");
60 _fileName = fileName;
61 #ifdef FEATURE_VDB
62 if (isVDBFile(_fileName)) {
63 openvdb::initialize();
64 openvdb::io::File _vdbFile(_fileName);
65
66 _vdbFile.open();
67 grids = _vdbFile.getGrids();
68 auto grid = openvdb::gridPtrCast<openvdb::FloatGrid>(*grids->begin());
69 _vdbFile.close();
70 openvdb::CoordBBox bounds = grid->evalActiveVoxelBoundingBox();
71 _shape[0] = bounds.max().x() - bounds.min().x();
72 _shape[1] = bounds.max().y() - bounds.min().y();
73 _shape[2] = bounds.max().z() - bounds.min().z();
74 }
75 #endif
76 #if not defined(FEATURE_VTK)
77 if (isVTKFile(_fileName))
78 {
79 std::cerr << "To use the VTK format, add VTK to the FEATURES list in config.mk";
81 }
82 #endif
83 #if defined(FEATURE_VTK)
84 if (isVTKFile(_fileName)) {
85 _reader->SetFileName(fileName.c_str());
86 _reader->Update();
87 _reader->SetScalarsName(_reader->GetScalarsNameInFile(0));
88 auto* _data = _reader->GetOutput();
89 _data->GetDimensions(_shape.
data());
90 }
91 #endif
92 #ifndef FEATURE_VDB
93 if (isVDBFile(_fileName))
94 {
95 std::cerr << "To use the VDB format, add VDB to the FEATURES list in config.mk";
97 }
98 #endif
99 }
constexpr const T * data() const any_platform