38 =
Record(
"gmsh",
"Parameters of gmsh output format.")
45 ofstream &file = this->_base_file;
48 file <<
"$MeshFormat" << endl;
49 file <<
"2" <<
" 0 " <<
sizeof(double) << endl;
50 file <<
"$EndMeshFormat" << endl;
55 ofstream &file = this->_base_file;
56 Mesh* mesh = this->_mesh;
59 file <<
"$Nodes" << endl;
62 file <<
NODE_FULL_ITER(mesh, nod).id() <<
" " << nod->getX() <<
" " << nod->getY() <<
" " << nod->getZ() << endl;
64 file <<
"$EndNodes" << endl;
69 ofstream &file = this->_base_file;
70 Mesh* mesh = this->_mesh;
72 const static unsigned int gmsh_simplex_types_[4] = {0, 1, 2, 4};
75 file <<
"$Elements" << endl;
80 <<
" " << gmsh_simplex_types_[ elm->dim() ]
81 <<
" 3 " << elm->region().id() <<
" " << elm->region().id() <<
" " << elm->pid;
87 file <<
"$EndElements" << endl;
91 template<
class element>
94 ofstream &file = this->_base_file;
97 file.precision(std::numeric_limits<double>::digits10);
99 for(
unsigned int i=0; i < output_data->n_values; i ++) {
100 file << vec(i).id() <<
" ";
101 output_data->print(file, i);
110 Mesh *mesh = this->_mesh;
111 ofstream &file = this->_base_file;
114 file.precision(std::numeric_limits<double>::digits10);
118 unsigned int i_corner = 0;
120 file << ele.id() <<
" " << ele->n_nodes() <<
" ";
123 output_data->print(file, i_corner++);
133 ofstream &file = this->_base_file;
134 Mesh *mesh = this->_mesh;
136 double time_fixed = isfinite(time)?time:0;
138 for(
OutputDataPtr output_data : this->output_data_vec_[NODE_DATA])
140 file <<
"$NodeData" << endl;
143 file <<
"\"" << output_data->output_field_name <<
"\"" << endl;
146 file << time_fixed << endl;
149 file << step << endl;
150 file << output_data->n_elem_ << endl;
151 file << output_data->n_values << endl;
153 this->write_msh_ascii_cont_data(mesh->
node_vector, output_data);
155 file <<
"$EndNodeData" << endl;
157 for(
OutputDataPtr output_data : this->output_data_vec_[CORNER_DATA] )
159 file <<
"$ElementNodeData" << endl;
162 file <<
"\"" << output_data->output_field_name <<
"\"" << endl;
165 file << time_fixed << endl;
168 file << step << endl;
169 file << output_data->n_elem_ << endl;
172 this->write_msh_ascii_discont_data(output_data);
174 file <<
"$EndElementNodeData" << endl;
180 ofstream &file = this->_base_file;
182 double time_fixed = isfinite(time) ? time : 0;
184 for(
OutputDataPtr output_data : this->output_data_vec_[ELEM_DATA] )
186 file <<
"$ElementData" << endl;
189 file <<
"\"" << output_data->output_field_name <<
"\"" << endl;
192 file << time_fixed << endl;
195 file << step << endl;
196 file << output_data->n_elem_ << endl;
197 file << output_data->n_values << endl;
199 this->write_msh_ascii_cont_data(this->_mesh->element, output_data);
201 file <<
"$EndElementData" << endl;
208 this->_base_filename.c_str());
210 this->write_msh_header();
212 this->write_msh_geometry();
214 this->write_msh_topology();
224 this->_base_filename.c_str());
227 if(this->header_written ==
false) {
229 this->header_written =
true;
232 this->write_msh_node_data(this->time, this->current_step);
233 this->write_msh_elem_data(this->time, this->current_step);
236 this->_base_file.flush();
257 if(this->
rank == 0) {
void write_msh_header(void)
This function write header of GMSH (.msh) file format.
static Input::Type::AbstractRecord input_format_type
The specification of output file format.
void write_msh_elem_data(double time, int step)
This function write all data on elements to output file. This function is used for static and dynamic...
#define FOR_ELEMENT_NODES(i, j)
#define NODE_FULL_ITER(_mesh_, i)
OutputMSH()
The constructor of this class.
void fix_main_file_extension(std::string extension)
#define FOR_ELEMENTS(_mesh_, __i)
void write_msh_geometry(void)
This function writes geometry (position of nodes) to GMSH (.msh) file format.
#define ELEM_FULL_ITER(_mesh_, i)
int write_tail(void)
This method should write tail of GMSH (.msh) file format.
Small extension of Vector container with support to Id numbers.
static Input::Type::Record input_type
The definition of input record for gmsh file format.
unsigned int size() const
Returns size of the container. This is independent of the allocated space.
unsigned int n_elements() const
void write_msh_ascii_cont_data(flow::VectorId< element > &vec, OutputDataPtr output_data)
This function writes continuous ascii data to GMSH (.msh) output file.
void write_msh_topology(void)
This function writes topology (connection of nodes) to the GMSH (.msh) file format.
void write_msh_ascii_discont_data(OutputDataPtr output_data)
This function writes discontinuous ascii data to GMSH (.msh) output file.
void write_msh_node_data(double time, int step)
This function write all data on nodes to output file. This function is used for static and dynamic da...
~OutputMSH()
The destructor of this class.
The class for outputting data during time.
#define FOR_NODES(_mesh_, i)
#define INPUT_CHECK(i,...)
Debugging macros.
int write_data(void)
This method writes data to GMSH (.msh) file format for current time.
std::shared_ptr< OutputDataBase > OutputDataPtr
int write_head(void)
This method writes head of GMSH (.msh) file format.
NodeVector node_vector
Vector of nodes of the mesh.