14 #include <Grid/map_grid.hpp> 
   17 #define FORTRAN_STYLE 1 
   18 #define STRUCT_OF_ARRAY 2 
   25 template<
unsigned int dim, 
typename Tg, 
typename Tr, 
unsigned int i>
 
   30         auto it = gr.getIterator();
 
   36             raw.read((
char *)&gr.template get<i>(
key),
sizeof(Tr));
 
   48 template<
unsigned int dim, 
typename Tg, 
typename Tr ,
unsigned int i, 
unsigned int nv>
 
   53         for (
size_t k = 0 ; k < nv ; k++)
 
   55             auto it = gr.getIterator();
 
   61                 raw.read((
char *)&gr.template get<i>(
key)[k],
sizeof(Tr));
 
   79 template<
unsigned int dim, 
typename Tg>
 
  102         typedef typename boost::mpl::at<typename Tg::type,boost::mpl::int_<T::value>>::type Tr;
 
  108 template <
unsigned int dim, 
typename T, 
typename idx_type>
 
  129         raw.open (file, std::ios::binary );
 
  131         if (raw.is_open() == 
false)
 
  133             std::cerr << __FILE__ << 
":" << __LINE__ << 
" error in opening the file: " << file << std::endl;
 
  138         raw.seekg (0, std::ios::end);
 
  139         size_t length = raw.tellg();
 
  140         raw.seekg (skip, std::ios::beg);
 
  142         if (opt & FORTRAN_STYLE)
 
  143             raw.read((
char *)&tmp,
sizeof(idx_type));
 
  147         for (
size_t i = 0 ; i < dim ; i++)
 
  150             raw.read((
char *)&sz[i],
sizeof(idx_type));
 
  153         if (opt & FORTRAN_STYLE)
 
  154             raw.read((
char *)&tmp,
sizeof(idx_type));
 
  156         if (opt & FORTRAN_STYLE)
 
  157             raw.read((
char *)&tmp,
sizeof(idx_type));
 
  162         if (opt & FORTRAN_STYLE)
 
  163             offset += 2*
sizeof(idx_type)*2;
 
  166         if (length - dim*
sizeof(idx_type) - offset - skip != gs.
size()*
sizeof(T) )
 
  168             std::cout << __FILE__ << 
":" << __LINE__ << 
" Error the size of the raw file does not match with the calculated one" << std::endl;
 
  177         if (!(opt & STRUCT_OF_ARRAY))
 
  180             raw.read((
char *)gr.getPointer(),gr.size()*
sizeof(T));
 
  188             boost::mpl::for_each< boost::mpl::range_c<int,0, T::max_prop> >(rr);
 
raw_read(grid_cpu< dim, Tg > &gr, std::ifstream &fl)
constructor 
 
size_t size() const 
Return the size of the grid. 
 
this class is a functor for "for_each" algorithm 
 
void operator()(T &t) const 
It read for each property. 
 
GridRawReader()
Constructor. 
 
std::ifstream & fl
File stream. 
 
This class is a trick to indicate the compiler a specific specialization pattern. ...
 
grid_cpu< dim, Tg > & gr
Grid out. 
 
bool read(std::string file, grid_cpu< dim, T > &gr, size_t opt=0, size_t skip=0)
Read a raw grid.