24#ifndef DUMUX_MULTIDOMAIN_VTK_OUTPUT_MODULE_HH
25#define DUMUX_MULTIDOMAIN_VTK_OUTPUT_MODULE_HH
31#include <dune/common/hybridutilities.hh>
32#include <dune/common/indices.hh>
48 using MDSolutionVector =
typename MDTraits::SolutionVector;
49 static constexpr std::size_t numSubDomains = MDTraits::numSubDomains;
51 template<std::
size_t i>
52 using GridVariables =
typename MDTraits::template SubDomain<i>::GridVariables;
54 using MDGridVars =
typename MDTraits::template TupleOfSharedPtrConst<GridVariables>;
56 template<std::
size_t i>
57 using SolutionVector =
typename MDTraits::template SubDomain<i>::SolutionVector;
59 template<std::
size_t i>
60 using VtkOutputModule = Module<GridVariables<i>, SolutionVector<i>>;
62 using VtkOutputModuleTuple =
typename MDTraits::template TupleOfSharedPtr<VtkOutputModule>;
66 template<std::
size_t i>
67 using Type = VtkOutputModule<i>;
70 template<std::
size_t i>
85 const std::array<std::string, numSubDomains>& name)
87 using namespace Dune::Hybrid;
88 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
90 constexpr auto i = std::decay_t<
decltype(id)>::value;
91 elementAt(vtkOutputModule_,
id) = std::make_shared<Type<i>>(*std::get<i>(gridVars), sol[id], name[id]);
98 using namespace Dune::Hybrid;
99 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
101 constexpr auto i = std::decay_t<
decltype(id)>::value;
102 MDTraits::template SubDomain<i>::IOFields::initOutputModule(*elementAt(vtkOutputModule_,
id));
107 void write(
double t, Dune::VTK::OutputType type = Dune::VTK::ascii)
109 using namespace Dune::Hybrid;
110 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
112 elementAt(vtkOutputModule_,
id)->write(t, type);
117 template<std::
size_t i>
119 {
return *Dune::Hybrid::elementAt(vtkOutputModule_,
id); }
122 template<std::
size_t i>
124 {
return *Dune::Hybrid::elementAt(vtkOutputModule_,
id); }
127 template<std::
size_t i>
129 {
return Dune::Hybrid::elementAt(vtkOutputModule_,
id); }
132 template<std::
size_t i>
133 void set(
PtrType<i> p, Dune::index_constant<i>
id = Dune::index_constant<i>{})
134 { Dune::Hybrid::elementAt(vtkOutputModule_,
id) = p; }
139 typename MDTraits::template Tuple<PtrType> vtkOutputModule_;
Utilities for template meta programming.
A VTK output module to simplify writing dumux simulation data to VTK format.
Definition: io/vtkoutputmodule.hh:305
A multidomain wrapper for multiple vtk output modules.
Definition: multidomain/io/vtkoutputmodule.hh:47
PtrType< i > get(Dune::index_constant< i > id=Dune::index_constant< i >{})
return the vtkoutput module for domain with index i
Definition: multidomain/io/vtkoutputmodule.hh:128
void set(PtrType< i > p, Dune::index_constant< i > id=Dune::index_constant< i >{})
set the pointer for sub domain i
Definition: multidomain/io/vtkoutputmodule.hh:133
void initDefaultOutputFields()
initialized all vtkoutput modules with the models default output fields
Definition: multidomain/io/vtkoutputmodule.hh:96
std::shared_ptr< Type< i > > PtrType
export pointer types the stored type
Definition: multidomain/io/vtkoutputmodule.hh:71
MultiDomainVtkOutputModule()=default
The default constructor.
MultiDomainVtkOutputModule(MDGridVars &&gridVars, const MDSolutionVector &sol, const std::array< std::string, numSubDomains > &name)
Contruct the vtk output modules.
Definition: multidomain/io/vtkoutputmodule.hh:84
void write(double t, Dune::VTK::OutputType type=Dune::VTK::ascii)
Write the data for this timestep to file for all output moduless.
Definition: multidomain/io/vtkoutputmodule.hh:107
const Type< i > & operator[](Dune::index_constant< i > id) const
return the output module for domain with index i
Definition: multidomain/io/vtkoutputmodule.hh:118
VtkOutputModule< i > Type
export base types of the stored type
Definition: multidomain/io/vtkoutputmodule.hh:67
A VTK output module to simplify writing dumux simulation data to VTK format.