#ifndef __MHD_MANAGER_H__ #define __MHD_MANAGER_H__ #include "Average.h" #include "SimulationManager.h" #include "IM_Interface.h" class MHD; // Fortran bindings #ifdef LC_UNSC #define HDFDUMP_VAR hdfdump_var_ #define HDFTAKE_VAR hdftake_var_ #define HDFDUMP_CLOSE hdfdump_close_ #define HDFTAKE_CLOSE hdftake_close_ #define MHD_OPEN_READ_HDF mhd_open_read_hdf_ #define MHD_OPEN_WRITE_HDF mhd_open_write_hdf_ #elif LC_NOUNSC #define HDFDUMP_VAR hdfdump_var #define HDFTAKE_VAR hdftake_var #define HDFDUMP_CLOSE hdfdump_close #define HDFTAKE_CLOSE hdftake_close #define MHD_OPEN_READ_HDF mhd_open_read_hdf #define MHD_OPEN_WRITE_HDF mhd_open_write_hdf #endif #define fcharred(A) A /// Defined in hdfdump-para.F extern "C" int MHD_OPEN_WRITE_HDF(char*, char *, char *, double *, int *, double *); /// Defined in hdftake-para.F extern "C" int MHD_OPEN_READ_HDF(char*, char *, char *, double *, int *, double *); /// Defined in hdfdump-para.F extern "C" int HDFDUMP_VAR(char *, FLoaT *, int* ,int *,int *, int*, int *, double *, int*, char *); /// Defined in hdftake-para.F extern "C" int HDFTAKE_VAR(char *, FLoaT *, int *, int *, int *, int *, int *, double *, int *); /// Defined in hdfdump-para.F extern "C" int HDFDUMP_CLOSE(); /// Defined in hdftake-para.F extern "C" int HDFTAKE_CLOSE(); /// Abstract Base Class for MHD /** * Abstract base class for managing MHD input/output (I/O) and * simulation timesteps for MHD (Magnetohydrodynamics) for the LFM. * * The protected members of this class wrap FORTRAN HDF I/O routines * * @note - MHDManager should not be confused with the MHD class, * which is the C++ interface to FORTRAN MHD data structures. * * @seealso SimulationManager, UTMHD, TimestepMHD */ class MHDManager : public SimulationManager { public: /// Do we advance the simulation? virtual bool advance(void) = 0; /// Advance the simulation by dt seconds. virtual void incrementTime(const FLoaT &dt) = 0; /// Do we dump simulation data to the file? virtual bool atDump(void) = 0; /// Current time step since the beginning of the simulation int currentStep; // see "LSTEP" in run-time.h /// Elapsed simulation time (in seconds) double simTime; // see "TIME" in run-time.h /// Write data for a single timestep to file virtual int dump_step(char *base, MHD *mhd, IM_Interface const * const innerMag, const Average &avg ) = 0; /// Read data for a single timestep from file virtual int read_step(char *base, MHD *mhd) = 0; /// Read accumulate & bleed arrays from file into IM_interface object; used for coupling with RCM. virtual int read_accumulate_and_bleed_step(char *base, MHD *mhd, IM_Interface * const innerMag) = 0; protected: /* file I/O */ bool open_write_hdf(char *prefix, char *stepIdentification, char *suffix, double *mjd); bool write_data(MHD *mhd, const Average &avg); bool write_data(MHD *mhd, IM_Interface const * const innerMag, const Average &avg); bool write_accumulate_and_bleed_data(MHD *mhd, IM_Interface const * const innerMag); bool open_read_hdf(char *prefix, char *stepIdentification, char *suffix, double *mjd); bool read_data(MHD *mhd); bool read_accumulate_and_bleed_data(MHD *mhd, IM_Interface * const innerMag); bool close_hdf(void); private: }; #endif