Page MenuHomec4science

simulation.h
No OneTemporary

File Metadata

Created
Tue, Jul 9, 15:54

simulation.h

//
// Created by Arnaud Pannatier on 06.05.18.
// Based on the code of :
// - Nicolas Richart <nicolas.richart@epfl.ch>
// - Vincent Keller <vincent.keller@epfl.ch>
// - Vittoria Rezzonico <vittoria.rezzonico@epfl.ch>
// See the files AUTHORS and COPYRIGHT for the concerning information
//
#ifndef PHPCTSUNAMIPROJECT_SIMULATION_H
#define PHPCTSUNAMIPROJECT_SIMULATION_H
#include <tuple>
#include <string>
#include <mpi.h>
#include "double_buffer.h"
#include "grid.h"
class Simulation {
public:
Simulation(std::size_t NX_,double G_, std::size_t SIZE_,double TEND_, double DX_, std::string dir_, MPI_Comm communicator_);
/// Simulation I/O
void readInitialConditionsFromFile();
void writeResultsToFile();
/// perform the simulation
std::tuple<double, int> compute();
inline std::size_t x(){ return NX; };
inline std::size_t y(){ return NY; };
protected:
/// compute one step
void compute_step();
void compute_mu_and_set_dt ();
void compute_row (size_t i);
void resizeGrids(size_t nx, size_t ny);
private:
/// Global problem size
std::size_t NX,NY;
/// Directory of the files where to read the grids and write the results
std::string dir;
/// Constant, timesteps and scalar variables useful for the simulation
double G, TEND, DX, dt, T,nt, C;
/// Size of the Grid
std::size_t SIZE;
/// Grid that stores the actual data for the height and the velocity of the water
DoubleBuffer H, HV,HU;
/// Topology of the map
Grid Zdx,Zdy;
/// Local problem size
std::size_t local_x, local_y;
/// local offset
int offset_x, offset_y;
/// local neighbors
int north_prank, south_prank;
/// proc rank
int prank;
/// communicator size
int psize;
/// communicator
MPI_Comm communicator;
};
#endif //PHPCTSUNAMIPROJECT_SIMULATION_H

Event Timeline