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 vtkEnzoReaderBlock(const vtkEnzoReaderBlock& other) 00067 { this->DeepCopy(&other); } 00068 vtkEnzoReaderBlock& operator=(const vtkEnzoReaderBlock& other) 00069 { this->DeepCopy(&other); return *this; } 00070 00071 int Index; 00072 int Level; 00073 int ParentId; 00074 std::vector< int > ChildrenIds; 00075 00076 int MinParentWiseIds[3]; 00077 int MaxParentWiseIds[3]; 00078 int MinLevelBasedIds[3]; 00079 int MaxLevelBasedIds[3]; 00080 00081 int NumberOfParticles; 00082 int NumberOfDimensions; 00083 int BlockCellDimensions[3]; 00084 int BlockNodeDimensions[3]; 00085 00086 double MinBounds[3]; 00087 double MaxBounds[3]; 00088 double SubdivisionRatio[3]; 00089 00090 std::string BlockFileName; 00091 std::string ParticleFileName; 00092 00093 void Init(); 00094 void DeepCopy(const vtkEnzoReaderBlock *other); 00095 void GetParentWiseIds( std::vector< vtkEnzoReaderBlock > & blocks ); 00096 void GetLevelBasedIds( std::vector< vtkEnzoReaderBlock > & blocks ); 00097 }; 00098 00099 00100 // ---------------------------------------------------------------------------- 00101 // Class vtkEnzoReaderBlock ( end ) 00102 // ---------------------------------------------------------------------------- 00103 00104 00105 // ---------------------------------------------------------------------------- 00106 // Class vtkEnzoReaderInternal (begin) 00107 // ---------------------------------------------------------------------------- 00108 00109 00110 class vtkEnzoReaderInternal 00111 { 00112 public: 00113 vtkEnzoReaderInternal(); 00114 ~vtkEnzoReaderInternal(); 00115 00116 // number of all vtkDataSet (vtkImageData / vtkRectilinearGrid / vtkPolyData) 00117 // objects that have been SUCCESSFULLY extracted and inserted to the output 00118 // vtkMultiBlockDataSet (including rectilinear blocks and particle sets) 00119 int NumberOfMultiBlocks; 00120 00121 int NumberOfDimensions; 00122 int NumberOfLevels; 00123 int NumberOfBlocks; 00124 int ReferenceBlock; 00125 int CycleIndex; 00126 char * FileName; 00127 double DataTime; 00128 vtkDataArray * DataArray; 00129 // vtkAMREnzoReader * TheReader; 00130 00131 std::string DirectoryName; 00132 std::string MajorFileName; 00133 std::string BoundaryFileName; 00134 std::string HierarchyFileName; 00135 std::vector< std::string > BlockAttributeNames; 00136 std::vector< std::string > ParticleAttributeNames; 00137 std::vector< std::string > TracerParticleAttributeNames; 00138 std::vector< vtkEnzoReaderBlock > Blocks; 00139 00140 void Init(); 00141 void ReleaseDataArray(); 00142 void SetFileName( char * fileName ) { this->FileName = fileName; } 00143 void ReadMetaData(); 00144 void GetAttributeNames(); 00145 void CheckAttributeNames(); 00146 void ReadBlockStructures(); 00147 void ReadGeneralParameters(); 00148 void DetermineRootBoundingBox(); 00149 int LoadAttribute( const char *attribute, int blockIdx ); 00150 int GetBlockAttribute( 00151 const char* attribute, int blockIdx, vtkDataSet* pDataSet ); 00152 std::string GetBaseDirectory(const char* path) 00153 {return GetEnzoDirectory(path); }; 00154 00155 00156 }; 00157 00158 00159 00160 00161 // ---------------------------------------------------------------------------- 00162 // Class vtkEnzoReaderInternal ( end ) 00163 // ---------------------------------------------------------------------------- 00164 00165 #endif /* VTKAMRENZOREADERINTERNAL_HPP_ */ 00166 // VTK-HeaderTest-Exclude: vtkAMREnzoReaderInternal.h