Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fieldIO.h
Go to the documentation of this file.
1 
14 #ifndef FIELDIO_INCLUDED
15 #define FIELDIO_INCLUDED
16 
17 #include <string>
18 #include <stdint.h>
19 #include <vector>
20 
21 #include "Field/field.h"
22 #include "Field/index_lex.h"
24 #include "io_format.h"
25 
27 
53 class FieldIO
54 {
55  public:
56  static const std::string class_name;
57 
58  private:
60 
61  protected:
63 
65 
66  public:
67 
69  FieldIO(const IO_Format::Format *format) : m_format(format), m_vl(CommonParameters::Vlevel()) {}
70  virtual ~FieldIO() {}
71 
72  private:
73  // non-copyable
74  FieldIO(const FieldIO&);
75  FieldIO& operator=(const FieldIO&);
76 
77  public:
78 
79  virtual void read_file(Field *v, std::string) = 0;
80  virtual void write_file(Field *v, std::string) = 0;
81 
82  virtual void read_file(std::vector<Field *>& vv, const std::string& filename);
83  virtual void write_file(std::vector<Field *>& vv, const std::string& filename);
84 
85  void deliver(Field *vlocal, Field *vglobal);
86  void gather(Field *vglobal, Field *vlocal);
87 
88 // protected:
89 
91  static void byte_swap(void *buf, size_t size, size_t nmemb)
92  {
93  return convert_endian(buf, size, nmemb);
94  }
95 
97  static void convert_endian(void *buf, size_t size, size_t nmemb);
98 
100  static bool is_bigendian();
101 };
102 #endif
Index_lex idx
Definition: fieldIO.h:59
virtual ~FieldIO()
Definition: fieldIO.h:70
static void byte_swap(void *buf, size_t size, size_t nmemb)
< convert byte order. alternative interface.
Definition: fieldIO.h:91
static const std::string class_name
Definition: fieldIO.h:56
void deliver(Field *vlocal, Field *vglobal)
distribute data on primary node over parallel nodes.
Definition: fieldIO.cpp:30
Container of Field-type object.
Definition: field.h:45
FieldIO(const IO_Format::Format *format)
< constructor. format specifies data layout on file.
Definition: fieldIO.h:69
FieldIO & operator=(const FieldIO &)
static bool is_bigendian()
Definition: fieldIO.cpp:206
Common parameter class: provides parameters as singleton.
Lexical site index.
Definition: index_lex.h:34
const IO_Format::Format * m_format
Definition: fieldIO.h:62
VerboseLevel
Definition: bridgeIO.h:42
virtual void read_file(Field *v, std::string)=0
read data from file.
virtual void write_file(Field *v, std::string)=0
write data to file.
static void convert_endian(void *buf, size_t size, size_t nmemb)
check if machine byte order is big-endian.
Definition: fieldIO.cpp:227
FieldIO class for file I/O of space-time distributed data.
Definition: fieldIO.h:53
void gather(Field *vglobal, Field *vlocal)
gather data on parallel nodes to primary node.
Definition: fieldIO.cpp:119
Bridge::VerboseLevel m_vl
Definition: fieldIO.h:64