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();
void write_msh_header(void)
This function write header of GMSH (.msh) file format.
Common parent class for templated OutputData.
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)
Header: The functions for all outputs.
#define NODE_FULL_ITER(_mesh_, i)
OutputMSH()
The constructor of this class.
std::string output_field_name
#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.
I/O functions with filename storing, able to track current line in opened file. All standard stdio fu...
void write_msh_ascii_cont_data(flow::VectorId< element > &vec, OutputDataBase *output_data)
This function writes continuous ascii data to GMSH (.msh) output file.
unsigned int size() const
Returns size of the container. This is independent of the allocated space.
unsigned int n_elements() const
void write_msh_topology(void)
This function writes topology (connection of nodes) to the GMSH (.msh) file format.
Header: The functions for MSH (GMSH) outputs.
void write_msh_ascii_discont_data(OutputDataBase *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 outputing data during time.
#define FOR_NODES(_mesh_, i)
OutFileFormat file_format
int write_data(void)
This method writes data to GMSH (.msh) file format for current time.
int write_head(void)
This method writes head of GMSH (.msh) file format.
virtual void print(ostream &out_stream, unsigned int idx)=0
NodeVector node_vector
Vector of nodes of the mesh.