Saras
Finite   Difference   Solver   for   Fluid   Dynamics   Simulations
reader.h
Go to the documentation of this file.
1/********************************************************************************************************************************************
2 * Saras
3 *
4 * Copyright (C) 2019, Mahendra K. Verma
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the copyright holder nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 ********************************************************************************************************************************************
31 */
43#ifndef READER_H
44#define READER_H
45
46#include <blitz/array.h>
47#include <sys/stat.h>
48#include <algorithm>
49#include <fstream>
50#include <iomanip>
51#include <sstream>
52#include <vector>
53#include <dirent.h>
54
55#include "field.h"
56#include "grid.h"
57#include "hdf5.h"
58
59class reader {
60 private:
61 const grid &mesh;
62
63 std::vector<field> &rFields;
64
65#ifdef PLANAR
66 blitz::Array<real, 2> fieldData;
67#else
68 blitz::Array<real, 3> fieldData;
69#endif
70
71 std::vector<hid_t> sourceDSpace, targetDSpace;
72
73 std::vector< blitz::TinyVector<int, 3> > localSize;
74
75 void initLimits();
76 void copyData(field &outField);
77 void restartCheck(hid_t fHandle);
78
79 public:
80 reader(const grid &mesh, std::vector<field> &rFields);
81
82 real readData();
83
84 ~reader();
85};
86
97#endif
Field class to store data and perform finite difference operations on the data.
Definition: field.h:52
Contains all the global variables related to the grid, its slices, limits, and grid derivatives used ...
Definition: grid.h:53
Class for all the global variables and functions related to reading input data for the solver.
Definition: reader.h:59
real readData()
Function to read files in HDF5 format in parallel.
Definition: reader.cc:213
reader(const grid &mesh, std::vector< field > &rFields)
Constructor of the reader class.
Definition: reader.cc:55
Class declaration of field.
Class declaration of grid.