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 
41 namespace Nektar
42 {
43 namespace FieldUtils
44 {
45 
47 {
48  eOrdered = 0,
56 };
57 
58 /**
59  * @brief Tecplot output class.
60  */
62 {
63 public:
64  /// Creates an instance of this class
65  static std::shared_ptr<Module> create(FieldSharedPtr f)
66  {
68  }
69 
72  virtual ~OutputTecplot();
73 
74  virtual void Process(po::variables_map &vm);
75 
76  virtual std::string GetModuleName()
77  {
78  return "OutputTecplot";
79  }
80 
81 protected:
82  /// Write from pts to output file.
83  virtual void OutputFromPts(po::variables_map &vm);
84 
85  /// Write from m_exp to output file.
86  virtual void OutputFromExp(po::variables_map &vm);
87 
88  /// Write from data to output file.
89  virtual void OutputFromData(po::variables_map &vm);
90 
91  virtual fs::path GetPath(std::string &filename, po::variables_map &vm);
92 
93  virtual fs::path GetFullOutName(std::string &filename,
94  po::variables_map &vm);
95 
96  /// True if writing binary field output
97  bool m_binary;
98  /// True if writing a single output file
100  /// True if writing header
102  /// Tecplot zone type of output
104  /// Number of points per block in Tecplot file
105  std::vector<int> m_numPoints;
106  /// Number of blocks in Tecplot file
108  /// Coordinate dimension of output
110  /// Total number of connectivity entries
112  /// Connectivty for each block: one per element
113  std::vector<Array<OneD, int>> m_conn;
114  /// Each rank's field sizes
116  /// Each rank's connectivity sizes
118  /// Field data to output
120 
121  virtual void WriteTecplotHeader(std::ofstream &outfile,
122  std::vector<std::string> &var);
123  virtual void WriteTecplotZone(std::ofstream &outfile);
124  virtual void WriteTecplotConnectivity(std::ofstream &outfile);
125 
126  void WriteTecplotFile(po::variables_map &vm);
127 
128  int GetNumTecplotBlocks();
129  void CalculateConnectivity();
130 };
131 
132 /**
133  * @brief Tecplot output class, specifically for binary field output.
134  */
136 {
137 public:
138  /// Creates an instance of this class
139  static std::shared_ptr<Module> create(FieldSharedPtr f)
140  {
142  }
143 
146  {
147  m_binary = true;
148  }
149 
151  {
152  }
153 
154 protected:
155  void WriteDoubleOrFloat(std::ofstream &outfile,
156  Array<OneD, NekDouble> &data);
157  virtual void WriteTecplotHeader(std::ofstream &outfile,
158  std::vector<std::string> &var);
159  virtual void WriteTecplotZone(std::ofstream &outfile);
160  virtual void WriteTecplotConnectivity(std::ofstream &outfile);
161 };
162 
163 } // namespace FieldUtils
164 } // namespace Nektar
165 
166 #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 WriteTecplotZone(std::ofstream &outfile)
virtual void WriteTecplotHeader(std::ofstream &outfile, std::vector< std::string > &var)
Write Tecplot files header in binary format.
virtual void WriteTecplotConnectivity(std::ofstream &outfile)
Write Tecplot connectivity information (ASCII)
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
int m_totConn
Total number of connectivity entries.
std::vector< Array< OneD, int > > m_conn
Connectivty for each block: one per element.
Array< OneD, int > m_rankConnSizes
Each rank's connectivity sizes.
bool m_binary
True if writing binary field output.
Definition: OutputTecplot.h:97
bool m_oneOutputFile
True if writing a single output file.
Definition: OutputTecplot.h:99
virtual fs::path GetFullOutName(std::string &filename, po::variables_map &vm)
virtual void WriteTecplotZone(std::ofstream &outfile)
virtual std::string GetModuleName()
Definition: OutputTecplot.h:76
void CalculateConnectivity()
Calculate connectivity information for each expansion dimension.
virtual void WriteTecplotConnectivity(std::ofstream &outfile)
Write Tecplot connectivity information (ASCII)
virtual void Process(po::variables_map &vm)
Write fld to output file.
bool m_writeHeader
True if writing header.
virtual void OutputFromExp(po::variables_map &vm)
Write from m_exp to output file.
TecplotZoneType m_zoneType
Tecplot zone type of output.
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
Definition: OutputTecplot.h:65
Array< OneD, int > m_rankFieldSizes
Each rank's field sizes.
std::vector< int > m_numPoints
Number of points per block in Tecplot file.
virtual fs::path GetPath(std::string &filename, po::variables_map &vm)
virtual void WriteTecplotHeader(std::ofstream &outfile, std::vector< std::string > &var)
Write Tecplot files header.
void WriteTecplotFile(po::variables_map &vm)
virtual void OutputFromPts(po::variables_map &vm)
Write from pts to output file.
int m_numBlocks
Number of blocks in Tecplot file.
int m_coordim
Coordinate dimension of output.
int GetNumTecplotBlocks()
Calculate number of Tecplot blocks.
Array< OneD, Array< OneD, NekDouble > > m_fields
Field data to output.
virtual void OutputFromData(po::variables_map &vm)
Write from data to output file.
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:989
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:285
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1