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
42{
43namespace FieldUtils
44{
45
47{
56};
57
58/**
59 * @brief Tecplot output class.
60 */
62{
63public:
64 /// Creates an instance of this class
65 static std::shared_ptr<Module> create(FieldSharedPtr f)
66 {
68 }
69
72 virtual ~OutputTecplot();
73
74protected:
75 virtual void v_Process(po::variables_map &vm) override;
76
77 virtual std::string v_GetModuleName() override
78 {
79 return "OutputTecplot";
80 }
81
82 /// Write from pts to output file.
83 virtual void v_OutputFromPts(po::variables_map &vm) override;
84
85 /// Write from m_exp to output file.
86 virtual void v_OutputFromExp(po::variables_map &vm) override;
87
88 /// Write from data to output file.
89 virtual void v_OutputFromData(po::variables_map &vm) override;
90
91 virtual fs::path v_GetPath(std::string &filename,
92 po::variables_map &vm) override;
93
94 virtual fs::path v_GetFullOutName(std::string &filename,
95 po::variables_map &vm) override;
96
97 /// True if writing binary field output
99 /// True if writing a single output file
101 /// True if writing header
103 /// Tecplot zone type of output
105 /// Number of points per block in Tecplot file
106 std::vector<int> m_numPoints;
107 /// Number of blocks in Tecplot file
109 /// Coordinate dimension of output
111 /// Total number of connectivity entries
113 /// Connectivty for each block: one per element
114 std::vector<Array<OneD, int>> m_conn;
115 /// Each rank's field sizes
117 /// Each rank's connectivity sizes
119 /// Field data to output
121
122 virtual void v_WriteTecplotHeader(std::ofstream &outfile,
123 std::vector<std::string> &var);
124 void WriteTecplotHeader(std::ofstream &outfile,
125 std::vector<std::string> &var)
126 {
127 v_WriteTecplotHeader(outfile, var);
128 }
129 virtual void v_WriteTecplotZone(std::ofstream &outfile);
130 void WriteTecplotZone(std::ofstream &outfile)
131 {
132 v_WriteTecplotZone(outfile);
133 }
134 virtual void v_WriteTecplotConnectivity(std::ofstream &outfile);
135 void WriteTecplotConnectivity(std::ofstream &outfile)
136 {
138 }
139
140 void WriteTecplotFile(po::variables_map &vm);
141
144};
145
146/**
147 * @brief Tecplot output class, specifically for binary field output.
148 */
150{
151public:
152 /// Creates an instance of this class
153 static std::shared_ptr<Module> create(FieldSharedPtr f)
154 {
156 }
157
160 {
161 m_binary = true;
162 }
163
165 {
166 }
167
168protected:
169 void WriteDoubleOrFloat(std::ofstream &outfile,
171 virtual void v_WriteTecplotHeader(std::ofstream &outfile,
172 std::vector<std::string> &var) override;
173 virtual void v_WriteTecplotZone(std::ofstream &outfile) override;
174 virtual void v_WriteTecplotConnectivity(std::ofstream &outfile) override;
175};
176
177} // namespace FieldUtils
178} // namespace Nektar
179
180#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.
virtual 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.
virtual void v_WriteTecplotHeader(std::ofstream &outfile, std::vector< std::string > &var) override
Write Tecplot files header in binary format.
virtual void v_WriteTecplotZone(std::ofstream &outfile) override
virtual void v_WriteTecplotHeader(std::ofstream &outfile, std::vector< std::string > &var)
Write Tecplot files header.
virtual void v_Process(po::variables_map &vm) override
Write fld to output file.
virtual fs::path v_GetPath(std::string &filename, po::variables_map &vm) override
int m_totConn
Total number of connectivity entries.
virtual 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:65
bool m_binary
True if writing binary field output.
Definition: OutputTecplot.h:98
bool m_oneOutputFile
True if writing a single output file.
void WriteTecplotZone(std::ofstream &outfile)
void CalculateConnectivity()
Calculate connectivity information for each expansion dimension.
void WriteTecplotConnectivity(std::ofstream &outfile)
virtual void v_OutputFromData(po::variables_map &vm) override
Write from data to output file.
bool m_writeHeader
True if writing header.
virtual 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.
void WriteTecplotHeader(std::ofstream &outfile, std::vector< std::string > &var)
void WriteTecplotFile(po::variables_map &vm)
virtual 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.
virtual std::string v_GetModuleName() override
Definition: OutputTecplot.h:77
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:991
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:317
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2