vtkXMLStructuredDataWriter.h 3.68 KB
Newer Older
1 2 3 4 5
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkXMLStructuredDataWriter.h

6
  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 8 9
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

10 11
     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 13 14 15 16 17 18 19
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkXMLStructuredDataWriter - Superclass for VTK XML structured data writers.
// .SECTION Description
// vtkXMLStructuredDataWriter provides VTK XML writing functionality that
// is common among all the structured data formats.

20 21
#ifndef vtkXMLStructuredDataWriter_h
#define vtkXMLStructuredDataWriter_h
22

23
#include "vtkIOXMLModule.h" // For export macro
24 25
#include "vtkXMLWriter.h"

Utkarsh Ayachit's avatar
ENH:  
Utkarsh Ayachit committed
26
class vtkAbstractArray;
27 28
class vtkInformation;
class vtkInformationVector;
29

30
class VTKIOXML_EXPORT vtkXMLStructuredDataWriter : public vtkXMLWriter
31 32
{
public:
33
  vtkTypeMacro(vtkXMLStructuredDataWriter,vtkXMLWriter);
34
  void PrintSelf(ostream& os, vtkIndent indent);
35

36 37 38 39 40
  // Description:
  // Get/Set the number of pieces used to stream the image through the
  // pipeline while writing to the file.
  vtkSetMacro(NumberOfPieces, int);
  vtkGetMacro(NumberOfPieces, int);
41

42 43 44 45 46 47 48 49 50 51 52
  // Description:
  // Get/Set the piece to write to the file.  If this is
  // negative, all pieces will be written.
  vtkSetMacro(WritePiece, int);
  vtkGetMacro(WritePiece, int);

  // Description:
  // Get/Set the ghost level used to pad each piece.
  vtkSetMacro(GhostLevel, int);
  vtkGetMacro(GhostLevel, int);

53 54 55 56 57 58
  // Description:
  // Get/Set the extent of the input that should be treated as the
  // WholeExtent in the output file.  The default is the WholeExtent
  // of the input.
  vtkSetVector6Macro(WriteExtent, int);
  vtkGetVector6Macro(WriteExtent, int);
59

60 61
protected:
  vtkXMLStructuredDataWriter();
62 63
  ~vtkXMLStructuredDataWriter();

64
  // Writing drivers defined by subclasses.
65
  virtual void WritePrimaryElementAttributes(ostream &os, vtkIndent indent);
66 67
  virtual void WriteAppendedPiece(int index, vtkIndent indent);
  virtual void WriteAppendedPieceData(int index);
68
  virtual void WriteInlinePiece(vtkIndent indent);
69
  virtual void GetInputExtent(int* extent)=0;
70

71 72 73 74 75 76 77
  virtual int WriteHeader();
  virtual int WriteAPiece();
  virtual int WriteFooter();

  virtual void AllocatePositionArrays();
  virtual void DeletePositionArrays();

78
  virtual int WriteInlineMode(vtkIndent indent);
79 80
  vtkIdType GetStartTuple(int* extent, vtkIdType* increments,
                          int i, int j, int k);
81
  void CalculatePieceFractions(float* fractions);
82

83
  void SetInputUpdateExtent(int piece);
84 85 86 87
  int ProcessRequest(vtkInformation* request,
                     vtkInformationVector** inputVector,
                     vtkInformationVector* outputVector);

88 89 90
  vtkSetVector6Macro(InternalWriteExtent, int);

  // The extent of the input to write, as specified by user
91
  int WriteExtent[6];
92

93 94
  // The actual extent of the input to write.
  int InternalWriteExtent[6];
95

96 97
  // Number of pieces used for streaming.
  int NumberOfPieces;
98

99
  int WritePiece;
100

101 102 103
  float* ProgressFractions;

  int CurrentPiece;
104

105 106 107 108
  int GhostLevel;

  vtkTypeInt64* ExtentPositions;

109
  // Appended data offsets of point and cell data arrays.
110 111 112
  // Store offset position (add TimeStep support)
  OffsetsManagerArray *PointDataOM;
  OffsetsManagerArray *CellDataOM;
113

114 115 116 117 118 119
private:
  vtkXMLStructuredDataWriter(const vtkXMLStructuredDataWriter&);  // Not implemented.
  void operator=(const vtkXMLStructuredDataWriter&);  // Not implemented.
};

#endif