Nektar++
OutputTecplot.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: OutputTecplot.h
4//
5// For more information, please see: http://www.nektar.info/
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Tecplot output module
32//
33////////////////////////////////////////////////////////////////////////////////
34
35#ifndef FIELDUTILS_OUTPUTTECPLOT
36#define FIELDUTILS_OUTPUTTECPLOT
37
38#include "OutputFileBase.h"
39#include <tinyxml.h>
40
41namespace Nektar::FieldUtils
42{
43
45{
54};
55
56/**
57 * @brief Tecplot output class.
58 */
60{
61public:
62 /// Creates an instance of this class
63 static std::shared_ptr<Module> create(FieldSharedPtr f)
64 {
66 }
67
70 ~OutputTecplot() override;
71
72protected:
73 void v_Process(po::variables_map &vm) override;
74
75 std::string v_GetModuleName() override
76 {
77 return "OutputTecplot";
78 }
79
80 /// Write from pts to output file.
81 void v_OutputFromPts(po::variables_map &vm) override;
82
83 /// Write from m_exp to output file.
84 void v_OutputFromExp(po::variables_map &vm) override;
85
86 /// Write from data to output file.
87 void v_OutputFromData(po::variables_map &vm) override;
88
89 fs::path v_GetPath(std::string &filename, po::variables_map &vm) override;
90
91 fs::path v_GetFullOutName(std::string &filename,
92 po::variables_map &vm) override;
93
94 /// True if writing binary field output
96 /// True if writing a single output file
98 /// True if writing header
100 /// Tecplot zone type of output
102 /// Number of points per block in Tecplot file
103 std::vector<int> m_numPoints;
104 /// Number of blocks in Tecplot file
106 /// Coordinate dimension of output
108 /// Total number of connectivity entries
110 /// Connectivty for each block: one per element
111 std::vector<Array<OneD, int>> m_conn;
112 /// Each rank's field sizes
114 /// Each rank's connectivity sizes
116 /// Field data to output
118
119 virtual void v_WriteTecplotHeader(std::ofstream &outfile,
120 std::vector<std::string> &var);
121 void WriteTecplotHeader(std::ofstream &outfile,
122 std::vector<std::string> &var)
123 {
124 v_WriteTecplotHeader(outfile, var);
125 }
126 virtual void v_WriteTecplotZone(std::ofstream &outfile);
127 void WriteTecplotZone(std::ofstream &outfile)
128 {
129 v_WriteTecplotZone(outfile);
130 }
131 virtual void v_WriteTecplotConnectivity(std::ofstream &outfile);
132 void WriteTecplotConnectivity(std::ofstream &outfile)
133 {
135 }
136
137 void WriteTecplotFile(po::variables_map &vm);
138
141};
142
143/**
144 * @brief Tecplot output class, specifically for binary field output.
145 */
147{
148public:
149 /// Creates an instance of this class
150 static std::shared_ptr<Module> create(FieldSharedPtr f)
151 {
153 }
154
157 {
158 m_binary = true;
159 }
160
162 {
163 }
164
165protected:
166 void WriteDoubleOrFloat(std::ofstream &outfile,
168 void v_WriteTecplotHeader(std::ofstream &outfile,
169 std::vector<std::string> &var) override;
170 void v_WriteTecplotZone(std::ofstream &outfile) override;
171 void v_WriteTecplotConnectivity(std::ofstream &outfile) override;
172};
173
174} // namespace Nektar::FieldUtils
175
176#endif
Converter from fld to vtk.
Tecplot output class, specifically for binary field output.
void WriteDoubleOrFloat(std::ofstream &outfile, Array< OneD, NekDouble > &data)
Write either double-precision or single-precision output of field data.
void v_WriteTecplotConnectivity(std::ofstream &outfile) override
Write Tecplot connectivity information (ASCII)
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
void v_WriteTecplotHeader(std::ofstream &outfile, std::vector< std::string > &var) override
Write Tecplot files header in binary format.
void v_WriteTecplotZone(std::ofstream &outfile) override
virtual void v_WriteTecplotHeader(std::ofstream &outfile, std::vector< std::string > &var)
Write Tecplot files header.
void v_Process(po::variables_map &vm) override
Write fld to output file.
fs::path v_GetPath(std::string &filename, po::variables_map &vm) override
int m_totConn
Total number of connectivity entries.
void v_OutputFromPts(po::variables_map &vm) override
Write from pts to output file.
std::vector< Array< OneD, int > > m_conn
Connectivty for each block: one per element.
Array< OneD, int > m_rankConnSizes
Each rank's connectivity sizes.
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
Definition: OutputTecplot.h:63
bool m_binary
True if writing binary field output.
Definition: OutputTecplot.h:95
bool m_oneOutputFile
True if writing a single output file.
Definition: OutputTecplot.h:97
void WriteTecplotZone(std::ofstream &outfile)
void CalculateConnectivity()
Calculate connectivity information for each expansion dimension.
void WriteTecplotConnectivity(std::ofstream &outfile)
void v_OutputFromData(po::variables_map &vm) override
Write from data to output file.
bool m_writeHeader
True if writing header.
Definition: OutputTecplot.h:99
void v_OutputFromExp(po::variables_map &vm) override
Write from m_exp to output file.
TecplotZoneType m_zoneType
Tecplot zone type of output.
Array< OneD, int > m_rankFieldSizes
Each rank's field sizes.
std::vector< int > m_numPoints
Number of points per block in Tecplot file.
std::string v_GetModuleName() override
Definition: OutputTecplot.h:75
void WriteTecplotHeader(std::ofstream &outfile, std::vector< std::string > &var)
void WriteTecplotFile(po::variables_map &vm)
fs::path v_GetFullOutName(std::string &filename, po::variables_map &vm) override
int m_numBlocks
Number of blocks in Tecplot file.
int m_coordim
Coordinate dimension of output.
virtual void v_WriteTecplotConnectivity(std::ofstream &outfile)
Write Tecplot connectivity information (ASCII)
int GetNumTecplotBlocks()
Calculate number of Tecplot blocks.
virtual void v_WriteTecplotZone(std::ofstream &outfile)
Array< OneD, Array< OneD, NekDouble > > m_fields
Field data to output.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< Field > FieldSharedPtr
Definition: Field.hpp:990
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:180