Bridge++  Ver. 2.0.2
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 
80  virtual void read_file(Field& v, const std::string&) = 0;
81 
83  virtual void write_file(Field& v, const std::string&) = 0;
84 
85 
87  void deliver(Field *vlocal, Field *vglobal);
88 
90  void gather(Field *vglobal, Field *vlocal);
91 
92  // protected:
93 
95  static void byte_swap(void *buf, size_t size, size_t nmemb)
96  {
97  return convert_endian(buf, size, nmemb);
98  }
99 
101  static void convert_endian(void *buf, size_t size, size_t nmemb);
102 
104  static bool is_bigendian();
105 };
106 #endif
CommonParameters
Common parameter class: provides parameters as singleton.
Definition: commonParameters.h:42
Index_lex
Lexical site index.
Definition: index_lex.h:34
IO_Format::Format
Definition: io_format.h:36
FieldIO::is_bigendian
static bool is_bigendian()
Definition: fieldIO.cpp:210
FieldIO::m_vl
Bridge::VerboseLevel m_vl
Definition: fieldIO.h:64
FieldIO::gather
void gather(Field *vglobal, Field *vlocal)
gather data on parallel nodes to primary node.
Definition: fieldIO.cpp:121
FieldIO::class_name
static const std::string class_name
Definition: fieldIO.h:56
FieldIO::deliver
void deliver(Field *vlocal, Field *vglobal)
distribute data on primary node over parallel nodes.
Definition: fieldIO.cpp:30
FieldIO::convert_endian
static void convert_endian(void *buf, size_t size, size_t nmemb)
check if machine byte order is big-endian.
Definition: fieldIO.cpp:231
field.h
FieldIO::~FieldIO
virtual ~FieldIO()
Definition: fieldIO.h:70
io_format.h
index_lex.h
FieldIO::read_file
virtual void read_file(Field &v, const std::string &)=0
read data from file. (‘const’ is added [18 Mar 2021])
FieldIO::idx
Index_lex idx
Definition: fieldIO.h:59
FieldIO
FieldIO class for file I/O of space-time distributed data.
Definition: fieldIO.h:53
commonParameters.h
Field
Container of Field-type object.
Definition: field.h:46
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
FieldIO::FieldIO
FieldIO(const IO_Format::Format *format)
< constructor. format specifies data layout on file.
Definition: fieldIO.h:69
FieldIO::operator=
FieldIO & operator=(const FieldIO &)
FieldIO::write_file
virtual void write_file(Field &v, const std::string &)=0
write data to file. (‘const’ is added [18 Mar 2021])
FieldIO::m_format
const IO_Format::Format * m_format
Definition: fieldIO.h:62