<h3>Specific improvements</h3>
<ol>
- <li> New: There is now a function GridOut::write_vtk() that can
- write a mesh in VTK format.
+ <li> New: There are now functions GridOut::write_vtk() and
+ GridOut::write_vtu() that can
+ write a mesh in VTK/VTU format.
<br>
(Wolfgang Bangerth, 2014/07/14)
</li>
*/
struct Vtk : public DataOutBase::VtkFlags
{};
+
+
+ /**
+ * Flags for grid output in Vtu format. These flags are the same as
+ * those declared in DataOutBase::VtuFlags.
+ *
+ * @ingroup output
+ */
+ struct Vtu : public DataOutBase::VtkFlags
+ {};
}
/// write() calls write_mathgl()
mathgl,
/// write() calls write_vtk()
- vtk
+ vtk,
+ /// write() calls write_vtu()
+ vtu
};
/**
void write_vtk (const Triangulation<dim,spacedim> &tria,
std::ostream &out) const;
+ /**
+ * Write triangulation in VTU format.
+ */
+ template <int dim, int spacedim>
+ void write_vtu (const Triangulation<dim,spacedim> &tria,
+ std::ostream &out) const;
+
/**
* Write grid to @p out according to the given data format. This
* function simply calls the appropriate <tt>write_*</tt> function.
*/
void set_flags (const GridOutFlags::Vtk &flags);
+ /**
+ * Set flags for VTU output
+ */
+ void set_flags (const GridOutFlags::Vtu &flags);
+
/**
* Provide a function that can tell us which
* suffix a given output format
*/
GridOutFlags::Vtk vtk_flags;
+ /**
+ * Flags for VTU output.
+ */
+ GridOutFlags::Vtu vtu_flags;
+
/**
* Write the grid information about faces to @p out. Only those
* faces are printed which are on the boundary and which have a
vtk_flags = flags;
}
+void GridOut::set_flags (const GridOutFlags::Vtu &flags)
+{
+ vtu_flags = flags;
+}
+
std::string
GridOut::default_suffix (const OutputFormat output_format)
{
return ".mathgl";
case vtk:
return ".vtk";
+ case vtu:
+ return ".vtu";
default:
Assert (false, ExcNotImplemented());
return "";
if (format_name == "vtk")
return vtk;
+ if (format_name == "vtu")
+ return vtu;
+
AssertThrow (false, ExcInvalidState ());
// return something weird
return OutputFormat(-1);
std::string GridOut::get_output_format_names ()
{
- return "none|dx|gnuplot|eps|ucd|xfig|msh|svg|mathgl|vtk";
+ return "none|dx|gnuplot|eps|ucd|xfig|msh|svg|mathgl|vtk|vtu";
}
param.enter_subsection("Vtk");
GridOutFlags::Vtk::declare_parameters(param);
param.leave_subsection();
+
+ param.enter_subsection("Vtu");
+ GridOutFlags::Vtu::declare_parameters(param);
+ param.leave_subsection();
}
param.enter_subsection("Vtk");
vtk_flags.parse_parameters(param);
param.leave_subsection();
+
+ param.enter_subsection("Vtu");
+ vtu_flags.parse_parameters(param);
+ param.leave_subsection();
}
sizeof(xfig_flags) +
sizeof(svg_flags) +
sizeof(mathgl_flags) +
- sizeof(vtk_flags));
+ sizeof(vtk_flags) +
+ sizeof(vtu_flags));
}
+template <int dim, int spacedim>
+void GridOut::write_vtu (const Triangulation<dim,spacedim> &tria,
+ std::ostream &out) const
+{
+ AssertThrow (out, ExcIO ());
+
+ // convert the cells of the triangulation into a set of patches
+ // and then have them output. since there is no data attached to
+ // the geometry, we also do not have to provide any names, identifying
+ // information, etc.
+ DataOutBase::write_vtu (triangulation_to_patches(tria),
+ std::vector<std::string>(),
+ std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> >(),
+ vtu_flags,
+ out);
+
+ AssertThrow (out, ExcIO ());
+}
+
+
+
unsigned int GridOut::n_boundary_faces (const Triangulation<1> &) const
{
return 0;
case vtk:
write_vtk (tria, out);
return;
+
+ case vtu:
+ write_vtu (tria, out);
+ return;
}
Assert (false, ExcInternalError());
template void GridOut::write_vtk
(const Triangulation<deal_II_dimension>&,
std::ostream&) const;
+ template void GridOut::write_vtu
+ (const Triangulation<deal_II_dimension>&,
+ std::ostream&) const;
template void GridOut::write<deal_II_dimension>
(const Triangulation<deal_II_dimension> &,
template void GridOut::write_vtk
(const Triangulation<deal_II_dimension,deal_II_dimension+1>&,
std::ostream&) const;
+ template void GridOut::write_vtu
+ (const Triangulation<deal_II_dimension,deal_II_dimension+1>&,
+ std::ostream&) const;
#endif
#if deal_II_dimension == 3
template void GridOut::write_ucd