Flow123d  release_2.2.0-21-g2806cf6
output_msh.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file output_msh.h
15  * @brief Header: The functions for MSH (GMSH) outputs.
16  */
17 
18 #ifndef OUTPUT_MSH_HH_
19 #define OUTPUT_MSH_HH_
20 
21 #include "output_time.hh"
22 #include "system/sys_vector.hh"
23 
24 /**
25  * \brief This class is used for output data to VTK file format
26  */
27 class OutputMSH : public OutputTime {
28 public:
30 
31  /**
32  * \brief The constructor of this class.
33  * We open the output file in first call of write_data
34  */
35  OutputMSH();
36 
37  /**
38  * \brief The destructor of this class
39  */
40  ~OutputMSH();
41 
42  /**
43  * \brief The definition of input record for gmsh file format
44  */
45  static const Input::Type::Record & get_input_type();
46 
47  /**
48  * \brief This method writes head of GMSH (.msh) file format
49  *
50  * \return This function returns 1
51  */
52  int write_head(void);
53 
54  /**
55  * \brief This method writes data to GMSH (.msh) file format for current time
56  *
57  * \return This function returns 1
58  */
59  int write_data(void);
60 
61  /**
62  * \brief This method should write tail of GMSH (.msh) file format
63  *
64  * It is stupid file format. It doesn't write anything special at the end of
65  * the file
66  *
67  * \return This function returns 1
68  */
69  int write_tail(void);
70 
71 
72 private:
73 
74  /// Registrar of class to factory
75  static const int registrar;
76 
78 
79  /**
80  * EquationOutput force output of all output fields at the time zero.
81  * We keep this list to perform single elemnent/node output in order to have correct behavior in GMSH.
82  */
84 
85  /**
86  * \brief This function write header of GMSH (.msh) file format
87  */
88  void write_msh_header(void);
89 
90  /**
91  * \brief This function writes geometry (position of nodes) to GMSH (.msh) file
92  * format
93  */
94  void write_msh_geometry(void);
95 
96  /**
97  * \brief This function writes topology (connection of nodes) to the GMSH (.msh)
98  * file format
99  */
100  void write_msh_topology(void);
101 
102  /**
103  * \brief This function writes continuous ascii data to GMSH (.msh) output file.
104  *
105  * \param[in] *out_data The pointer at structure storing pointer at own data.
106  */
107  template<class element>
109 
110  /**
111  * \brief This function writes discontinuous ascii data to GMSH (.msh) output file.
112  *
113  * \param[in] *out_data The pointer at structure storing pointer at own data.
114  */
116 
117  /**
118  * \brief This function write all data on nodes to output file. This function
119  * is used for static and dynamic data
120  *
121  * \param[in] time The time from start
122  * \param[in] step The number of steps from start
123  */
124  void write_node_data(OutputDataPtr output_data);
125  /**
126  * \brief writes ElementNode data ascii GMSH (.msh) output file.
127  *
128  */
129  void write_corner_data(OutputDataPtr output_data);
130 
131 
132  /**
133  * \brief This function write all data on elements to output file. This
134  * function is used for static and dynamic data
135  *
136  * \param[in] time The time from start
137  * \param[in] step The number of steps from start
138  */
139  void write_elem_data(OutputDataPtr output_data);
140 
141  /**
142  * Write fields of single discrete space type, use given format function for the output of single field data.
143  *
144  * At first call it fills dummy_data_list_ (assuming output of all fields at the first output frame).
145  */
146  void write_field_data(OutputTime::DiscreteSpace type_idx, void (OutputMSH::* format_fce)(OutputDataPtr) );
147 
148  /**
149  * \brief This method add right suffix to .msh GMSH file
150  */
151  void fix_base_file_name(void);
152 };
153 
154 #endif /* OUTPUT_MSH_HH_ */
std::vector< std::vector< OutputDataPtr > > dummy_data_list_
Definition: output_msh.hh:83
void write_msh_header(void)
This function write header of GMSH (.msh) file format.
Definition: output_msh.cc:110
static const Input::Type::Record & get_input_type()
The definition of input record for gmsh file format.
Definition: output_msh.cc:81
OutputMSH()
The constructor of this class. We open the output file in first call of write_data.
Definition: output_msh.cc:92
static const int registrar
Registrar of class to factory.
Definition: output_msh.hh:75
void write_msh_geometry(void)
This function writes geometry (position of nodes) to GMSH (.msh) file format.
Definition: output_msh.cc:120
void write_corner_data(OutputDataPtr output_data)
writes ElementNode data ascii GMSH (.msh) output file.
Definition: output_msh.cc:218
OutputTime FactoryBaseType
Definition: output_msh.hh:29
int write_tail(void)
This method should write tail of GMSH (.msh) file format.
Definition: output_msh.cc:338
Small extension of Vector<T> container with support to Id numbers.
Definition: sys_vector.hh:154
std::shared_ptr< ElementDataCacheBase > OutputDataPtr
Definition: output_time.hh:111
void write_field_data(OutputTime::DiscreteSpace type_idx, void(OutputMSH::*format_fce)(OutputDataPtr))
Definition: output_msh.cc:264
void write_node_data(OutputDataPtr output_data)
This function write all data on nodes to output file. This function is used for static and dynamic da...
Definition: output_msh.cc:193
void fix_base_file_name(void)
This method add right suffix to .msh GMSH file.
void write_msh_ascii_cont_data(flow::VectorId< element > &vec, OutputDataPtr output_data)
This function writes continuous ascii data to GMSH (.msh) output file.
Definition: output_msh.cc:159
void write_msh_topology(void)
This function writes topology (connection of nodes) to the GMSH (.msh) file format.
Definition: output_msh.cc:134
void write_msh_ascii_discont_data(OutputDataPtr output_data)
This function writes discontinuous ascii data to GMSH (.msh) output file.
Definition: output_msh.cc:172
bool header_written
Definition: output_msh.hh:77
~OutputMSH()
The destructor of this class.
Definition: output_msh.cc:102
The class for outputting data during time.
Definition: output_time.hh:44
void write_elem_data(OutputDataPtr output_data)
This function write all data on elements to output file. This function is used for static and dynamic...
Definition: output_msh.cc:241
int write_data(void)
This method writes data to GMSH (.msh) file format for current time.
Definition: output_msh.cc:305
Vector classes to support both Iterator, index and Id access and creating co-located vectors...
Record type proxy class.
Definition: type_record.hh:182
This class is used for output data to VTK file format.
Definition: output_msh.hh:27
int write_head(void)
This method writes head of GMSH (.msh) file format.
Definition: output_msh.cc:290