Sierra Toolkit  Version of the Day
stk_classic::linsys::AggregateLinearSystem Class Reference

#include <AggregateLinearSystem.hpp>

Inherits stk_classic::linsys::LinearSystemInterface.

Public Member Functions

 AggregateLinearSystem (MPI_Comm comm, fei::SharedPtr< fei::Factory > factory, size_t num_matrices=1, size_t num_rhsvecs=1)
 
virtual ~AggregateLinearSystem ()
 
void set_parameters (Teuchos::ParameterList &paramlist)
 
void set_num_matrices_rhsvecs (size_t num_matrices, size_t num_rhsvecs)
 
void synchronize_mappings_and_structure ()
 
void create_fei_LinearSystem ()
 
fei::SharedPtr< fei::Matrix > get_matrix (size_t index)
 
fei::SharedPtr< fei::Vector > get_rhsvec (size_t index)
 
void aggregate_system (const std::vector< double > &mat_scalars, const std::vector< double > &rhs_scalars)
 
void finalize_assembly ()
 
const DofMapperget_DofMapper () const
 
DofMapperget_DofMapper ()
 
void reset_to_zero ()
 
const fei::SharedPtr< fei::MatrixGraph > get_fei_MatrixGraph () const
 
fei::SharedPtr< fei::MatrixGraph > get_fei_MatrixGraph ()
 
const fei::SharedPtr< fei::LinearSystem > get_fei_LinearSystem () const
 
fei::SharedPtr< fei::LinearSystem > get_fei_LinearSystem ()
 
void write_files (const std::string &base_name) const
 
int solve (int &status, const Teuchos::ParameterList &params)
 

Detailed Description

Container for holding and manipulating collections of matrices and vectors.

This class provides the ability to form a linear system in which the matrix is a linear combination of other matrices, and the right-hand-side is a linear combination of other vectors. If n matrices A[0..n-1] and m vectors b[0..n-1] are each assembled, then the 'aggregate' linear-system is formed with A = sum(alpha[i]*A[i]) and b = sum(beta[i]*b[i]) where alpha and beta are arrays of scalars provided by the calling code.

Definition at line 32 of file AggregateLinearSystem.hpp.

Constructor & Destructor Documentation

◆ AggregateLinearSystem()

stk_classic::linsys::AggregateLinearSystem::AggregateLinearSystem ( MPI_Comm  comm,
fei::SharedPtr< fei::Factory >  factory,
size_t  num_matrices = 1,
size_t  num_rhsvecs = 1 
)

Constructor

Definition at line 20 of file AggregateLinearSystem.cpp.

◆ ~AggregateLinearSystem()

stk_classic::linsys::AggregateLinearSystem::~AggregateLinearSystem ( )
virtual

Destructor

Definition at line 28 of file AggregateLinearSystem.cpp.

Member Function Documentation

◆ set_num_matrices_rhsvecs()

void stk_classic::linsys::AggregateLinearSystem::set_num_matrices_rhsvecs ( size_t  num_matrices,
size_t  num_rhsvecs 
)

set the number of matrices and right-hand-sides

Definition at line 39 of file AggregateLinearSystem.cpp.

◆ synchronize_mappings_and_structure()

void stk_classic::linsys::AggregateLinearSystem::synchronize_mappings_and_structure ( )

This is a collective call – will hang if only a subset of processors call it. Internally calls fei::MatrixGraph::initComplete() and DofMapper::finalize().

Definition at line 46 of file AggregateLinearSystem.cpp.

◆ create_fei_LinearSystem()

void stk_classic::linsys::AggregateLinearSystem::create_fei_LinearSystem ( )

Uses the fei::Factory (that was passed as a constructor argument) to create a fei::LinearSystem and populate it with a fei::Matrix and fei::Vectors.

Definition at line 52 of file AggregateLinearSystem.cpp.

◆ get_matrix()

fei::SharedPtr< fei::Matrix > stk_classic::linsys::AggregateLinearSystem::get_matrix ( size_t  index)

Return the matrix at offset 'index' in the internally-stored array of matrices.

Definition at line 69 of file AggregateLinearSystem.cpp.

◆ get_rhsvec()

fei::SharedPtr< fei::Vector > stk_classic::linsys::AggregateLinearSystem::get_rhsvec ( size_t  index)

Return the rhs-vec at offset 'index' in the internally-stored array of rhs-vectors.

Definition at line 79 of file AggregateLinearSystem.cpp.

◆ aggregate_system()

void stk_classic::linsys::AggregateLinearSystem::aggregate_system ( const std::vector< double > &  mat_scalars,
const std::vector< double > &  rhs_scalars 
)

Given arrays of scalars (which must have the same lengths as specified when this class was constructed), form an aggregate linear system as described in the class-description comments above.

Definition at line 89 of file AggregateLinearSystem.cpp.

◆ finalize_assembly()

void stk_classic::linsys::AggregateLinearSystem::finalize_assembly ( )

This is a collective call – will hang if only a subset of processors call it. Internally calls fei::LinearSystem::loadComplete(), which in turn calls fei::Matrix::globalAssemble() and fei::Vector::gatherFromOverlap(). These operations perform communication to move shared contributions to owning processors, etc.

Definition at line 120 of file AggregateLinearSystem.cpp.

◆ get_DofMapper() [1/2]

const DofMapper & stk_classic::linsys::AggregateLinearSystem::get_DofMapper ( ) const

Return DOF-mapping object

Definition at line 126 of file AggregateLinearSystem.cpp.

◆ get_DofMapper() [2/2]

DofMapper & stk_classic::linsys::AggregateLinearSystem::get_DofMapper ( )

Return DOF-mapping object

Definition at line 132 of file AggregateLinearSystem.cpp.

◆ get_fei_MatrixGraph() [1/2]

const fei::SharedPtr< fei::MatrixGraph > stk_classic::linsys::AggregateLinearSystem::get_fei_MatrixGraph ( ) const

Return fei::MatrixGraph object

Definition at line 149 of file AggregateLinearSystem.cpp.

◆ get_fei_MatrixGraph() [2/2]

fei::SharedPtr< fei::MatrixGraph > stk_classic::linsys::AggregateLinearSystem::get_fei_MatrixGraph ( )

Return fei::MatrixGraph object

Definition at line 155 of file AggregateLinearSystem.cpp.

◆ get_fei_LinearSystem() [1/2]

const fei::SharedPtr< fei::LinearSystem > stk_classic::linsys::AggregateLinearSystem::get_fei_LinearSystem ( ) const

Return fei::LinearSystem object

Definition at line 161 of file AggregateLinearSystem.cpp.

◆ get_fei_LinearSystem() [2/2]

fei::SharedPtr< fei::LinearSystem > stk_classic::linsys::AggregateLinearSystem::get_fei_LinearSystem ( )

Return fei::LinearSystem object

Definition at line 167 of file AggregateLinearSystem.cpp.

◆ solve()

int stk_classic::linsys::AggregateLinearSystem::solve ( int &  status,
const Teuchos::ParameterList &  params 
)

Solve the linear system Note that the caller is expected to have already called the method 'aggregate_system' if multiple matrices/rhs-vectors are being used.

Parameters
statusOutput flag indicating the termination condition of the underlying linear-solver. Values are solver-specific. In general, 0 indicates that the solver achieved a solution that satisfied the stopping test, within the iteration limit, etc. If an iterative solver fails to converge, this status value will generally be non-zero, but the actual value can vary by solver-library.
paramsTeuchos::ParameterList for the solver
Returns
error-code 0 if successful. Note that a 0 error-return does not necessarily mean that the underlying solver achieved a solution. It simply means that no fatal errors were encountered, such as allocation failures, etc.

Definition at line 192 of file AggregateLinearSystem.cpp.


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