VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkAMREnzoReaderInternal.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 =========================================================================*/ 00024 #ifndef VTKAMRENZOREADERINTERNAL_HPP_ 00025 #define VTKAMRENZOREADERINTERNAL_HPP_ 00026 00027 #include "vtksys/SystemTools.hxx" 00028 00029 #include <vector> // for STL vector 00030 #include <string> // for STL string 00031 #include <cassert> // for assert() 00032 00033 class vtkDataArray; 00034 class vtkDataSet; 00035 00036 /***************************************************************************** 00037 * 00038 * Copyright (c) 2000 - 2009, Lawrence Livermore National Security, LLC 00039 * Produced at the Lawrence Livermore National Laboratory 00040 * LLNL-CODE-400124 00041 * All rights reserved. 00042 * 00043 * This file was adapted from the VisIt Enzo reader (avtEnzoFileFormat). For 00044 * details, see https://visit.llnl.gov/. The full copyright notice is contained 00045 * in the file COPYRIGHT located at the root of the VisIt distribution or at 00046 * http://www.llnl.gov/visit/copyright.html. 00047 * 00048 *****************************************************************************/ 00049 00050 static std::string GetEnzoDirectory( const char* path ) 00051 { 00052 return( vtksys::SystemTools::GetFilenamePath( std::string(path) ) ); 00053 } 00054 00055 00056 // ---------------------------------------------------------------------------- 00057 // Class vtkEnzoReaderBlock (begin) 00058 // ---------------------------------------------------------------------------- 00059 00060 00061 class vtkEnzoReaderBlock 00062 { 00063 public: 00064 vtkEnzoReaderBlock() { this->Init(); } 00065 ~vtkEnzoReaderBlock() { this->Init(); } 00066 00067 int Index; 00068 int Level; 00069 int ParentId; 00070 std::vector< int > ChildrenIds; 00071 00072 int MinParentWiseIds[3]; 00073 int MaxParentWiseIds[3]; 00074 int MinLevelBasedIds[3]; 00075 int MaxLevelBasedIds[3]; 00076 00077 int NumberOfParticles; 00078 int NumberOfDimensions; 00079 int BlockCellDimensions[3]; 00080 int BlockNodeDimensions[3]; 00081 00082 double MinBounds[3]; 00083 double MaxBounds[3]; 00084 double SubdivisionRatio[3]; 00085 00086 std::string BlockFileName; 00087 std::string ParticleFileName; 00088 00089 void Init(); 00090 void GetParentWiseIds( std::vector< vtkEnzoReaderBlock > & blocks ); 00091 void GetLevelBasedIds( std::vector< vtkEnzoReaderBlock > & blocks ); 00092 }; 00093 00094 00095 // ---------------------------------------------------------------------------- 00096 // Class vtkEnzoReaderBlock ( end ) 00097 // ---------------------------------------------------------------------------- 00098 00099 00100 // ---------------------------------------------------------------------------- 00101 // Class vtkEnzoReaderInternal (begin) 00102 // ---------------------------------------------------------------------------- 00103 00104 00105 class vtkEnzoReaderInternal 00106 { 00107 public: 00108 vtkEnzoReaderInternal(); 00109 ~vtkEnzoReaderInternal(); 00110 00111 // number of all vtkDataSet (vtkImageData / vtkRectilinearGrid / vtkPolyData) 00112 // objects that have been SUCCESSFULLY extracted and inserted to the output 00113 // vtkMultiBlockDataSet (including rectilinear blocks and particle sets) 00114 int NumberOfMultiBlocks; 00115 00116 int NumberOfDimensions; 00117 int NumberOfLevels; 00118 int NumberOfBlocks; 00119 int ReferenceBlock; 00120 int CycleIndex; 00121 char * FileName; 00122 double DataTime; 00123 vtkDataArray * DataArray; 00124 // vtkAMREnzoReader * TheReader; 00125 00126 std::string DirectoryName; 00127 std::string MajorFileName; 00128 std::string BoundaryFileName; 00129 std::string HierarchyFileName; 00130 std::vector< std::string > BlockAttributeNames; 00131 std::vector< std::string > ParticleAttributeNames; 00132 std::vector< std::string > TracerParticleAttributeNames; 00133 std::vector< vtkEnzoReaderBlock > Blocks; 00134 00135 void Init(); 00136 void ReleaseDataArray(); 00137 void SetFileName( char * fileName ) { this->FileName = fileName; } 00138 void ReadMetaData(); 00139 void GetAttributeNames(); 00140 void CheckAttributeNames(); 00141 void ReadBlockStructures(); 00142 void ReadGeneralParameters(); 00143 void DetermineRootBoundingBox(); 00144 int LoadAttribute( const char *attribute, int blockIdx ); 00145 int GetBlockAttribute( 00146 const char* attribute, int blockIdx, vtkDataSet* pDataSet ); 00147 std::string GetBaseDirectory(const char* path) 00148 {return GetEnzoDirectory(path); }; 00149 00150 00151 }; 00152 00153 00154 00155 00156 // ---------------------------------------------------------------------------- 00157 // Class vtkEnzoReaderInternal ( end ) 00158 // ---------------------------------------------------------------------------- 00159 00160 #endif /* VTKAMRENZOREADERINTERNAL_HPP_ */ 00161 // VTK-HeaderTest-Exclude: vtkAMREnzoReaderInternal.h