UI

namespace ui
class GUI
#include <GUI.h>

Public Functions

int launch()

Entry-point for the GUI.

Returns:

exit code

Private Functions

int exec(std::string i_cmd, std::string i_outputFile)

Executes a shell command.

Parameters:
  • i_cmd – command

  • i_outputFile – file to pipe the shell output to

Returns:

exit code

json createConfigJson()

Creates a config json from local config parameters.

Returns:

config as json object

void updateSystemInfo()

Gets info on CPU and RAM usage from the server.

void updateTimeValues()

Gets info on time step and time per time step from the server.

Private Members

const char *VERSION = "1.0.2"

Version of the GUI.

const unsigned int WINDOW_WIDTH = 1500

Width of the window.

const unsigned int WINDOW_HEIGHT = 1000

Height of the window.

xlpmg::Communicator m_communicator

The communcator object.

std::string m_clientLog

Local copy of the client log.

bool m_clientLogAutoScroll = true

Whether the client log should auto-scroll.

int PORT = 8080

Port of the server.

char IPADDRESS[16] = "127.0.0.1"

IP address of the server.

bool m_connected = false

Connection status.

std::chrono::time_point<std::chrono::system_clock> m_lastSystemInfoUpdate

Last system info update.

int m_systemInfoUpdateFrequency = 2

System info update frequency.

bool m_logSystemInfoDataTransmission = false

Log system info data transmission.

std::chrono::time_point<std::chrono::system_clock> m_lastTimeValuesUpdate

Last time values update.

int m_timeValuesUpdateFrequency = 2

Time values update frequency.

bool m_logTimeValuesDataTransmission = false

Log time values data transmission.

int m_clientReadBufferSize = m_communicator.BUFF_SIZE_READ_DEFAULT

Client read buffer size.

int m_clientSendBufferSize = m_communicator.BUFF_SIZE_SEND_DEFAULT

Client send buffer size.

int m_serverReadBufferSize = m_communicator.BUFF_SIZE_READ_DEFAULT

Server read buffer size.

int m_serverSendBufferSize = m_communicator.BUFF_SIZE_SEND_DEFAULT

Server send buffer size.

int m_serverRestartPort = 8080

Port which the server restarts on.

const char *m_compileModes[5] = {"release", "debug", "release+san", "debug+san", "benchmark"}

Compile modes from the SConstruct file.

int m_compileMode = 0

Selected compile mode.

char m_compilerChoice[256] = ""

Compiler choice.

const char *m_optFlags[5] = {"0", "1", "2", "3", "fast"}

Optimization flags.

int m_optFlag = 2

Selected optimization flag.

const char *m_ompFlags[3] = {"none", "gnu", "intel"}

OpenMP flags.

int m_ompFlag = 0

Selected OpenMP flag.

int m_ompNumThreads = -1

Number of OpenMP threads.

const char *m_reportFlags[7] = {"none", "0", "1", "2", "3", "4", "5"}

Report flagss.

int m_reportFlag = 0

Selected report flag.

bool m_useFilesystem = true

Use filesystem flag.

char m_customEnv[256] = ""

Custom environment variables.

bool m_useGui = true

Whether to use the GUI.

const char *m_runnerOptions[3] = {"none", "bash", "sbatch"}

Options for the runner.

int m_runner = 0

Selected runner option.

bool m_checkpointBeforeRecomp = false

Whether to checkpoint before recompiling.

char m_sbJob[256] = "tsunami_lab_auto"

SLURM job name.

char m_sbOut[256] = "output.txt"

SLURM job output file.

char m_sbErr[256] = "error.txt"

SLURM job error file.

char m_sbTim[256] = "10:00:00"

SLURM job wall clock.

char m_configFilePath[256] = ""

Path to the config file.

const char *m_tsunamiEvents[3] = {"CUSTOM2D", "ARTIFICIAL2D", "CIRCULARDAMBREAK2D"}

Tsunami event types.

int m_tsunamiEvent = 0

Selected tsunami event.

int m_nx = 1

Number of cells in x direction.

int m_ny = 1

Number of cells in y direction.

int m_nk = 1

Cell grouping size for coarse output.

float m_simulationSizeX = 10

Simulation size in x direction.

float m_simulationSizeY = 1

Simulation size in y direction.

float m_offsetX = 0

Offset in x direction.

float m_offsetY = 0

Offset in y direction.

int m_endTime = 30

Simulated time in seconds.

bool m_useFileIO = true

Whether to use file IO or not.

const char *m_outputMethods[2] = {"netcdf", "csv"}

Data output method options.

int m_outputMethod = 0

Selected data output method.

int m_writingFrequency = 100

Data output frequency.

char m_outputFileName[256] = "solution"

Output file name.

int m_stationFrequency = 0

Station frequency.

int m_checkpointFrequency = 10

Checkpoint frequency.

int m_height = 10

Elevated water height (currently only used for CIRCULARDAMBREAK2D)

int m_baseHeight = 5

Water height at the base (currently only used for CIRCULARDAMBREAK2D)

int m_diameter = 10

Diameter of the elevated circular water body (currently only used for CIRCULARDAMBREAK2D)

float m_timeStepScaling = 1.0f

Scaling factor for the time step.

char m_transferLocalFilePath[256] = ""

Path to the local file to transfer.

char m_transferRemoteFilePath[256] = ""

Remote path to transfer the file to.

char m_bathymetryFilePath[256] = ""

Remote path to the bathymetry file.

char m_displacementFilePath[256] = ""

Remote path to the displacement file.

bool m_boundaryL = false

Boundary condition on the left side.

bool m_boundaryR = false

Boundary condition on the right side.

bool m_boundaryT = false

Boundary condition on the top side.

bool m_boundaryB = false

Boundary condition on the bottom side.

std::vector<Station> m_stations

List of stations.

float m_currStationX = 0

Currently selected station x position.

float m_currStationY = 0

Currently selected station y position.

char m_currStationName[256] = ""

Currently selected station name.

std::string m_simulationStatus = "UNKNOWN"

Status of the simulation.

bool m_isPausing = false

Whether the simulation was paused.

int m_currentTimeStep = 0

Current time step.

int m_maxTimeSteps = 0

Maximum number of time steps.

double m_timePerTimeStep = 0

Time per time step in milliseconds.

double m_estimatedTimeLeft = 0

Estimated time left in seconds.

std::vector<float> m_cpuData

Vector of CPU usage data (entries correspond to the individual cores)

double m_totalRAM = 0

Total RAM available on the server machine.

double m_usedRAM = 0

Used RAM on the server machine.

std::vector<float> m_stationTime

Vector of time values of the station data.

std::vector<float> m_stationBathymetry

Bathymetry data at the station.

std::vector<float> m_stationMomentumX

Momentum in x direction at the station.

std::vector<float> m_stationMomentumY

Momentum in y direction at the station.

std::vector<float> m_stationTotalHeight

Total height at the station.

std::string m_stationFilePath = ""

Path to the station data file.

tsunami_lab::t_real *m_heightData = nullptr

Array of water height data.

tsunami_lab::t_real *m_bathymetryData = nullptr

Array of bathymetry data.

float m_scaleMin = -1

Minimum of the color scale.

float m_scaleMax = 1

Maximum of the color scale.

long m_currCellsX = 0

Current number of cells in x direction for data visualization.

long m_currCellsY = 0

Current number of cells in y direction for data visualization.

tsunami_lab::t_real m_currOffsetY = 0

Current offset in x direction for data visualization.

tsunami_lab::t_real m_currOffsetX = 0

Current offset in y direction for data visualization.

tsunami_lab::t_real m_currSimSizeX = 0

Current simulation size in x direction for data visualization.

tsunami_lab::t_real m_currSimSizeY = 0

Current simulation size in y direction for data visualization.

struct Station

Station struct.

Public Members

std::string name
float positionX = 0
float positionY = 0
bool isSelected = false