VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GridVTKWriter.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
33//=======================================================================================
34#ifndef GridVTKWriter_h
35#define GridVTKWriter_h
36
37#include <string>
38
39#include "global.h"
40
41namespace vf::gpu {
42
43enum class WRITING_FORMAT { BINARY, ASCII };
44
45class Grid;
46
48{
49public:
50 static void writeSparseGridToVTK(SPtr<Grid> grid, const std::string& name, WRITING_FORMAT format = WRITING_FORMAT::ASCII);
51 static void writeGridToVTKXML(SPtr<Grid> grid, const std::string& name);
52 static void writeInterpolationCellsToVTKXML(SPtr<Grid> grid, SPtr<Grid> gridCoarse, const std::string& name);
53
54private:
55 GridVTKWriter() = default;
56 ~GridVTKWriter() = default;
57
58 static FILE *file;
59 static WRITING_FORMAT format;
60
61 static void initalVtkWriter(WRITING_FORMAT format, const std::string& name);
62
63 static bool isBinaryWritingFormat();
64
65 static void writeVtkFile(SPtr<Grid> grid);
66
67 static void openFile(const std::string& name, const std::string& mode);
68 static void closeFile();
69
70 static void writeHeader();
71 static void writePoints(SPtr<Grid> grid);
72 static void writeCells(const unsigned int &size);
73 static void writeTypeHeader(const unsigned int &size);
74 static void writeTypes(SPtr<Grid> grid);
75
76 static void end_line();
77 static void force_big_endian(unsigned char *bytes);
78 static void write_int(int val);
79 static void write_float(float val);
80};
81
82}
83
84#endif
85
static void writeSparseGridToVTK(SPtr< Grid > grid, const std::string &name, WRITING_FORMAT format=WRITING_FORMAT::ASCII)
static void writeInterpolationCellsToVTKXML(SPtr< Grid > grid, SPtr< Grid > gridCoarse, const std::string &name)
static void writeGridToVTKXML(SPtr< Grid > grid, const std::string &name)
std::shared_ptr< T > SPtr
UbTypeOp< typenameUbDuoT< N, UbDuo< A, B > >::ResultT >::RefT val(UbDuo< A, B > &d)
Definition UbTuple.h:393