Commit 5d8c1ba9 authored by Lukas Riedel's avatar Lukas Riedel 🎧
Browse files

changed OutputWriterFactory to take parameters in constructor and call create() without arguments

parent 18ed445a
......@@ -114,21 +114,43 @@ private:
using OWB = OutputWriterBase<Traits>;
Dune::ParameterTree& inifile;
typename Traits::GV& gv;
GFS& gfs;
Param& param;
U& u;
public:
/// Create the factory. References will be forwarded to the writer.
/** \param _inifile Parameter file parser
* \param _gv GridView
* \param _gfs GridFunctionSpace of the solution
* \param _param Parameter class
* \param _u Solution vector to write
*/
OutputWriterFactory (Dune::ParameterTree& _inifile, typename Traits::GV& _gv, GFS& _gfs, Param& _param, U& _u) :
inifile(_inifile),
gv(_gv),
gfs(_gfs),
param(_param),
u(_u)
{ }
/// Create a dummy OutputWriter
template<bool active = enabled>
static std::unique_ptr<OWB> create (Dune::ParameterTree& inifile, typename Traits::GV& gv, GFS& gfs, Param& param, U& unew, typename std::enable_if_t<!active,int> = 0)
std::enable_if_t<!active,std::unique_ptr<OWB>> create ()
{
return std::make_unique<OWB>();
}
/// Create a true OutputWriter
template<bool active = enabled>
static std::unique_ptr<OWB> create (Dune::ParameterTree& inifile, typename Traits::GV& gv, GFS& gfs, Param& param, U& unew, typename std::enable_if_t<active,int> = 0)
std::enable_if_t<active,std::unique_ptr<OWB>> create ()
{
std::unique_ptr<OWB> p;
p = std::make_unique<OutputWriter<Traits,GFS,Param,U>>(inifile,gv,gfs,param,unew);
p = std::make_unique<OutputWriter<Traits,GFS,Param,U>>(inifile,gv,gfs,param,u);
return p;
}
};
......
......@@ -44,7 +44,8 @@ Simulation<Traits>::Simulation (Dune::MPIHelper& _helper, std::shared_ptr<Grid>
operator_setup();
// --- Utility Class Setup --- //
output = OutputWriterFactory::create(inifile,gv,*gfs,*param,*unew);
OutputWriterFactory output_fac(inifile,gv,*gfs,*param,*unew);
output = output_fac.create();
AdaptivityHandlerFactory adaptivity_fac(inifile,*grid);
adaptivity = adaptivity_fac.create();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment