11#ifndef vtkAMReXGridReaderInternal_h
12#define vtkAMReXGridReaderInternal_h
21VTK_ABI_NAMESPACE_BEGIN
89 std::string vectorNamePrefix =
"amrexvec";
111 std::vector<std::vector<std::vector<std::vector<double>>>>
levelCells;
131 bool Parse(
const std::string& headerData);
141 std::string GetBaseVariableName(
const std::string& name);
144 int CheckComponent(
const std::string& name);
147 bool HasVectorPrefix(
const std::string& name);
167 NoFabHeaderMinMax_v1 = 3,
169 NoFabHeaderFAMinMax_v1 = 4
203 bool Parse(
int _level,
int _dim,
const std::string& headerData);
245 std::size_t
ReadBoxArray(std::istream& is,
int* boxArray,
int* boxArrayDim);
249 std::istream& is, std::size_t numberOfPoints, std::size_t size,
char* buffer);
252 void PermuteOrder(
void* out,
const void* in, std::size_t nitems,
const int* outord,
253 const int* inord, std::size_t REALSIZE);
255 template <
typename T>
257 const RealDescriptor* ird,
const std::vector<std::vector<char>>& buffers,
258 std::size_t numberOfPoints,
const std::string& attribute);
268 friend class vtkAMReXGridLeveHeader;
274 const std::vector<std::vector<char>>& buffers, std::size_t numberOfPoints,
275 const std::string& attribute)
277 int nComps =
static_cast<int>(this->Header->parsedVariableNames[attribute].size());
280 nComps =
static_cast<int>(this->Header->extraMultiFabParsedVarNames[attribute].size());
286 dataArray->
SetName(attribute.c_str());
289 T* arrayPtr =
new T[numberOfPoints];
290 for (
int j = 0; j < nComps; ++j)
292 this->Convert(arrayPtr, buffers[j].data(), numberOfPoints, *ord, *ird);
295 for (std::size_t i = 0; i < numberOfPoints; ++i)
const int * order() const &
const std::vector< long > & formatarray() const &
const std::vector< int > & orderarray() const &
std::size_t numBytes() const
const long * format() const &
RealDescriptor(const long *format, const int *order, int order_length)
Consists of the low-level AMReX Reader used by the vtkAMReXGridReader.
void ReadFAB(std::istream &is)
void ReadFormat(std::istream &is, std::vector< long > &ar)
vtkAMReXGridReaderInternal()
std::vector< vtkAMReXGridLevelHeader * > LevelHeader
void GetBlockAttribute(const char *attribute, int blockIdx, vtkDataSet *pDataSet)
void PrintSelf(std::ostream &os, vtkIndent indent)
void DestroyLevelHeader()
bool ReadExtraFabHeader()
vtkIdType GetAttributeOffsetExtraMultiFab(const char *attribute, int fabIndex)
RealDescriptor * ReadRealDescriptor(std::istream &is)
int GetBlockLevel(int blockIdx)
vtkIdType GetOffsetOfAttribute(const char *attribute)
void PrintBoxArray(int *boxArray)
int GetBlockIndexWithinLevel(int blockIdx, int level)
void Convert(void *out, const void *in, std::size_t nitems, const RealDescriptor &ord, const RealDescriptor &ird)
int ReadNumberOfAttributes(std::istream &is)
bool extraMultiFabHeadersAreRead
void PrintOrder(std::vector< int > &ar)
void CreateVTKAttributeArray(vtkAOSDataArrayTemplate< T > *dataArray, const RealDescriptor *ord, const RealDescriptor *ird, const std::vector< std::vector< char > > &buffers, std::size_t numberOfPoints, const std::string &attribute)
void PermuteOrder(void *out, const void *in, std::size_t nitems, const int *outord, const int *inord, std::size_t REALSIZE)
int GetExtraMultiFabIndex(const char *attribute)
void PrintFormat(std::vector< long > &ar)
void ReadBlockAttribute(std::istream &is, std::size_t numberOfPoints, std::size_t size, char *buffer)
int ReadVersion(std::istream &is)
std::vector< std::vector< vtkAMReXGridLevelHeader * > > ExtraMultiFabHeader
void SetFileName(char *fName)
void GetExtraMultiFabBlockAttribute(const char *attribute, int blockIdx, vtkDataSet *pDataSet)
~vtkAMReXGridReaderInternal()
vtkAMReXGridHeader * Header
std::size_t ReadBoxArray(std::istream &is, int *boxArray, int *boxArrayDim)
void ReadOrder(std::istream &is, std::vector< int > &ar)
Array-Of-Structs implementation of vtkGenericDataArray.
void SetTypedComponent(vtkIdType tupleIdx, int comp, ValueType value)
Set component comp of the tuple at tupleIdx to value.
virtual void SetName(const char *)
Set/get array's name.
abstract class to specify dataset behavior
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
void SetNumberOfTuples(vtkIdType number) override
Set the number of tuples (a component group) in the array.
a simple class to control print indentation