Advanced Multi-Physics (AMP)
On-Line Documentation
MatrixTests.h
Go to the documentation of this file.
1#ifndef included_AMP_test_MatrixTests
2#define included_AMP_test_MatrixTests
3
4#include "AMP/matrices/Matrix.h"
5#include "AMP/mesh/Mesh.h"
6#include "AMP/utils/UnitTest.h"
7#include "AMP/vectors/Variable.h"
8#include "AMP/vectors/Vector.h"
9
10#include <memory>
11#include <string>
12
13
14namespace AMP::LinearAlgebra {
15
16void fillWithPseudoLaplacian( std::shared_ptr<AMP::LinearAlgebra::Matrix> matrix );
17
18
23class MatrixFactory
24{
25public:
26 virtual ~MatrixFactory() {}
27 virtual std::shared_ptr<AMP::Mesh::Mesh> getMesh() const = 0;
28 virtual std::shared_ptr<AMP::LinearAlgebra::Vector> getVector() const = 0;
29 virtual std::shared_ptr<AMP::LinearAlgebra::Matrix> getMatrix() const = 0;
30 virtual std::shared_ptr<AMP::Discretization::DOFManager> getDOFMap() const = 0;
31 virtual std::shared_ptr<AMP::Discretization::DOFManager> getDOFMapL() const = 0;
32 virtual std::string name() const = 0;
33 const std::string &type() const { return d_type; }
34
35protected:
36 MatrixFactory( const std::string &type ) : d_type( type ) {}
38
39protected:
40 const std::string d_type;
41};
42
43
49{
50public:
51 explicit MatrixTests( std::shared_ptr<const MatrixFactory> factory,
52 std::shared_ptr<const MatrixFactory> copy_factory = nullptr )
53 : d_factory( factory ), d_copy_factory( copy_factory )
54 {
55 }
56
57public:
71
72private:
73 std::shared_ptr<AMP::LinearAlgebra::Matrix>
74 getCopyMatrix( std::shared_ptr<AMP::LinearAlgebra::Matrix> matrix );
75 std::shared_ptr<const MatrixFactory> d_factory;
76 std::shared_ptr<const MatrixFactory> d_copy_factory;
77};
78
79void test_matrix_loop( AMP::UnitTest &ut, std::shared_ptr<MatrixTests> tests );
80
81
83 std::shared_ptr<MatrixFactory> factory,
84 std::shared_ptr<MatrixFactory> copy_factory = nullptr );
85
86
87void testBasics( AMP::UnitTest &ut, const std::string &type );
88
89
90} // namespace AMP::LinearAlgebra
91
92#endif
virtual std::string name() const =0
virtual std::shared_ptr< AMP::Discretization::DOFManager > getDOFMap() const =0
MatrixFactory(const std::string &type)
Definition MatrixTests.h:36
virtual std::shared_ptr< AMP::Discretization::DOFManager > getDOFMapL() const =0
virtual std::shared_ptr< AMP::LinearAlgebra::Vector > getVector() const =0
virtual std::shared_ptr< AMP::LinearAlgebra::Matrix > getMatrix() const =0
const std::string & type() const
Definition MatrixTests.h:33
virtual std::shared_ptr< AMP::Mesh::Mesh > getMesh() const =0
MatrixFactory(const MatrixFactory &)
A helper class to store/run tests for a matrix.
Definition MatrixTests.h:49
void VerifyGetSetValuesMatrix(AMP::UnitTest *ut)
void VerifyScaleMatrix(AMP::UnitTest *ut)
void VerifyAXPYMatrix(AMP::UnitTest *ut)
void VerifyExtractDiagonal(AMP::UnitTest *ut)
void VerifyMatMultMatrix_AI(AMP::UnitTest *ut)
void VerifyCopyMatrix(AMP::UnitTest *ut)
void VerifyMatMultMatrix(AMP::UnitTest *ut)
void VerifyGetLeftRightVector(AMP::UnitTest *ut)
MatrixTests(std::shared_ptr< const MatrixFactory > factory, std::shared_ptr< const MatrixFactory > copy_factory=nullptr)
Definition MatrixTests.h:51
void VerifyMultMatrix(AMP::UnitTest *ut)
void VerifyMatMultMatrix_IA(AMP::UnitTest *ut)
void VerifyAddElementNode(AMP::UnitTest *ut)
std::shared_ptr< const MatrixFactory > d_copy_factory
Definition MatrixTests.h:76
std::shared_ptr< AMP::LinearAlgebra::Matrix > getCopyMatrix(std::shared_ptr< AMP::LinearAlgebra::Matrix > matrix)
void InstantiateMatrix(AMP::UnitTest *ut)
std::shared_ptr< const MatrixFactory > d_factory
Definition MatrixTests.h:75
void VerifyMatMultMatrix_AA(AMP::UnitTest *ut)
Class UnitTest is simple utility for running unit tests. It provides basic routines for tracing succe...
Definition UnitTest.h:49
void fillWithPseudoLaplacian(std::shared_ptr< AMP::LinearAlgebra::Matrix > matrix)
void test_matrix_loop(AMP::UnitTest &ut, std::shared_ptr< MatrixTests > tests)
void testBasics(AMP::UnitTest &ut, const std::string &type)



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:40.
Comments on this page