#ifndef __TIMESTEP_MHD_H__ #define __TIMESTEP_MHD_H__ #include "MHDManager.h" /// Manages standard timestep advancement and I/O for MHD /** * Standard timestep Input/Output managment for LFM MHD; simulation * advances the simulation based on the integer timestep rather than * the elapsed simulation time. I/O steps expect files named * according to 0-padded integer time step in the format "[Run * Name]_mhd_[XXXXXXX].[File Extension]" * * @seealso SimulationManager, MHDManager, UTMHD */ class TimestepMHD : public MHDManager { public: TimestepMHD(const int &start_step, const int &stop_step, const int &dump_interval); /// Advance the simulation by one timestep bool advance(void); /// Increment the internal simulation time clock void incrementTime(const FLoaT &dt); /// Are we at a dump interval to write data? bool atDump(void); // Accessors /// Get the starting integer timestep int getStartStep(void) { return startStep; } /// Get the last integer timestep to simulate int getStopStep(void) { return stopStep; } /// Get the frequency of dumps (in number of integer timesteps) int getDumpInterval(void) { return dumpInterval; } // I/O /// Write data for a single timestep to file int dump_step(char *base, MHD *mhd, IM_Interface const * const innerMag, const Average &avg); /// Read data for a single timestep from file int read_step(char *base, MHD *mhd); /// Read accumulate & bleed arrays from file into IM_interface object; used for coupling with RCM. int read_accumulate_and_bleed_step(char *base, MHD *mhd, IM_Interface * const innerMag); protected: /// First timestep in this simulation segment int startStep; /// Last timestep in this simulation segment int stopStep; /// Frequency of file output (in number of timesteps) int dumpInterval; private: /// TimestepIonIO gets time information from the TimestepMHD class, so make it a friend: friend class TimestepIonIO; }; #endif