VTUGridWriterASCII.hpp
1 /*---------------------------------------------------------------------------*\
2  *
3  * mimmo
4  *
5  * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6  *
7  * -------------------------------------------------------------------------
8  * License
9  * This file is part of mimmo.
10  *
11  * mimmo is free software: you can redistribute it and/or modify it
12  * under the terms of the GNU Lesser General Public License v3 (LGPL)
13  * as published by the Free Software Foundation.
14  *
15  * mimmo is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18  * License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with mimmo. If not, see <http://www.gnu.org/licenses/>.
22  *
23 \*---------------------------------------------------------------------------*/
24 #ifndef __VTUGRIDASCIIWRITER_HPP__
25 #define __VTUGRIDASCIIWRITER_HPP__
26 
27 #include <bitpit_patchkernel.hpp>
28 #include "mimmoTypeDef.hpp"
29 
30 namespace mimmo{
31 
41 class VTUFlushStreamerASCII : public bitpit::VTKBaseStreamer{
42 public:
44  virtual ~VTUFlushStreamerASCII();
47 
48  void setTargetPatch(bitpit::PatchKernel & patch, bitpit::PiercedStorage<long, long> & vtkVertexMap);
49  virtual void flushData(std::fstream &stream, const std::string & name, bitpit::VTKFormat format = bitpit::VTKFormat::ASCII);
50 
51 private:
52  bitpit::PatchKernel * m_patch;
53  bitpit::PiercedStorage<long,long> * m_vtkVertexMap;
54 };
55 
63 class VTUGridWriterASCII: protected bitpit::VTKUnstructuredGrid
64 {
65 
66 public:
67  VTUGridWriterASCII(VTUFlushStreamerASCII & streamer,bitpit::PatchKernel & patch,
68  bitpit::VTKElementType eltype= bitpit::VTKElementType::UNDEFINED);
70 
71  void write(const std::string & dir, const std::string & file, bitpit::VTKWriteMode mode= bitpit::VTKWriteMode::DEFAULT);
72 
73 private:
74  bitpit::PatchKernel& m_patch;
75  VTUFlushStreamerASCII & m_streamer;
76  bitpit::PiercedStorage<long,long> m_vtkVertexMap;
77 };
78 
79 
80 };
81 
82 #endif /* __VTUGRIDASCIIWRITER_HPP__ */
VTUGridWriterASCII(VTUFlushStreamerASCII &streamer, bitpit::PatchKernel &patch, bitpit::VTKElementType eltype=bitpit::VTKElementType::UNDEFINED)
void setTargetPatch(bitpit::PatchKernel &patch, bitpit::PiercedStorage< long, long > &vtkVertexMap)
virtual void flushData(std::fstream &stream, const std::string &name, bitpit::VTKFormat format=bitpit::VTKFormat::ASCII)
Custom writer of ASCII unstructured grids to external files *.vtu.
Abstract class for custom ASCII writer/flusher of *.vtu mesh external files.
void write(const std::string &dir, const std::string &file, bitpit::VTKWriteMode mode=bitpit::VTKWriteMode::DEFAULT)