File: vtkParallelReader.h

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 205,916 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 178; javascript: 165; objc: 153; tcl: 59
file content (121 lines) | stat: -rw-r--r-- 4,149 bytes parent folder | download | duplicates (6)
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-License-Identifier: BSD-3-Clause
/**
 * @class   vtkParallelReader
 * @brief   Superclass for algorithms that are parallel aware
 *
 * vtkParallelReader is a vtkReaderAlgorithm subclass that provides
 * a specialized API to develop readers that are parallel aware (i.e.
 * can handle piece requests) but do not natively support time series.
 * This reader adds support for file series in order to support time
 * series.
 */

#ifndef vtkParallelReader_h
#define vtkParallelReader_h

#include "vtkCommonExecutionModelModule.h" // For export macro
#include "vtkReaderAlgorithm.h"

#include <string> // needed for std::string in the interface

VTK_ABI_NAMESPACE_BEGIN
struct vtkParallelReaderInternal;

class VTKCOMMONEXECUTIONMODEL_EXPORT vtkParallelReader : public vtkReaderAlgorithm
{
public:
  vtkTypeMacro(vtkParallelReader, vtkReaderAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent) override;

  /**
   * Add a filename to be read. Since this superclass handles
   * file series to support time, multiple filenames can be added.
   * Note that the time values are either integers growing sequentially,
   * or are obtained from individual files as supported by the subclass.
   */
  void AddFileName(VTK_FILEPATH const char* fname);

  /**
   * Removes all filenames stored by the reader.
   */
  void ClearFileNames();

  /**
   * Returns the number of filenames stored by the reader.
   */
  int GetNumberOfFileNames() const;

  /**
   * Returns a particular filename stored by the reader.
   */
  VTK_FILEPATH const char* GetFileName(int i) const;

  /**
   * Returns the filename that was last loaded by the reader.
   * This is set internally in ReadMesh()
   */
  VTK_FILEPATH const char* GetCurrentFileName() const;

  ///@{
  /**
   * This is the superclass API overridden by this class
   * to provide time support internally. Subclasses should
   * not normally have to override these methods.
   */
  int ReadMetaData(vtkInformation* metadata) override;
  int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
  int ReadPoints(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
  int ReadArrays(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
  ///@}

protected:
  vtkParallelReader();
  ~vtkParallelReader() override;

  /**
   * A subclass can override this method to provide an actual
   * time value for a given file (this method is called for
   * each filename stored by the reader). If time values is not
   * available, the subclass does not have to override.
   */
  virtual double GetTimeValue(const std::string& fname);

  /**
   * A method that needs to be override by the subclass to provide
   * the mesh (topology). Note that the filename is passed to this
   * method and should be used by the subclass. The subclass directly
   * adds the structure/topology to the provided data object.
   */
  virtual int ReadMesh(
    const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) = 0;

  /**
   * A method that needs to be override by the subclass to provide
   * the point coordinates. Note that the filename is passed to this
   * method and should be used by the subclass. The subclass directly
   * adds the coordinates to the provided data object.
   */
  virtual int ReadPoints(
    const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) = 0;

  /**
   * A method that needs to be override by the subclass to provide
   * data arrays. Note that the filename is passed to this
   * method and should be used by the subclass. The subclass directly
   * adds data arrays to the provided data object.
   */
  virtual int ReadArrays(
    const std::string& fname, int piece, int npieces, int nghosts, vtkDataObject* output) = 0;

  int CurrentFileIndex;

private:
  vtkParallelReader(const vtkParallelReader&) = delete;
  void operator=(const vtkParallelReader&) = delete;

  vtkParallelReaderInternal* Internal;
};

VTK_ABI_NAMESPACE_END
#endif