1 // -*- c++ -*-
2 /*=========================================================================
3 
4   Program:   Visualization Toolkit
5   Module:    vtkSLACParticleReader.h
6 
7   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8   All rights reserved.
9   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10 
11      This software is distributed WITHOUT ANY WARRANTY; without even
12      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13      PURPOSE.  See the above copyright notice for more information.
14 
15 =========================================================================*/
16 
17 /*-------------------------------------------------------------------------
18   Copyright 2008 Sandia Corporation.
19   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
20   the U.S. Government retains certain rights in this software.
21 -------------------------------------------------------------------------*/
22 
23 // .NAME vtkSLACParticleReader
24 //
25 // .SECTION Description
26 //
27 // A reader for a data format used by Omega3p, Tau3p, and several other tools
28 // used at the Standford Linear Accelerator Center (SLAC).  The underlying
29 // format uses netCDF to store arrays, but also imposes some conventions
30 // to store a list of particles in 3D space.
31 //
32 // This reader supports pieces, but in actuality only loads anything in
33 // piece 0.  All other pieces are empty.
34 //
35 
36 #ifndef vtkSLACParticleReader_h
37 #define vtkSLACParticleReader_h
38 
39 #include "vtkIONetCDFModule.h" // For export macro
40 #include "vtkPolyDataAlgorithm.h"
41 
42 class vtkDataArraySelection;
43 class vtkIdTypeArray;
44 class vtkInformationIntegerKey;
45 class vtkInformationObjectBaseKey;
46 
47 class VTKIONETCDF_EXPORT vtkSLACParticleReader : public vtkPolyDataAlgorithm
48 {
49 public:
50   vtkTypeMacro(vtkSLACParticleReader, vtkPolyDataAlgorithm);
51   static vtkSLACParticleReader *New();
52   virtual void PrintSelf(ostream &os, vtkIndent indent);
53 
54   vtkGetStringMacro(FileName);
55   vtkSetStringMacro(FileName);
56 
57   // Description:
58   // Returns true if the given file can be read by this reader.
59   static int CanReadFile(const char *filename);
60 
61 protected:
62   vtkSLACParticleReader();
63   ~vtkSLACParticleReader();
64 
65   char *FileName;
66 
67   virtual int RequestInformation(vtkInformation *request,
68                                  vtkInformationVector **inputVector,
69                                  vtkInformationVector *outputVector);
70 
71   virtual int RequestData(vtkInformation *request,
72                           vtkInformationVector **inputVector,
73                           vtkInformationVector *outputVector);
74 
75   // Description:
76   // Convenience function that checks the dimensions of a 2D netCDF array that
77   // is supposed to be a set of tuples.  It makes sure that the number of
78   // dimensions is expected and that the number of components in each tuple
79   // agree with what is expected.  It then returns the number of tuples.  An
80   // error is emitted and 0 is returned if the checks fail.
81   virtual vtkIdType GetNumTuplesInVariable(int ncFD, int varId,
82                                            int expectedNumComponents);
83 
84 private:
85   vtkSLACParticleReader(const vtkSLACParticleReader &);         // Not implemented
86   void operator=(const vtkSLACParticleReader &);        // Not implemented
87 };
88 
89 #endif //vtkSLACParticleReader_h
90