OOFEM 3.0
Loading...
Searching...
No Matches
vtkxmlexportmodule.h
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35#ifndef vtkxmlexportmodule_h
36#define vtkxmlexportmodule_h
37
38#include "vtkbaseexportmodule.h"
39#include "intarray.h"
40#include "nodalrecoverymodel.h"
41#include "interface.h"
43#include "integrationrule.h"
44#include "xfem/xfemmanager.h"
45#include <iostream>
46#include <fstream>
47#include <iomanip>
48
49#ifdef __VTK_MODULE
50 #include <vtkUnstructuredGrid.h>
51 #include <vtkSmartPointer.h>
52#endif
53
54
55#ifdef _WIN32
56 #define NULL_DEVICE "NUL:"
57#else
58 #define NULL_DEVICE "/dev/null"
59#endif
60
61
62#include <string>
63#include <list>
64
66
67#define _IFT_VTKXMLExportModule_Name "vtkxml"
68#define _IFT_VTKXMLExportModule_cellvars "cellvars"
69#define _IFT_VTKXMLExportModule_vars "vars"
70#define _IFT_VTKXMLExportModule_primvars "primvars"
71#define _IFT_VTKXMLExportModule_externalForces "externalforces"
72#define _IFT_VTKXMLExportModule_ipvars "ipvars"
73#define _IFT_VTKXMLExportModule_stype "stype"
74#define _IFT_VTKXMLExportModule_exportSetMembershipFlag "setmembership"
75
77
78using namespace std;
79namespace oofem {
80class Node;
81
90{
91protected:
104
105
106
110 std::unique_ptr< NodalRecoveryModel >smoother;
112 std::unique_ptr< NodalRecoveryModel >primVarSmoother;
113
115 std::list< std::string >pvdBuffer;
116
118 std::list< std::string >gpPvdBuffer;
119
120
121public:
125 virtual ~VTKXMLExportModule();
126
127 void initializeFrom(InputRecord &ir) override;
128 void doOutput(TimeStep *tStep, bool forcedOutput = false) override;
129 void initialize() override;
130 void terminate() override;
131 const char *giveClassName() const override { return "VTKXMLExportModule"; }
135 void exportPointDataHeader(std::ofstream fileStream, TimeStep *tStep);
136 virtual void giveDataHeaders(std::string &pointHeader, std::string &cellHeader); // returns the headers
141
142
143#ifdef __VTK_MODULE
144 vtkSmartPointer< vtkUnstructuredGrid >fileStream;
145 vtkSmartPointer< vtkPoints >nodes;
146 vtkSmartPointer< vtkIdList >elemNodeArray;
147
148 vtkSmartPointer< vtkDoubleArray >intVarArray;
149 vtkSmartPointer< vtkDoubleArray >primVarArray;
150#else
151 std::ofstream fileStream;
152#endif
153
155
156 std::vector< ExportRegion >defaultVTKPieces;
157
158 ExportRegion& getExportRegions() {return this->defaultVTKPiece;}
159protected:
160
162 std::string giveOutputFileName(TimeStep *tStep);
163
165 std::ofstream giveOutputStream(TimeStep *tStep);
166
167 void writeIntVars(ExportRegion &vtkPiece);
169 void writePrimaryVars(ExportRegion &vtkPiece);
170 void writeCellVars(ExportRegion &vtkPiece);
171 void writeExternalForces(ExportRegion &vtkPiece);
173 void writeCellSetMembership(ExportRegion &vtkPiece);
178 bool writeVTKPieceEpilog(ExportRegion &vtkPiece, TimeStep *tStep);
183 bool writeVTKPieceVariables(ExportRegion &vtkPiece, TimeStep *tStep);
188 bool writeVTKPieceProlog(ExportRegion &vtkPiece, TimeStep *tStep);
194 void exportIntVarsInGpAs(IntArray valIDs, TimeStep *tStep);
198 void writeVTKCollection();
199
202
203#ifdef __VTK_MODULE
204 void writeVTKPointData(const char *name, vtkSmartPointer< vtkDoubleArray >varArray);
205#else
206 void writeVTKPointData(FloatArray &valueArray);
207#endif
208
209#ifdef __VTK_MODULE
210 void writeVTKCellData(const char *name, vtkSmartPointer< vtkDoubleArray >varArray);
211#else
212 void writeVTKCellData(FloatArray &valueArray);
213#endif
214
215 // Export of composite elements (built up from several subcells)
216 void exportCompositeElement(ExportRegion &vtkPiece, Element *el, TimeStep *tStep);
217 void exportCompositeElement(std::vector< ExportRegion > &vtkPieces, Element *el, TimeStep *tStep);
218};
219
227{
228
229public:
231 virtual void giveCompositeExportData(ExportRegion &vtkPiece, IntArray &primaryVarsToExport, IntArray &internalVarsToExport, IntArray cellVarsToExport, TimeStep *tStep) { }
232 virtual void giveCompositeExportData(std::vector< ExportRegion > &vtkPieces, IntArray &primaryVarsToExport, IntArray &internalVarsToExport, IntArray cellVarsToExport, TimeStep *tStep) { }
233};
234} // end namespace oofem
235#endif // vtkxmlexportmodule_h
Stores all neccessary data (of a region) in a VTKPiece so it can be exported later.
Interface()
Constructor.
Definition interface.h:86
VTKBaseExportModule(int n, EngngModel *e)
Constructor. Creates empty Output Manager. By default all components are selected.
virtual void giveCompositeExportData(ExportRegion &vtkPiece, IntArray &primaryVarsToExport, IntArray &internalVarsToExport, IntArray cellVarsToExport, TimeStep *tStep)
virtual void giveCompositeExportData(std::vector< ExportRegion > &vtkPieces, IntArray &primaryVarsToExport, IntArray &internalVarsToExport, IntArray cellVarsToExport, TimeStep *tStep)
std::list< std::string > pvdBuffer
Buffer for earlier time steps exported to *.pvd file.
NodalRecoveryModel::NodalRecoveryModelType stype
Smoother type.
virtual void giveDataHeaders(std::string &pointHeader, std::string &cellHeader)
IntArray internalVarsToExport
List of InternalStateType values, identifying the selected vars for export.
void initializeFrom(InputRecord &ir) override
Initializes receiver according to object description stored in input record.
void exportPointDataHeader(std::ofstream fileStream, TimeStep *tStep)
std::unique_ptr< NodalRecoveryModel > smoother
Smoother.
void exportIntVarsInGpAs(IntArray valIDs, TimeStep *tStep)
void writeExternalForces(ExportRegion &vtkPiece)
IntArray externalForcesToExport
List of primary unknowns to export.
IntArray primaryVarsToExport
List of primary unknowns to export.
IntArray ipInternalVarsToExport
List of internal variables to export directly in Integration Points (no smoothing to nodes).
NodalRecoveryModel * givePrimVarSmoother()
Returns the smoother for primary variables (nodal averaging).
std::list< std::string > gpPvdBuffer
Buffer for earlier time steps with gauss points exported to *.gp.pvd file.
void writeVertexSetMembership(ExportRegion &vtkPiece)
void exportCompositeElement(ExportRegion &vtkPiece, Element *el, TimeStep *tStep)
VTKXMLExportModule(int n, EngngModel *e)
Constructor. Creates empty Output Manager. By default all components are selected.
void writeVTKPointData(FloatArray &valueArray)
IntArray cellVarsToExport
List of cell data to export.
bool writeVTKPieceVariables(ExportRegion &vtkPiece, TimeStep *tStep)
void writeVTKCellData(FloatArray &valueArray)
void writeXFEMVars(ExportRegion &vtkPiece)
void writeCellSetMembership(ExportRegion &vtkPiece)
void doOutput(TimeStep *tStep, bool forcedOutput=false) override
bool exportSetMembershipFlag
Flag whether to export setMembership (byte encoded array).
void writePrimaryVars(ExportRegion &vtkPiece)
std::vector< ExportRegion > defaultVTKPieces
void writeGPVTKCollection()
Writes a VTK collection file for Gauss points.
bool writeVTKPieceProlog(ExportRegion &vtkPiece, TimeStep *tStep)
const char * giveClassName() const override
Returns class name of the receiver.
NodalRecoveryModel * giveSmoother()
Returns the internal smoother.
bool writeVTKPieceEpilog(ExportRegion &vtkPiece, TimeStep *tStep)
void writeCellVars(ExportRegion &vtkPiece)
std::unique_ptr< NodalRecoveryModel > primVarSmoother
Smoother for primary variables.
#define OOFEM_EXPORT
Definition oofemcfg.h:7

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011