27 using GlobalBasis =
typename SystemVector::GlobalBasis;
29 using Grid =
typename GridView::Grid;
35 : systemVector_(std::move(systemVector))
36 , boundaryManager_(std::move(boundaryManager))
45 template <
class... Indices>
46 std::unique_ptr<FileWriterInterface>
47 create(std::string type, std::string prefix, Indices... ii)
const
49 auto data = valueOf(*systemVector_, ii...);
50 return create_impl(std::move(type), std::move(prefix), data, Dune::PriorityTag<42>{});
55 REQUIRES(not std::is_same_v<ValueCategory_t<typename Data::Range>,
tag::unknown>),
56 REQUIRES(std::is_arithmetic_v<
typename Dune::FieldTraits<typename Data::Range>::field_type>)>
57 std::unique_ptr<FileWriterInterface>
58 create_impl(std::string type, std::string prefix, Data
const& data, Dune::PriorityTag<2>)
const
60 GridView
const& gridView = systemVector_->basis().gridView();
65 return std::make_unique<VTKWriter<GridView,Data>>(prefix, gridView, data);
69 else if (type ==
"dune-vtk")
71 return std::make_unique<DuneVtkWriter<GridView,Data>>(prefix, gridView, data);
75 else if (type ==
"gmsh")
77 if (!!boundaryManager_)
78 return std::make_unique<GmshWriter<GridView>>(prefix, gridView,
79 std::vector<int>{}, boundaryManager_->boundaryIds());
81 return std::make_unique<GmshWriter<GridView>>(prefix, gridView);
84 else if (type ==
"backup")
86 return std::make_unique<BackupWriter<SystemVector>>(prefix, systemVector_);
89 error_exit(
"Unknown filewriter type '{}' given for '{}'. Use one of "
90 "(vtk, gmsh, backup, [dune-vtk]), where the last one is only available "
91 "if the dune module dune-vtk is found.", type, prefix);
98 REQUIRES(std::is_same_v<ValueCategory_t<typename Data::Range>,tag::unknown>),
99 REQUIRES(std::is_arithmetic_v<
typename Dune::FieldTraits<typename Data::Range>::field_type>)>
100 std::unique_ptr<FileWriterInterface>
101 create_impl(std::string type, std::string prefix, Data
const& , Dune::PriorityTag<1>)
const
104 if (type ==
"backup")
106 return std::make_unique<BackupWriter<SystemVector>>(prefix, systemVector_);
109 error_exit(
"Filewriter '{}' cannot be applied to this component in the tree. "
110 "Either use the writer 'backup' to write the whole tree, or add a treepath "
111 "to the output prefix '{}'.", type, prefix);
116 template <
class Data>
117 std::unique_ptr<FileWriterInterface>
118 create_impl(std::string, std::string, Data
const&, Dune::PriorityTag<0>)
const
120 error_exit(
"Filewriter cannot be used with unsupported Range and field_type");
125 std::shared_ptr<SystemVector> systemVector_;
126 std::shared_ptr<BoundaryManager<Grid>> boundaryManager_ =
nullptr;
FileWriterCreator(std::shared_ptr< SystemVector > systemVector, std::shared_ptr< BoundaryManager< Grid > > boundaryManager=nullptr)
Constructor. Stores the pointer to the systemVector and to the (optional) boundaryManager.
Definition FileWriterCreator.hpp:33
std::unique_ptr< FileWriterInterface > create(std::string type, std::string prefix, Indices... ii) const
Create a new FileWriter of type type
Definition FileWriterCreator.hpp:47