Saras
Finite   Difference   Solver   for   Fluid   Dynamics   Simulations
writer.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 WRITER_H
44#define WRITER_H
45
46#include <blitz/array.h>
47#include <sys/stat.h>
48#include <fstream>
49#include <iomanip>
50#include <sstream>
51#include <vector>
52
53#include "field.h"
54#include "grid.h"
55#include "hdf5.h"
56
57class writer {
58 public:
59 writer(const grid &mesh, std::vector<field> &wFields);
60
61 void writeTarang(real time);
62 void writeSolution(real time);
63 void writeRestart(real time);
64
65 ~writer();
66
67 private:
68 const grid &mesh;
69
70 std::vector<field> &wFields;
71
72#ifdef PLANAR
73 blitz::Array<real, 2> fieldData;
74#else
75 blitz::Array<real, 3> fieldData;
76#endif
77
78 std::vector<hid_t> sourceDSpace, targetDSpace;
79
80 std::vector< blitz::TinyVector<int, 3> > localSize;
81
82 void outputCheck();
83
84 void initLimits();
85
86 void copyData(field &outField);
87 void interpolateData(field &outField);
88};
89
100#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 writing output data of the solver.
Definition: writer.h:57
void writeTarang(real time)
Function to write solution file in HDF5 format in parallel in the same manner as TARANG.
Definition: writer.cc:253
void writeSolution(real time)
Function to write solution file in HDF5 format in parallel.
Definition: writer.cc:371
void writeRestart(real time)
Function to write restart file in HDF5 format in parallel.
Definition: writer.cc:455
writer(const grid &mesh, std::vector< field > &wFields)
Constructor of the writer class.
Definition: writer.cc:56
Class declaration of field.
Class declaration of grid.