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 =========================================================================*/ 00080 #ifndef __vtkMPASReader_h 00081 #define __vtkMPASReader_h 00082 00083 #define MAX_VARS 100 00084 #define MAX_VAR_NAME 100 00085 00086 #include "vtkUnstructuredGridAlgorithm.h" 00087 00088 class vtkCallbackCommand; 00089 class vtkDataArraySelection; 00090 class vtkDoubleArray; 00091 class vtkStdString; 00092 class vtkStringArray; 00093 00094 class VTK_IO_EXPORT vtkMPASReader : public vtkUnstructuredGridAlgorithm 00095 { 00096 public: 00097 static vtkMPASReader *New(); 00098 vtkTypeMacro(vtkMPASReader,vtkUnstructuredGridAlgorithm); 00099 void PrintSelf(ostream& os, vtkIndent indent); 00100 00102 00103 vtkSetStringMacro(FileName); 00104 vtkGetStringMacro(FileName); 00106 00108 00109 vtkGetMacro(MaximumCells, int); 00111 00113 00114 vtkGetMacro(MaximumPoints, int); 00116 00118 00119 vtkGetMacro(NumberOfCellVars, int); 00120 vtkGetMacro(NumberOfPointVars, int); 00122 00124 00125 vtkUnstructuredGrid *GetOutput(); 00126 vtkUnstructuredGrid *GetOutput(int index); 00128 00130 00133 int GetNumberOfPointArrays(); 00134 const char* GetPointArrayName(int index); 00135 int GetPointArrayStatus(const char* name); 00136 void SetPointArrayStatus(const char* name, int status); 00137 void DisableAllPointArrays(); 00138 void EnableAllPointArrays(); 00140 00141 int GetNumberOfCellArrays(); 00142 const char* GetCellArrayName(int index); 00143 int GetCellArrayStatus(const char* name); 00144 void SetCellArrayStatus(const char* name, int status); 00145 void DisableAllCellArrays(); 00146 void EnableAllCellArrays(); 00147 00148 void SetVerticalLevel(int level); 00149 vtkGetVector2Macro(VerticalLevelRange, int); 00150 00151 void SetLayerThickness(int val); 00152 vtkGetVector2Macro(LayerThicknessRange, int); 00153 00154 void SetCenterLon(int val); 00155 vtkGetVector2Macro(CenterLonRange, int); 00156 00157 void SetProjectLatLon(bool val); 00158 vtkGetMacro(ProjectLatLon, bool); 00159 00160 void SetIsAtmosphere(bool val); 00161 vtkGetMacro(IsAtmosphere, bool); 00162 00163 void SetIsZeroCentered(bool val); 00164 vtkGetMacro(IsZeroCentered, bool); 00165 00166 void SetShowMultilayerView(bool val); 00167 vtkGetMacro(ShowMultilayerView, bool); 00168 00170 static int CanReadFile(const char *filename); 00171 00172 protected: 00173 vtkMPASReader(); 00174 ~vtkMPASReader(); 00175 void DestroyData(); 00176 00177 char *FileName; // First field part file giving path 00178 /* 00179 int Rank; // Number of this processor 00180 int TotalRank; // Number of processors 00181 */ 00182 00183 // int NumberOfPieces; // Number of files in dataset 00184 // vtkIdType NumberOfTuples; // Number of tuples in sub extent 00185 00186 vtkStdString* VariableName; // Names of each variable 00187 int* VariableType; // Scalar, vector or tensor 00188 00189 int NumberOfTimeSteps; // Temporal domain 00190 double* TimeSteps; // Times available for request 00191 double DTime; 00192 00193 00194 // Observer to modify this object when array selections are modified 00195 vtkCallbackCommand* SelectionObserver; 00196 00197 int RequestData(vtkInformation *, vtkInformationVector **, 00198 vtkInformationVector *); 00199 int RequestInformation(vtkInformation *, vtkInformationVector **, 00200 vtkInformationVector *); 00201 00202 00203 static void SelectionCallback(vtkObject* caller, unsigned long eid, 00204 void* clientdata, void* calldata); 00205 00206 bool InfoRequested; 00207 bool DataRequested; 00208 00209 // params 00210 00211 // Selected field of interest 00212 vtkDataArraySelection* PointDataArraySelection; 00213 vtkDataArraySelection* CellDataArraySelection; 00214 00215 vtkDoubleArray** CellVarDataArray; // Actual data arrays 00216 vtkDoubleArray** PointVarDataArray; // Actual data arrays 00217 00218 int VerticalLevelSelected; 00219 int VerticalLevelRange[2]; 00220 00221 int LayerThickness; 00222 int LayerThicknessRange[2]; 00223 00224 int CenterLon; 00225 int CenterLonRange[2]; 00226 00227 bool ProjectLatLon; 00228 bool IsAtmosphere; 00229 bool IsZeroCentered; 00230 bool ShowMultilayerView; 00231 00232 bool IncludeTopography; 00233 bool DoBugFix; 00234 double CenterRad; 00235 00236 00237 // geometry 00238 int MaximumNVertLevels; 00239 int NumberOfCells; 00240 int NumberOfPoints; 00241 int CellOffset; 00242 int PointOffset; 00243 int PointsPerCell; 00244 int CurrentExtraPoint; // current extra point 00245 int CurrentExtraCell; // current extra cell 00246 double* PointX; // x coord of point 00247 double* PointY; // y coord of point 00248 double* PointZ; // z coord of point 00249 int ModNumPoints; 00250 int ModNumCells; 00251 int* OrigConnections; // original connections 00252 int* ModConnections; // modified connections 00253 int* CellMap; // maps from added cell to original cell # 00254 int* PointMap; // maps from added point to original point # 00255 int* MaximumLevelPoint; // 00256 int MaximumCells; // max cells 00257 int MaximumPoints; // max points 00258 int VerticalIndex; // for singleLayer, which vertical level 00259 00260 // vars 00261 int NumberOfCellVars; 00262 int NumberOfPointVars; 00263 double* PointVarData; 00264 00265 void SetDefaults(); 00266 int GetNcDims(); 00267 int CheckParams(); 00268 int GetNcVars(const char* cellDimName, const char* pointDimName); 00269 int ReadAndOutputGrid(bool init); 00270 int ReadAndOutputVariableData(); 00271 int BuildVarArrays(); 00272 int AllocSphereGeometry(); 00273 int AllocLatLonGeometry(); 00274 void ShiftLonData(); 00275 int AddMirrorPoint(int index, double dividerX); 00276 void FixPoints(); 00277 int EliminateXWrap(); 00278 void OutputPoints(bool init); 00279 void OutputCells(bool init); 00280 unsigned char GetCellType(); 00281 void LoadGeometryData(int var, double dTime); 00282 int LoadPointVarData(int variable, double dTime); 00283 int LoadCellVarData(int variable, double dTime); 00284 int RegenerateGeometry(); 00285 00286 private: 00287 vtkMPASReader(const vtkMPASReader&); // Not implemented. 00288 void operator=(const vtkMPASReader&); // Not implemented. 00289 class Internal; 00290 Internal *Internals; 00291 00292 }; 00293 00294 #endif