00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkCosmoReader.h,v $ 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 Program: VTK/ParaView Los Alamos National Laboratory Modules (PVLANL) 00018 Module: $RCSfile: vtkCosmoReader.h,v $ 00019 00020 Copyright (c) 2007, Los Alamos National Security, LLC 00021 00022 All rights reserved. 00023 00024 Copyright 2007. Los Alamos National Security, LLC. 00025 This software was produced under U.S. Government contract DE-AC52-06NA25396 00026 for Los Alamos National Laboratory (LANL), which is operated by 00027 Los Alamos National Security, LLC for the U.S. Department of Energy. 00028 The U.S. Government has rights to use, reproduce, and distribute this software. 00029 NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, 00030 EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. 00031 If software is modified to produce derivative works, such modified software 00032 should be clearly marked, so as not to confuse it with the version available 00033 from LANL. 00034 00035 Additionally, redistribution and use in source and binary forms, with or 00036 without modification, are permitted provided that the following conditions 00037 are met: 00038 - Redistributions of source code must retain the above copyright notice, 00039 this list of conditions and the following disclaimer. 00040 - Redistributions in binary form must reproduce the above copyright notice, 00041 this list of conditions and the following disclaimer in the documentation 00042 and/or other materials provided with the distribution. 00043 - Neither the name of Los Alamos National Security, LLC, Los Alamos National 00044 Laboratory, LANL, the U.S. Government, nor the names of its contributors 00045 may be used to endorse or promote products derived from this software 00046 without specific prior written permission. 00047 00048 THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS 00049 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00050 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00051 ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR 00052 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00053 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00054 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00055 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00056 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00057 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00058 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00059 00060 =========================================================================*/ 00094 #ifndef __vtkCosmoReader_h 00095 #define __vtkCosmoReader_h 00096 00097 #include "vtkUnstructuredGridAlgorithm.h" 00098 00099 class vtkDataArraySelection; 00100 class vtkStdString; 00101 00102 class VTK_IO_EXPORT vtkCosmoReader : public vtkUnstructuredGridAlgorithm 00103 { 00104 public: 00105 static vtkCosmoReader *New(); 00106 vtkTypeRevisionMacro(vtkCosmoReader, vtkUnstructuredGridAlgorithm); 00107 void PrintSelf(ostream& os, vtkIndent indent); 00108 00110 00111 vtkSetStringMacro(FileName); 00112 vtkGetStringMacro(FileName); 00114 00116 00117 vtkGetMacro(NumberOfNodes, int); 00119 00121 00122 vtkGetMacro(NumberOfVariables, int); 00124 00126 00127 vtkUnstructuredGrid *GetOutput(); 00128 vtkUnstructuredGrid *GetOutput(int index); 00130 00132 00133 void SetByteOrderToBigEndian(); 00134 void SetByteOrderToLittleEndian(); 00135 vtkSetMacro(ByteOrder, int); 00136 vtkGetMacro(ByteOrder, int); 00138 00139 // Set/Get the stride for reading a subset of the particles 00140 vtkSetMacro(Stride, int); 00141 vtkGetMacro(Stride, int); 00142 00143 // Set/Get the box size for the simulation (range along x,y,z) 00144 // Negative x,y,z values are subtracted from this for wraparound 00145 vtkSetMacro(BoxSize, double); 00146 vtkGetMacro(BoxSize, double); 00147 00149 00150 vtkSetVector2Macro(PositionRange, int); 00151 vtkGetVector2Macro(PositionRange, int); 00153 00155 void ComputeDefaultRange(); 00156 00158 00161 int GetNumberOfPointArrays(); 00162 const char* GetPointArrayName(int index); 00163 int GetPointArrayStatus(const char* name); 00164 void SetPointArrayStatus(const char* name, int status); 00165 void DisableAllPointArrays(); 00166 void EnableAllPointArrays(); 00168 00170 00172 vtkSetMacro(MakeCells, int); 00173 vtkGetMacro(MakeCells, int); 00175 00176 protected: 00177 vtkCosmoReader(); 00178 ~vtkCosmoReader(); 00179 00180 int RequestInformation(vtkInformation *, 00181 vtkInformationVector **, vtkInformationVector *); 00182 int RequestData(vtkInformation *, 00183 vtkInformationVector **, vtkInformationVector *); 00184 00185 char* FileName; // Name of binary particle file 00186 ifstream *FileStream; // Data stream 00187 00188 int TotalRank; // Number of processors reading data 00189 int Rank; // Which processor is running 00190 00191 vtkIdType NumberOfNodes; // Number of particles 00192 int NumberOfVariables; // Number of attached data variables 00193 00194 int ByteOrder; // Endian 00195 int Stride; // Read in every nth data particle 00196 int PositionRange[2]; // Range of particle indices 00197 double BoxSize; // Maximum of x,y,z locations from simulation 00198 00199 // Selected field of interest 00200 vtkDataArraySelection* PointDataArraySelection; 00201 00202 vtkStdString *VariableName; 00203 vtkIdType *ComponentNumber; // Components per variable 00204 00205 int MakeCells; 00206 00207 private: 00208 vtkCosmoReader(const vtkCosmoReader&); // Not implemented. 00209 void operator=(const vtkCosmoReader&); // Not implemented. 00210 00211 void ReadFile(vtkUnstructuredGrid *output); 00212 }; 00213 00214 #endif 00215