File: vtkMPIImageReader.h

package info (click to toggle)
paraview 5.13.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 544,220 kB
  • sloc: cpp: 3,374,605; ansic: 1,332,409; python: 150,381; xml: 122,166; sql: 65,887; sh: 7,317; javascript: 5,262; yacc: 4,417; java: 3,977; perl: 2,363; lex: 1,929; f90: 1,397; makefile: 170; objc: 153; tcl: 59; pascal: 50; fortran: 29
file content (121 lines) | stat: -rw-r--r-- 4,167 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
// SPDX-License-Identifier: BSD-3-Clause

/**
 * @class   vtkMPIImageReader
 *
 *
 *
 * vtkMPIImageReader provides the mechanism to read a brick of bytes (or shorts,
 * or ints, or floats, or doubles, ...) from a file or series of files.  You can
 * use it to read raw image data from files.  You may also be able to subclass
 * this to read simple file formats.
 *
 * What distinguishes this class from vtkImageReader and vtkImageReader2 is that
 * it performs synchronized parallel I/O using the MPIIO layer.  This can make a
 * huge difference in file read times, especially when reading in parallel from
 * a parallel file system.
 *
 * Despite the name of this class, vtkMPIImageReader will work even if MPI is
 * not available.  If MPI is not available or MPIIO is not available or the
 * given Controller is not a vtkMPIController (or nullptr), then this class will
 * silently work exactly like its superclass.  The point is that you can safely
 * use this class in applications that may or may not be compiled with MPI (or
 * may or may not actually be run with MPI).
 *
 * @sa
 * vtkMultiProcessController, vtkImageReader, vtkImageReader2
 *
 */

#ifndef vtkMPIImageReader_h
#define vtkMPIImageReader_h

#include "vtkIOMPIImageModule.h" // For export macro
#include "vtkImageReader.h"

VTK_ABI_NAMESPACE_BEGIN
class vtkMPIOpaqueFileHandle;
class vtkMultiProcessController;

class VTKIOMPIIMAGE_EXPORT vtkMPIImageReader : public vtkImageReader
{
public:
  vtkTypeMacro(vtkMPIImageReader, vtkImageReader);
  static vtkMPIImageReader* New();
  void PrintSelf(ostream& os, vtkIndent indent) override;

  ///@{
  /**
   * Get/set the multi process controller to use for coordinated reads.  By
   * default, set to the global controller.
   */
  vtkGetObjectMacro(Controller, vtkMultiProcessController);
  virtual void SetController(vtkMultiProcessController*);
  ///@}

protected:
  vtkMPIImageReader();
  ~vtkMPIImageReader() override;

  vtkMultiProcessController* Controller;

  /**
   * Returns the size, in bytes of the scalar data type (GetDataScalarType).
   */
  int GetDataScalarTypeSize();

  /**
   * Break up the controller based on the files each process reads.  Each group
   * comprises the processes that read the same files in the same order.
   * this->GroupedController is set to the group for the current process.
   */
  virtual void PartitionController(const int extent[6]);

  /**
   * Get the header size of the given open file.  This should be used in liu of
   * the GetHeaderSize methods of the superclass.
   */
  virtual unsigned long GetHeaderSize(vtkMPIOpaqueFileHandle& file);

  /**
   * Set up a "view" on the open file that will allow you to read the 2D or 3D
   * subarray from the file in one read.  Once you call this method, the file
   * will look as if it contains only the data the local process needs to read
   * in.
   */
  virtual void SetupFileView(vtkMPIOpaqueFileHandle& file, const int extent[6]);

  /**
   * Given a slice of the data, open the appropriate file, read the data into
   * given buffer, and close the file.  For three dimensional data, always
   * use "slice" 0.  Make sure the GroupedController is properly created before
   * calling this using the PartitionController method.
   */
  virtual void ReadSlice(int slice, const int extent[6], void* buffer);

  /**
   * Transform the data from the order read from a file to the order to place
   * in the output data (as defined by the transform).
   */
  virtual void TransformData(vtkImageData* data);

  ///@{
  /**
   * A group of processes that are reading the same file (as determined by
   * PartitionController.
   */
  void SetGroupedController(vtkMultiProcessController*);
  vtkMultiProcessController* GroupedController;
  ///@}

  void ExecuteDataWithInformation(vtkDataObject* data, vtkInformation* outInfo) override;

private:
  vtkMPIImageReader(const vtkMPIImageReader&) = delete;
  void operator=(const vtkMPIImageReader&) = delete;
};

VTK_ABI_NAMESPACE_END
#endif // vtkMPIImageReader_h