VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMPASReader.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*========================================================================= 00016 00017 Copyright (c) 2002-2005 Los Alamos National Laboratory 00018 00019 This software and ancillary information known as vtk_ext (and herein 00020 called "SOFTWARE") is made available under the terms described below. 00021 The SOFTWARE has been approved for release with associated LA_CC 00022 Number 99-44, granted by Los Alamos National Laboratory in July 1999. 00023 00024 Unless otherwise indicated, this SOFTWARE has been authored by an 00025 employee or employees of the University of California, operator of the 00026 Los Alamos National Laboratory under Contract No. W-7405-ENG-36 with 00027 the United States Department of Energy. 00028 00029 The United States Government has rights to use, reproduce, and 00030 distribute this SOFTWARE. The public may copy, distribute, prepare 00031 derivative works and publicly display this SOFTWARE without charge, 00032 provided that this Notice and any statement of authorship are 00033 reproduced on all copies. 00034 00035 Neither the U. S. Government, the University of California, nor the 00036 Advanced Computing Laboratory makes any warranty, either express or 00037 implied, nor assumes any liability or responsibility for the use of 00038 this SOFTWARE. 00039 00040 If SOFTWARE is modified to produce derivative works, such modified 00041 SOFTWARE should be clearly marked, so as not to confuse it with the 00042 version available from Los Alamos National Laboratory. 00043 00044 =========================================================================*/ 00077 #ifndef __vtkMPASReader_h 00078 #define __vtkMPASReader_h 00079 00080 #define MAX_VARS 100 00081 #define MAX_VAR_NAME 100 00082 00083 #include "vtkUnstructuredGridAlgorithm.h" 00084 00085 class vtkCallbackCommand; 00086 class vtkDataArraySelection; 00087 class vtkDoubleArray; 00088 class vtkStdString; 00089 class vtkStringArray; 00090 00091 class VTK_IO_EXPORT vtkMPASReader : public vtkUnstructuredGridAlgorithm 00092 { 00093 public: 00094 static vtkMPASReader *New(); 00095 vtkTypeMacro(vtkMPASReader,vtkUnstructuredGridAlgorithm); 00096 void PrintSelf(ostream& os, vtkIndent indent); 00097 00099 00100 vtkSetStringMacro(FileName); 00101 vtkGetStringMacro(FileName); 00103 00105 00106 vtkGetMacro(maxCells, int); 00108 00110 00111 vtkGetMacro(maxPoints, int); 00113 00115 00116 vtkGetMacro(numCellVars, int); 00117 vtkGetMacro(numPointVars, int); 00119 00121 00122 vtkUnstructuredGrid *GetOutput(); 00123 vtkUnstructuredGrid *GetOutput(int index); 00125 00127 00130 int GetNumberOfPointArrays(); 00131 const char* GetPointArrayName(int index); 00132 int GetPointArrayStatus(const char* name); 00133 void SetPointArrayStatus(const char* name, int status); 00134 void DisableAllPointArrays(); 00135 void EnableAllPointArrays(); 00137 00138 int GetNumberOfCellArrays(); 00139 const char* GetCellArrayName(int index); 00140 int GetCellArrayStatus(const char* name); 00141 void SetCellArrayStatus(const char* name, int status); 00142 void DisableAllCellArrays(); 00143 void EnableAllCellArrays(); 00144 00145 void SetVerticalLevel(int level); 00146 vtkGetVector2Macro(VerticalLevelRange, int); 00147 00148 void SetLayerThickness(int val); 00149 vtkGetVector2Macro(LayerThicknessRange, int); 00150 00151 void SetCenterLon(int val); 00152 vtkGetVector2Macro(CenterLonRange, int); 00153 00154 void SetProjectLatLon(bool val); 00155 vtkGetMacro(ProjectLatLon, bool); 00156 00157 void SetIsAtmosphere(bool val); 00158 vtkGetMacro(IsAtmosphere, bool); 00159 00160 void SetIsZeroCentered(bool val); 00161 vtkGetMacro(IsZeroCentered, bool); 00162 00163 void SetShowMultilayerView(bool val); 00164 vtkGetMacro(ShowMultilayerView, bool); 00165 00167 static int CanReadFile(const char *filename); 00168 00169 protected: 00170 vtkMPASReader(); 00171 ~vtkMPASReader(); 00172 void DestroyData(); 00173 00174 char *FileName; // First field part file giving path 00175 /* 00176 int Rank; // Number of this processor 00177 int TotalRank; // Number of processors 00178 */ 00179 00180 // int NumberOfPieces; // Number of files in dataset 00181 // vtkIdType NumberOfTuples; // Number of tuples in sub extent 00182 00183 vtkStdString* VariableName; // Names of each variable 00184 int* VariableType; // Scalar, vector or tensor 00185 00186 int NumberOfTimeSteps; // Temporal domain 00187 double* TimeSteps; // Times available for request 00188 double dTime; 00189 00190 00191 // Observer to modify this object when array selections are modified 00192 vtkCallbackCommand* SelectionObserver; 00193 00194 int RequestData(vtkInformation *, vtkInformationVector **, 00195 vtkInformationVector *); 00196 int RequestInformation(vtkInformation *, vtkInformationVector **, 00197 vtkInformationVector *); 00198 00199 00200 static void SelectionCallback(vtkObject* caller, unsigned long eid, 00201 void* clientdata, void* calldata); 00202 00203 bool infoRequested; 00204 bool dataRequested; 00205 00206 // params 00207 00208 // Selected field of interest 00209 vtkDataArraySelection* PointDataArraySelection; 00210 vtkDataArraySelection* CellDataArraySelection; 00211 00212 vtkDoubleArray** cellVarDataArray; // Actual data arrays 00213 vtkDoubleArray** pointVarDataArray; // Actual data arrays 00214 00215 int VerticalLevelSelected; 00216 int VerticalLevelRange[2]; 00217 00218 int LayerThickness; 00219 int LayerThicknessRange[2]; 00220 00221 int CenterLon; 00222 int CenterLonRange[2]; 00223 00224 bool ProjectLatLon; 00225 bool IsAtmosphere; 00226 bool IsZeroCentered; 00227 bool ShowMultilayerView; 00228 00229 bool includeTopography; 00230 bool doBugFix; 00231 double centerRad; 00232 00233 00234 // geometry 00235 int maxNVertLevels; 00236 int numCells; 00237 int numPoints; 00238 int cellOffset; 00239 int pointOffset; 00240 int pointsPerCell; 00241 int currentExtraPoint; // current extra point 00242 int currentExtraCell; // current extra cell 00243 double* pointX; // x coord of point 00244 double* pointY; // y coord of point 00245 double* pointZ; // z coord of point 00246 int modNumPoints; 00247 int modNumCells; 00248 int* origConnections; // original connections 00249 int* modConnections; // modified connections 00250 int* cellMap; // maps from added cell to original cell # 00251 int* pointMap; // maps from added point to original point # 00252 int* maxLevelPoint; // 00253 int maxCells; // max cells 00254 int maxPoints; // max points 00255 int verticalIndex; // for singleLayer, which vertical level 00256 00257 // vars 00258 int numCellVars; 00259 int numPointVars; 00260 double* pointVarData; 00261 double* cellVarData; 00262 00263 void SetDefaults(); 00264 int GetNcDims(); 00265 int CheckParams(); 00266 int GetNcVars(const char* cellDimName, const char* pointDimName); 00267 int ReadAndOutputGrid(bool init); 00268 int ReadAndOutputVariableData(); 00269 int BuildVarArrays(); 00270 int AllocSphereGeometry(); 00271 int AllocLatLonGeometry(); 00272 void ShiftLonData(); 00273 int AddMirrorPoint(int index, double dividerX); 00274 void FixPoints(); 00275 int EliminateXWrap(); 00276 void OutputPoints(bool init); 00277 void OutputCells(bool init); 00278 unsigned char GetCellType(); 00279 void LoadGeometryData(int var, double dTime); 00280 int LoadPointVarData(int variable, double dTime); 00281 int LoadCellVarData(int variable, double dTime); 00282 int RegenerateGeometry(); 00283 00284 private: 00285 vtkMPASReader(const vtkMPASReader&); // Not implemented. 00286 void operator=(const vtkMPASReader&); // Not implemented. 00287 class Internal; 00288 Internal *Internals; 00289 00290 }; 00291 00292 #endif