VTK
vtkAMREnzoReaderInternal.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAMREnzoReaderInternal.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
25 #ifndef vtkAMREnzoReaderInternal_h
26 #define vtkAMREnzoReaderInternal_h
27 
28 #include "vtksys/SystemTools.hxx"
29 
30 #include <vector> // for STL vector
31 #include <string> // for STL string
32 #include <cassert> // for assert()
33 
34 class vtkDataArray;
35 class vtkDataSet;
36 
37 /*****************************************************************************
38 *
39 * Copyright (c) 2000 - 2009, Lawrence Livermore National Security, LLC
40 * Produced at the Lawrence Livermore National Laboratory
41 * LLNL-CODE-400124
42 * All rights reserved.
43 *
44 * This file was adapted from the VisIt Enzo reader (avtEnzoFileFormat). For
45 * details, see https://visit.llnl.gov/. The full copyright notice is contained
46 * in the file COPYRIGHT located at the root of the VisIt distribution or at
47 * http://www.llnl.gov/visit/copyright.html.
48 *
49 *****************************************************************************/
50 
51 static std::string GetEnzoDirectory( const char* path )
52 {
53  return( vtksys::SystemTools::GetFilenamePath( std::string(path) ) );
54 }
55 
56 
57 // ----------------------------------------------------------------------------
58 // Class vtkEnzoReaderBlock (begin)
59 // ----------------------------------------------------------------------------
60 
61 
63 {
64 public:
65  vtkEnzoReaderBlock() { this->Init(); }
66  ~vtkEnzoReaderBlock() { this->Init(); }
68  { this->DeepCopy(&other); }
70  { this->DeepCopy(&other); return *this; }
71 
72  int Index;
73  int Level;
74  int ParentId;
75  std::vector< int > ChildrenIds;
76 
80  int MaxLevelBasedIds[3];
81 
85  int BlockNodeDimensions[3];
86 
87  double MinBounds[3];
88  double MaxBounds[3];
89  double SubdivisionRatio[3];
90 
93 
94  void Init();
95  void DeepCopy(const vtkEnzoReaderBlock *other);
96  void GetParentWiseIds( std::vector< vtkEnzoReaderBlock > & blocks );
97  void GetLevelBasedIds( std::vector< vtkEnzoReaderBlock > & blocks );
98 };
99 
100 
101 // ----------------------------------------------------------------------------
102 // Class vtkEnzoReaderBlock ( end )
103 // ----------------------------------------------------------------------------
104 
105 
106 // ----------------------------------------------------------------------------
107 // Class vtkEnzoReaderInternal (begin)
108 // ----------------------------------------------------------------------------
109 
110 
112 {
113 public:
116 
117  // number of all vtkDataSet (vtkImageData / vtkRectilinearGrid / vtkPolyData)
118  // objects that have been SUCCESSFULLY extracted and inserted to the output
119  // vtkMultiBlockDataSet (including rectilinear blocks and particle sets)
121 
127  char * FileName;
128  double DataTime;
130 // vtkAMREnzoReader * TheReader;
131 
136  std::vector< std::string > BlockAttributeNames;
137  std::vector< std::string > ParticleAttributeNames;
138  std::vector< std::string > TracerParticleAttributeNames;
139  std::vector< vtkEnzoReaderBlock > Blocks;
140 
141  void Init();
143  void SetFileName( char * fileName ) { this->FileName = fileName; }
144  void ReadMetaData();
145  void GetAttributeNames();
146  void CheckAttributeNames();
147  void ReadBlockStructures();
148  void ReadGeneralParameters();
150  int LoadAttribute( const char *attribute, int blockIdx );
151  int GetBlockAttribute(
152  const char* attribute, int blockIdx, vtkDataSet* pDataSet );
153  std::string GetBaseDirectory(const char* path)
154  {return GetEnzoDirectory(path); };
155 
156 
157 };
158 
159 
160 
161 
162 // ----------------------------------------------------------------------------
163 // Class vtkEnzoReaderInternal ( end )
164 // ----------------------------------------------------------------------------
165 
166 #endif /* vtkAMREnzoReaderInternal_h */
167 // VTK-HeaderTest-Exclude: vtkAMREnzoReaderInternal.h
vtkEnzoReaderBlock::MaxBounds
double MaxBounds[3]
Definition: vtkAMREnzoReaderInternal.h:87
vtkEnzoReaderBlock
Definition: vtkAMREnzoReaderInternal.h:61
vtkEnzoReaderInternal::NumberOfMultiBlocks
int NumberOfMultiBlocks
Definition: vtkAMREnzoReaderInternal.h:119
vtkEnzoReaderInternal::DetermineRootBoundingBox
void DetermineRootBoundingBox()
vtkEnzoReaderInternal::NumberOfDimensions
int NumberOfDimensions
Definition: vtkAMREnzoReaderInternal.h:121
vtkEnzoReaderBlock::MaxLevelBasedIds
int MaxLevelBasedIds[3]
Definition: vtkAMREnzoReaderInternal.h:79
vtkEnzoReaderInternal::Blocks
std::vector< vtkEnzoReaderBlock > Blocks
Definition: vtkAMREnzoReaderInternal.h:138
vtkEnzoReaderBlock::BlockCellDimensions
int BlockCellDimensions[3]
Definition: vtkAMREnzoReaderInternal.h:83
vtkEnzoReaderBlock::Level
int Level
Definition: vtkAMREnzoReaderInternal.h:72
vtkEnzoReaderBlock::MinLevelBasedIds
int MinLevelBasedIds[3]
Definition: vtkAMREnzoReaderInternal.h:78
vtkEnzoReaderBlock::SubdivisionRatio
double SubdivisionRatio[3]
Definition: vtkAMREnzoReaderInternal.h:88
vtkEnzoReaderInternal
Definition: vtkAMREnzoReaderInternal.h:110
vtkEnzoReaderInternal::DirectoryName
std::string DirectoryName
Definition: vtkAMREnzoReaderInternal.h:131
vtkEnzoReaderInternal::TracerParticleAttributeNames
std::vector< std::string > TracerParticleAttributeNames
Definition: vtkAMREnzoReaderInternal.h:137
vtkEnzoReaderBlock::Index
int Index
Definition: vtkAMREnzoReaderInternal.h:71
vtkEnzoReaderBlock::~vtkEnzoReaderBlock
~vtkEnzoReaderBlock()
Definition: vtkAMREnzoReaderInternal.h:65
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkEnzoReaderInternal::CycleIndex
int CycleIndex
Definition: vtkAMREnzoReaderInternal.h:125
vtkEnzoReaderInternal::ReferenceBlock
int ReferenceBlock
Definition: vtkAMREnzoReaderInternal.h:124
vtkEnzoReaderInternal::GetBlockAttribute
int GetBlockAttribute(const char *attribute, int blockIdx, vtkDataSet *pDataSet)
vtkEnzoReaderInternal::CheckAttributeNames
void CheckAttributeNames()
vtkEnzoReaderInternal::DataTime
double DataTime
Definition: vtkAMREnzoReaderInternal.h:127
GetEnzoDirectory
static std::string GetEnzoDirectory(const char *path)
Definition: vtkAMREnzoReaderInternal.h:50
vtkEnzoReaderInternal::ReadGeneralParameters
void ReadGeneralParameters()
vtkEnzoReaderBlock::BlockFileName
std::string BlockFileName
Definition: vtkAMREnzoReaderInternal.h:90
vtkEnzoReaderBlock::vtkEnzoReaderBlock
vtkEnzoReaderBlock()
Definition: vtkAMREnzoReaderInternal.h:64
vtkEnzoReaderBlock::Init
void Init()
vtkEnzoReaderInternal::ReadBlockStructures
void ReadBlockStructures()
vtkEnzoReaderInternal::ParticleAttributeNames
std::vector< std::string > ParticleAttributeNames
Definition: vtkAMREnzoReaderInternal.h:136
vtkEnzoReaderBlock::MinBounds
double MinBounds[3]
Definition: vtkAMREnzoReaderInternal.h:86
vtkEnzoReaderInternal::ReadMetaData
void ReadMetaData()
vtkEnzoReaderBlock::BlockNodeDimensions
int BlockNodeDimensions[3]
Definition: vtkAMREnzoReaderInternal.h:84
vtkEnzoReaderInternal::BoundaryFileName
std::string BoundaryFileName
Definition: vtkAMREnzoReaderInternal.h:133
vtkEnzoReaderBlock::NumberOfDimensions
int NumberOfDimensions
Definition: vtkAMREnzoReaderInternal.h:82
vtkEnzoReaderBlock::ParentId
int ParentId
Definition: vtkAMREnzoReaderInternal.h:73
vtkEnzoReaderInternal::HierarchyFileName
std::string HierarchyFileName
Definition: vtkAMREnzoReaderInternal.h:134
vtkEnzoReaderInternal::SetFileName
void SetFileName(char *fileName)
Definition: vtkAMREnzoReaderInternal.h:142
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkEnzoReaderInternal::Init
void Init()
vtkX3D::string
Definition: vtkX3D.h:490
vtkEnzoReaderInternal::DataArray
vtkDataArray * DataArray
Definition: vtkAMREnzoReaderInternal.h:128
vtkEnzoReaderInternal::FileName
char * FileName
Definition: vtkAMREnzoReaderInternal.h:126
vtkEnzoReaderInternal::NumberOfBlocks
int NumberOfBlocks
Definition: vtkAMREnzoReaderInternal.h:123
vtkEnzoReaderInternal::NumberOfLevels
int NumberOfLevels
Definition: vtkAMREnzoReaderInternal.h:122
vtkEnzoReaderBlock::GetParentWiseIds
void GetParentWiseIds(std::vector< vtkEnzoReaderBlock > &blocks)
vtkEnzoReaderInternal::GetBaseDirectory
std::string GetBaseDirectory(const char *path)
Definition: vtkAMREnzoReaderInternal.h:152
vtkEnzoReaderBlock::ParticleFileName
std::string ParticleFileName
Definition: vtkAMREnzoReaderInternal.h:91
vtkEnzoReaderBlock::DeepCopy
void DeepCopy(const vtkEnzoReaderBlock *other)
vtkEnzoReaderInternal::ReleaseDataArray
void ReleaseDataArray()
vtkEnzoReaderBlock::NumberOfParticles
int NumberOfParticles
Definition: vtkAMREnzoReaderInternal.h:81
vtkEnzoReaderInternal::~vtkEnzoReaderInternal
~vtkEnzoReaderInternal()
vtkEnzoReaderBlock::ChildrenIds
std::vector< int > ChildrenIds
Definition: vtkAMREnzoReaderInternal.h:74
vtkEnzoReaderBlock::GetLevelBasedIds
void GetLevelBasedIds(std::vector< vtkEnzoReaderBlock > &blocks)
vtkEnzoReaderInternal::MajorFileName
std::string MajorFileName
Definition: vtkAMREnzoReaderInternal.h:132
vtkEnzoReaderInternal::LoadAttribute
int LoadAttribute(const char *attribute, int blockIdx)
vtkEnzoReaderBlock::MinParentWiseIds
int MinParentWiseIds[3]
Definition: vtkAMREnzoReaderInternal.h:76
vtkEnzoReaderInternal::vtkEnzoReaderInternal
vtkEnzoReaderInternal()
vtkEnzoReaderInternal::BlockAttributeNames
std::vector< std::string > BlockAttributeNames
Definition: vtkAMREnzoReaderInternal.h:135
vtkEnzoReaderBlock::MaxParentWiseIds
int MaxParentWiseIds[3]
Definition: vtkAMREnzoReaderInternal.h:77
vtkEnzoReaderInternal::GetAttributeNames
void GetAttributeNames()
vtkEnzoReaderBlock::operator=
vtkEnzoReaderBlock & operator=(const vtkEnzoReaderBlock &other)
Definition: vtkAMREnzoReaderInternal.h:68