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