12#ifndef DUMUX_MULTIDOMAIN_VTK_OUTPUT_MODULE_HH
13#define DUMUX_MULTIDOMAIN_VTK_OUTPUT_MODULE_HH
19#include <dune/common/hybridutilities.hh>
20#include <dune/common/indices.hh>
36 using MDSolutionVector =
typename MDTraits::SolutionVector;
37 static constexpr std::size_t numSubDomains = MDTraits::numSubDomains;
39 template<std::
size_t i>
40 using GridVariables =
typename MDTraits::template SubDomain<i>::GridVariables;
42 using MDGridVars =
typename MDTraits::template TupleOfSharedPtrConst<GridVariables>;
44 template<std::
size_t i>
45 using SolutionVector =
typename MDTraits::template SubDomain<i>::SolutionVector;
47 template<std::
size_t i>
48 using VtkOutputModule = Module<GridVariables<i>, SolutionVector<i>>;
50 using VtkOutputModuleTuple =
typename MDTraits::template TupleOfSharedPtr<VtkOutputModule>;
54 template<std::
size_t i>
55 using Type = VtkOutputModule<i>;
58 template<std::
size_t i>
73 const std::array<std::string, numSubDomains>& name)
75 using namespace Dune::Hybrid;
76 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
78 constexpr auto i = std::decay_t<
decltype(id)>::value;
79 elementAt(vtkOutputModule_,
id) = std::make_shared<Type<i>>(*std::get<i>(gridVars), sol[id], name[id]);
86 using namespace Dune::Hybrid;
87 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
89 constexpr auto i = std::decay_t<
decltype(id)>::value;
90 MDTraits::template SubDomain<i>::IOFields::initOutputModule(*elementAt(vtkOutputModule_,
id));
95 void write(
double t, Dune::VTK::OutputType type = Dune::VTK::ascii)
97 using namespace Dune::Hybrid;
98 forEach(std::make_index_sequence<numSubDomains>{}, [&](
auto&& id)
100 elementAt(vtkOutputModule_,
id)->write(t, type);
105 template<std::
size_t i>
107 {
return *Dune::Hybrid::elementAt(vtkOutputModule_,
id); }
110 template<std::
size_t i>
112 {
return *Dune::Hybrid::elementAt(vtkOutputModule_,
id); }
115 template<std::
size_t i>
117 {
return Dune::Hybrid::elementAt(vtkOutputModule_,
id); }
120 template<std::
size_t i>
121 void set(
PtrType<i> p, Dune::index_constant<i>
id = Dune::index_constant<i>{})
122 { Dune::Hybrid::elementAt(vtkOutputModule_,
id) = p; }
127 typename MDTraits::template Tuple<PtrType> vtkOutputModule_;
A multidomain wrapper for multiple vtk output modules.
Definition: multidomain/io/vtkoutputmodule.hh:35
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:116
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:121
void initDefaultOutputFields()
initialized all vtkoutput modules with the models default output fields
Definition: multidomain/io/vtkoutputmodule.hh:84
std::shared_ptr< Type< i > > PtrType
export pointer types the stored type
Definition: multidomain/io/vtkoutputmodule.hh:59
MultiDomainVtkOutputModule()=default
The default constructor.
MultiDomainVtkOutputModule(MDGridVars &&gridVars, const MDSolutionVector &sol, const std::array< std::string, numSubDomains > &name)
Construct the vtk output modules.
Definition: multidomain/io/vtkoutputmodule.hh:72
void write(double t, Dune::VTK::OutputType type=Dune::VTK::ascii)
Write the data for this timestep to file for all output modules.
Definition: multidomain/io/vtkoutputmodule.hh:95
const Type< i > & operator[](Dune::index_constant< i > id) const
return the output module for domain with index i
Definition: multidomain/io/vtkoutputmodule.hh:106
VtkOutputModule< i > Type
export base types of the stored type
Definition: multidomain/io/vtkoutputmodule.hh:55
A VTK output module to simplify writing dumux simulation data to VTK format.
Definition: io/vtkoutputmodule.hh:300
A VTK output module to simplify writing dumux simulation data to VTK format.
Utilities for template meta programming.