VTK  9.0.1
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 <cassert> // for assert()
31 #include <string> // for STL string
32 #include <vector> // for STL vector
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 // Class vtkEnzoReaderBlock (begin)
58 // ----------------------------------------------------------------------------
59 
61 {
62 public:
63  vtkEnzoReaderBlock() { this->Init(); }
64  ~vtkEnzoReaderBlock() { this->Init(); }
65  vtkEnzoReaderBlock(const vtkEnzoReaderBlock& other) { this->DeepCopy(&other); }
67  {
68  this->DeepCopy(&other);
69  return *this;
70  }
71 
72  int Index;
73  int Level;
74  int ParentId;
75  std::vector<int> ChildrenIds;
76 
81 
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 // Class vtkEnzoReaderBlock ( end )
102 // ----------------------------------------------------------------------------
103 
104 // ----------------------------------------------------------------------------
105 // Class vtkEnzoReaderInternal (begin)
106 // ----------------------------------------------------------------------------
107 
109 {
110 public:
113 
114  // number of all vtkDataSet (vtkImageData / vtkRectilinearGrid / vtkPolyData)
115  // objects that have been SUCCESSFULLY extracted and inserted to the output
116  // vtkMultiBlockDataSet (including rectilinear blocks and particle sets)
118 
124  char* FileName;
125  double DataTime;
127  // vtkAMREnzoReader * TheReader;
128 
133  std::vector<std::string> BlockAttributeNames;
134  std::vector<std::string> ParticleAttributeNames;
135  std::vector<std::string> TracerParticleAttributeNames;
136  std::vector<vtkEnzoReaderBlock> Blocks;
137 
138  void Init();
139  void ReleaseDataArray();
140  void SetFileName(char* fileName) { this->FileName = fileName; }
141  void ReadMetaData();
142  void GetAttributeNames();
143  void CheckAttributeNames();
144  void ReadBlockStructures();
145  void ReadGeneralParameters();
147  int LoadAttribute(const char* attribute, int blockIdx);
148  int GetBlockAttribute(const char* attribute, int blockIdx, vtkDataSet* pDataSet);
149  std::string GetBaseDirectory(const char* path) { return GetEnzoDirectory(path); }
150 };
151 
152 // ----------------------------------------------------------------------------
153 // Class vtkEnzoReaderInternal ( end )
154 // ----------------------------------------------------------------------------
155 
156 #endif /* vtkAMREnzoReaderInternal_h */
157 // VTK-HeaderTest-Exclude: vtkAMREnzoReaderInternal.h
std::vector< int > ChildrenIds
std::vector< std::string > ParticleAttributeNames
vtkEnzoReaderBlock(const vtkEnzoReaderBlock &other)
std::string GetBaseDirectory(const char *path)
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
std::vector< vtkEnzoReaderBlock > Blocks
std::vector< std::string > TracerParticleAttributeNames
void GetLevelBasedIds(std::vector< vtkEnzoReaderBlock > &blocks)
void SetFileName(char *fileName)
void DeepCopy(const vtkEnzoReaderBlock *other)
vtkEnzoReaderBlock & operator=(const vtkEnzoReaderBlock &other)
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
int GetBlockAttribute(const char *attribute, int blockIdx, vtkDataSet *pDataSet)
int LoadAttribute(const char *attribute, int blockIdx)
void GetParentWiseIds(std::vector< vtkEnzoReaderBlock > &blocks)
static std::string GetEnzoDirectory(const char *path)
std::vector< std::string > BlockAttributeNames