numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_prob_collect::linear::laplacian_2d_grid< Matrix > Class Template Reference

Class to create matrices of Laplacian on a 2-dimensional grid. More...

#include <num_prob_collect/linear/laplacian_2d_grid.h>

+ Collaboration diagram for num_prob_collect::linear::laplacian_2d_grid< Matrix >:

Public Types

using matrix_type = Matrix
 Type of the matrix.
 
using scalar_type = typename Matrix::Scalar
 Type of the scalars.
 

Public Member Functions

 laplacian_2d_grid (num_collect::index_type grid_rows, num_collect::index_type grid_cols, typename Matrix::value_type grid_width)
 Constructor.
 
auto diag_coeff () const noexcept -> scalar_type
 Get the coefficient of diagonal elements.
 
auto grid_cols () const noexcept -> num_collect::index_type
 Get the number of columns in the grid.
 
auto grid_rows () const noexcept -> num_collect::index_type
 Get the number of rows in the grid.
 
auto index (num_collect::index_type x, num_collect::index_type y) const noexcept -> num_collect::index_type
 Calculate an index in the matrix.
 
auto mat () const noexcept -> const Matrix &
 Get the Laplacian matrix.
 
auto mat_size () const noexcept -> num_collect::index_type
 Get the size of the matrix.
 
auto off_diag_coeff () const noexcept -> scalar_type
 Get the coefficient of off-diagonal elements.
 

Private Member Functions

void calc ()
 Calculate matrices.
 

Private Attributes

scalar_type diag_coeff_ {}
 Coefficient of diagonal elements.
 
num_collect::index_type grid_cols_
 Number of columns in the grid.
 
num_collect::index_type grid_rows_
 Number of rows in the grid.
 
scalar_type grid_width_
 Width of squares in the grid.
 
Matrix mat_
 Laplacian matrix.
 
num_collect::index_type mat_size_
 Number of rows in the Laplacian matrix.
 
scalar_type off_diag_coeff_ {}
 Coefficient of off-diagonal elements.
 

Detailed Description

template<num_collect::base::concepts::sparse_matrix Matrix>
class num_prob_collect::linear::laplacian_2d_grid< Matrix >

Class to create matrices of Laplacian on a 2-dimensional grid.

Note
Discretization is based on bilinear finite elements.
Template Parameters
MatrixType of the matrix.

Definition at line 42 of file laplacian_2d_grid.h.

Member Typedef Documentation

◆ matrix_type

using num_prob_collect::linear::laplacian_2d_grid< Matrix >::matrix_type = Matrix

Type of the matrix.

Definition at line 45 of file laplacian_2d_grid.h.

◆ scalar_type

using num_prob_collect::linear::laplacian_2d_grid< Matrix >::scalar_type = typename Matrix::Scalar

Type of the scalars.

Definition at line 48 of file laplacian_2d_grid.h.

Constructor & Destructor Documentation

◆ laplacian_2d_grid()

num_prob_collect::linear::laplacian_2d_grid< Matrix >::laplacian_2d_grid ( num_collect::index_type grid_rows,
num_collect::index_type grid_cols,
typename Matrix::value_type grid_width )
inline

Constructor.

Parameters
[in]grid_rowsNumber of rows in the grid.
[in]grid_colsNumber of columns in the grid. (Excluding boundaries.)
[in]grid_widthWidth of squares in the grid.

Definition at line 58 of file laplacian_2d_grid.h.

Member Function Documentation

◆ calc()

void num_prob_collect::linear::laplacian_2d_grid< Matrix >::calc ( )
inlineprivate

Calculate matrices.

Definition at line 140 of file laplacian_2d_grid.h.

◆ diag_coeff()

auto num_prob_collect::linear::laplacian_2d_grid< Matrix >::diag_coeff ( ) const -> scalar_type
inlinenodiscardnoexcept

Get the coefficient of diagonal elements.

Returns
Coefficient.

Definition at line 104 of file laplacian_2d_grid.h.

◆ grid_cols()

auto num_prob_collect::linear::laplacian_2d_grid< Matrix >::grid_cols ( ) const -> num_collect::index_type
inlinenodiscardnoexcept

Get the number of columns in the grid.

Returns
Number of columns in the grid.

Definition at line 86 of file laplacian_2d_grid.h.

◆ grid_rows()

auto num_prob_collect::linear::laplacian_2d_grid< Matrix >::grid_rows ( ) const -> num_collect::index_type
inlinenodiscardnoexcept

Get the number of rows in the grid.

Returns
Number of rows in the grid.

Definition at line 77 of file laplacian_2d_grid.h.

◆ index()

Calculate an index in the matrix.

Parameters
[in]xIndex of x in grid.
[in]yIndex of y in grid.
Returns
Index in the matrix.

Definition at line 131 of file laplacian_2d_grid.h.

◆ mat()

auto num_prob_collect::linear::laplacian_2d_grid< Matrix >::mat ( ) const -> const Matrix&
inlinenodiscardnoexcept

Get the Laplacian matrix.

Returns
Laplacian matrix.

Definition at line 122 of file laplacian_2d_grid.h.

◆ mat_size()

auto num_prob_collect::linear::laplacian_2d_grid< Matrix >::mat_size ( ) const -> num_collect::index_type
inlinenodiscardnoexcept

Get the size of the matrix.

Returns
Size of the matrix.

Definition at line 95 of file laplacian_2d_grid.h.

◆ off_diag_coeff()

auto num_prob_collect::linear::laplacian_2d_grid< Matrix >::off_diag_coeff ( ) const -> scalar_type
inlinenodiscardnoexcept

Get the coefficient of off-diagonal elements.

Returns
Coefficient.

Definition at line 113 of file laplacian_2d_grid.h.

Member Data Documentation

◆ diag_coeff_

Coefficient of diagonal elements.

Definition at line 192 of file laplacian_2d_grid.h.

◆ grid_cols_

Number of columns in the grid.

Definition at line 183 of file laplacian_2d_grid.h.

◆ grid_rows_

Number of rows in the grid.

Definition at line 180 of file laplacian_2d_grid.h.

◆ grid_width_

Width of squares in the grid.

Definition at line 189 of file laplacian_2d_grid.h.

◆ mat_

Laplacian matrix.

Definition at line 198 of file laplacian_2d_grid.h.

◆ mat_size_

Number of rows in the Laplacian matrix.

Definition at line 186 of file laplacian_2d_grid.h.

◆ off_diag_coeff_

Coefficient of off-diagonal elements.

Definition at line 195 of file laplacian_2d_grid.h.


The documentation for this class was generated from the following file: