avtPixieFileFormat.h 3.71 KB
Newer Older
hrchilds's avatar
hrchilds committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// ************************************************************************* //
//                            avtPixieFileFormat.h                           //
// ************************************************************************* //

#ifndef AVT_Pixie_FILE_FORMAT_H
#define AVT_Pixie_FILE_FORMAT_H

#include <avtMTSDFileFormat.h>

#include <hdf5.h>
#include <vector>
#include <map>

// ****************************************************************************
//  Class: avtPixieFileFormat
//
//  Purpose:
//      Reads in Pixie files as a plugin to VisIt.
//
//  Programmer: Brad Whitlock
//  Creation:   Fri Aug 13 14:31:43 PST 2004
//
hrchilds's avatar
hrchilds committed
23
24
25
26
27
28
29
30
//  Modifications:
//    Brad Whitlock, Thu Aug 26 09:54:15 PDT 2004
//    Added support for meshes that have coordinates.
//
//    Brad Whitlock, Wed Sep 15 17:04:01 PST 2004
//    Rewrote some aspects of support for meshes with coordinates so the
//    "coords" attributes are used.
//
hrchilds's avatar
hrchilds committed
31
32
33
34
35
36
37
38
39
// ****************************************************************************

class avtPixieFileFormat : public avtMTSDFileFormat
{
    struct TraversalInfo
    {
        avtPixieFileFormat *This;
        int                level;
        std::string        path;
hrchilds's avatar
hrchilds committed
40
41
42
43
        bool               hasCoords;
        std::string        coordX;
        std::string        coordY;
        std::string        coordZ;
hrchilds's avatar
hrchilds committed
44
45
46
47
    };

    struct VarInfo
    {
hrchilds's avatar
hrchilds committed
48
        bool        timeVarying;
hrchilds's avatar
hrchilds committed
49
50
51
        hsize_t     dims[3];
        hid_t       nativeVarType;
        std::string fileVarName;
hrchilds's avatar
hrchilds committed
52
53
54
55
        bool        hasCoords;
        std::string coordX;
        std::string coordY;
        std::string coordZ;
hrchilds's avatar
hrchilds committed
56
57
58
59
60
61
62
63
64
65
66
67
68
69
    };

    typedef std::map<std::string, VarInfo> VarInfoMap;
public:
                       avtPixieFileFormat(const char *);
    virtual           ~avtPixieFileFormat();

    virtual void           GetCycles(std::vector<int> &);
    virtual void           GetTimes(std::vector<double> &);

    virtual int            GetNTimesteps(void);

    virtual const char    *GetType(void)   { return "Pixie"; };
    virtual void           FreeUpResources(void); 
hrchilds's avatar
hrchilds committed
70
    virtual void           ActivateTimestep(int ts);
hrchilds's avatar
hrchilds committed
71
72
73
74
75
76

    virtual vtkDataSet    *GetMesh(int, const char *);
    virtual vtkDataArray  *GetVar(int, const char *);

protected:
    void                   Initialize();
hrchilds's avatar
hrchilds committed
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    void                   DetermineVarDimensions(const VarInfo &info,
                                                  int *dims,
                                                  int &nSpatialDims) const;
    bool                   MeshIsCurvilinear(const std::string &) const;
    vtkDataSet            *CreatePointMesh(int timestate, const VarInfo &,
                                           int nDims) const;
    vtkDataSet            *CreateCurvilinearMesh(int timestate, const VarInfo &,
                                                 int nnodes[3],
                                                 int nDims);
    bool                   ReadCoordinateFields(int timestate, const VarInfo &,
                                                float *coords[3], int dims[3],
                                                int nDims) const;
    bool                   ReadVariableFromFile(int timestate,
                                                const std::string &,
                                                const VarInfo &it,
                                                void *dest) const;


hrchilds's avatar
hrchilds committed
95
96
97
98
99
100
    virtual void           PopulateDatabaseMetaData(avtDatabaseMetaData *);

    hid_t                  fileId;
    VarInfoMap             variables;
    VarInfoMap             meshes;
    int                    nTimeStates;
hrchilds's avatar
hrchilds committed
101
102
    bool                   haveMeshCoords;
    std::string            timeStatePrefix;
hrchilds's avatar
hrchilds committed
103
104
105
106
107
108

    static herr_t GetVariableList(hid_t, const char *, void *);
};


#endif