Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Tecplot output module
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef FIELDUTILS_OUTPUTTECPLOT
37 #define FIELDUTILS_OUTPUTTECPLOT
38 
39 #include "../Module.h"
40 #include <tinyxml.h>
41 
42 namespace Nektar
43 {
44 namespace FieldUtils
45 {
46 
48  eOrdered = 0,
56 };
57 
58 /**
59  * @brief Tecplot output class.
60  */
62 {
63 public:
64  /// Creates an instance of this class
65  static boost::shared_ptr<Module> create(FieldSharedPtr f)
66  {
68  }
69 
72  virtual ~OutputTecplot();
73 
74  virtual void Process(po::variables_map &vm);
75 
76 protected:
77  /// True if writing binary field output
78  bool m_binary;
79  /// True if writing a single output file
81  /// Tecplot zone type of output
83  /// Number of points per block in Tecplot file
84  vector<int> m_numPoints;
85  /// Number of blocks in Tecplot file
87  /// Coordinate dimension of output
88  int m_coordim;
89  /// Total number of connectivity entries
90  int m_totConn;
91  /// Connectivty for each block: one per element
92  vector<Array<OneD, int> > m_conn;
93  /// Each rank's field sizes
95  /// Each rank's connectivity sizes
97  /// Field data to output
99 
100  virtual void WriteTecplotHeader(std::ofstream &outfile,
101  std::vector<std::string> &var);
102  virtual void WriteTecplotZone(std::ofstream &outfile);
103  virtual void WriteTecplotConnectivity(std::ofstream &outfile);
104 
105  int GetNumTecplotBlocks();
106  void CalculateConnectivity();
107 
108  /// Returns this module's name.
109  virtual std::string GetModuleName()
110  {
111  return "OutputTecplot";
112  }
113 };
114 
115 /**
116  * @brief Tecplot output class, specifically for binary field output.
117  */
119 {
120 public:
121  /// Creates an instance of this class
122  static boost::shared_ptr<Module> create(FieldSharedPtr f)
123  {
125  }
126 
129  {
130  m_binary = true;
131  m_config["double"] =
132  ConfigOption(true, "0", "Write double-precision data: more "
133  "accurate but more disk space required");
134  }
135 
137  {
138  }
139 
140 protected:
141  void WriteDoubleOrFloat(std::ofstream &outfile,
142  Array<OneD, NekDouble> &data);
143  virtual void WriteTecplotHeader(std::ofstream &outfile,
144  std::vector<std::string> &var);
145  virtual void WriteTecplotZone(std::ofstream &outfile);
146  virtual void WriteTecplotConnectivity(std::ofstream &outfile);
147 };
148 
149 }
150 }
151 
152 #endif
map< string, ConfigOption > m_config
List of configuration values.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
Represents a command-line configuration option.
TecplotZoneType m_zoneType
Tecplot zone type of output.
Definition: OutputTecplot.h:82
static boost::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
Definition: OutputTecplot.h:65
Array< OneD, int > m_rankConnSizes
Each rank's connectivity sizes.
Definition: OutputTecplot.h:96
static boost::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
virtual void WriteTecplotHeader(std::ofstream &outfile, std::vector< std::string > &var)
Write Tecplot files header in binary format.
pair< ModuleType, string > ModuleKey
bool m_oneOutputFile
True if writing a single output file.
Definition: OutputTecplot.h:80
void WriteDoubleOrFloat(std::ofstream &outfile, Array< OneD, NekDouble > &data)
Write either double-precision or single-precision output of field data.
Tecplot output class.
Definition: OutputTecplot.h:61
virtual void WriteTecplotConnectivity(std::ofstream &outfile)
Write Tecplot connectivity information (ASCII)
void CalculateConnectivity()
Calculate connectivity information for each expansion dimension.
virtual void WriteTecplotHeader(std::ofstream &outfile, std::vector< std::string > &var)
Write Tecplot files header.
Array< OneD, int > m_rankFieldSizes
Each rank's field sizes.
Definition: OutputTecplot.h:94
boost::shared_ptr< Field > FieldSharedPtr
Definition: Field.hpp:740
virtual void WriteTecplotZone(std::ofstream &outfile)
vector< Array< OneD, int > > m_conn
Connectivty for each block: one per element.
Definition: OutputTecplot.h:92
int m_numBlocks
Number of blocks in Tecplot file.
Definition: OutputTecplot.h:86
int m_totConn
Total number of connectivity entries.
Definition: OutputTecplot.h:90
virtual std::string GetModuleName()
Returns this module's name.
int GetNumTecplotBlocks()
Calculate number of Tecplot blocks.
virtual void Process(po::variables_map &vm)
Set up member variables to dump Tecplot format output.
int m_coordim
Coordinate dimension of output.
Definition: OutputTecplot.h:88
Array< OneD, Array< OneD, NekDouble > > m_fields
Field data to output.
Definition: OutputTecplot.h:98
Tecplot output class, specifically for binary field output.
bool m_binary
True if writing binary field output.
Definition: OutputTecplot.h:78
virtual void WriteTecplotConnectivity(std::ofstream &outfile)
Write Tecplot connectivity information (ASCII)
virtual void WriteTecplotZone(std::ofstream &outfile)
vector< int > m_numPoints
Number of points per block in Tecplot file.
Definition: OutputTecplot.h:84
Abstract base class for output modules.