Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121759211
simulation.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jul 13, 16:40
Size
1 KB
Mime Type
text/x-c++
Expires
Tue, Jul 15, 16:40 (2 d)
Engine
blob
Format
Raw Data
Handle
27359961
Attached To
rTSUNAMIPROJECT PHPC-TSUNAMI-PROJECT
simulation.h
View Options
//
// 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
Log In to Comment