27 using namespace
Input::Type;
39 this->output_field_name = field_name_in;
40 this->n_elem_ = n_elem_in;
47 void print(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 <<
" ";
68 return Record(
"gmsh",
"Parameters of gmsh output format.")
101 file <<
"$MeshFormat" << endl;
102 file <<
"2" <<
" 0 " <<
sizeof(double) << endl;
103 file <<
"$EndMeshFormat" << endl;
112 file <<
"$Nodes" << endl;
115 file <<
NODE_FULL_ITER(mesh, nod).id() <<
" " << nod->getX() <<
" " << nod->getY() <<
" " << nod->getZ() << endl;
117 file <<
"$EndNodes" << endl;
125 const static unsigned int gmsh_simplex_types_[4] = {0, 1, 2, 4};
128 file <<
"$Elements" << endl;
133 <<
" " << gmsh_simplex_types_[ elm->dim() ]
134 <<
" 3 " << elm->region().id() <<
" " << elm->region().id() <<
" " << elm->pid;
140 file <<
"$EndElements" << endl;
144 template<
class element>
150 file.precision(std::numeric_limits<double>::digits10);
152 for(
unsigned int i=0; i < output_data->n_values; i ++) {
153 file << vec(i).id() <<
" ";
154 output_data->print(file, i);
167 file.precision(std::numeric_limits<double>::digits10);
171 unsigned int i_corner = 0;
173 file << ele.id() <<
" " << ele->n_nodes() <<
" ";
176 output_data->print(file, i_corner++);
188 double time_fixed = isfinite(this->
time)?this->
time:0;
191 file <<
"$NodeData" << endl;
194 file <<
"\"" << output_data->output_field_name <<
"\"" << endl;
197 file << time_fixed << endl;
201 file << output_data->n_elem_ << endl;
202 file << output_data->n_values << endl;
206 file <<
"$EndNodeData" << endl;
213 double time_fixed = isfinite(this->
time)?this->
time:0;
215 file <<
"$ElementNodeData" << endl;
218 file <<
"\"" << output_data->output_field_name <<
"\"" << endl;
221 file << time_fixed << endl;
225 file << output_data->n_elem_ << endl;
230 file <<
"$EndElementNodeData" << endl;
236 double time_fixed = isfinite(this->
time)?this->
time:0;
238 file <<
"$ElementData" << endl;
241 file <<
"\"" << output_data->output_field_name <<
"\"" << endl;
244 file << time_fixed << endl;
248 file << output_data->n_elem_ << endl;
249 file << output_data->n_values << endl;
253 file <<
"$EndElementData" << endl;
261 if (dummy_data_list.size() == 0) {
265 for(
auto out_ptr : data_list)
266 dummy_data_list.push_back( std::make_shared<DummyOutputData>(out_ptr->output_field_name, out_ptr->n_elem_));
270 auto data_it = data_list.begin();
271 for(
auto dummy_it = dummy_data_list.begin(); dummy_it != dummy_data_list.end(); ++dummy_it) {
272 DebugOut().fmt(
"dummy field: {} data field: {}\n", (*dummy_it)->output_field_name, (*data_it)->output_field_name);
273 if ((*dummy_it)->output_field_name == (*data_it)->output_field_name) {
274 (this->*format_fce)(*data_it); ++data_it;
276 (this->*format_fce)(*dummy_it);
279 ASSERT( data_it == data_list.end() )(data_it - data_list.begin())(data_list.size());
301 if(this->
rank == 0) {
std::vector< std::vector< OutputDataPtr > > dummy_data_list_
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.
#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.
void print(ostream &out_stream, unsigned int idx) override
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
#define DebugOut()
Macro defining 'debug' record of log.
void print_all(ostream &out_stream) 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.