DUNE-FEM (unstable)

Implementation of the IOInterface. This class manages checkpointing. More...

#include <dune/fem/io/file/datawriter.hh>

Classes

struct  GridPersistentObject
 call appropriate backup and restore methods on the grid class More...
 

Public Member Functions

 CheckPointer (const GridType &grid, const CheckPointerParameters &parameter=CheckPointerParameters())
 Constructor generating a checkpointer. More...
 
 CheckPointer (const GridType &grid, const TimeProviderBase &tp, const CheckPointerParameters &parameter=CheckPointerParameters())
 Constructor generating a checkpointer. More...
 
virtual const char * myClassName () const
 print class name
 
bool willWrite (const TimeProviderBase &tp) const
 returns true if data will be written on next write call
 
virtual void writeBinaryData (const double time) const
 write binary data
 
virtual bool willWrite () const
 returns true if data will be written on next write call
 
void write (const std::string &outstring) const
 write given data to disc, evaluates parameter savecount More...
 
void write () const
 write given data to disc, evaluates parameter savecount
 
void write (const TimeProviderBase &tp, const std::string &outstring) const
 write given data to disc, evaluates parameter savecount and savestep More...
 
void write (const TimeProviderBase &tp) const
 write given data to disc, evaluates parameter savecount and savestep More...
 
void writeData (double sequenceStamp, const std::string &outstring) const
 write data with a given sequence stamp and outstring More...
 
void writeData (double sequenceStamp) const
 write data with a given sequence stamp More...
 
const std::string & path () const
 return output path name
 
int writeStep () const
 return write step
 
int writeCalls () const
 return write calls
 
double saveTime () const
 return save time
 

Static Public Member Functions

static GridTyperestoreGrid (const std::string checkFile, const int givenRank=-1, const CheckPointerParameters &parameter=CheckPointerParameters())
 restore grid from previous runs More...
 
static void restoreData (const GridType &grid, const std::string checkFile, const int rank=-1)
 restores data, assumes that all objects have been created and inserted to PersistenceManager before this method is called More...
 
static std::string defaultGridKey (int dimension, bool check=true)
 return FEM key for macro grid reading
 
static std::string defaultGridKey (std::string base, int dimension, const ParameterReader &parameter, bool check=true)
 return FEM key for macro grid reading
 
static void createPath (const std::string &path)
 create given path in combination with rank
 
static std::string createPathName (const std::string &pathPref, int rank)
 create given path in combination with rank
 
static std::string readPath ()
 
template<class CommunicatorType >
static void createGlobalPath (const CommunicatorType &comm, const std::string &path)
 create global path for data output
 

Protected Types

typedef GridImp GridType
 used grid type
 
typedef DataWriter< GridImp, DataImp > BaseType
 type of base class
 
typedef CheckPointer< GridImp > ThisType
 type of this class
 
typedef DataImp OutPutDataType
 used data tuple
 

Protected Member Functions

 CheckPointer (const GridType &grid, const int myRank, const char *checkFile, const bool takeCareOfPersistenceManager=true, const int writeStep=0)
 Constructor generating a checkpointer to restore data. More...
 
std::string restorePersistentData ()
 restores data, assumes that all objects have been created before this method is called
 
bool readCheckPoint (const bool warn=true)
 read checkpoint file
 
virtual void display () const
 display data with grape
 
void grapeDisplay (OutputTupleType &data) const
 display data with grape
 

Protected Attributes

const GridTypegrid_
 type of this class
 

Detailed Description

template<class GridImp>
class Dune::Fem::CheckPointer< GridImp >

Implementation of the IOInterface. This class manages checkpointing.

All data that was registered to PersistenceManager will be stored in binary output format. The derivation from DataWriter is simply to use the writeStep method. The binary output of DataWriter is not used anymore and does not work for checkpointing.

Constructor & Destructor Documentation

◆ CheckPointer() [1/3]

template<class GridImp >
Dune::Fem::CheckPointer< GridImp >::CheckPointer ( const GridType grid,
const CheckPointerParameters parameter = CheckPointerParameters() 
)
inline

Constructor generating a checkpointer.

Parameters
gridcorresponding grid
parameterstructure for tuning the behavior of the Dune::CheckPointer defaults to Dune::CheckPointerParameters

◆ CheckPointer() [2/3]

template<class GridImp >
Dune::Fem::CheckPointer< GridImp >::CheckPointer ( const GridType grid,
const TimeProviderBase tp,
const CheckPointerParameters parameter = CheckPointerParameters() 
)
inline

Constructor generating a checkpointer.

Parameters
gridcorresponding grid
dataTuple containing discrete functions to write
tpa time provider to set time (e.g. for restart)
parameterstructure for tuning the behavior of the Dune::CheckPointer defaults to Dune::CheckPointerParameters

◆ CheckPointer() [3/3]

template<class GridImp >
Dune::Fem::CheckPointer< GridImp >::CheckPointer ( const GridType grid,
const int  myRank,
const char *  checkFile,
const bool  takeCareOfPersistenceManager = true,
const int  writeStep = 0 
)
inlineprotected

Constructor generating a checkpointer to restore data.

Parameters
gridcorresponding grid
myRankrank of process
dataTuple containing discrete functions to write
checkFilefilename for restoring state of program from previous runs
takeCareOfPersistenceManagerflag whether to keep persistent values by PersistenceManager (default true)
writeStepinitial counter value, default 0
Note
In Addition to the parameters read by the DataWriter this class reads the following parameters:

write checkpoint every ‘CheckPointStep’ time step

fem.io.checkpointstep: 500

store checkpoint information to file ‘CheckPointFile’

fem.io.checkpointfile: checkpoint

References Dune::Fem::CheckPointerParameters::checkPointPrefix(), Dune::Fem::CheckPointer< GridImp >::readCheckPoint(), and Dune::Fem::DataOutput< GridImp, std::tuple<> >::writeStep().

Member Function Documentation

◆ readPath()

static std::string Dune::Fem::IOInterface::readPath ( )
inlinestaticinherited

standard path reading and creation method rank is added to output path

References Dune::Fem::Parameter::commonOutputPath().

Referenced by Dune::Fem::CheckPointer< GridImp >::restoreGrid().

◆ restoreData()

template<class GridImp >
static void Dune::Fem::CheckPointer< GridImp >::restoreData ( const GridType grid,
const std::string  checkFile,
const int  rank = -1 
)
inlinestatic

restores data, assumes that all objects have been created and inserted to PersistenceManager before this method is called

Parameters
gridGrid the data belong to
checkFilecheck point file

References DUNE_THROW, and Dune::Fem::CheckPointer< GridImp >::restoreData().

Referenced by Dune::Fem::CheckPointer< GridImp >::restoreData().

◆ restoreGrid()

template<class GridImp >
static GridType * Dune::Fem::CheckPointer< GridImp >::restoreGrid ( const std::string  checkFile,
const int  givenRank = -1,
const CheckPointerParameters parameter = CheckPointerParameters() 
)
inlinestatic

restore grid from previous runs

Parameters
[in]checkFilecheckPoint filename
[in]givenRanknumber of my process (defaults to MPIManager :: rank() )
[in]parameterParameterclass which provides informations about the checkpoint
Returns
Pointer to restored grid instance

References Dune::Fem::CheckPointerParameters::checkPointPrefix(), DUNE_THROW, Dune::Fem::DataOutput< GridImp, std::tuple<> >::path(), Dune::Fem::IOInterface::readPath(), Dune::BackupRestoreFacility< Grid >::restore(), Dune::Fem::CheckPointerParameters::separateRankPath(), and Dune::Fem::Parameter::verbose().

◆ write() [1/3]

void Dune::Fem::DataOutput< GridImp, std::tuple<> >::write ( const std::string &  outstring) const
inlineinherited

write given data to disc, evaluates parameter savecount

Parameters
outstringpass additional string for naming

◆ write() [2/3]

void Dune::Fem::DataOutput< GridImp, std::tuple<> >::write ( const TimeProviderBase tp) const
inlinevirtualinherited

write given data to disc, evaluates parameter savecount and savestep

Parameters
tptime provider for time and step

Implements Dune::Fem::IOInterface.

◆ write() [3/3]

void Dune::Fem::DataOutput< GridImp, std::tuple<> >::write ( const TimeProviderBase tp,
const std::string &  outstring 
) const
inlineinherited

write given data to disc, evaluates parameter savecount and savestep

Parameters
tptime provider for time and step
outstringpass additional string for naming

◆ writeData() [1/2]

void Dune::Fem::DataOutput< GridImp, std::tuple<> >::writeData ( double  sequenceStamp) const
inlinevirtualinherited

write data with a given sequence stamp

Parameters
sequenceStampstamp for the data set

Implements Dune::Fem::IOInterface.

◆ writeData() [2/2]

void Dune::Fem::DataOutput< GridImp, std::tuple<> >::writeData ( double  sequenceStamp,
const std::string &  outstring 
) const
inlineinherited

write data with a given sequence stamp and outstring

Parameters
sequenceStampstamp for the data set
outstringpass additional string for naming

The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)