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  eOrdered = 0,
55 };
56 
57 /**
58  * @brief Tecplot output class.
59  */
61 {
62 public:
63  /// Creates an instance of this class
64  static std::shared_ptr<Module> create(FieldSharedPtr f)
65  {
67  }
68 
71  virtual ~OutputTecplot();
72 
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,
92  po::variables_map &vm);
93 
94  virtual fs::path GetFullOutName(std::string &filename,
95  po::variables_map &vm);
96 
97  /// True if writing binary field output
98  bool m_binary;
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 WriteTecplotHeader(std::ofstream &outfile,
123  std::vector<std::string> &var);
124  virtual void WriteTecplotZone(std::ofstream &outfile);
125  virtual void WriteTecplotConnectivity(std::ofstream &outfile);
126 
127  void WriteTecplotFile(po::variables_map &vm);
128 
129  int GetNumTecplotBlocks();
130  void CalculateConnectivity();
131 
132 };
133 
134 /**
135  * @brief Tecplot output class, specifically for binary field output.
136  */
138 {
139 public:
140  /// Creates an instance of this class
141  static std::shared_ptr<Module> create(FieldSharedPtr f)
142  {
144  }
145 
148  {
149  m_binary = true;
150  }
151 
153  {
154  }
155 
156 protected:
157  void WriteDoubleOrFloat(std::ofstream &outfile,
158  Array<OneD, NekDouble> &data);
159  virtual void WriteTecplotHeader(std::ofstream &outfile,
160  std::vector<std::string> &var);
161  virtual void WriteTecplotZone(std::ofstream &outfile);
162  virtual void WriteTecplotConnectivity(std::ofstream &outfile);
163 };
164 
165 }
166 }
167 
168 #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:98
bool m_oneOutputFile
True if writing a single output file.
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:64
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:290
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1