Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90554178
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
Sat, Nov 2, 17:19
Size
1 KB
Mime Type
text/x-c++
Expires
Mon, Nov 4, 17:19 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22097289
Attached To
rPHPCSHALLOWWATER PHPC project - Shallow water simulation 2019
Simulation.h
View Options
//
// Created by Joachim Koerfer on 10.05.2019.
//
#ifndef SEQUENTIAL_SIMULATION_H
#define SEQUENTIAL_SIMULATION_H
#include <memory>
#include <string>
#include "Matrix.h"
#define SQRT_2 1.414213562373095
struct
State
{
int
niter
=
0
;
double
T
=
0
;
double
max_nu
=
0
;
double
delta_t
=
0
;
};
typedef
std
::
chrono
::
high_resolution_clock
Clock
;
class
Simulation
{
private:
std
::
unique_ptr
<
Matrix
>
H_
;
std
::
unique_ptr
<
Matrix
>
Hu_
;
std
::
unique_ptr
<
Matrix
>
Hv_
;
std
::
unique_ptr
<
Matrix
>
Zdx_
;
std
::
unique_ptr
<
Matrix
>
Zdy_
;
//Temp storage
std
::
unique_ptr
<
Matrix
>
Ht_
;
std
::
unique_ptr
<
Matrix
>
Hut_
;
std
::
unique_ptr
<
Matrix
>
Hvt_
;
int
size_
;
int
nx_
;
double
delta_nx_
;
double
Tend_
;
const
double
g_
=
127267.2
;
//Variables relative to the state of the simulation
double
T_
;
double
delta_t_
;
double
cst_
;
int
niter_
;
//Variables relative to the measure of performance
Clock
::
time_point
start_time_
;
Clock
::
time_point
end_time_
;
double
measured_time
=
0
;
double
nflops_
=
0
;
double
compute_delta_t
();
void
impose_tolerances
();
void
enforce_boundary_conditions
();
void
copy_old_borders
();
public:
Simulation
(
std
::
string
path
,
int
nx
,
int
size
,
double
Tend
);
void
compute
();
bool
compute_step
();
double
get_flops_performance
()
{
return
nflops_
;
}
void
save
(
const
std
::
string
&
file_name
);
};
#endif
//SEQUENTIAL_SIMULATION_H
Event Timeline
Log In to Comment