Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace > Class Template Reference

Reference structured preconditioned block conjugate gradient implementation. More...

#include <Cabana_Grid_ReferenceStructuredSolver.hpp>

Inheritance diagram for Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >:
Collaboration diagram for Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >:

Classes

struct  LayoutContainer
 Array-like container to hold layout and data information. More...
 

Public Types

using base_type
 Base type.
 
using memory_space = typename base_type::memory_space
 Memory space.
 
using execution_space = typename base_type::execution_space
 Default execution space.
 
using entity_type = typename base_type::entity_type
 Entity type.
 
using value_type = typename base_type::value_type
 Scalar value type.
 
using Array_t = typename base_type::Array_t
 Array type.
 
using subarray_type = typename base_type::subarray_type
 SubArray type.
 
- Public Types inherited from Cabana::Grid::ReferenceStructuredSolver< Scalar, EntityType, MeshType, MemorySpace >
using entity_type = EntityType
 Entity type.
 
using value_type = Scalar
 Scalar value type.
 
using memory_space = typename MemorySpace::memory_space
 Memory space.
 
using execution_space = typename memory_space::execution_space
 Default execution space.
 
using Array_t = Array<Scalar, EntityType, MeshType, MemorySpace>
 Array type.
 
using subarray_type = typename Array_t::subarray_type
 SubArray type.
 

Public Member Functions

 ReferenceConjugateGradient (const ArrayLayout< EntityType, MeshType > &layout)
 Constructor.
 
void setMatrixStencil (const std::vector< std::array< int, num_space_dim > > &stencil, const bool is_symmetric=false) override
 Set the matrix stencil.
 
const Array_tgetMatrixValues () override
 Get the matrix values.
 
void setPreconditionerStencil (const std::vector< std::array< int, num_space_dim > > &stencil, const bool is_symmetric=false) override
 Set the preconditioner stencil.
 
const Array_tgetPreconditionerValues () override
 Get the preconditioner values.
 
void setTolerance (const double tol) override
 Set convergence tolerance implementation.
 
void setMaxIter (const int max_iter) override
 Set maximum iteration implementation.
 
void setPrintLevel (const int print_level) override
 Set the output level.
 
void setup () override
 Setup the problem.
 
void solve (const Array_t &b, Array_t &x) override
 Solve the problem Ax = b for x.
 
int getNumIter () override
 Get the number of iterations taken on the last solve.
 
double getFinalRelativeResidualNorm () override
 Get the relative residual norm achieved on the last solve.
 

Static Public Attributes

static constexpr std::size_t num_space_dim = MeshType::num_space_dim
 Spatial dimension.
 
- Static Public Attributes inherited from Cabana::Grid::ReferenceStructuredSolver< Scalar, EntityType, MeshType, MemorySpace >
static constexpr std::size_t num_space_dim = MeshType::num_space_dim
 Spatial dimension.
 

Detailed Description

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
class Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >

Reference structured preconditioned block conjugate gradient implementation.

Member Typedef Documentation

◆ base_type

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
using Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::base_type
Initial value:
Reference preconditioned structured solver interface.
Definition Cabana_Grid_ReferenceStructuredSolver.hpp:50

Base type.

Member Function Documentation

◆ getFinalRelativeResidualNorm()

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
double Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::getFinalRelativeResidualNorm ( )
inlineoverridevirtual

Get the relative residual norm achieved on the last solve.

Implements Cabana::Grid::ReferenceStructuredSolver< Scalar, EntityType, MeshType, MemorySpace >.

◆ getMatrixValues()

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
const Array_t & Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::getMatrixValues ( )
inlineoverridevirtual

Get the matrix values.

Returns
The matrix entry values. For each entity over which the vector space is defined an entry for each stencil element is required. The order of the stencil elements is that same as that in the stencil definition. Note that values corresponding to stencil entries outside of the domain should be set to zero.

Implements Cabana::Grid::ReferenceStructuredSolver< Scalar, EntityType, MeshType, MemorySpace >.

◆ getNumIter()

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
int Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::getNumIter ( )
inlineoverridevirtual

Get the number of iterations taken on the last solve.

Implements Cabana::Grid::ReferenceStructuredSolver< Scalar, EntityType, MeshType, MemorySpace >.

◆ getPreconditionerValues()

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
const Array_t & Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::getPreconditionerValues ( )
inlineoverridevirtual

Get the preconditioner values.

Returns
The preconditioner entry values. For each entity over which the vector space is defined an entry for each stencil element is required. The order of the stencil elements is that same as that in the stencil definition. Note that values corresponding to stencil entries outside of the domain should be set to zero.

Implements Cabana::Grid::ReferenceStructuredSolver< Scalar, EntityType, MeshType, MemorySpace >.

◆ setMatrixStencil()

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
void Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::setMatrixStencil ( const std::vector< std::array< int, num_space_dim > > & stencil,
const bool is_symmetric = false )
inlineoverridevirtual

Set the matrix stencil.

Parameters
stencilThe (i,j,k) offsets describing the structured matrix entries at each grid point. Offsets are defined relative to an index.
is_symmetricIf true the matrix is designated as symmetric. The stencil entries should only contain one entry from each symmetric component if this is true.

Implements Cabana::Grid::ReferenceStructuredSolver< Scalar, EntityType, MeshType, MemorySpace >.

◆ setMaxIter()

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
void Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::setMaxIter ( const int max_iter)
inlineoverridevirtual

◆ setPreconditionerStencil()

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
void Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::setPreconditionerStencil ( const std::vector< std::array< int, num_space_dim > > & stencil,
const bool is_symmetric = false )
inlineoverridevirtual

Set the preconditioner stencil.

Parameters
stencilThe (i,j,k) offsets describing the structured preconditioner entries at each grid point. Offsets are defined relative to an index.
is_symmetricIf true the preconditioner is designated as symmetric. The stencil entries should only contain one entry from each symmetric component if this is true.

Implements Cabana::Grid::ReferenceStructuredSolver< Scalar, EntityType, MeshType, MemorySpace >.

◆ setPrintLevel()

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
void Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::setPrintLevel ( const int print_level)
inlineoverridevirtual

◆ setTolerance()

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
void Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::setTolerance ( const double tol)
inlineoverridevirtual

Set convergence tolerance implementation.

Implements Cabana::Grid::ReferenceStructuredSolver< Scalar, EntityType, MeshType, MemorySpace >.

◆ setup()

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
void Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::setup ( )
inlineoverridevirtual

◆ solve()

template<class Scalar, class EntityType, class MeshType, class MemorySpace>
void Cabana::Grid::ReferenceConjugateGradient< Scalar, EntityType, MeshType, MemorySpace >::solve ( const Array_t & b,
Array_t & x )
inlineoverridevirtual

Solve the problem Ax = b for x.

Parameters
bThe forcing term.
xThe solution.

Implements Cabana::Grid::ReferenceStructuredSolver< Scalar, EntityType, MeshType, MemorySpace >.


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