27 using namespace
Input::Type;
39 this->output_field_name = field_name_in;
40 this->n_elem_ = n_elem_in;
47 void print_ascii(ostream &out_stream,
unsigned int idx)
override 49 for(
unsigned int i=0; i< n_elem_;i++) out_stream << 0 <<
" ";
54 for(
unsigned int i=0; i< n_elem_;i++) out_stream << 0 <<
" ";
59 ASSERT(
false).error(
"Not implemented.");
76 return Record(
"gmsh",
"Parameters of gmsh output format.")
109 file <<
"$MeshFormat" << endl;
110 file <<
"2" <<
" 0 " <<
sizeof(double) << endl;
111 file <<
"$EndMeshFormat" << endl;
120 file <<
"$Nodes" << endl;
123 file <<
NODE_FULL_ITER(mesh, nod).id() <<
" " << nod->getX() <<
" " << nod->getY() <<
" " << nod->getZ() << endl;
125 file <<
"$EndNodes" << endl;
133 const static unsigned int gmsh_simplex_types_[4] = {0, 1, 2, 4};
136 file <<
"$Elements" << endl;
141 <<
" " << gmsh_simplex_types_[ elm->dim() ]
142 <<
" 3 " << elm->region().id() <<
" " << elm->region().id() <<
" " << elm->pid;
148 file <<
"$EndElements" << endl;
152 template<
class element>
158 file.precision(std::numeric_limits<double>::digits10);
160 for(
unsigned int i=0; i < output_data->n_values; i ++) {
161 file << vec(i).id() <<
" ";
162 output_data->print_ascii(file, i);
175 file.precision(std::numeric_limits<double>::digits10);
179 unsigned int i_corner = 0;
181 file << ele.id() <<
" " << ele->n_nodes() <<
" ";
184 output_data->print_ascii(file, i_corner++);
196 double time_fixed = isfinite(this->
time)?this->
time:0;
199 file <<
"$NodeData" << endl;
202 file <<
"\"" << output_data->output_field_name <<
"\"" << endl;
205 file << time_fixed << endl;
209 file << output_data->n_elem_ << endl;
210 file << output_data->n_values << endl;
214 file <<
"$EndNodeData" << endl;
221 double time_fixed = isfinite(this->
time)?this->
time:0;
223 file <<
"$ElementNodeData" << endl;
226 file <<
"\"" << output_data->output_field_name <<
"\"" << endl;
229 file << time_fixed << endl;
233 file << output_data->n_elem_ << endl;
238 file <<
"$EndElementNodeData" << endl;
244 double time_fixed = isfinite(this->
time)?this->
time:0;
246 file <<
"$ElementData" << endl;
249 file <<
"\"" << output_data->output_field_name <<
"\"" << endl;
252 file << time_fixed << endl;
256 file << output_data->n_elem_ << endl;
257 file << output_data->n_values << endl;
261 file <<
"$EndElementData" << endl;
269 if (dummy_data_list.size() == 0) {
273 for(
auto out_ptr : data_list)
274 dummy_data_list.push_back( std::make_shared<DummyOutputData>(out_ptr->output_field_name, out_ptr->n_elem_));
278 auto data_it = data_list.begin();
279 for(
auto dummy_it = dummy_data_list.begin(); dummy_it != dummy_data_list.end(); ++dummy_it) {
281 if ((*dummy_it)->output_field_name == (*data_it)->output_field_name) {
282 (this->*format_fce)(*data_it); ++data_it;
284 (this->*format_fce)(*dummy_it);
287 ASSERT( data_it == data_list.end() )(data_it - data_list.begin())(data_list.size());
309 if(this->
rank == 0) {
std::vector< std::vector< OutputDataPtr > > dummy_data_list_
void print_ascii_all(ostream &out_stream) override
void print_ascii(ostream &out_stream, unsigned int idx) override
void write_msh_header(void)
This function write header of GMSH (.msh) file format.
Common parent class for templated OutputData.
#define FOR_ELEMENT_NODES(i, j)
static const Input::Type::Record & get_input_type()
The definition of input record for gmsh file format.
Input::Record input_record_
#define NODE_FULL_ITER(_mesh_, i)
OutputMSH()
The constructor of this class. We open the output file in first call of write_data.
void fix_main_file_extension(std::string extension)
#define FOR_ELEMENTS(_mesh_, __i)
static const int registrar
Registrar of class to factory.
void write_msh_geometry(void)
This function writes geometry (position of nodes) to GMSH (.msh) file format.
void write_corner_data(OutputDataPtr output_data)
writes ElementNode data ascii GMSH (.msh) output file.
#define ELEM_FULL_ITER(_mesh_, i)
int write_tail(void)
This method should write tail of GMSH (.msh) file format.
static Input::Type::Abstract & get_input_format_type()
The specification of output file format.
Small extension of Vector<T> container with support to Id numbers.
DummyOutputData(std::string field_name_in, OutputDataBase::NumCompValueType n_elem_in)
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
#define LogOut()
Macro defining 'log' record of log.
void write_field_data(OutputTime::DiscreteSpace type_idx, void(OutputMSH::*format_fce)(OutputDataPtr))
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...
unsigned int size() const
Returns size of the container. This is independent of the allocated space.
void open_stream(Stream &stream) const
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.
static const unsigned int N_DISCRETE_SPACES
void write_msh_ascii_discont_data(OutputDataPtr output_data)
This function writes discontinuous ascii data to GMSH (.msh) output file.
~OutputMSH()
The destructor of this class.
#define FOR_NODES(_mesh_, i)
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...
virtual ~DummyOutputData() override
int write_data(void)
This method writes data to GMSH (.msh) file format for current time.
OutputDataFieldVec output_data_vec_[N_DISCRETE_SPACES]
std::shared_ptr< OutputDataBase > OutputDataPtr
bool enable_refinement_
Auxliary flag for refinement enabling, due to gmsh format.
void print_all_yaml(ostream &out_stream, unsigned int precision) override
void print_binary_all(ostream &out_stream, bool print_data_size=true) override
void get_min_max_range(double &min, double &max) override
This class is used for output data to VTK file format.
int write_head(void)
This method writes head of GMSH (.msh) file format.
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
NodeVector node_vector
Vector of nodes of the mesh.
ElementVector element
Vector of elements of the mesh.