1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 \*---------------------------------------------------------------------------*/
35 #ifndef vtkFoamReader_h
36 #define vtkFoamReader_h
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 #include "vtkDataSetSource.h"
41 #include "vtkFoamData.h"
43 // * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
51 class vtkDataArraySelection
;
52 class vtkDataArrayCollection
;
53 class vtkCallbackCommand
;
55 /*---------------------------------------------------------------------------*\
56 Class vtkFoamReader Declaration
57 \*---------------------------------------------------------------------------*/
59 class VTK_IO_EXPORT vtkFoamReader
61 public vtkDataSetSource
66 //- Standard VTK class creation function
67 static vtkFoamReader
*New();
69 //- Standard VTK class type and revision declaration macro
70 vtkTypeRevisionMacro(vtkFoamReader
,vtkDataSetSource
);
72 //- Standard VTK class print function
73 void PrintSelf(ostream
& os
, vtkIndent indent
);
75 // File name of FOAM datafile to read
76 void SetFileName(const char *);
77 //vtkSetStringMacro(FileName);
78 vtkGetStringMacro(FileName
);
81 vtkSetMacro(UpdateGUI
, int);
82 vtkGetMacro(UpdateGUI
, int);
84 // FOAM mesh caching control
85 vtkSetMacro(CacheMesh
, int);
86 vtkGetMacro(CacheMesh
, int);
88 // Time-step slider control
89 vtkSetMacro(TimeStep
, int);
90 vtkGetMacro(TimeStep
, int);
91 vtkSetVector2Macro(TimeStepRange
, int);
92 vtkGetVector2Macro(TimeStepRange
, int);
94 // Control of the upper and lower limits on the number of times
95 // displayed in the selection list
96 vtkSetVector2Macro(TimeStepLimits
, int);
97 vtkGetVector2Macro(TimeStepLimits
, int);
99 // Time selection list control
100 vtkDataArraySelection
* GetTimeSelection();
101 int GetNumberOfTimeArrays();
102 const char* GetTimeArrayName(int index
);
103 int GetTimeArrayStatus(const char* name
);
104 void SetTimeArrayStatus(const char* name
, int status
);
106 // Region selection list control
107 vtkDataArraySelection
* GetRegionSelection();
108 int GetNumberOfRegionArrays();
109 const char* GetRegionArrayName(int index
);
110 int GetRegionArrayStatus(const char* name
);
111 void SetRegionArrayStatus(const char* name
, int status
);
113 // volField selection list control
114 vtkDataArraySelection
* GetVolFieldSelection();
115 int GetNumberOfVolFieldArrays();
116 const char* GetVolFieldArrayName(int index
);
117 int GetVolFieldArrayStatus(const char* name
);
118 void SetVolFieldArrayStatus(const char* name
, int status
);
120 // pointField selection list control
121 vtkDataArraySelection
* GetPointFieldSelection();
122 int GetNumberOfPointFieldArrays();
123 const char* GetPointFieldArrayName(int index
);
124 int GetPointFieldArrayStatus(const char* name
);
125 void SetPointFieldArrayStatus(const char* name
, int status
);
127 // SetNthOutput provided so that vtkFoam can access it
128 void SetNthOutput(int num
, vtkDataObject
*output
)
130 vtkDataSetSource::SetNthOutput(num
, output
);
133 // Standard VTK ExecuteInformation function overriding the base-class.
134 // Called by ParaView before GUI is displayed.
135 virtual void ExecuteInformation();
137 // Callback registered with the SelectionObserver
138 // for all the selection lists
139 static void SelectionModifiedCallback
147 void SelectionModified();
155 // Standard VTK execute function overriding the base-class.
156 // Called by ParaView when Accept is pressed.
159 // Cache for the outputs. These are stored before the end of Execute()
160 // and re-instated at the beginning because the Outputs would disappear
162 vtkFoamData
* StoredOutputs
;
164 // FOAM file name (*.foam)
168 Foam::vtkFoam
* foamData_
;
176 int TimeStepRange
[2];
178 int TimeStepLimits
[2];
180 vtkDataArraySelection
* TimeSelection
;
181 vtkDataArraySelection
* RegionSelection
;
182 vtkDataArraySelection
* VolFieldSelection
;
183 vtkDataArraySelection
* PointFieldSelection
;
185 // The observer to modify this object when the array selections are modified
186 vtkCallbackCommand
* SelectionObserver
;
191 vtkFoamReader(const vtkFoamReader
&); // Not implemented.
192 void operator=(const vtkFoamReader
&); // Not implemented.
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 // ************************************************************************* //