VTK  9.7.20261204
vtkHDFWriterImplementationData.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
7#ifndef vtkHDFWriterImplementationData_h
8#define vtkHDFWriterImplementationData_h
9
10#include "vtkHDF5ScopedHandle.h"
11#include "vtkSmartPointer.h"
12#include "vtkType.h"
13
14#include <array>
15#include <string>
16#include <string_view>
17#include <vector>
18
19VTK_ABI_NAMESPACE_BEGIN
20
21class vtkDataObject;
23
25{
52
54{
55 std::vector<vtkIdType> PartOffsets; // offset per rank, size = nRanks + 1
56 std::vector<GeometryOffset> GeoOffsets; // absolute file offsets, size = nParts + 1
57};
58
59struct Subfile
60{
61 std::string Name;
62 vtkHDF::ScopedH5FHandle Handle;
63};
64using Subfiles = std::vector<Subfile>;
65
82
84{
85 hsize_t Offset = 0;
86 hsize_t Count = 0;
87 bool Temporal = false;
88};
89
95 bool distributed, PartitionedOffsets& offsets);
96
102
111
116 const Subfiles& subfiles, const std::string& basePath, vtkDataObject* data);
117
119bool HasDataset(const Subfiles& subfiles, const std::string& path);
120
124vtkHDF::ScopedH5GHandle GetSubfileNonNullPart(
125 const Subfiles& subfiles, const std::string& blockPath, int& type);
126
131bool CreateRepresentativeFromSubfile(const Subfiles& subfiles, const std::string& blockPath,
132 vtkSmartPointer<vtkDataObject>& representative);
133
140
145
154 const PartitionedOffsets& offsets, unsigned int partId, int rank, bool distributed);
155
161 const PartitionedOffsets& offsets, const std::string& path, bool distributed);
162
167hsize_t GetDatasetValueOffset(const PartitionedOffsets& offsets, std::size_t partition,
168 const std::string& datasetPath, IndexingMode mode);
169
175 const PartitionedOffsets& offsets, const std::string& datasetPath);
176
184IndexingMode GetDatasetIndexationMode(const std::string& path);
185
190hsize_t GetDatasetPadding(const std::string& datasetPath, IndexingMode mode, hsize_t partitions);
191
193bool GetSubfilePartRange(const Subfiles& subfiles, const std::string& basePath, std::size_t file,
194 hsize_t step, SubfilePartRange& range);
195
200hsize_t GetNumberOfCellsSubfile(const Subfiles& subfiles, const std::string& basePath,
201 std::size_t subfileId, hsize_t part, bool isPolyData, const std::string& groupName);
202
210hsize_t GetSubfileNumberOf(const Subfiles& subfiles, const std::string& base,
211 const std::string_view& qualifier, std::size_t subfileId, hsize_t part, int primitive = -1);
212
216hsize_t GetSubfileDatasetSize(const Subfiles& subfiles, const std::string& datasetPath,
217 std::size_t file, hsize_t part, bool isPolyData, hsize_t defaultSize = 0);
218
225bool GetSubFilesDatasetSize(const Subfiles& subfiles, const std::string& datasetPath,
226 const std::string& groupName, hsize_t& totalSize, const std::string& fallbackPath = "");
227
232hsize_t GetSubfileFieldSize(const Subfiles& subfiles, const std::string& datasetPath,
233 std::size_t file, hsize_t partOffset, hsize_t parts);
234
238vtkHDF::ScopedH5THandle GetSubfileDataType(
239 const Subfiles& subfiles, const std::string& datasetPath);
240
251
256 const Subfiles& subfiles, const VirtualDataset& dataset, hsize_t numberOfSteps);
257}
258
259VTK_ABI_NAMESPACE_END
260#endif
general representation of visualization data
Multiprocessing communication superclass.
Hold a reference to a vtkObjectBase instance.
VTKHDF Writer helpers for partition offsets, subfile metadata, and virtual mappings.
hsize_t GetSubfileDatasetSize(const Subfiles &subfiles, const std::string &datasetPath, std::size_t file, hsize_t part, bool isPolyData, hsize_t defaultSize=0)
Read the extent contributed by one subfile partition.
bool BuildVirtualMappings(const Subfiles &subfiles, const VirtualDataset &dataset, hsize_t numberOfSteps)
Build HDF5 virtual dataset mappings from a VirtualDataset description.
bool UsesDistributedOffsets(const PartitionedOffsets &offsets, const std::string &path, bool distributed)
Return true if a given path can use distributed offsets and writing.
vtkSmartPointer< vtkDataObject > CreateEmptyPartition(vtkSmartPointer< vtkDataObject > input, vtkMultiProcessController *controller)
Create placeholders for empty inputs to make sure all ranks have the same data type,...
hsize_t GetSubfileFieldSize(const Subfiles &subfiles, const std::string &datasetPath, std::size_t file, hsize_t partOffset, hsize_t parts)
Return the number of tuples for all a given number of parts in a subfile, starting at offset partOffs...
hsize_t GetDistributedDatasetSize(const PartitionedOffsets &offsets, const std::string &datasetPath)
Return the total number of rows for the given dataset.
hsize_t GetDatasetValueOffset(const PartitionedOffsets &offsets, std::size_t partition, const std::string &datasetPath, IndexingMode mode)
Get offset value from a file-absolute partition number and path, using computed offsets from the coll...
bool CollectOffsets(hid_t group, vtkDataObject *input, vtkMultiProcessController *controller, bool distributed, PartitionedOffsets &offsets)
Collect temporal file extents, then add the current partition offsets.
bool CreateArraysFromNonNullPart(hid_t group, vtkDataObject *data)
Initialize empty data object array structures from a base group.
hsize_t GetSubfileNumberOf(const Subfiles &subfiles, const std::string &base, const std::string_view &qualifier, std::size_t subfileId, hsize_t part, int primitive=-1)
Retrieve a single value from the 1-dimensional (usually meta-data) group name in a given subfile subf...
IndexingMode GetDatasetIndexationMode(const std::string &path)
Return the indexation mode of dataset at the given path: when the dataset adds 1 component for every ...
vtkHDF::ScopedH5GHandle GetSubfileNonNullPart(const Subfiles &subfiles, const std::string &blockPath, int &type)
Find the first non null part for the given path in all subfiles.
bool HasDataset(const Subfiles &subfiles, const std::string &path)
Return true if at least one registered subfile contains the given path.
bool CreateRepresentativeFromSubfile(const Subfiles &subfiles, const std::string &blockPath, vtkSmartPointer< vtkDataObject > &representative)
Recover a block type, attributes, and field arrays from subfiles.
bool CollectTemporalOffsets(hid_t group, GeometryOffset &offsets)
Collect temporal offsets from the file currently open.
bool CollectSubfileAttributes(const Subfiles &subfiles, const std::string &basePath, vtkDataObject *data)
Add schemas for point/cell arrays found in any subfile during metafile assembly.
int ReadNumberOfTimeSteps(hid_t root)
Read the existing timestep count, including composite leaves.
bool GetSubFilesDatasetSize(const Subfiles &subfiles, const std::string &datasetPath, const std::string &groupName, hsize_t &totalSize, const std::string &fallbackPath="")
Set totalSize as the the sum of the subfiles dataset's size given a path to the dataset.
hsize_t GetNumberOfCellsSubfile(const Subfiles &subfiles, const std::string &basePath, std::size_t subfileId, hsize_t part, bool isPolyData, const std::string &groupName)
Look into subfile subfileId and return the number of cells in part part.
vtkHDF::ScopedH5THandle GetSubfileDataType(const Subfiles &subfiles, const std::string &datasetPath)
Copy the datatype from dataset in subfile.
hsize_t GetDatasetPadding(const std::string &datasetPath, IndexingMode mode, hsize_t partitions)
Number of extra offset entries stored for the given partitions.
bool IsMissingPartition(const PartitionedOffsets &offsets, unsigned int partId, int rank, bool distributed)
Return true if the current partition in the current rank is a placeholder used only for collective wr...
bool GetSubfilePartRange(const Subfiles &subfiles, const std::string &basePath, std::size_t file, hsize_t step, SubfilePartRange &range)
Locate the partitions belonging to a subfile timestep.
Store absolute file offsets for a partition in the current time step.
GeometryOffset & operator+=(const GeometryOffset &other)
@ Cells
A cell specified by degrees of freedom held in arrays.
int64_t hid_t
int vtkIdType
Definition vtkType.h:366