36 using namespace Input::Type;
39 =
Record(
"gmsh",
"Parameters of gmsh output format.")
46 ofstream &file = this->get_base_file();
49 file <<
"$MeshFormat" << endl;
50 file <<
"2" <<
" 0 " <<
sizeof(double) << endl;
51 file <<
"$EndMeshFormat" << endl;
56 ofstream &file = this->get_base_file();
57 Mesh* mesh = this->get_mesh();
60 file <<
"$Nodes" << endl;
63 file <<
NODE_FULL_ITER(mesh, nod).id() <<
" " << nod->getX() <<
" " << nod->getY() <<
" " << nod->getZ() << endl;
65 file <<
"$EndNodes" << endl;
70 ofstream &file = this->get_base_file();
71 Mesh* mesh = this->get_mesh();
73 const static unsigned int gmsh_simplex_types_[4] = {0, 1, 2, 4};
76 file <<
"$Elements" << endl;
81 <<
" " << gmsh_simplex_types_[ elm->dim() ]
82 <<
" 3 " << elm->region().id() <<
" " << elm->region().id() <<
" " << elm->pid;
88 file <<
"$EndElements" << endl;
92 template<
class element>
95 ofstream &file = this->get_base_file();
99 file.precision(std::numeric_limits<double>::digits10);
102 for(
unsigned int i=0; i < output_data->
n_values; i ++) {
103 file << vec(i).id() <<
" ";
104 output_data->
print(file, i);
113 Mesh *mesh = this->get_mesh();
114 ofstream &file = this->get_base_file();
118 file.precision(std::numeric_limits<double>::digits10);
122 unsigned int i_corner=0;
124 file << ele.id() <<
" " << ele->n_nodes() <<
" ";
127 output_data->
print(file, i_corner++);
137 ofstream &file = this->get_base_file();
138 Mesh *mesh = this->get_mesh();
141 double time_fixed = isfinite(time)?time:0;
143 if(this->node_data.empty() ==
false) {
145 data != this->node_data.end();
150 file <<
"$NodeData" << endl;
156 file << time_fixed << endl;
159 file << step << endl;
160 file << output_data->
n_elem_ << endl;
161 file << output_data->
n_values << endl;
163 this->write_msh_ascii_cont_data(mesh->
node_vector, output_data);
165 file <<
"$EndNodeData" << endl;
167 }
else if(this->corner_data.empty() ==
false) {
169 data != this->corner_data.end();
174 file <<
"$ElementNodeData" << endl;
180 file << time_fixed << endl;
183 file << step << endl;
184 file << output_data->
n_elem_ << endl;
187 this->write_msh_ascii_discont_data(output_data);
189 file <<
"$EndElementNodeData" << endl;
197 ofstream &file = this->get_base_file();
199 double time_fixed = isfinite(time)?time:0;
201 if(this->elem_data.empty() ==
false) {
203 data != this->elem_data.end();
207 file <<
"$ElementData" << endl;
213 file << time_fixed << endl;
216 file << step << endl;
217 file << output_data->
n_elem_ << endl;
218 file << output_data->
n_values << endl;
220 this->write_msh_ascii_cont_data(this->get_mesh()->element, output_data);
222 file <<
"$EndElementData" << endl;
229 xprintf(
MsgLog,
"%s: Writing output file %s ... ", __func__, this->base_filename()->c_str());
231 this->write_msh_header();
233 this->write_msh_geometry();
235 this->write_msh_topology();
244 xprintf(
MsgLog,
"%s: Writing output file %s ... ", __func__, this->base_filename()->c_str());
247 if(this->header_written ==
false) {
249 this->header_written =
true;
252 this->write_msh_node_data(this->time, this->current_step);
253 this->write_msh_elem_data(this->time, this->current_step);
256 this->get_base_file().flush();