Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
ExporterParaView_decl.hpp
1#ifndef ExporterParaView_DECL_hpp
2#define ExporterParaView_DECL_hpp
3
4#include <fstream>
5#include "feddlib/core/FEDDCore.hpp"
6#include "feddlib/core/General/DefaultTypeDefs.hpp"
7#include "feddlib/core/LinearAlgebra/MultiVector.hpp"
8#include "feddlib/core/Mesh/Mesh.hpp"
9// Trilinos
10#include <Teuchos_Array.hpp>
11
12#include <hdf5.h>
13#include "feddlib/core/General/HDF5Toolbox.hpp"
14
15
27
28namespace FEDD {
29template <class SC = default_sc, class LO = default_lo, class GO = default_go, class NO = default_no>
30class ExporterParaView {
31public:
32 typedef std::vector<double> vec_dbl;
33 typedef std::vector<std::vector<double> > vec2D_dbl;
34 typedef std::vector<std::vector<int> > vec2D_int;
35 typedef std::vector<std::vector<long long> > vec2D_longlong;
36 typedef Teuchos::RCP<std::vector<int> > vec_int_ptr;
37 typedef Teuchos::RCP<std::vector<long long> > vec_longlong_ptr;
38 typedef Teuchos::RCP<vec_dbl> vec_dbl_ptr;
39 typedef Teuchos::RCP<std::vector<std::vector<double> > > vec2D_dbl_ptr;
40 typedef Teuchos::RCP<std::vector<std::vector<int> > > vec2D_int_ptr;
41 typedef Teuchos::RCP<vec2D_longlong > vec2D_longlong_ptr;
42
43 typedef MultiVector<SC,LO,GO,NO> MultiVector_Type;
44 typedef Teuchos::RCP<MultiVector_Type> MultiVectorPtr_Type;
45 typedef Teuchos::RCP<const MultiVector_Type> MultiVectorConstPtr_Type;
46
47 typedef HDF5Toolbox<SC,LO,GO,NO> HDF5_Type;
48 typedef Teuchos::RCP<HDF5_Type> HDF5Ptr_Type;
49
50 typedef Teuchos::Comm<int> Comm_Type;
51 typedef Teuchos::RCP<const Comm_Type> CommConstPtr_Type;
52 typedef const Teuchos::RCP<const Comm_Type> CommConstPtrConst_Type;
53
54 typedef Map<LO,GO,NO> Map_Type;
55 typedef Teuchos::RCP<Map_Type> MapPtr_Type;
56 typedef Teuchos::RCP<const Map_Type> MapConstPtr_Type;
57 typedef const MapConstPtr_Type MapConstPtrConst_Type;
58
59 typedef MultiVector<SC,LO,GO,NO> MultiVec_Type;
60 typedef Teuchos::RCP<const MultiVec_Type> MultiVecConstPtr_Type;
61 typedef const MultiVecConstPtr_Type MultiVecConstPtrConst_Type;
62
63 typedef Mesh<SC,LO,GO,NO> Mesh_Type;
64 typedef Teuchos::RCP<Mesh_Type> MeshPtr_Type;
65
66 typedef typename Mesh_Type::ElementsPtr_Type ElementsPtr_Type;
67
68 ExporterParaView();
69
70 void setup(std::string filename,
71 MeshPtr_Type mesh,
72 std::string FEType,
73 ParameterListPtr_Type parameterList=Teuchos::null);
74
75 void setup(std::string filename,
76 MeshPtr_Type mesh,
77 std::string FEType,
78 int saveTimestep,
79 ParameterListPtr_Type parameterList=Teuchos::null);
80
81// void setup(int dim,
82// GO nmbElementsGlob,
83// vec2D_int_ptr elements,
84// vec2D_dbl_ptr pointsUni,
85// MapConstPtrConst_Type& mapUnique,
86// MapConstPtrConst_Type& mapRepeated,
87// std::string FEType,
88// std::string filename,
89// CommConstPtrConst_Type &comm,
90// ParameterListPtr_Type parameterList=Teuchos::null);
91//
92// void setup(int dim,
93// GO nmbElementsGlob,
94// vec2D_int_ptr elements,
95// vec2D_dbl_ptr pointsUni,
96// MapConstPtrConst_Type& mapUnique,
97// MapConstPtrConst_Type& mapRepeated,
98// std::string FEType,
99// std::string filename,
100// int saveTimestep,
101// CommConstPtrConst_Type &comm,
102// ParameterListPtr_Type parameterList=Teuchos::null);
103
104
105 void addVariable(MultiVecConstPtr_Type &u,
106 std::string varName,
107 std::string varType,
108 int dofPerNode,
109 MapConstPtrConst_Type& mapUnique=Teuchos::null);
110
111 void save(double time);
112
113 void save(double time, double dt);
114
115 void closeExporter();
116
117 void writeVariablesHDF5();
118
119 void initHDF5();
120
121 void writeMeshElements( std::string nameConn );
122
123 void writeMeshPointsHDF5();
124
125 void writeMeshPoints(std::string nameP_X,
126 std::string nameP_Y,
127 std::string nameP_Z );
128
129 void updatePoints();
130
131
132 void initXmf();
133
134 void initXmfTimes();
135
136 void writeXmf(double time);
137
138 void writeXmfElements(std::string nameConn, double time);
139
140 void writeXmfPoints(std::string nameP_X,
141 std::string nameP_Y,
142 std::string nameP_Z);
143
144 void writeXmfVariables();
145
146 void writeXmfTime(double time, double dt);
147
148 void prepareVectorField(MultiVecConstPtr_Type &u,
149 MultiVectorPtr_Type &u_export,
150 int dof) const;
151
152 void prepareScalar(MultiVecConstPtr_Type &u,
153 MultiVectorPtr_Type &u_export) const;
154
155 void makePostfix();
156
157protected:
158
159 HDF5Ptr_Type hdf5exporter_;
160 CommConstPtr_Type comm_;
161
162 std::streampos closingLinesPosition_;
163 std::streampos closingLinesPositionTimes_;
164 std::string closingLines_;
165 std::ofstream xmf_out_;
166 std::ofstream xmf_times_out_;
167 std::string filename_;
168 std::string outputFilename_;
169 std::string postfix_;
170 std::string FEType_;
171
172
173 std::vector<MultiVecConstPtr_Type> variables_;
174 std::vector<MapConstPtr_Type > uniqueMaps_;
175 std::vector<std::string> varNames_;
176 std::vector<std::string> varTypes_;
177 std::vector<int> varDofPerNode_;
178 MultiVectorPtr_Type pointsHDF_;
179 MultiVectorPtr_Type elementsHDF_;
180
181 UN dim_;
182 GO nmbElementsGlob_;
183 GO nmbPointsGlob_;
184 GO nmbExportValuesGlob_;
185 int nmbPointsPerElement_;
186 int timeIndex_;
187 bool writeDt_;
188 int saveTimestep_;
189 bool verbose_;
190 ParameterListPtr_Type parameterList_;
191 vec2D_dbl_ptr pointsUnique_;
192
193 bool redo_ = false;
194 MeshPtr_Type mesh_;
195 MapConstPtr_Type mapUniqueVariables_;
196
197 };
198}
199
200#endif
This class contains the features we use from EpteraExt::HDF5, but we transition it to Tpetra.
Definition HDF5Toolbox_decl.hpp:28
Definition Map_decl.hpp:30
Definition Mesh_decl.hpp:25
Definition MultiVector_decl.hpp:61
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement_decl.hpp:36