1717
1818
1919
20- namespace PHARE ::diagnostic::vtkh5::detail
21- {
22-
23- // some testing shows 32 to be the max value supported, something to do with a value `H5S_MAX_RANK`
24- static inline auto const CHUNK_SIZE = core::get_env_as(" PHARE_VTK_H5_CHUNK_SIZE" , std::size_t {32 });
25-
26- } // namespace PHARE::diagnostic::vtkh5::detail
27-
28-
2920namespace PHARE ::diagnostic::vtkh5
3021{
3122
@@ -55,7 +46,7 @@ class H5TypeWriter : public PHARE::diagnostic::TypeWriter
5546 // data is duplicated in lower dimensions to fit a 3d view
5647 // so 2d data is * 2
5748 // and 1d data is * 4
58- constexpr static auto X_TIMES = std::array{4 , 2 , /* 3d noop */ 1 }[dimension - 1 ];
49+ constexpr static auto X_TIMES = std::array{4 , 2 , 1 }[dimension - 1 ];
5950
6051 auto static flatten_boxes (auto const & boxes)
6152 {
@@ -126,7 +117,8 @@ struct H5TypeWriter<Writer>::VTKFileWriter
126117 {
127118 // set global per file attributes and datasets
128119 {
129- initDSDefault (base + " /Steps/Values" );
120+ h5file.create_resizable_1d_data_set <FloatType>(base + " /Steps/Values" );
121+
130122 auto steps_group = h5file.file ().getGroup (base + " /Steps" );
131123 if (!steps_group.hasAttribute (" NSteps" ))
132124 steps_group.template createAttribute <int >(" NSteps" , HighFive::DataSpace::From (0 ))
@@ -199,47 +191,22 @@ struct H5TypeWriter<Writer>::VTKFileWriter
199191 }
200192 }
201193
202- template <typename T = FloatType>
203- void initDS (auto const & path, auto const & ds) const
204- {
205- h5file.template create_chunked_data_set <T>(path, std::vector<hsize_t >{detail::CHUNK_SIZE},
206- ds);
207- }
208194
209- template <typename T = FloatType>
210- void initDSDefault (auto const & path) const
211- {
212- initDS<T>(path, HighFive::DataSpace ({0 }, {HighFive::DataSpace::UNLIMITED}));
213- }
214195
215196 void initFileLevel (int const level) const
216197 {
217198 auto const lvl = std::to_string (level);
218199
219- {
220- auto const path = level_base + lvl + " /AMRBox" ;
221- h5file.template create_chunked_data_set <int >(
222- path, std::vector<hsize_t >{detail::CHUNK_SIZE, boxValsIn3D},
223- HighFive::DataSpace ({0 , boxValsIn3D},
224- {HighFive::DataSpace::UNLIMITED, boxValsIn3D}));
225- }
226-
227- auto const chucked_int_datasets
228- = std::array{step_level + lvl + " /PointDataOffset/data" ,
229- step_level + lvl + " /AMRBoxOffset" , step_level + lvl + " /NumberOfAMRBox" };
230-
231- for (auto const & path : chucked_int_datasets)
232- {
233- h5file.template create_chunked_data_set <int >(
234- path, std::vector<hsize_t >{detail::CHUNK_SIZE},
235- HighFive::DataSpace ({0 }, {HighFive::DataSpace::UNLIMITED}));
236- }
200+ h5file.create_resizable_2d_data_set <int , boxValsIn3D>(level_base + lvl + " /AMRBox" );
201+ h5file.create_resizable_1d_data_set <int >(step_level + lvl + " /PointDataOffset/data" );
202+ h5file.create_resizable_1d_data_set <int >(step_level + lvl + " /AMRBoxOffset" );
203+ h5file.create_resizable_1d_data_set <int >(step_level + lvl + " /NumberOfAMRBox" );
237204
238205 auto level_group = h5file.file ().getGroup (level_base + lvl);
239206 if (!level_group.hasAttribute (" Spacing" ))
240207 {
241- level_group.template createAttribute <std::array<float , dimension>>(
242- " Spacing " , level_spacing (level));
208+ level_group.createAttribute <std::array<float , dimension>>(" Spacing " ,
209+ level_spacing (level));
243210
244211 level_group.createGroup (" CellData" );
245212 level_group.createGroup (" FieldData" );
@@ -253,10 +220,8 @@ struct H5TypeWriter<Writer>::VTKFileWriter
253220 template <std::size_t N = 1 >
254221 void initAnyFieldLevel (int const level, auto & boxes)
255222 {
256- auto const path = level_base + std::to_string (level) + " /PointData/data" ;
257- h5file.template create_chunked_data_set <FloatType>(
258- path, std::vector<hsize_t >{detail::CHUNK_SIZE, N},
259- HighFive::DataSpace ({0 , N}, {HighFive::DataSpace::UNLIMITED, N}));
223+ auto const lvl = std::to_string (level);
224+ h5file.create_resizable_2d_data_set <FloatType, N>(level_base + lvl + " /PointData/data" );
260225 resize<N>(level, boxes);
261226 }
262227
0 commit comments