27 using namespace
Input::Type;
39 this->field_input_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.");
68 void read_ascii_data(Tokenizer &tok,
unsigned int n_components,
unsigned int i_row)
override 71 void read_binary_data(std::istream &data_stream,
unsigned int n_components,
unsigned int i_row)
override 82 return Record(
"gmsh",
"Parameters of gmsh output format.")
115 file <<
"$MeshFormat" << endl;
116 file <<
"2" <<
" 0 " <<
sizeof(double) << endl;
117 file <<
"$EndMeshFormat" << endl;
126 file <<
"$Nodes" << endl;
129 file <<
NODE_FULL_ITER(mesh, nod).id() <<
" " << nod->getX() <<
" " << nod->getY() <<
" " << nod->getZ() << endl;
131 file <<
"$EndNodes" << endl;
139 const static unsigned int gmsh_simplex_types_[4] = {0, 1, 2, 4};
142 file <<
"$Elements" << endl;
147 <<
" " << gmsh_simplex_types_[ elm->dim() ]
148 <<
" 3 " << elm->region().id() <<
" " << elm->region().id() <<
" " << elm->pid;
154 file <<
"$EndElements" << endl;
158 template<
class element>
163 for(
unsigned int i=0; i < output_data->n_values(); i ++) {
164 file << vec(i).id() <<
" ";
165 output_data->print_ascii(file, i);
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->field_input_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->field_input_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->field_input_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->field_input_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)->field_input_name() == (*data_it)->field_input_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) {
void read_ascii_data(Tokenizer &tok, unsigned int n_components, unsigned int i_row) override
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.
#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_
void read_binary_data(std::istream &data_stream, unsigned int n_components, unsigned int i_row) override
#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.
std::shared_ptr< ElementDataCacheBase > OutputDataPtr
#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...
DummyOutputData(std::string field_name_in, ElementDataCacheBase::NumCompValueType n_elem_in)
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.
void set_stream_precision(std::ofstream &stream)
~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]
bool enable_refinement_
Auxiliary 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.