File: vtkNetCDFCAMReader.h

package info (click to toggle)
paraview 4.0.1-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 526,572 kB
  • sloc: cpp: 2,284,430; ansic: 816,374; python: 239,936; xml: 70,162; tcl: 48,295; fortran: 39,116; yacc: 5,466; java: 3,518; perl: 3,107; lex: 1,620; sh: 1,555; makefile: 932; asm: 471; pascal: 228
file content (126 lines) | stat: -rw-r--r-- 4,530 bytes parent folder | download | duplicates (4)
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
122
123
124
125
126
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkNetCDFCAMReader.h

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

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkNetCDFCAMReader - Read unstructured NetCDF CAM files.
// .SECTION Description
// Reads in a NetCDF CAM (Community Atmospheric Model) file and produces
// and unstructured grid.  The grid is actually unstructured in the
// X and Y directions and rectilinear in the Z direction with all
// hex cells.  The reader requires 2 NetCDF files.  The first is the
// cell connectivity file which has the quad connectivity in the plane.
// The other connectivity file has all of the point and field information.
// Currently this reader ignores time that may exist in the points
// file.

#ifndef __vtkNetCDFCAMReader_h
#define __vtkNetCDFCAMReader_h

#include "vtkIONetCDFModule.h" // For export macro
#include "vtkUnstructuredGridAlgorithm.h"

class NcFile;

class VTKIONETCDF_EXPORT vtkNetCDFCAMReader : public vtkUnstructuredGridAlgorithm
{
public:
  static vtkNetCDFCAMReader *New();
  vtkTypeMacro(vtkNetCDFCAMReader,vtkUnstructuredGridAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Returns 1 if this file can be read and 0 if the file cannot be read.
  // Because NetCDF CAM files come in pairs and we only check one of the
  // files, the result is not definitive.  Invalid files may still return 1
  // although a valid file will never return 0.
  static int CanReadFile(const char* fileName);

  void SetFileName(const char* fileName);
  vtkGetStringMacro(FileName);

  void SetConnectivityFileName(const char* fileName);
  vtkGetStringMacro(ConnectivityFileName);

  // Description:
  // Set whether or not to read a single level.  A
  // value of one indicates that only a single level will be read in.
  // The NetCDF variables loaded will then be ones with dimensions
  // of (time, ncols).  This will result in a surface grid. Otherwise
  // a volumetric grid will be created (if lev > 1) and the variables
  // with dimensions of (time, lev, ncols) will be read in.
  // By default, SingleLevel = 0.
  vtkBooleanMacro(SingleLevel,int);
  vtkSetClampMacro(SingleLevel, int, 0, 1);
  vtkGetMacro(SingleLevel, int);

  // Description:
  // Specify which "side" of the domain to add the connecting
  // cells at.  0 indicates left side and 1 indicates right side.
  // The default is the right side.
  vtkSetMacro(CellLayerRight, int);
  vtkGetMacro(CellLayerRight, int);

protected:
  vtkNetCDFCAMReader();
  ~vtkNetCDFCAMReader();

  int RequestInformation(vtkInformation*, vtkInformationVector**,
                         vtkInformationVector*);

  virtual int RequestData(vtkInformation *, vtkInformationVector **,
                          vtkInformationVector *);

  virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **,
                                  vtkInformationVector *);

  // Description:
  // Returns true for success.  Based on the piece, number of pieces,
  // number of levels of cells, and the number of cells per level, gives
  // a partitioned space of levels and cells.
  bool GetPartitioning(
    int piece, int numPieces,int numCellLevels, int numCellsPerLevel,
    int & beginCellLevel, int & endCellLevel, int & beginCell, int & endCell);

private:
  vtkNetCDFCAMReader(const vtkNetCDFCAMReader&);  // Not implemented.
  void operator=(const vtkNetCDFCAMReader&);  // Not implemented.

  // Description:
  // The file name of the file that contains all of the point
  // data (coordinates and fields).
  char* FileName;
  char* CurrentFileName;
  vtkSetStringMacro(CurrentFileName);

  // Description:
  // The file name that contains the cell connectivity information.
  char* ConnectivityFileName;
  char* CurrentConnectivityFileName;
  vtkSetStringMacro(CurrentConnectivityFileName);

  int SingleLevel;

  int CellLayerRight;

  double * TimeSteps;

  long NumberOfTimeSteps;

  // Description:
  // The NetCDF file descriptors.  NULL indicates they haven't
  // been opened.
  NcFile* PointsFile;
  NcFile* ConnectivityFile;
};

#endif