GridFormat
0.6.0
I/O-Library for grid-like data structures
Toggle main menu visibility
Loading...
Searching...
No Matches
pvti_reader.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2022-2023 Dennis Gläser <dennis.glaeser@iws.uni-stuttgart.de>
2
// SPDX-License-Identifier: MIT
8
#ifndef GRIDFORMAT_VTK_PVTI_READER_HPP_
9
#define GRIDFORMAT_VTK_PVTI_READER_HPP_
10
11
#include <
gridformat/vtk/vti_reader.hpp
>
12
#include <
gridformat/vtk/pxml_reader.hpp
>
13
14
namespace
GridFormat {
15
21
class
PVTIReader :
public
VTK::PXMLStructuredGridReader
<VTIReader> {
22
using
ParentType =
VTK::PXMLStructuredGridReader<VTIReader>
;
23
24
public
:
25
PVTIReader()
26
: ParentType(
"PImageData"
)
27
{}
28
29
explicit
PVTIReader(
const
NullCommunicator&)
30
: ParentType(
"PImageData"
)
31
{}
32
33
template
<Concepts::Communicator C>
34
explicit
PVTIReader(
const
C& comm)
35
: ParentType(
"PImageData"
, comm)
36
{}
37
38
private
:
39
std::string _name()
const override
{
40
return
"PVTIReader"
;
41
}
42
43
std::vector<double> _ordinates(
unsigned
int
direction)
const override
{
44
if
(this->_num_process_pieces() == 0)
45
return
{};
46
if
(this->_num_process_pieces() == 1)
47
return
this->_readers().front().ordinates(direction);
48
49
const
auto
extents
= this->_specs().extents;
50
const
auto
extent_begin = this->_specs().extents[2*direction];
51
const
auto
origin
= this->
origin
();
52
const
auto
spacing
= this->
spacing
();
53
const
std::size_t num_ordinates(
extents
[2*direction + 1] - extent_begin + 1);
54
std::vector<double> result(num_ordinates);
55
std::ranges::copy(
56
std::views::iota(std::size_t{0}, num_ordinates) | std::views::transform([&] (
const
std::size_t i) {
57
return
origin
[direction] + (extent_begin + i)*
spacing
[direction];
58
}),
59
result.begin()
60
);
61
return
result;
62
}
63
};
64
65
}
// namespace GridFormat
66
67
#endif
// GRIDFORMAT_VTK_PVTI_READER_HPP_
GridFormat::GridReader::extents
std::array< std::size_t, 3 > extents() const
Return the extents of the grid (only available for structured grid formats).
Definition
reader.hpp:113
GridFormat::GridReader::origin
Vector origin() const
Return the origin of the grid (only available for image grid formats).
Definition
reader.hpp:140
GridFormat::GridReader::spacing
Vector spacing() const
Return the spacing of the grid (only available for image grid formats).
Definition
reader.hpp:135
GridFormat::VTK::PXMLStructuredGridReader
Base class for readers of parallel vtk-xml file formats for structured grids.
Definition
pxml_reader.hpp:294
pxml_reader.hpp
Base class for readers of parallel vtk-xml file formats.
vti_reader.hpp
Reader for .vti file format.
gridformat
vtk
pvti_reader.hpp
Generated by
1.18.0