Simulator

class Simulator

Public Functions

inline bool isPreparing()

Gets the preparing status.

Returns:

Preparing status.

inline bool isCalculating()

Gets the calculating status.

Returns:

Calculating status.

inline bool isResetting()

Gets the resetting status.

Returns:

Resetting status.

inline tsunami_lab::patches::WavePropagation *getWaveProp()

Gets a pointer to the current Wavepropagation patch.

Returns:

pointer to wavepropagation patch.

inline void getSetupChoice(std::string &o_setupChoice)

Gets the setup choice.

Parameters:

o_setupChoice – setup choice

Returns:

void

inline void getTimeValues(tsunami_lab::t_idx &o_currentTimeStep, tsunami_lab::t_idx &o_maxTimeStep, tsunami_lab::t_real &o_timePerTimestep)

Gets time step values.

Parameters:
  • o_currentTimeStep – pointer to current time step

  • o_maxTimeStep – pointer to maximum time step

  • o_timePerTimestep – pointer to time per time step

Returns:

void

inline void getCellAmount(tsunami_lab::t_idx &o_ncellsX, tsunami_lab::t_idx &o_ncellsY)

Gets the cell amounts.

Parameters:
  • o_ncellsX – pointer to cell amount for x dimension

  • o_ncellsY – pointer to cell amount for y dimension

Returns:

void

inline void getSimulationSize(tsunami_lab::t_real &o_sizeX, tsunami_lab::t_real &o_sizeY)

Gets the simulation size.

Parameters:
  • o_sizeX – pointer to simulation size for x dimension

  • o_sizeY – pointer to simulation size for y dimension

Returns:

void

inline void getSimulationOffset(tsunami_lab::t_real &o_offsetX, tsunami_lab::t_real &o_offsetY)

Gets the simulation offset.

Parameters:
  • o_offsetX – pointer to offset for x dimension

  • o_offsetY – pointer to offset for y dimension

Returns:

void

inline void setSetupChoice(std::string i_setupChoice)

Sets the setup choice.

Parameters:

i_setupChoice – Setup choice.

Returns:

void

inline void setCellAmount(tsunami_lab::t_idx i_ncellsX, tsunami_lab::t_idx i_ncellsY)

Sets the cell amount.

Parameters:
  • i_ncellsX – cells in x-direction.

  • i_ncellsY – cells in y-direction.

Returns:

void

inline void setOffset(tsunami_lab::t_idx i_offsetX, tsunami_lab::t_idx i_offsetY)

Sets the offset.

Parameters:
  • i_offsetX – offset in x-direction.

  • i_offsetY – offset in y-direction.

Returns:

void

inline void setBathymetryFilePath(std::string i_filePath)

Sets the bathymetry file path.

Parameters:

i_filePath – file path.

Returns:

void

inline void setDisplacementFilePath(std::string i_filePath)

Sets displacement file path.

Parameters:

i_filePath – file path.

Returns:

void

inline void setPrepared(bool i_prepared)

Sets the prepared flag.

Parameters:

i_prepared – prepared flag

Returns:

void

~Simulator()

Destructor which frees all allocated memory.

void deleteCheckpoints()

Deletes the Checkpoint files.

Returns:

void

void deleteStations()

Deletes all stations.

Returns:

void

void resetSimulator()

Resets the simulator.

Returns:

void

void writeCheckpoint()

Calls the netcdf writeCheckpoint function with necessary parameters.

Returns:

void

void loadConfigDataFromFile(std::string i_configFilePath)

Loads the config data from a file

Parameters:

i_configFilePath – path of the config file

Returns:

void

void loadConfigDataJson(json i_config)

Loads the config data from an input json string.

Parameters:

i_config – config data in json format

Returns:

void

void loadStations(json i_jsonData = "")

Sets up stations from config data.

Returns:

void

void addStation(tsunami_lab::t_real i_locationX, tsunami_lab::t_real i_locationY, std::string i_stationName)

Sets up a station.

Parameters:
  • i_locationX – location of the station in x-direction

  • i_locationY – location of the station in y-direction

  • i_stationName – name of the station

Returns:

void

void prepareForCalculation()

Prepares the solver for calculation.

Returns:

void

void runCalculation()

Starts the calculation with the set parameters.

Returns:

void

inline void toggleFileIO(bool i_useFileIO)

Enables or disables file I/O.

Parameters:

i_useFileIO – true if file I/O should be enabled.

Returns:

void

int start(std::string i_config)

Starts the main loop.

Parameters:

i_config – path to a config .json file or “”.

Returns:

exit code

inline void shouldExit(bool i_shouldExit)

Sets the exit flag to provide a safe-exit mechanism.

Parameters:

i_shouldExit – whether to exit or not.

Returns:

void

inline void setPausingStatus(bool i_pauseStatus)

Sets the pause flag.

Parameters:

i_pauseStatus – whether to pause or not.

Returns:

void

double computeEstimatedTimeLeft()

Public Members

std::atomic<double> m_calculationTime = 0
std::atomic<double> m_preparingTime = 0
std::atomic<double> m_timePerTimeStep = 0