Skip to content
Snippets Groups Projects
Commit 57f8f136 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Use a predicate that discards tensors from vtk output

parent c5dd5aef
No related branches found
No related tags found
No related merge requests found
#ifndef DUNE_PERFTOOL_VTKPREDICATE_HH
#define DUNE_PERFTOOL_VTKPREDICATE_HH
/** A predicate for vtk output
* that cuts all vector grid function spaces with a length greater than 4.
* This is necessary because VTK cannot handle them.
*/
struct CuttingPredicate
{
template<typename T, typename TP>
bool operator()(const T& t, TP tp) const
{
return Dune::TypeTree::degree(t) < 4;
}
};
#endif
\ No newline at end of file
......@@ -901,6 +901,24 @@ def define_gfs_name(element, prefix=()):
return "{}.name(\"data_{}\");".format(gfs, "_".join(str(p) for p in prefix))
@symbol
def type_predicate():
include_file("dune/perftool/vtkpredicate.hh", filetag="driver")
return "CuttingPredicate"
@preamble
def define_predicate(name):
t = type_predicate()
return "{} {};".format(t, name)
@symbol
def name_predicate():
define_predicate("predicate")
return "predicate"
@preamble
def vtkoutput():
element = _form.coefficients()[0].ufl_element()
......@@ -910,8 +928,9 @@ def vtkoutput():
gfs = name_gfs(element)
vec = name_vector()
vtkfile = name_vtkfile()
predicate = name_predicate()
dune_solve()
print_residual()
print_matrix()
return ["Dune::PDELab::addSolutionToVTKWriter({}, {}, {});".format(vtkwriter, gfs, vec),
return ["Dune::PDELab::addSolutionToVTKWriter({}, {}, {}, Dune::PDELab::vtk::defaultNameScheme(), {});".format(vtkwriter, gfs, vec, predicate),
"{}.write({}, Dune::VTK::ascii);".format(vtkwriter, vtkfile)]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment