14template<
class container>
15void simple_average(
unsigned nx,
unsigned ny,
const container& in0,
const container& in1, container& out)
17 const double* in0_ptr = thrust::raw_pointer_cast( in0.data());
18 const double* in1_ptr = thrust::raw_pointer_cast( in1.data());
19 double* out_ptr = thrust::raw_pointer_cast( out.data());
23 for(
unsigned i=1; i<ny; i++)
25 in0_view.construct( in0_ptr+i*nx, nx);
26 in1_view.construct( in1_ptr+i*nx, nx);
51template<
class ContainerType>
68 m_nx = g.
Nx()*g.
nx(), m_ny = g.
Ny()*g.
ny();
90 thrust::host_vector<double> t1d( size1d);
91 m_temp1d = dg::construct<ContainerType>( t1d);
92 if( !(
"exact"==mode ||
"simple" == mode))
103 unsigned nx = g.
nx()*g.
Nx(), ny = g.
ny()*g.
Ny(), nz = g.
nz()*g.
Nz();
107 m_nx = nx, m_ny = ny*nz;
108 if(
"simple" == mode)
115 m_nx = nx*ny, m_ny = nz;
122 m_nx = nx*ny, m_ny = nz;
123 if(
"simple" == mode)
130 m_nx = nx, m_ny = ny*nz;
135 std::cerr <<
"Warning: this direction is not implemented\n";
137 m_temp1d = dg::construct<ContainerType>(
138 thrust::host_vector<double>( m_ny,0.));
140 m_temp1d = dg::construct<ContainerType>(
141 thrust::host_vector<double>( m_nx,0.));
142 if( !(
"exact"==mode ||
"simple" == mode))
156 void operator() (
const ContainerType& src, ContainerType& res,
bool extend =
true)
161 if(
"exact" == m_mode)
162 dg::average( m_nx, m_ny, src, m_w, m_temp1d);
166 dg::simple_average( m_ny, m_nx, m_temp, m_w, m_temp1d);
176 if(
"exact" == m_mode)
179 dg::average( m_ny, m_nx, m_temp, m_w, m_temp1d);
182 dg::simple_average( m_nx, m_ny, src, m_w, m_temp1d);
192 ContainerType m_w, m_temp, m_temp1d;
class intended for the use in throw statements
Definition: exceptions.h:83
small class holding a stringstream
Definition: exceptions.h:29
#define _ping_
Definition: exceptions.h:12
void scal(ContainerType &x, get_value_type< ContainerType > alpha)
Definition: blas1.h:185
void pointwiseDot(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:336
coo3d
3d contra- and covariant coordinates
Definition: enums.h:177
direction
Direction of a discrete derivative.
Definition: enums.h:97
coo2d
2d coordinates
Definition: enums.h:171
MPI_Vector< thrust::host_vector< real_type > > weights(const aRealMPITopology2d< real_type > &g)
Nodal weight coefficients.
Definition: mpi_weights.h:22
void extend_column(unsigned nx, unsigned ny, const ContainerType &in, ContainerType &out)
Copy a line into columns of output vector.
Definition: average_dispatch.h:67
void extend_line(unsigned nx, unsigned ny, const ContainerType &in, ContainerType &out)
Copy a line into rows of output vector.
Definition: average_dispatch.h:47
void transpose(unsigned nx, unsigned ny, const ContainerType &in, ContainerType &out)
Transpose vector.
Definition: average_dispatch.h:26
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Topological average computations in a Cartesian topology.
Definition: average.h:53
void operator()(const ContainerType &src, ContainerType &res, bool extend=true)
Compute the average as configured in the constructor.
Definition: average.h:156
Average(const aTopology2d &g, enum coo2d direction, std::string mode="exact")
Prepare internal workspace.
Definition: average.h:66
ContainerType container_type
Definition: average.h:54
Average(const aTopology3d &g, enum coo3d direction, std::string mode="exact")
Prepare internal workspace.
Definition: average.h:98
A vector view class, usable in dg functions.
Definition: view.h:43
real_type ly() const
length of y
Definition: grid.h:318
unsigned ny() const
number of polynomial coefficients in y
Definition: grid.h:340
real_type lx() const
length of x
Definition: grid.h:312
unsigned Nx() const
number of cells in x
Definition: grid.h:346
unsigned nx() const
number of polynomial coefficients in x
Definition: grid.h:338
unsigned Ny() const
number of cells in y
Definition: grid.h:352
An abstract base class for three-dimensional grids.
Definition: grid.h:523
real_type lx() const
length in x
Definition: grid.h:573
unsigned nz() const
number of polynomial coefficients in z
Definition: grid.h:616
unsigned Nx() const
number of points in x
Definition: grid.h:622
unsigned ny() const
number of polynomial coefficients in y
Definition: grid.h:614
real_type ly() const
length in y
Definition: grid.h:579
unsigned Ny() const
number of points in y
Definition: grid.h:628
real_type lz() const
length in z
Definition: grid.h:585
unsigned Nz() const
number of points in z
Definition: grid.h:634
unsigned nx() const
number of polynomial coefficients in x
Definition: grid.h:612
Creation functions for integration weights and their inverse.