16#if !defined(_PIODATAPIO_H)
30VTK_ABI_NAMESPACE_BEGIN
40 const std::list<std::string>* fields_to_read =
nullptr,
bool _defer_read_data =
true,
41 const std::set<const char*, Cstring_less>* rdata =
nullptr,
42 const std::set<const char*, Cstring_less>* cdata =
nullptr);
51 inline bool good_read()
override {
return (pio_field !=
nullptr) ? true :
false; }
79 void GetPIOData(
const char*,
const double*&,
const char*&);
85 const char* var,
int materialId)
override;
93 if (RealData.find(_name) == RealData.end())
94 RealData.insert(strdup(_name));
98 if (CharData.find(_name) == CharData.end())
99 CharData.insert(strdup(_name));
105 std::set<const char*, Cstring_less> RealData;
106 std::set<const char*, Cstring_less> CharData;
108 std::istream* Infile;
112 int PIO_HEADER_LENGTH;
113 int PIO_INDEX_LENGTH;
114 const char* pio_dandt;
116 int64_t pio_position;
119 bool defer_read_data;
121 size_t timertype_len;
125 void ReadPioFieldData(
PIO_FIELD& pio_field);
126 bool read(
const char*,
const std::list<std::string>* fields_to_read =
nullptr);
127 bool read(
const std::list<std::string>* fields_to_read =
nullptr);
128 inline void byte_flip(
char* word, int64_t size)
130 if (size_buf < (
size_t)size)
134 buf =
new char[size_buf];
136 memcpy((
void*)buf, (
const void*)word, size);
137 for (int64_t i = 0; i < size; ++i)
138 word[i] = buf[size - 1 - i];
142 inline T read_pio_word(T& val)
145 this->Infile->read((
char*)&word,
sizeof(word));
147 byte_flip((
char*)&word,
sizeof(word));
152 inline bool read_pio_bool()
155 this->Infile->read((
char*)&word,
sizeof(word));
157 byte_flip((
char*)&word,
sizeof(word));
158 return (word != 0) ? true :
false;
161 inline void fstr2Cstr(
char* s,
size_t len)
const
172 inline char* read_pio_char_string(
size_t len)
178 buf =
new char[size_buf];
180 this->Infile->read(buf, len);
183 char* val =
new char[strlen(buf) + 1];
188 inline void insert_VAR_MAP_pairs()
190 for (
int i = 0; i < pio_num; ++i)
192 if (pio_field[i].read_field_data)
194#if !defined __SUNPRO_CC
195 VarMMap.insert(std::make_pair(pio_field[i].pio_name, pio_field + i));
197 VAR_MAP::value_type
type(pio_field[i].pio_name, pio_field + i);
204 inline bool read_field(
const char* pio_name,
const std::list<std::string>* fields_to_read)
206 std::string spio_name = std::string(pio_name);
207 if (fields_to_read ==
nullptr)
211 for (std::list<std::string>::const_iterator pos = fields_to_read->begin();
212 pos != fields_to_read->end(); ++pos)
214 if (spio_name == *pos)
bool IsPIOfile(const char *)
bool GetPIOfileTime(const char *, double &)
class for reading PIO (Parallel Input Output) data files
bool set_scalar_field(std::valarray< int64_t > &, const char *) override
PIO_FIELD * get_pio_field() const override
int get_PIO_NAME_LENGTH() const
bool reconstruct_chunk_field(int64_t numcell, std::valarray< double > &va, const char *prefix, const char *var, int materialId) override
void print(std::ostream &)
bool get_gridsize(std::valarray< int > &) override
int64_t get_num_cells() override
int get_dimension() override
bool get_gridorigin(std::valarray< double > &) override
bool get_reverse_endian() const
void GetPIOData(PIO_FIELD &, const double *&, const char *&)
int get_PIO_VERSION() const
int get_pio_num() const override
void AddCharData(const char *_name)
void GetPIOData(PIO_FIELD &, const double *&)
void GetPIOData(PIO_FIELD &, const char *&)
int get_num_components(const char *) const override
void AddRealData(const char *_name)
std::string get_username() override
PIO_DATA_PIO(const char *piofile=nullptr, const std::list< std::string > *fields_to_read=nullptr, bool _defer_read_data=true, const std::set< const char *, Cstring_less > *rdata=nullptr, const std::set< const char *, Cstring_less > *cdata=nullptr)
int get_num_materials() const override
bool has_field(const char *) override
void FreePIOData(PIO_FIELD &pio_field)
const char * get_pio_dandt() const
std::string get_problemname() override
std::string get_eap_version() override
bool set_scalar_field(std::valarray< int > &, const char *) override
int get_pio_signature() const
bool GetPIOfileTime(const char *, double &)
const double * GetPIOData(PIO_FIELD &)
double GetPIOData(const char *, int)
void GetPIOData(const char *, const double *&)
bool set_scalar_field(std::valarray< double > &, const char *) override
double get_simtime() override
void GetPIOData(const char *, const double *&, const char *&)
bool get_tracer_variable_names(std::valarray< std::string > &) override
int get_PIO_HEADER_LENGTH() const
bool get_material_names(std::valarray< std::string > &) override
const double * GetPIOData(const char *)
bool good_read() override
int get_pio_num_with_size(int64_t n) const
const char * get_name() const
void GetPIOData(const char *, const char *&)
bool set_vector_field(std::valarray< std::valarray< double > > &, const char *) override
int get_PIO_INDEX_LENGTH() const
bool get_gridscale(std::valarray< double > &) override
class for reading PIO (Parallel Input Output) data files