7#ifndef TSUNAMI_LAB_PATCHES_WAVE_PROPAGATION_1D
8#define TSUNAMI_LAB_PATCHES_WAVE_PROPAGATION_1D
15 class WavePropagation1d;
30 unsigned short m_step = 0;
36 t_real * m_h[2] = {
nullptr,
nullptr };
39 t_real * m_hu[2] = {
nullptr,
nullptr };
51 for(
unsigned short l_st = 0; l_st < 2; l_st++ ) {
52 m_h[l_st] =
new t_real[ m_nCells + 2 ];
53 m_hu[l_st] =
new t_real[ m_nCells + 2 ];
57 for(
unsigned short l_st = 0; l_st < 2; l_st++ ) {
58 for(
t_idx l_ce = 0; l_ce < m_nCells + 2; l_ce++ ) {
69 for(
unsigned short l_st = 0; l_st < 2; l_st++ ) {
82 t_real * l_hOld = m_h[m_step];
83 t_real * l_huOld = m_hu[m_step];
85 m_step = (m_step+1) % 2;
86 t_real * l_hNew = m_h[m_step];
87 t_real * l_huNew = m_hu[m_step];
90 for(
t_idx l_ce = 1; l_ce < m_nCells+1; l_ce++ ) {
91 l_hNew[l_ce] = l_hOld[l_ce];
92 l_huNew[l_ce] = l_huOld[l_ce];
96 for(
t_idx l_ed = 0; l_ed < m_nCells+1; l_ed++ ) {
102 t_real l_netUpdates[2][2];
104 this->
solver.netUpdates( l_hOld[l_ceL],
112 l_hNew[l_ceL] -= i_scaling * l_netUpdates[0][0];
113 l_huNew[l_ceL] -= i_scaling * l_netUpdates[0][1];
115 l_hNew[l_ceR] -= i_scaling * l_netUpdates[1][0];
116 l_huNew[l_ceR] -= i_scaling * l_netUpdates[1][1];
124 t_real * l_h = m_h[m_step];
125 t_real * l_hu = m_hu[m_step];
132 l_h[m_nCells+1] = l_h[m_nCells];
133 l_hu[m_nCells+1] = l_hu[m_nCells];
151 return m_h[m_step]+1;
160 return m_hu[m_step]+1;
179 m_h[m_step][i_ix+1] = i_h;
191 m_hu[m_step][i_ix+1] = i_hu;
Definition WavePropagation1d.h:27
void setHeight(t_idx i_ix, t_idx, t_real i_h)
Definition WavePropagation1d.h:176
void timeStep(t_real i_scaling)
Definition WavePropagation1d.h:80
t_real const * getMomentumX()
Definition WavePropagation1d.h:159
WavePropagation1d(t_idx i_nCells)
Definition WavePropagation1d.h:47
t_idx getStride()
Definition WavePropagation1d.h:141
t_real const * getHeight()
Definition WavePropagation1d.h:150
~WavePropagation1d()
Definition WavePropagation1d.h:68
void setGhostOutflow()
Definition WavePropagation1d.h:123
void setMomentumX(t_idx i_ix, t_idx, t_real i_hu)
Definition WavePropagation1d.h:188
void setMomentumY(t_idx, t_idx, t_real)
Definition WavePropagation1d.h:197
t_real const * getMomentumY()
Definition WavePropagation1d.h:166
Definition WavePropagation.h:22
T solver
Definition WavePropagation.h:23
Definition constants.h:12
float t_real
floating point type
Definition constants.h:17
std::size_t t_idx
integral type for cell-ids, pointer arithmetic, etc.
Definition constants.h:14