64template <
class Geometry,
class Matrix,
class Container>
109 m_tempx = m_sigma = m_precond;
113 template<
class ...Params>
117 *
this =
Elliptic1d( std::forward<Params>( ps)...);
131 template<
class ContainerType0>
165 template<
class ContainerType0,
class ContainerType1>
166 void operator()(
const ContainerType0& x, ContainerType1& y){
171 template<
class ContainerType0,
class ContainerType1>
172 void symv(
const ContainerType0& x, ContainerType1& y){
176 template<
class ContainerType0,
class ContainerType1>
183 if( 0.0 != m_jfactor )
190 Matrix m_leftx, m_rightx, m_jumpX;
191 Container m_weights, m_precond;
229template <
class Geometry,
class Matrix,
class Container>
251 Elliptic2d( g, g.bcx(), g.bcy(), dir, jfactor, chi_weight_jump)
268 value_type jfactor=1.,
bool chi_weight_jump =
false)
271 m_chi_weight_jump = chi_weight_jump;
281 m_temp = m_tempx = m_tempy = m_weights;
287 template<
class ...Params>
291 *
this =
Elliptic2d( std::forward<Params>( ps)...);
310 template<
class ContainerType0>
333 template<
class ContainerType0>
387 template<
class ContainerType0,
class ContainerType1>
388 void operator()(
const ContainerType0& x, ContainerType1& y){
400 template<
class ContainerType0,
class ContainerType1>
401 void symv(
const ContainerType0& x, ContainerType1& y){
414 template<
class ContainerType0,
class ContainerType1>
429 if( 0.0 != m_jfactor )
431 if(m_chi_weight_jump)
455 template<
class ContainerType0,
class ContainerType1>
456 void variation(
const ContainerType0& phi, ContainerType1& sigma){
468 template<
class ContainerTypeL,
class ContainerType0,
class ContainerType1>
469 void variation(
const ContainerTypeL& lambda,
const ContainerType0& phi, ContainerType1& sigma){
483 template<
class ContainerTypeL,
class ContainerType0,
class ContainerType1>
493 Matrix m_leftx, m_lefty, m_rightx, m_righty, m_jumpX, m_jumpY;
494 Container m_weights, m_precond;
495 Container m_tempx, m_tempy, m_temp;
497 Container m_sigma, m_vol;
499 bool m_chi_weight_jump;
504template <
class Geometry,
class Matrix,
class Container>
543template <
class Geometry,
class Matrix,
class Container>
565 Elliptic3d( g, g.bcx(), g.bcy(), g.bcz(), dir, jfactor, chi_weight_jump)
586 m_chi_weight_jump = chi_weight_jump;
609 m_temp = m_tempx = m_tempy = m_tempz = m_weights;
614 template<
class ...Params>
618 *
this =
Elliptic3d( std::forward<Params>( ps)...);
622 template<
class ContainerType0>
634 template<
class ContainerType0>
665 m_multiplyZ = !compute_in_2d;
669 template<
class ContainerType0,
class ContainerType1>
670 void symv(
const ContainerType0& x, ContainerType1& y){
674 template<
class ContainerType0,
class ContainerType1>
700 if(m_chi_weight_jump)
708 m_tempz, 0., m_tempx, m_tempy, m_tempz);
712 0., m_tempx, m_tempy);
730 template<
class ContainerType0,
class ContainerType1>
731 void variation(
const ContainerType0& phi, ContainerType1& sigma){
735 template<
class ContainerTypeL,
class ContainerType0,
class ContainerType1>
736 void variation(
const ContainerTypeL& lambda,
const ContainerType0& phi, ContainerType1& sigma){
740 template<
class ContainerTypeL,
class ContainerType0,
class ContainerType1>
749 dg::tensor::scalar_product3d(alpha, lambda, m_tempx, m_tempy, m_tempz, m_chi, lambda, m_tempx, m_tempy, m_tempz, beta, sigma);
753 Matrix m_leftx, m_lefty, m_leftz, m_rightx, m_righty, m_rightz, m_jumpX, m_jumpY, m_jumpZ;
754 Container m_weights, m_precond;
755 Container m_tempx, m_tempy, m_tempz, m_temp;
757 Container m_sigma, m_vol;
759 bool m_multiplyZ =
true, m_addJumpZ =
false;
760 bool m_chi_weight_jump;
763template<
class G,
class M,
class V>
764struct TensorTraits< Elliptic1d<G, M, V> >
769template<
class G,
class M,
class V>
770struct TensorTraits< Elliptic2d<G, M, V> >
776template<
class G,
class M,
class V>
777struct TensorTraits< Elliptic3d<G, M, V> >
A 1d negative elliptic differential operator .
Definition: elliptic.h:66
Container container_type
Definition: elliptic.h:70
void operator()(const ContainerType0 &x, ContainerType1 &y)
Compute elliptic term and store in output.
Definition: elliptic.h:166
void set_jfactor(value_type new_jfactor)
Set the currently used jfactor ( )
Definition: elliptic.h:161
const Container & precond() const
Return the default preconditioner to use in conjugate gradient.
Definition: elliptic.h:157
Elliptic1d(const Geometry &g, direction dir=forward, value_type jfactor=1.)
Construct from Grid.
Definition: elliptic.h:83
Elliptic1d(const Geometry &g, bc bcx, direction dir=forward, value_type jfactor=1.)
Construct from grid and boundary conditions.
Definition: elliptic.h:98
Elliptic1d()=default
empty object ( no memory allocation)
const Container & weights() const
Return the weights making the operator self-adjoint.
Definition: elliptic.h:146
Geometry geometry_type
Definition: elliptic.h:68
void symv(value_type alpha, const ContainerType0 &x, value_type beta, ContainerType1 &y)
Compute elliptic term and add to output.
Definition: elliptic.h:177
void set_chi(const ContainerType0 &sigma)
Change scalar part Chi.
Definition: elliptic.h:132
get_value_type< Container > value_type
Definition: elliptic.h:71
Matrix matrix_type
Definition: elliptic.h:69
void symv(const ContainerType0 &x, ContainerType1 &y)
Compute elliptic term and store in output.
Definition: elliptic.h:172
void construct(Params &&...ps)
Perfect forward parameters to one of the constructors.
Definition: elliptic.h:114
value_type get_jfactor() const
Get the currently used jfactor ( )
Definition: elliptic.h:163
A 2d negative elliptic differential operator .
Definition: elliptic.h:231
void set_jfactor(value_type new_jfactor)
Set the currently used jfactor ( )
Definition: elliptic.h:363
void symv(const ContainerType0 &x, ContainerType1 &y)
Compute elliptic term and store in output.
Definition: elliptic.h:401
get_value_type< Container > value_type
Definition: elliptic.h:236
void operator()(const ContainerType0 &x, ContainerType1 &y)
Compute elliptic term and store in output.
Definition: elliptic.h:388
Matrix matrix_type
Definition: elliptic.h:234
void construct(Params &&...ps)
Perfect forward parameters to one of the constructors.
Definition: elliptic.h:288
const Container & weights() const
Return the weights making the operator self-adjoint.
Definition: elliptic.h:345
void set_jump_weighting(bool jump_weighting)
Set the chi weighting of jump terms.
Definition: elliptic.h:373
void set_chi(const ContainerType0 &sigma)
Change scalar part in Chi tensor.
Definition: elliptic.h:311
void variation(value_type alpha, const ContainerTypeL &lambda, const ContainerType0 &phi, value_type beta, ContainerType1 &sigma)
Definition: elliptic.h:484
Elliptic2d(const Geometry &g, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false)
Construct from Grid.
Definition: elliptic.h:249
Elliptic2d()=default
empty object ( no memory allocation)
const Container & precond() const
Return the default preconditioner to use in conjugate gradient.
Definition: elliptic.h:356
Geometry geometry_type
Definition: elliptic.h:233
void symv(value_type alpha, const ContainerType0 &x, value_type beta, ContainerType1 &y)
Compute elliptic term and add to output.
Definition: elliptic.h:415
void variation(const ContainerTypeL &lambda, const ContainerType0 &phi, ContainerType1 &sigma)
Definition: elliptic.h:469
void set_chi(const SparseTensor< ContainerType0 > &tau)
Change tensor part in Chi tensor.
Definition: elliptic.h:334
value_type get_jfactor() const
Get the currently used jfactor ( )
Definition: elliptic.h:368
Elliptic2d(const Geometry &g, bc bcx, bc bcy, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false)
Construct from grid and boundary conditions.
Definition: elliptic.h:266
void variation(const ContainerType0 &phi, ContainerType1 &sigma)
Definition: elliptic.h:456
Container container_type
Definition: elliptic.h:235
bool get_jump_weighting() const
Get the current state of chi weighted jump terms.
Definition: elliptic.h:378
A 3d negative elliptic differential operator .
Definition: elliptic.h:545
void variation(const ContainerTypeL &lambda, const ContainerType0 &phi, ContainerType1 &sigma)
Definition: elliptic.h:736
const Container & precond() const
Return the default preconditioner to use in conjugate gradient.
Definition: elliptic.h:645
void symv(value_type alpha, const ContainerType0 &x, value_type beta, ContainerType1 &y)
Compute elliptic term and add to output.
Definition: elliptic.h:675
void variation(const ContainerType0 &phi, ContainerType1 &sigma)
Definition: elliptic.h:731
void set_chi(const SparseTensor< ContainerType0 > &tau)
Change tensor part in Chi tensor.
Definition: elliptic.h:635
void variation(value_type alpha, const ContainerTypeL &lambda, const ContainerType0 &phi, value_type beta, ContainerType1 &sigma)
Definition: elliptic.h:741
void construct(Params &&...ps)
Perfect forward parameters to one of the constructors.
Definition: elliptic.h:615
get_value_type< Container > value_type
Definition: elliptic.h:550
value_type get_jfactor() const
Get the currently used jfactor ( )
Definition: elliptic.h:651
void set_jfactor(value_type new_jfactor)
Set the currently used jfactor ( )
Definition: elliptic.h:649
Elliptic3d()=default
empty object ( no memory allocation)
const Container & weights() const
Return the weights making the operator self-adjoint.
Definition: elliptic.h:641
Elliptic3d(const Geometry &g, bc bcx, bc bcy, bc bcz, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false)
Construct from grid and boundary conditions.
Definition: elliptic.h:582
void set_compute_in_2d(bool compute_in_2d)
Restrict the problem to the first 2 dimensions.
Definition: elliptic.h:664
void set_chi(const ContainerType0 &sigma)
Change scalar part in Chi tensor.
Definition: elliptic.h:623
Elliptic3d(const Geometry &g, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false)
Construct from Grid.
Definition: elliptic.h:564
void symv(const ContainerType0 &x, ContainerType1 &y)
Compute elliptic term and store in output.
Definition: elliptic.h:670
void set_jump_weighting(bool jump_weighting)
Set the chi weighting of jump terms.
Definition: elliptic.h:653
Container container_type
Definition: elliptic.h:549
Matrix matrix_type
Definition: elliptic.h:548
Geometry geometry_type
Definition: elliptic.h:547
bool get_jump_weighting() const
Get the current state of chi weighted jump terms.
Definition: elliptic.h:655
Convenience functions to create 2D derivatives.
Function discretization routines.
void assign(const from_ContainerType &from, ContainerType &to, Params &&... ps)
Generic way to assign the contents of a from_ContainerType object to a ContainerType object optionall...
Definition: blas1.h:665
static DG_DEVICE double one(double x)
Definition: functions.h:20
void copy(const ContainerTypeIn &source, ContainerTypeOut &target)
Definition: blas1.h:164
void axpbypgz(get_value_type< ContainerType > alpha, const ContainerType1 &x, get_value_type< ContainerType > beta, const ContainerType2 &y, get_value_type< ContainerType > gamma, ContainerType &z)
Definition: blas1.h:265
void axpby(get_value_type< ContainerType > alpha, const ContainerType1 &x, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:231
void scal(ContainerType &x, get_value_type< ContainerType > alpha)
Definition: blas1.h:185
void pointwiseDivide(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:428
void pointwiseDot(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:336
void gemv(get_value_type< ContainerType1 > alpha, MatrixType &&M, const ContainerType1 &x, get_value_type< ContainerType1 > beta, ContainerType2 &y)
; (alias for symv)
Definition: blas2.h:299
void transfer(const MatrixType &x, AnotherMatrixType &y)
; Generic way to copy and/or convert a Matrix type to a different Matrix type
Definition: blas2.h:443
void symv(MatrixType &&M, const ContainerType1 &x, ContainerType2 &y)
Definition: blas2.h:287
EllSparseBlockMat< real_type > dz(const aRealTopology3d< real_type > &g, bc bcz, direction dir=centered)
Create 3d derivative in z-direction.
Definition: derivatives.h:308
EllSparseBlockMat< real_type > dx(const aRealTopology2d< real_type > &g, bc bcx, direction dir=centered)
Create 2d derivative in x-direction.
Definition: derivatives.h:33
EllSparseBlockMat< real_type > jumpZ(const aRealTopology3d< real_type > &g, bc bcz)
Matrix that contains jump terms in Z direction in 3D.
Definition: derivatives.h:190
static bc inverse(bc bound)
invert boundary condition
Definition: enums.h:87
bc
Switch between boundary conditions.
Definition: enums.h:15
EllSparseBlockMat< real_type > jumpX(const aRealTopology2d< real_type > &g, bc bcx)
Matrix that contains 2d jump terms in X direction.
Definition: derivatives.h:95
EllSparseBlockMat< real_type > dy(const aRealTopology2d< real_type > &g, bc bcy, direction dir=centered)
Create 2d derivative in y-direction.
Definition: derivatives.h:65
direction
Direction of a discrete derivative.
Definition: enums.h:97
EllSparseBlockMat< real_type > jumpY(const aRealTopology2d< real_type > &g, bc bcy)
Matrix that contains 2d jump terms in Y direction.
Definition: derivatives.h:112
@ forward
forward derivative (cell to the right and current cell)
Definition: enums.h:98
@ centered
centered derivative (cell to the left and right and current cell)
Definition: enums.h:100
thrust::host_vector< real_type > evaluate(UnaryOp f, const RealGrid1d< real_type > &g)
Evaluate a 1d function on grid coordinates.
Definition: evaluation.h:67
MPI_Vector< thrust::host_vector< real_type > > weights(const aRealMPITopology2d< real_type > &g)
Nodal weight coefficients.
Definition: mpi_weights.h:22
EllSparseBlockMat< real_type > jump(int n, int N, real_type h, bc bcx)
Create and assemble a host Matrix for the jump terms in 1d.
Definition: dx.h:310
get_host_vector< Geometry > volume(const Geometry &g)
Create the volume element on the grid (including weights!!)
Definition: transform.h:225
void scalar_product2d(get_value_type< ContainerType0 > alpha, const ContainerTypeL &lambda, const ContainerType0 &v0, const ContainerType1 &v1, const SparseTensor< ContainerType2 > &t, const ContainerTypeM &mu, const ContainerType3 &w0, const ContainerType4 &w1, get_value_type< ContainerType0 > beta, ContainerType5 &y)
Definition: multiply.h:510
void multiply2d(const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerTypeM &mu, ContainerType3 &out0, ContainerType4 &out1)
Definition: multiply.h:230
ContainerType volume(const SparseTensor< ContainerType > &t)
Definition: multiply.h:406
void multiply3d(const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerType3 &in2, const ContainerTypeM &mu, ContainerType4 &out0, ContainerType5 &out1, ContainerType6 &out2)
Definition: multiply.h:256
void scalar_product3d(get_value_type< ContainerType0 > alpha, const ContainerTypeL &lambda, const ContainerType0 &v0, const ContainerType1 &v1, const ContainerType2 &v2, const SparseTensor< ContainerType3 > &t, const ContainerTypeM &mu, const ContainerType4 &w0, const ContainerType5 &w1, const ContainerType6 &w2, get_value_type< ContainerType0 > beta, ContainerType7 &y)
Definition: multiply.h:552
typename TensorTraits< std::decay_t< Vector > >::value_type get_value_type
Definition: tensor_traits.h:38
Function discretization routines for mpi vectors.
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Class for 2x2 and 3x3 matrices sharing elements.
Definition: tensor.h:66
NotATensorTag tensor_category
Definition: tensor_traits.h:33
void value_type
Definition: tensor_traits.h:32