IFEM  90A354
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
SIMSolver< T1 > Class Template Reference

Template class for transient simulator drivers. More...

#include <SIMSolver.h>

Inheritance diagram for SIMSolver< T1 >:
Inheritance graph
[legend]
Collaboration diagram for SIMSolver< T1 >:
Collaboration graph
[legend]

Public Member Functions

 SIMSolver (T1 &s1)
 The constructor initializes the reference to the actual solver.
 
virtual ~SIMSolver ()
 The destructor deletes the restart data handler.
 
virtual bool read (const char *file)
 Reads solver data from the specified input file.
 
const TimeStepgetTimePrm () const
 Returns a const reference to the time stepping information.
 
bool advanceStep ()
 Advances the time step one step forward.
 
virtual int solveProblem (char *infile, const char *heading=nullptr)
 Solves the problem up to the final time.
 
void handleDataOutput (const std::string &hdf5file, const ProcessAdm &modelAdm, int saveInterval=1, int restartInterval=0)
 Handles application data output. More...
 
virtual bool serialize (HDF5Restart::SerializeData &data)
 Serialize internal state for restarting purposes. More...
 
virtual bool deSerialize (const HDF5Restart::SerializeData &data)
 Set internal state from a serialized state. More...
 
int restart (const std::string &restartFile, int restartStep)
 Handles application restarts by reading a serialized solver state. More...
 
- Public Member Functions inherited from SIMSolverStat< T1 >
 SIMSolverStat (T1 &s1, const char *head=nullptr)
 The constructor initializes the reference to the actual solver.
 
virtual ~SIMSolverStat ()
 The destructor deletes the results data exporter object.
 
void handleDataOutput (const std::string &hdf5file, const ProcessAdm &modelAdm, int saveInterval=1)
 Handles application data output. More...
 
- Public Member Functions inherited from SIMadmin
virtual ~SIMadmin ()
 Empty destructor.
 
virtual bool preprocess (const IntVec &ignored={}, bool fixDup=false)
 Performs some pre-processing tasks on the FE model.
 
virtual bool preprocessC (const IntVec &, bool, double=0.0)
 Performs some pre-processing tasks on the FE model.
 
const ProcessAdmgetProcessAdm () const
 Returns the parallel process administrator.
 
int getGlobalProcessID () const
 Returns the global process ID. More...
 
const std::string & getHeading () const
 Returns the simulator heading.
 
void setHeading (const std::string &heading)
 Defines the simulator heading.
 
void printHeading (int &supStep) const
 Prints the heading of this simulator, if any, to IFEM::cout.
 
- Public Member Functions inherited from XMLInputBase
bool readXML (const char *fileName, bool verbose=true)
 Reads an XML input file. More...
 
bool loadXML (const char *xml)
 Loads data from an XML-formatted text string. More...
 

Protected Member Functions

virtual bool parse (char *keyw, std::istream &is)
 Parses a data section from an input stream.
 
virtual bool parse (const tinyxml2::XMLElement *elem)
 Parses a data section from an XML element.
 
bool saveState (int &geoBlk, int &nBlock, bool newMesh=false, char *infile=nullptr, bool saveRes=true)
 Saves geometry and results to VTF and HDF5 for current time step.
 
- Protected Member Functions inherited from SIMSolverStat< T1 >
void printHeading (const char *heading)
 Writes an application-specific heading, if provided.
 
- Protected Member Functions inherited from SIMadmin
 SIMadmin (const char *heading=nullptr)
 The default constructor initializes the process administrator.
 
 SIMadmin (SIMadmin &anotherSIM)
 Copy constructor.
 
- Protected Member Functions inherited from XMLInputBase
const tinyxml2::XMLElement * loadFile (tinyxml2::XMLDocument &doc, const char *fileName, bool verbose=false)
 Loads an XML input file into a tinyxml2::XMLDocument object. More...
 
virtual const char ** getPrioritizedTags () const
 Returns a list of prioritized XML-tags.
 

Protected Attributes

bool dumpLog
 Set to true, to print out dump time levels.
 
TimeStep tp
 Time stepping information.
 
HDF5RestartrestartAdm
 Administrator for restart output.
 
ProcessAdmrestartProcAdm
 Process admin used for restart output.
 
int startRstLevel
 Initial time level for the restart output.
 
- Protected Attributes inherited from SIMSolverStat< T1 >
T1S1
 The actual solver.
 
DataExporterexporter
 Administrator for result output to HDF5 file.
 
int startExpLevel
 Initial time level for the DataExporter.
 
- Protected Attributes inherited from SIMadmin
ProcessAdm adm
 Parallel administrator.
 
int myPid
 Processor ID in parallel simulations.
 
int nProc
 Number of processors in parallel simulations.
 
std::string myHeading
 Heading written before reading the input file.
 

Private Attributes

bool saveDivergedSol
 If true, save also the diverged solution to VTF.
 

Additional Inherited Members

- Public Attributes inherited from SIMadmin
SIMoptionsopt
 Simulation control parameters.
 
- Static Public Attributes inherited from SIMadmin
static int msgLevel = 2
 Controls the console output amount during solving.
 
- Protected Types inherited from SIMadmin
using IntVec = std::vector< int >
 Convenience alias.
 

Detailed Description

template<class T1>
class SIMSolver< T1 >

Template class for transient simulator drivers.

This template can be instantiated over any type implementing the ISolver interface. It provides a time stepping loop and restart in addition.

Member Function Documentation

◆ deSerialize()

template<class T1 >
virtual bool SIMSolver< T1 >::deSerialize ( const HDF5Restart::SerializeData data)
inlinevirtual

Set internal state from a serialized state.

Parameters
[in]dataContainer for serialized data

References TimeStep::deSerialize(), SIMSolverStat< T1 >::S1, and SIMSolver< T1 >::tp.

Referenced by SIMSolver< T1 >::restart().

◆ handleDataOutput()

template<class T1 >
void SIMSolver< T1 >::handleDataOutput ( const std::string &  hdf5file,
const ProcessAdm modelAdm,
int  saveInterval = 1,
int  restartInterval = 0 
)
inline

Handles application data output.

Parameters
[in]hdf5fileThe file to save to
[in]modelAdmProcess administrator to use
[in]saveIntervalThe stride in the output file
[in]restartIntervalThe stride in the restart file

References SIMadmin::adm, ProcessAdm::dd, ProcessAdm::getProcId(), SIMSolverStat< T1 >::handleDataOutput(), DomainDecomposition::isPartitioned(), SIMSolver< T1 >::restartAdm, SIMSolver< T1 >::restartProcAdm, and SIMSolver< T1 >::startRstLevel.

◆ restart()

template<class T1 >
int SIMSolver< T1 >::restart ( const std::string &  restartFile,
int  restartStep 
)
inline

Handles application restarts by reading a serialized solver state.

Parameters
[in]restartFileFile to read restart state from
[in]restartStepIndex of the time level to read restart state for
Returns
One-based time level index of the restart state read. If zero, no restart specified. If negative, read failure.

References SIMadmin::adm, IFEM::cout, ProcessAdm::dd, SIMSolver< T1 >::deSerialize(), DomainDecomposition::isPartitioned(), HDF5Restart::readData(), SIMSolverStat< T1 >::S1, and SIMSolver< T1 >::startRstLevel.

◆ serialize()

template<class T1 >
virtual bool SIMSolver< T1 >::serialize ( HDF5Restart::SerializeData data)
inlinevirtual

Serialize internal state for restarting purposes.

Parameters
dataContainer for serialized data

Reimplemented in SIMSolverTS< T1 >.

References SIMSolverStat< T1 >::S1, TimeStep::serialize(), and SIMSolver< T1 >::tp.

Referenced by SIMSolver< T1 >::saveState(), and SIMSolverTS< T1 >::serialize().


The documentation for this class was generated from the following file: