26template<
class real_type>
30 thrust::host_vector<int> A_row_offsets(size+1), A_column_indices( size);
31 thrust::host_vector<real_type> A_values( size);
34 for(
unsigned i=0; i<size; i++)
36 A_row_offsets[i+1] = i+1;
37 A_column_indices[i] = i;
40 return { size, size, A_row_offsets, A_column_indices, A_values};
70template<
class real_type,
size_t Nd>
101 auto project =
interpolation( g_old, g_new, method).transpose();
102 for(
unsigned row=0; row<project.num_rows(); row++)
103 for (
int jj = project.row_offsets()[row]; jj < project.row_offsets()[row+1]; jj++)
105 int col = project.column_indices()[jj];
107 project.values()[jj] = v_new[row] * ( project.values()[jj]* w_old[col]);
134template<
class real_type,
size_t Nd>
139 std::array<unsigned, Nd> n_lcm{}, N_lcm{};
140 for(
unsigned u=0; u<Nd; u++)
142 n_lcm [u] = std::lcm( g_new.
n(u), g_old.
n(u));
143 N_lcm [u] = std::lcm( g_new.
N(u), g_old.
N(u));
153template<
class real_type>
161 for(
unsigned i=0; i<block.num_rows(); i++)
162 for(
unsigned j=block.row_offsets()[i]; j<(
unsigned)block.row_offsets()[i+1]; j++)
163 op( i, block.column_indices()[j]) = block.values()[j];
183template<
class real_type,
size_t Nd>
186 std::array<dg::IHMatrix_t<real_type>,Nd>
matrix;
187 for(
unsigned u=0; u<Nd; u++)
190 detail::square_backproject( g.
grid(u)));
192 for(
unsigned u=1; u<Nd; u++)
206template<
class real_type,
size_t Nd>
209 std::array<dg::IHMatrix_t<real_type>,Nd>
matrix;
210 for(
unsigned u=0; u<Nd; u++)
215 for(
unsigned u=1; u<Nd; u++)
A square nxn matrix.
Definition operator.h:31
auto inv_weights(const Topology &g)
Inverse nodal weight coefficients.
Definition weights.h:107
auto weights(const Topology &g)
Nodal weight coefficients.
Definition weights.h:62
dg::MIHMatrix_t< typename MPITopology::value_type > projection(const MPITopology &g_new, const MPITopology &g_old, std::string method="dg")
Create a projection between two grids.
Definition mpi_projection.h:288
dg::SparseMatrix< int, real_type, thrust::host_vector > interpolation(const RecursiveHostVector &x, const aRealTopology< real_type, Nd > &g, std::array< dg::bc, Nd > bcx, std::string method="dg")
Create interpolation matrix of a list of points in given grid.
Definition interpolation.h:445
dg::SparseMatrix< int, real_type, thrust::host_vector > diagonal(const thrust::host_vector< real_type > &diagonal)
Create a diagonal matrix.
Definition projection.h:27
dg::SparseMatrix< int, real_type, thrust::host_vector > transformation(const aRealTopology< real_type, Nd > &g_new, const aRealTopology< real_type, Nd > &g_old)
Create a transformation matrix between two grids.
Definition projection.h:135
dg::SquareMatrix< T > invert(const dg::SquareMatrix< T > &in)
Compute inverse of square matrix (alias for dg::create::inverse)
Definition operator.h:690
SquareMatrix< T > tensorproduct(const SquareMatrix< T > &op1, const SquareMatrix< T > &op2)
Form the tensor product between two operators.
Definition operator_tensor.h:25
dg::IHMatrix_t< real_type > inv_backproject(const aRealTopology< real_type, Nd > &g)
Create a matrix that transforms values from an equidistant grid back to a dg grid.
Definition projection.h:207
dg::IHMatrix_t< real_type > backproject(const aRealTopology< real_type, Nd > &g)
Create a matrix that projects values to an equidistant grid.
Definition projection.h:184
Interpolation matrix creation functions.
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
The simplest implementation of aRealTopology.
Definition grid.h:710
A CSR formatted sparse matrix.
Definition sparsematrix.h:102
An abstract base class for Nd-dimensional dG grids.
Definition grid.h:95
std::array< real_type, Nd > get_q() const
Get right boundary point .
Definition grid.h:207
std::array< dg::bc, Nd > get_bc() const
Get boundary condition for all axes.
Definition grid.h:240
unsigned n(unsigned u=0) const
Get number of polynomial coefficients for axis u.
Definition grid.h:262
std::array< real_type, Nd > get_p() const
Get left boundary point .
Definition grid.h:202
RealGrid< real_type, 1 > grid(unsigned u) const
Get axis u as a 1d grid.
Definition grid.h:274
unsigned N(unsigned u=0) const
Get number of cells for axis u.
Definition grid.h:265
Creation functions for integration weights and their inverse.