Skip to content
Snippets Groups Projects
Commit bc82d485 authored by Robert K's avatar Robert K
Browse files

simplify choice of data writer.

parent c29704f8
No related branches found
No related tags found
No related merge requests found
......@@ -33,11 +33,6 @@ namespace Fem
ss << name << loop;
loop_ = ss.str();
}
explicit EocDataOutputParameters(const std::string& name) {
std::stringstream ss;
ss << name;
loop_ = ss.str();
}
EocDataOutputParameters(const EocDataOutputParameters& other)
: loop_(other.loop_) {}
......@@ -186,13 +181,8 @@ namespace Fem
GridType& grid = algorithm.grid();
auto dataTup = algorithm.dataTuple() ;
typedef typename Algorithm::DataWriterHandlerType DataWriterHandlerType;
DataWriterHandlerType dataWriter( grid, "" );
// initialize data writer with output path and data tuple
{
EocDataOutputParameters param( algorithm.problem().dataPrefix() );
dataWriter.init( dataTup, param );
}
typedef typename Algorithm::DataWriterHandlerType::template DataOutput< GridType, decltype( dataTup ) > ::Type DataOutputType;
DataOutputType dataOutput( grid, dataTup );
// initialize FemEoc if eocSteps > 1
EocParametersType& eocParam( algorithm.eocParams() );
......@@ -234,7 +224,7 @@ namespace Fem
}
// write eoc step
dataWriter.step( eocloop );
dataOutput.writeData( eocloop );
// Refine the grid for the next EOC Step. If the scheme uses adaptation,
// the refinement level needs to be set in the algorithms' initialize method.
......
......@@ -23,6 +23,12 @@ namespace Fem
public:
typedef DataWriter< GridImp, IOTupleImp > DataWriterType;
template <class Grid, class DataTuple>
struct DataOutput
{
typedef Dune::Fem::DataWriter< Grid, DataTuple > Type;
};
DefaultDataWriterHandler( const GridImp& grid, const std::string keyPrefix = "" )
: dataTuple_(),
......@@ -38,13 +44,6 @@ namespace Fem
dataWriter_.reset( new DataWriterType( grid_, dataTuple_, tp, param ) );
}
template< class DataTupleImp, class ParameterType >
void init( DataTupleImp dataTup, ParameterType& param )
{
dataTuple_ = dataTup;
dataWriter_.reset( new DataWriterType( grid_, dataTuple_, param ) );
}
//template< class InDiscreteFunction, class OutDiscreteFunction, class ... Args >
//void preWriteData( const InDiscreteFunction& in, OutDiscreteFunction* out, Args& ... args )
......@@ -74,15 +73,6 @@ namespace Fem
}
}
void step( const int eocStep )
{
if( dataWriter_ )
{
dataWriter_->writeData( eocStep );
}
}
private:
IOTupleImp dataTuple_;
std::unique_ptr< DataWriterType > dataWriter_;
......@@ -95,6 +85,11 @@ namespace Fem
class NoDataWriterHandler
{
public:
template <class Grid, class DataTuple>
struct DataOutput
{
typedef Dune::Fem::DataOutput< Grid, DataTuple > Type;
};
template< class ... Args >
NoDataWriterHandler( Args&& ... )
......
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